Commit Graph
160 Commits
Author SHA1 Message Date
Ta-Ching ChenandGitHub 281349edb0 Update TerminationGracePeriod usage text (#1524) 2020-02-03 13:05:15 +08:00
Ta-Ching ChenandGitHub e2500ef602 Set package initial status if its empty (#1522)
If the user applies package YAML file has no status field,
the package won't be able to be compiled or deployed due
to lack of status. This PR aims to add a check at buildermgr
to set initial package status to those packages.
2020-02-02 00:39:02 +08:00
Ta-Ching ChenandGitHub f8d643a0df Fix executor wrongly deletes rolebindings (#1517)
Executor wrongly deletes role bindings if the user
creates an environment in the reserved namespaces. This
PR is a quick fix to solve the problem by checking if
an environment is under reserved namespaces.
2020-01-29 00:01:21 +08:00
Ta-Ching ChenandGitHub 67092664ba Show global options in usage (#1516) 2020-01-28 19:37:07 +08:00
Ta-Ching ChenandGitHub 67dec55e0e Add fake client for local command operation (#1515)
This PR adds a fake controller client for local CLI operations like 
offline spec generation or for unit test purposes. The fake client 
now only implements the "Version()" function and more functions 
will be implemented once we figure out how to achieve the goals 
mentioned above.
2020-01-28 17:38:43 +08:00
Ta-Ching ChenandGitHub 1e70f828da Fix poolmanager wrongly delete env pool (#1511)
The root cause of the problem is that eagerPoolCreator
tries to create the deployment when the poolmanager
is trying to delete it. To avoid this, start eager pool
creator after executor starts serving requests.
2020-01-28 00:58:37 +08:00
Ta-Ching ChenandGitHub 05cf3963e7 Use patch for robust pod metadata update in poolmgr (#1509)
Use "Patch" to update pod metadata instead of "Update" to avoid 
dropping fields that the old client-go doesn't support.
2020-01-28 00:04:22 +08:00
63862a17a5 Add resource exists error on spec validate (#1506)
Co-authored-by: Anubhav <50611570+anubhav6663@users.noreply.github.com>
2020-01-27 19:09:35 +08:00
Ta-Ching ChenandGitHub 0e16586f13 Add --dry option to view the generated spec without saving (#1504) 2020-01-24 20:43:42 +08:00
Ta-Ching Chen ead44893a9 Let unit tests run in different namespaces to avoid resource conflict 2020-01-24 01:33:12 +08:00
Ta-Ching ChenandGitHub 6379559c78 Follow kubernetes APIs directory structure (#1497) 2020-01-20 17:06:46 +08:00
Ta-Ching ChenandGitHub 301fe0b249 Codebase cleanup & optimization (#1493)
Remove old v1 types that are no longer used and move fetcher structs to fetcher directory.
2020-01-16 16:47:32 +08:00
Ta-Ching ChenandGitHub 308ba054a9 Use code-generator to generate clientset/informer/lister (#1492)
To reduce maintenance effort and avoid writing duplicate informer code,
use code-generator to generate clientset/informer/lister code.
2020-01-16 15:18:38 +08:00
Ta-Ching ChenandGitHub 3576ffe690 Add config for fetcher resource requests & limits (#1489)
This PR adds fetcher resource requests&limits chart setting 
and remove unreasonable limits value from the charts.
2020-01-15 11:21:48 +08:00
Ta-Ching ChenandGitHub da5350df18 Fix terminationGracePeriod is 0 due to wrong flag type (#1476) 2019-12-25 10:21:35 +08:00
AnubhavandTa-Ching Chen 8e9f17e02c Add failed/success output to spec validate (#1471) 2019-12-20 12:00:47 +08:00
AnubhavandTa-Ching Chen b95f5f0073 Add spec list feature (#1468)
Adding fission spec list functionality. It lists Functions, Environment, Packages, HTTPTrigger, MessageQueueTriggers, Canary Config, TimeTrigger, KubeWatch created by an application specification.
2019-12-19 19:41:59 +08:00
Ta-Ching ChenandGitHub 0bda15c2b0 Add controller API client interface (#1467)
This PR adds an interface for controller API client, it allows us to
implement mock API client for unit testing with ease and we are
able to generate spec file without accessing the real Fission server.
2019-12-16 23:14:14 +08:00
Sahil LakhwaniandTa-Ching Chen e5b5acfd91 Remove FISSION_ROUTER for fn test (#1465) 2019-12-15 14:32:29 +08:00
Vivek SinghandTa-Ching Chen dc55d28583 Show the not present configmap/secret name while fn create in err message [CLI-UX] (#1462) 2019-12-10 22:58:52 +08:00
Ta-Ching ChenandGitHub 0d27fca38f Fix name conflict when buildermanager merges podspc (#1460) 2019-12-07 16:53:47 +08:00
Ta-Ching ChenandGitHub 34ede16ef6 Not to exclude hidden file when creating archive (#1458)
Some of configs are hidden files like .babelrc, we should not ignore them.
2019-12-05 01:54:05 +08:00
Ta-Ching ChenandGitHub aebf016865 Let executor type manages how to do cleanup for old kubeobjects (#1455)
Add CleanupOldExecutorObjects to executor type interface in order
to let an executor type manages how to clean up the resources it created.
2019-12-02 19:47:31 +08:00
Ta-Ching ChenandGitHub f0fe5c05d8 Prevent deployment from rolling update due to different instance-id (#1454)
The pod template is embedded inside the deployment. So if
the pod annotation contains instance-id, the deployment
will get updated and thus triggers a rolling update whenever
a new executor starts which is unwanted.

After this PR, poolmanager will patches instance-id when a
pod is chosen for a function.

For newdeploy, unlike poolmanager manages the lifecycle
of function pod directly, newdeploy is only responsible
to create the deployment so we append instance-id to top-
level controller (deployment) only.
2019-12-02 17:28:19 +08:00
Ta-Ching ChenandGitHub c76ad4211e Make AdoptExistingResources optional (#1453) 2019-12-02 07:34:07 +08:00
Ta-Ching ChenandGitHub 1b281af29b Prevent newdeploy updates deployment if no resources changed (#1452)
We used to update timestamp in the deployment environment field 
in order to trigger a rolling update when the function referenced 
resources get updated. However, use timestamp means we are not 
able to avoid triggering a rolling update when executor tries to adopt 
orphaned deployment due to timestamp changed which is unwanted. 
In order to let executor adopt deployment without triggering a rolling 
update, we need an identical way to get a value that can reflect res-
ources changed without affecting by time.

To achieve this goal, the sum of the resource version of all referenced 
resources is a good fit for our scenario since the sum of the resource 
version is always the same as long as no resources changed.
2019-12-02 06:35:07 +08:00
Ta-Ching ChenandGitHub d656eb8ad0 Fix CLI unable to get pod logs from controller (#1451) 2019-12-01 22:38:35 +08:00
Ta-Ching ChenandGitHub 4aa47d7949 Fix spec shows source archive is not used (#1448) 2019-12-01 16:51:13 +08:00
Ta-Ching ChenandGitHub e0b9ae7880 Ignore hidden file when creating archive file (#1450) 2019-12-01 09:58:16 +08:00
Ta-Ching ChenandGitHub 6ad870f43e Fix spec init overrides existing deploymentconfig (#1449) 2019-11-29 23:59:10 +08:00
Ta-Ching ChenandGitHub 14f0d82aaa Fix adopted deployment uses old fetcher image (#1447)
When a new executor starts up, it adopts the orphan kubernetes resources created
by the old executor instance. However, the adopted resource won't reflect the changes
come with the new executor, for example, the fetcher image inside won't be changed.

To solve this, executor updates the resource spec (HPA/Deployment/Service) with the
latest resources spec. By doing this, we can prevent the inconsistency between resources
created by different executor instance, also minimizes the impact on users.
2019-11-29 21:52:59 +08:00
Ta-Ching ChenandGitHub ce9076f01f Improve executor bootstrap speed (#1446) 2019-11-29 14:18:23 +08:00
Ta-Ching ChenandGitHub 7f03a4750a Adopt existing orphan kubernetes resources when executor starts up (#1443)
Previously, once the executor is deleted for reasons (like upgrade or cluster scale-in),
the new executor deletes all existing resources created by the old executor and creates
new one. This mechanism becomes a problem when there are requests connecting to the
existing pods. Also in the worst case, the cluster may not have enough resources to create
new pods and cause service downtime.

This PR let each executor type adopts existing resources before starting the executor
API services, and so the alive connections won't experience failure. However, the requests
send to the function that doesn't have alive function pods will still fail due to the
executor is in bootstrapping.
2019-11-27 23:08:45 +08:00
Ta-Ching ChenandGitHub 70876e5c34 Fix router tries to update ingress when createIngress is false (#1440) 2019-11-27 00:28:48 +08:00
Ta-Ching ChenandGitHub 24e9257c2c Fix poolmanager sets 0 timeout for function specialization (#1439) 2019-11-26 19:22:49 +08:00
Ta-Ching ChenandGitHub 8e416dad7b Return error when specialization failed (#1436) 2019-11-26 09:23:06 +08:00
Ta-Ching ChenandGitHub f20def9f8d Collect function metrics after finishing request (#1433) 2019-11-26 02:33:40 +08:00
Ta-Ching ChenandGitHub 70ce33a458 Fix poolmanager terminates running function pod periodically (#1435)
The pool manager keeps terminating function pod periodically even there are
traffic to the function. The root cause is that executor, poolmgr, newdeploy
manage their own functionServiceCache separately. And when router taps a
function, executor updates the access time of the function service entry in its
own cache without notifying executor types to do the update as well. Hence,
the access time of function service entry in poolmanager cache never gets updated.
Due to the access time never gets updated, the idle pod reaper in poolmanager
then thinks the function pod is in idle state and recycle it.

This PR removes the cache in executor itself, and when router tries to tap a function,
executor will call executor type to tap the function and update access time.
2019-11-26 01:16:30 +08:00
Ta-Ching ChenandGitHub 6489ace1a0 Allow to tap multiple function services at one time (#1434)
The router taps function service one by one which is inefficient and
increases the burden of executor. This PR aggregates all requests into
one to solve the problem mentioned above.
2019-11-25 18:44:48 +08:00
Ta-Ching ChenandGitHub ecd98a7ce8 Fix poolmanager crashes when failed to list environment (#1432) 2019-11-24 05:59:38 +08:00
Ta-Ching ChenandGitHub b800b49fa8 Ability to pull builder image from private registry (#1431) 2019-11-24 05:17:56 +08:00
Ta-Ching ChenandGitHub 86021e4380 Add checksum and insecure flag for user to skip checksum generation (#1430) 2019-11-24 01:35:01 +08:00
Ta-Ching ChenandGitHub 862afae91e Support to set imagePullSecret when creating environment (#1429) 2019-11-22 18:19:57 +08:00
Ta-Ching ChenandGitHub 0b0ec058de Fix no kubeobjs get created if fn created before env creation (#1428)
When a function is created before the creation of the environment it's used, the newdeploy will not be able to create kube objs. Hence no function service record is inserted into the cache.

When getFuncSvc is called, the newdeploy tries to find the record in service cache in order to create kube objs with the same name used in previous kubeobjs creation. However, due to no record in the cache, a NotFound error is returned directly and causes the problem. To solve this, we use fn meta UID to ensure we always get the same obj name instead of getting it from the cache.
2019-11-22 01:37:02 +08:00
Ta-Ching ChenandGitHub 88a2a9482f Fix verbosity flag not show in usage (#1425) 2019-11-21 12:36:50 +08:00
Ta-Ching ChenandGitHub 52d817f553 Fix truncated body returned from router (#1420)
If the context of request is closed before ReverseProxy finishing writing
a huge response body to the response writer, the client will only receive
a truncated response body.

To solve this, move the context cancel after ReverseProxy finished.
2019-11-21 01:04:35 +08:00
Ta-Ching ChenandGitHub 45929a7737 Show warning when referencing nonexistent resources in spec (#1415) 2019-11-18 13:46:28 +08:00
Ta-Ching ChenandGitHub a71dce9090 Add resource info to output message when saving spec file (#1414) 2019-11-18 12:35:14 +08:00
Ta-Ching ChenandGitHub 5b8655535b Add --spec to package command (#1411) 2019-11-18 11:15:48 +08:00
Ta-Ching ChenandGitHub 2542f55d15 Always embed URL provided by user in the archive (#1413)
To keep archive creation implementation simple and prevent any
confusion, we decided to remove `--keepurl` flag and embed URL
directly without downloading the file from it . In this way, we can
ensure consistent behavior in either package creation or spec file
creation. Also, it increases the portability of spec file.
2019-11-18 10:05:49 +08:00