Compare commits

...
94 Commits
Author SHA1 Message Date
Ta-Ching Chen 9401c1ee85 Fission 1.7.1 2019-12-09 11:55:01 +08:00
Ta-Ching ChenandGitHub 5c704f053b Fix name conflict when buildermanager merges podspc (#1460) 2019-12-07 16:53:47 +08:00
Ta-Ching ChenandGitHub eb1f971d52 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 Chen 83bc5508ee CHANGELOG 1.7.0 2019-12-02 14:08:00 +00:00
Ta-Ching Chen d6a8734aae Fission 1.7.0 2019-12-02 21:26:28 +08:00
Ta-Ching ChenandGitHub 3ee98cd13a Fix release script not uploads OpenShift deploy YAML file (#1456) 2019-12-02 21:12:15 +08:00
Ta-Ching ChenandGitHub 275da18cf6 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 3f3b11ffbf 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 7f8cb69326 Make AdoptExistingResources optional (#1453) 2019-12-02 07:34:07 +08:00
Ta-Ching ChenandGitHub 003c304105 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 763ab475f2 Fix CLI unable to get pod logs from controller (#1451) 2019-12-01 22:38:35 +08:00
Ta-Ching ChenandGitHub 4b3f48b537 Fix spec shows source archive is not used (#1448) 2019-12-01 16:51:13 +08:00
Ta-Ching ChenandGitHub 6301a78814 Ignore hidden file when creating archive file (#1450) 2019-12-01 09:58:16 +08:00
Ta-Ching ChenandGitHub 506b427124 Fix spec init overrides existing deploymentconfig (#1449) 2019-11-29 23:59:10 +08:00
Ta-Ching ChenandGitHub 19ae7d5ac6 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 47aaa85108 Improve executor bootstrap speed (#1446) 2019-11-29 14:18:23 +08:00
Ta-Ching Chen 3067ecdee3 CHANGELOG 1.7.0-rc.2 2019-11-27 17:10:57 +00:00
Ta-Ching Chen d9a0ee1e33 Fission 1.7.0-rc.2 2019-11-28 00:40:47 +08:00
Ta-Ching ChenandGitHub 5cfc8dee5e Push extra tag to fit go module semver tag format (#1444) 2019-11-28 00:40:20 +08:00
Ta-Ching ChenandGitHub 1ad7ac2dcf 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 86446c8879 Revert "Try to fix flaky canary test (#1441)" (#1442)
This reverts commit df857e3194.
Looks like there are some problems when running the test against GKE, so revert it.
2019-11-27 16:19:33 +08:00
Ta-Ching ChenandGitHub df857e3194 Try to fix flaky canary test (#1441) 2019-11-27 02:57:22 +08:00
Ta-Ching ChenandGitHub ad7a3951c5 Fix router tries to update ingress when createIngress is false (#1440) 2019-11-27 00:28:48 +08:00
Ta-Ching ChenandGitHub 7e8e968013 Fix poolmanager sets 0 timeout for function specialization (#1439) 2019-11-26 19:22:49 +08:00
Ta-Ching ChenandGitHub e38baeec36 Add huge response body test (#1437) 2019-11-26 12:50:41 +08:00
Ta-Ching ChenandGitHub ca28f962d4 Return error when specialization failed (#1436) 2019-11-26 09:23:06 +08:00
Ta-Ching ChenandGitHub dfb2c073d2 Collect function metrics after finishing request (#1433) 2019-11-26 02:33:40 +08:00
Ta-Ching ChenandGitHub 51b264e8ca 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 6d2fe08973 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 ccc551112b Fix poolmanager crashes when failed to list environment (#1432) 2019-11-24 05:59:38 +08:00
Ta-Ching ChenandGitHub 1a5537f4ba Ability to pull builder image from private registry (#1431) 2019-11-24 05:17:56 +08:00
Ta-Ching ChenandGitHub 5c2f0c5f4a Add checksum and insecure flag for user to skip checksum generation (#1430) 2019-11-24 01:35:01 +08:00
Ta-Ching ChenandGitHub a66de4c601 Support to set imagePullSecret when creating environment (#1429) 2019-11-22 18:19:57 +08:00
Ta-Ching ChenandGitHub af73d0ce1a 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 04654ca465 Improve compatibility with Openshift (#1424) 2019-11-21 16:56:53 +08:00
Ta-Ching ChenandGitHub af10579be9 Fix verbosity flag not show in usage (#1425) 2019-11-21 12:36:50 +08:00
Ta-Ching ChenandGitHub 30d24a85b5 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 Chen d8b386a812 Update CHANGELOG for 1.7.0-rc.1 2019-11-18 10:32:46 +00:00
Ta-Ching ChenandTa-Ching Chen 48e7a13c0f Fission 1.7.0-rc.1 2019-11-18 10:06:32 +00:00
Ta-Ching ChenandGitHub 70803e37fa Update release-builder go and helm version (#1418) 2019-11-18 18:06:11 +08:00
Ta-Ching ChenandGitHub 7a770b8627 Fix failed to find init_tools.sh (#1417) 2019-11-18 17:00:56 +08:00
Ta-Ching ChenandGitHub 8b0d99d65d Support semantic version tags (#1416) 2019-11-18 15:54:43 +08:00
Ta-Ching ChenandGitHub 3aca0edfcc Show warning when referencing nonexistent resources in spec (#1415) 2019-11-18 13:46:28 +08:00
Ta-Ching ChenandGitHub 81ece23bfe Add resource info to output message when saving spec file (#1414) 2019-11-18 12:35:14 +08:00
Ta-Ching ChenandGitHub 66b9dfa8e9 Add --spec to package command (#1411) 2019-11-18 11:15:48 +08:00
Ta-Ching ChenandGitHub f8e98f9f14 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
Ta-Ching ChenandGitHub b97a3c4b0a Fix wrong command and flag usage description (#1412) 2019-11-17 02:39:31 +08:00
Ta-Ching ChenandGitHub b5c8ea0e13 Update prometheus chart version from 7.1.0 to 9.3.0 (#1389) 2019-11-13 16:29:17 +08:00
Ta-Ching ChenandGitHub cf2d35291e Drop unreleased features (record & replay) (#1406)
1. The records are stored in redis which is not migratable to another cluster for the testing purposes.
2. Some of the requests fields are not recorded.
3. People should consider using https://github.com/buger/goreplay which is an existing mature and well-tested solution for testing purposes.
2019-11-13 15:10:32 +08:00
Ta-Ching ChenandGitHub 1cda7e051b Build error formatting on fission spec apply --wait (#1403)
The character `\n` in buildlog stores in package status
are escaped and so when we have to replace them with
actual line breaker.
2019-11-12 21:00:55 +08:00
Ta-Ching ChenandGitHub a645a1e197 Refactor controller client package (#1402)
The function implementations of controller client package are
inconsistent. This PR lets functions reuse the functions
that already implemented and able to set additional headers to
request.
2019-11-12 18:27:52 +08:00
Ta-Ching ChenandGitHub d0276f1d52 Fix fn test failed to query logs from log database (#1401)
When `fn test` failed to retrieve logs from the function
pod, it turns to query logs from the log database. However,
the logdb type flag is not set to `fn test`, hence the logdb
type is empty (even without default value) and cause `fn logs`
returns an error due to unable to find the corresponding log
database type.

This PR adds logdb type flag to `fn test` to resolve the problem.
2019-11-12 03:05:22 +08:00
Ta-Ching ChenandGitHub 4474f5f813 Skip trace for router healthz endpoint (#1400)
Jaeger preserves the trace data of router healthz endpoints
which is not so helpful for monitoring function metrics and
consumes storage to store such trace data.

This PR uses `GetStartOptions` to examine the request's path and
check if it's a request to healthz endpoint. If yes, skip and not
to trace it.
2019-11-12 00:13:17 +08:00
Ta-Ching ChenandGitHub 19e693bf52 Set jaeger collector endpoint as an environment variable (#1399)
To follow 12-factor app rules, make jaeger collector endpoint
as an environment variable instead of CLI args. It's easier to
replace the value in different deployments. Also, we can utilize
valueFrom to get value from the configmap.
2019-11-11 22:41:40 +08:00
Ta-Ching ChenandGitHub 825939c820 Replace deprecated serviceAccount with serviceAccountName (#1398) 2019-11-11 15:55:28 +08:00
Ta-Ching ChenandGitHub 5a9138711b Fix helm pre-upgrade check failure problem (#1397)
The helm pre-upgrade check failed due to the program tries to
check whether a multierr is a nil pointer instead of errors it contains.

This PR changes the way the program checks multierr in order not to block the upgrade.
2019-11-11 02:42:08 +08:00
Ta-Ching ChenandGitHub 7640f1199d Prettify console output message (#1396) 2019-11-10 16:42:34 +08:00
Ta-Ching ChenandGitHub 7b6e4318d4 Reorder command flag and add missing flags (#1394) 2019-11-10 14:58:29 +08:00
MengZeLeeandTa-Ching Chen fcd1bc0356 fix typo (#1395) 2019-11-10 14:17:56 +08:00
Ta-Ching ChenandGitHub d443eb1c96 Fix CLI exits with status 0 when error occurs (#1393) 2019-11-10 02:43:22 +08:00
Ta-Ching ChenandGitHub c7d0c09f01 Poolmanager wait for function specialization timeout when specializing a pod (#1392) 2019-11-10 00:01:19 +08:00
Ta-Ching ChenandGitHub d3d8ff6c1b Replace flag text with const (#1391) 2019-11-09 22:13:35 +08:00
Ta-Ching ChenandGitHub 6f5f6900b6 Fix githook not aborting push if error occurrs (#1386) 2019-11-08 23:47:40 +08:00
Ta-Ching ChenandGitHub 19753e07e0 Fix helm shows "Not a table" issue when install Fission (#1387)
Helm treats the single line "extraCoreComponentPodConfig" in
values.yaml as a key value pair config.

```
extraCoreComponentPodConfig:
```

And when a user tries to install helm with providing config
like following, it failed.

```
extraCoreComponentPodConfig:
  nodeSelector:
    serverless: fission
```

The root cause is that helm treats config in default values.yaml
and providing config as two different types of config, which is
key-value vs. value table. And so it's unable for helm to merge these
two configs even with the same key name.

This PR comments out the single line config in default values.yaml
to prevent the issue.
2019-11-08 23:15:15 +08:00
Ta-Ching ChenandGitHub 1888cd2ac7 Migrate from urfave/cli to cobra (#1385) 2019-11-08 21:22:00 +08:00
Ta-Ching ChenandGitHub 4b456db517 Update Makefile and add git pre-push hook (#1382) 2019-11-06 13:13:48 +08:00
Ta-Ching ChenandGitHub 9272f0cb2c Update maintainer info (#1383) 2019-11-06 13:01:05 +08:00
Ta-Ching ChenandGitHub b9a5588ca9 Update staticcheck version and fix all warnings (#1381) 2019-11-05 18:09:12 +08:00
Ta-Ching ChenandGitHub 93d4b88d84 Make CLI functions return error instead of fatal out (#1379)
Before this PR, CLI functions fatal out when encountering error
instead of returning it. Such behavior makes it hard to reuse 
the functions nor writing unit tests. This PR aims to make functions 
return errors instead of error out.
2019-11-05 16:50:13 +08:00
Ta-Ching ChenandGitHub b0d27ee5d2 Refactor record command (#1378) 2019-11-05 10:30:16 +08:00
Ta-Ching ChenandGitHub c33f1e112e Fix reverse proxy shows 404 not found when Istio enabled (#1377)
Istio sidecar proxy blocks all requests sent through the reverse proxy
to the target service if the request.Host is not properly set to the
internal target service host. This PR sets the target service hosts
before establishing the proxy for the client in order to pass the
Istio sidecar proxy check.
2019-11-04 21:59:40 +08:00
Ta-Ching ChenandGitHub f288f0f258 Refactor time trigger command (#1376) 2019-11-04 18:26:21 +08:00
Vivek SinghandTa-Ching Chen e4f44ffa63 Add example for builder podspec (#1374) 2019-11-04 16:02:30 +08:00
Ta-Ching ChenandGitHub d1ed089c3e Refactor mqtrigger command (#1375) 2019-11-04 07:40:18 +08:00
Vivek SinghandTa-Ching Chen e1a64dd0c1 PodSpec support in environment builder (#1369) 2019-11-03 23:05:02 +08:00
Ta-Ching ChenandGitHub 3b6749dce9 Refactor function command (#1372) 2019-11-03 13:31:47 +08:00
Ta-Ching ChenandGitHub 8f6887280c Allow to set API type for tensorflow serving environment (#1371)
Tensorflow Serving supports three kinds of API: predict, classify, regress. In order to fully support possible API types, this PR adds code to split the entry point with separator ":" to get model name and the API type separately. And append the API type to proxy URL when receiving the requests.

$ fission fn create --name t1 --pkg <pkg name> \
    --env tensorflow --entrypoint "half_plus_two:regress"
2019-11-02 23:51:31 +08:00
Ta-Ching ChenandGitHub ef0a2fa340 Refactor canary config command (#1370) 2019-11-01 15:36:40 +08:00
Ta-Ching ChenandGitHub 2b616ec4e2 Fix utility function uses the wrong flag text to get value (#1368)
The utility function GetMetadata uses wrong flag text to get the resource namespace and could cause the wrong results returned from the API server. This PR changes the function signature that allows users to pass in the flag text in order to get the correct value.
2019-11-01 00:59:50 +08:00
Ta-Ching ChenandGitHub fe02bb1678 Refactor HTTP trigger command (#1367) 2019-10-31 23:40:37 +08:00
Ta-Ching ChenandGitHub fc1aab2472 Update READEME link and add back the basic usage (#1366) 2019-10-31 11:14:04 +08:00
Ta-Ching ChenandGitHub e22cdee5f5 Refactor kubewatch command (#1365) 2019-10-31 10:48:27 +08:00
Vivek SinghandTa-Ching Chen 698d591788 Provide secrets and configmaps while updating the functions (#1358) 2019-10-31 00:19:06 +08:00
Ta-Ching ChenandGitHub 3b11ca87f1 Fix accidentally removed timestamp when listing package (#1364) 2019-10-30 23:47:00 +08:00
Chris CamelandTa-Ching Chen bbaf1b0c2d Replace AlwaysSample with ProbabilitySampler in router (#1348) 2019-10-30 20:05:55 +08:00
Ta-Ching ChenandGitHub a151f89eec Move route creation to independent function (#1362) 2019-10-30 05:47:51 +08:00
Ta-Ching ChenandGitHub d20dc9aa64 Allow using URL as archive source when creating functions (#1360)
In the case of large files, it takes a long time for the user to download
the source from the URL and upload it to StorgeSvc through CLI.

This PR allows a user to use URL as the function source when creating a function
and provides a new flag "--keeparchiveurl" to let the user to decided
whether the CLI should download the file first or store the file URL in the
archive directly. If "--keeparchiveurl" is true, then no checksum will be
generated, it's the user's responsibility to ensure the file won't be changed.
2019-10-28 22:37:13 +08:00
Ta-Ching ChenandGitHub 52b5cb0902 Remove UID from CLI output (#1361) 2019-10-28 19:34:02 +08:00
Ta-Ching ChenandGitHub bc5c181fc2 Update fission architecture doc (#1356) 2019-10-22 19:46:57 +08:00
Ta-Ching ChenandGitHub fed30e1b24 Refactor plugin & version subcommands (#1359) 2019-10-22 17:57:56 +08:00
Vivek SinghandTa-Ching Chen 22de11190c Calling the function that handles kafka messages, asynchronously (#1355) 2019-10-19 14:41:46 +08:00
Ta-Ching ChenandGitHub e42f81a7a1 Refactor package CLI command (#1345) 2019-10-13 01:30:20 +08:00
Ta-Ching ChenandGitHub f30e7df43d Fix release script wrongly tags image name & sed problem on Linux (#1353) 2019-10-12 21:38:13 +08:00
Ta-Ching ChenandGitHub c930c69629 Update CHANGELOG for 1.6.0 (#1352) 2019-10-11 04:07:38 +08:00
283 changed files with 20383 additions and 9132 deletions
+184 -22
View File
@@ -1,22 +1,184 @@
# 1.5.0
# 1.7.0
[Documentation](https://docs.fission.io/)
## Downloads for 1.5.0
## Downloads for 1.7.0
filename | sha256 hash
-------- | -----------
[fission-core-1.5.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0-minikube.yaml) | `bf804e8106f034b2cb5f7d577ca11a9267db43c4ce9c937af879b8a8f35f422a`
[fission-all-1.5.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0-minikube.yaml) | `fc526cde3f18d1cf5a86fa5f3612e0120cb1a0544012ec02292a666d9aed840b`
[fission-all-1.5.0.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0.yaml) | `c67b40869823f2ac436a02bb6d15dc68f531c1032c6af3bfdd4cee2a9d43399d`
[fission-core-1.5.0.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0.yaml) | `b15a1771955700c33abf63fe523d2c3393186a4d0f456b5a274aa1434cf7ba3b`
[fission-all-1.5.0.tgz](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0.tgz) | `07e6430f73d1eee0dfb4bd558bc05d51d828332ce2ec7d5b25a0b3722c175bc1`
[fission-core-1.5.0.tgz](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0.tgz) | `d13ac896f0ef480ede0cd505f3dd55370e2f16ed5dc1b5ad3bc67a2e06623aac`
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-osx) | `e3415e4c64d404b4065c420d7b62bf1b702e08b40b6018672545f2f2637a2d04`
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-windows.exe) | `b539ab484fac6f7a9b513df1f652fc93f5a39cf9a44237c0ba7457b863a05c36`
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-linux) | `d399aa01dac007a69c74be99944767e76321b067d29be64edd73b45d2a23d002`
[fission-core-1.7.0.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-core-1.7.0.yaml) | `e087b95a3f2adf8c97aed5ddc47a57941b0439ab9fb2253de5118b1eaa01c5e1`
[fission-core-1.7.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-core-1.7.0-minikube.yaml) | `ff0b623b21c7e087e90c6030a720e83c88572c2d9e87d82faa2a1f762cba8742`
[fission-all-1.7.0.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-all-1.7.0.yaml) | `5fc5eb9174ca74a102f172410dbc310cc29f56deb34f4490799315fe6c5913b0`
[fission-all-1.7.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-all-1.7.0-openshift.yaml) | `0a93a1b2e7b3bafc7e6db826170471120af90bc17362d84daf93216da503a33e`
[fission-all-1.7.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-all-1.7.0-minikube.yaml) | `21be5a7a7b95b11ca32b78f744d2c05897d2e0a3c6dfb9136936c90d3cbee0d8`
[fission-core-1.7.0-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.0/fission-core-1.7.0-openshift.yaml) | `679c9dd7482f2a799e61079149c3ede138dad8ee635faf8b325e45f58fac955d`
[fission-core-1.7.0.tgz](https://github.com/fission/fission/releases/download/1.7.0/fission-core-1.7.0.tgz) | `c8678298c1315502833e856b61c9ef587a751007ad757ccc9106bb0f3dc78fb8`
[fission-all-1.7.0.tgz](https://github.com/fission/fission/releases/download/1.7.0/fission-all-1.7.0.tgz) | `9849562fd8f8f3f83a3896c6a77dafe24f53d8f4f4701903d48bbfc3d365ec83`
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.7.0/fission-cli-osx) | `0ded704fae3ff10e08a7b535c4df5cbd11c2cb65a6d344c442718f6a807082fa`
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.7.0/fission-cli-windows.exe) | `2ff4b77e77446836170bb5433d765cc68f48b4eef13ef7ed580a9aa0c07be64e`
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.7.0/fission-cli-linux) | `1b8a3961a5de14c414fcaaea472020707b20cb9712020e55cc70f3f0b6a220b2`
# Change Log
## [1.7.0](https://github.com/fission/fission/tree/1.7.0) (2019-12-02)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0...1.7.0)
## [v1.7.0](https://github.com/fission/fission/tree/v1.7.0) (2019-12-02)
[Full Changelog](https://github.com/fission/fission/compare/1.7.0-rc.2...v1.7.0)
**Merged pull requests:**
- Fix release script not uploads OpenShift deploy YAML file [\#1456](https://github.com/fission/fission/pull/1456) ([life1347](https://github.com/life1347))
- Let executor type manages how to do cleanup for old kubeobjects [\#1455](https://github.com/fission/fission/pull/1455) ([life1347](https://github.com/life1347))
- Prevent deployment from rolling update due to different instance-id [\#1454](https://github.com/fission/fission/pull/1454) ([life1347](https://github.com/life1347))
- Make AdoptExistingResources optional [\#1453](https://github.com/fission/fission/pull/1453) ([life1347](https://github.com/life1347))
- Prevent newdeploy updates deployment if no resources changed [\#1452](https://github.com/fission/fission/pull/1452) ([life1347](https://github.com/life1347))
- Fix CLI unable to get pod logs from controller [\#1451](https://github.com/fission/fission/pull/1451) ([life1347](https://github.com/life1347))
- Ignore hidden file when creating archive file [\#1450](https://github.com/fission/fission/pull/1450) ([life1347](https://github.com/life1347))
- Fix spec init overrides existing deploymentconfig [\#1449](https://github.com/fission/fission/pull/1449) ([life1347](https://github.com/life1347))
- Fix spec shows source archive is not used [\#1448](https://github.com/fission/fission/pull/1448) ([life1347](https://github.com/life1347))
- Fix adopted deployment uses old fetcher image [\#1447](https://github.com/fission/fission/pull/1447) ([life1347](https://github.com/life1347))
- Improve executor bootstrap speed [\#1446](https://github.com/fission/fission/pull/1446) ([life1347](https://github.com/life1347))
- Fission 1.7.0-rc.2 [\#1445](https://github.com/fission/fission/pull/1445) ([life1347](https://github.com/life1347))
## [1.7.0-rc.2](https://github.com/fission/fission/tree/1.7.0-rc.2) (2019-11-27)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.2...1.7.0-rc.2)
## [v1.7.0-rc.2](https://github.com/fission/fission/tree/v1.7.0-rc.2) (2019-11-27)
[Full Changelog](https://github.com/fission/fission/compare/1.7.0-rc.1...v1.7.0-rc.2)
**Merged pull requests:**
- Push extra tag to fit go module semver tag format [\#1444](https://github.com/fission/fission/pull/1444) ([life1347](https://github.com/life1347))
- Adopt existing orphan kubernetes resources when executor starts up [\#1443](https://github.com/fission/fission/pull/1443) ([life1347](https://github.com/life1347))
- Revert "Try to fix flaky canary test" [\#1442](https://github.com/fission/fission/pull/1442) ([life1347](https://github.com/life1347))
- Try to fix flaky canary test [\#1441](https://github.com/fission/fission/pull/1441) ([life1347](https://github.com/life1347))
- Fix router tries to update ingress when createIngress is false [\#1440](https://github.com/fission/fission/pull/1440) ([life1347](https://github.com/life1347))
- Fix poolmanager sets 0 timeout for function specialization [\#1439](https://github.com/fission/fission/pull/1439) ([life1347](https://github.com/life1347))
- Add huge response body test [\#1437](https://github.com/fission/fission/pull/1437) ([life1347](https://github.com/life1347))
- Return error when specialization failed [\#1436](https://github.com/fission/fission/pull/1436) ([life1347](https://github.com/life1347))
- Fix poolmanager terminates running function pod periodically [\#1435](https://github.com/fission/fission/pull/1435) ([life1347](https://github.com/life1347))
- Allow to tap multiple function services at one time [\#1434](https://github.com/fission/fission/pull/1434) ([life1347](https://github.com/life1347))
- Collect function metrics after finishing request [\#1433](https://github.com/fission/fission/pull/1433) ([life1347](https://github.com/life1347))
- Fix poolmanager crashes when failed to list environment [\#1432](https://github.com/fission/fission/pull/1432) ([life1347](https://github.com/life1347))
- Ability to pull builder image from private registry [\#1431](https://github.com/fission/fission/pull/1431) ([life1347](https://github.com/life1347))
- Add checksum and insecure flag for user to skip checksum generation [\#1430](https://github.com/fission/fission/pull/1430) ([life1347](https://github.com/life1347))
- Support to set imagePullSecret when creating environment [\#1429](https://github.com/fission/fission/pull/1429) ([life1347](https://github.com/life1347))
- Fix no kubeobjs get created if fn created before env creation [\#1428](https://github.com/fission/fission/pull/1428) ([life1347](https://github.com/life1347))
- Fix verbosity flag not found in subcommand [\#1425](https://github.com/fission/fission/pull/1425) ([life1347](https://github.com/life1347))
- Improve compatibility with Openshift [\#1424](https://github.com/fission/fission/pull/1424) ([life1347](https://github.com/life1347))
- Fix truncated body returned from router [\#1420](https://github.com/fission/fission/pull/1420) ([life1347](https://github.com/life1347))
- Fission 1.7.0-rc.1 [\#1419](https://github.com/fission/fission/pull/1419) ([life1347](https://github.com/life1347))
## [1.7.0-rc.1](https://github.com/fission/fission/tree/1.7.0-rc.1) (2019-11-18)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.1...1.7.0-rc.1)
## [v1.7.0-rc.1](https://github.com/fission/fission/tree/v1.7.0-rc.1) (2019-11-18)
[Full Changelog](https://github.com/fission/fission/compare/1.6.0...v1.7.0-rc.1)
**Merged pull requests:**
- Update release-builder go and helm version [\#1418](https://github.com/fission/fission/pull/1418) ([life1347](https://github.com/life1347))
- Fix failed to find init\_tools.sh [\#1417](https://github.com/fission/fission/pull/1417) ([life1347](https://github.com/life1347))
- Support semantic version tags [\#1416](https://github.com/fission/fission/pull/1416) ([life1347](https://github.com/life1347))
- Show warning when referencing nonexistent resources in spec [\#1415](https://github.com/fission/fission/pull/1415) ([life1347](https://github.com/life1347))
- Add resource info to output message when saving spec file [\#1414](https://github.com/fission/fission/pull/1414) ([life1347](https://github.com/life1347))
- Always embed given URL in the archive [\#1413](https://github.com/fission/fission/pull/1413) ([life1347](https://github.com/life1347))
- Fix wrong command and flag usage description [\#1412](https://github.com/fission/fission/pull/1412) ([life1347](https://github.com/life1347))
- Add --spec to package command [\#1411](https://github.com/fission/fission/pull/1411) ([life1347](https://github.com/life1347))
- Drop unreleased features \(record & replay\) [\#1406](https://github.com/fission/fission/pull/1406) ([life1347](https://github.com/life1347))
- Build error formatting on fission spec apply --wait [\#1403](https://github.com/fission/fission/pull/1403) ([life1347](https://github.com/life1347))
- Refactor controller client package [\#1402](https://github.com/fission/fission/pull/1402) ([life1347](https://github.com/life1347))
- Fix fn test failed to query logs from log database [\#1401](https://github.com/fission/fission/pull/1401) ([life1347](https://github.com/life1347))
- Skip trace for router healthz endpoint [\#1400](https://github.com/fission/fission/pull/1400) ([life1347](https://github.com/life1347))
- Set jaeger collector endpoint as an environment variable [\#1399](https://github.com/fission/fission/pull/1399) ([life1347](https://github.com/life1347))
- Replace deprecated serviceAccount with serviceAccountName [\#1398](https://github.com/fission/fission/pull/1398) ([life1347](https://github.com/life1347))
- Fix helm pre-upgrade check failure problem [\#1397](https://github.com/fission/fission/pull/1397) ([life1347](https://github.com/life1347))
- Prettify console output message [\#1396](https://github.com/fission/fission/pull/1396) ([life1347](https://github.com/life1347))
- fix typo [\#1395](https://github.com/fission/fission/pull/1395) ([jjmengze](https://github.com/jjmengze))
- Reorder command flags and add missing flags [\#1394](https://github.com/fission/fission/pull/1394) ([life1347](https://github.com/life1347))
- Fix CLI exits with status 0 when error occurs [\#1393](https://github.com/fission/fission/pull/1393) ([life1347](https://github.com/life1347))
- Poolmanager wait for function pod till specialization timeout [\#1392](https://github.com/fission/fission/pull/1392) ([life1347](https://github.com/life1347))
- Replace flag text with const [\#1391](https://github.com/fission/fission/pull/1391) ([life1347](https://github.com/life1347))
- Update prometheus version and disable it from the default installation [\#1389](https://github.com/fission/fission/pull/1389) ([life1347](https://github.com/life1347))
- Fix helm shows "Not a table" issue when install Fission [\#1387](https://github.com/fission/fission/pull/1387) ([life1347](https://github.com/life1347))
- Fix githook not aborting push if error occurs [\#1386](https://github.com/fission/fission/pull/1386) ([life1347](https://github.com/life1347))
- Migrate from urfave/cli to cobra [\#1385](https://github.com/fission/fission/pull/1385) ([life1347](https://github.com/life1347))
- Update maintainer info [\#1383](https://github.com/fission/fission/pull/1383) ([life1347](https://github.com/life1347))
- Update Makefile and add git pre-push hook [\#1382](https://github.com/fission/fission/pull/1382) ([life1347](https://github.com/life1347))
- Update staticcheck version and fix all warnings [\#1381](https://github.com/fission/fission/pull/1381) ([life1347](https://github.com/life1347))
- Make CLI functions return error instead of fatal out [\#1379](https://github.com/fission/fission/pull/1379) ([life1347](https://github.com/life1347))
- Refactor record command [\#1378](https://github.com/fission/fission/pull/1378) ([life1347](https://github.com/life1347))
- Fix reverse proxy shows 404 not found when Istio enabled [\#1377](https://github.com/fission/fission/pull/1377) ([life1347](https://github.com/life1347))
- Refactor time trigger command [\#1376](https://github.com/fission/fission/pull/1376) ([life1347](https://github.com/life1347))
- Refactor mqtrigger command [\#1375](https://github.com/fission/fission/pull/1375) ([life1347](https://github.com/life1347))
- added example for builder podspec [\#1374](https://github.com/fission/fission/pull/1374) ([viveksinghggits](https://github.com/viveksinghggits))
- Refactor function command [\#1372](https://github.com/fission/fission/pull/1372) ([life1347](https://github.com/life1347))
- Allow to set API type for tensorflow serving environment [\#1371](https://github.com/fission/fission/pull/1371) ([life1347](https://github.com/life1347))
- Refactor canary config command [\#1370](https://github.com/fission/fission/pull/1370) ([life1347](https://github.com/life1347))
- PodSpec support in environment builder [\#1369](https://github.com/fission/fission/pull/1369) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix utility function uses the wrong flag text to get value [\#1368](https://github.com/fission/fission/pull/1368) ([life1347](https://github.com/life1347))
- Refactor HTTP trigger command [\#1367](https://github.com/fission/fission/pull/1367) ([life1347](https://github.com/life1347))
- Update READEME link and add back the basic usage [\#1366](https://github.com/fission/fission/pull/1366) ([life1347](https://github.com/life1347))
- Refactor kubewatch command [\#1365](https://github.com/fission/fission/pull/1365) ([life1347](https://github.com/life1347))
- Fix accidentally removed timestamp when listing package [\#1364](https://github.com/fission/fission/pull/1364) ([life1347](https://github.com/life1347))
- Move route creation to function [\#1362](https://github.com/fission/fission/pull/1362) ([life1347](https://github.com/life1347))
- Remove UID from CLI output [\#1361](https://github.com/fission/fission/pull/1361) ([life1347](https://github.com/life1347))
- Allow using URL as archive source when creating functions [\#1360](https://github.com/fission/fission/pull/1360) ([life1347](https://github.com/life1347))
- Refactor plugin & version subcommands [\#1359](https://github.com/fission/fission/pull/1359) ([life1347](https://github.com/life1347))
- Provide secrets and configmaps while updating the functions [\#1358](https://github.com/fission/fission/pull/1358) ([viveksinghggits](https://github.com/viveksinghggits))
- Update fission architecture doc [\#1356](https://github.com/fission/fission/pull/1356) ([life1347](https://github.com/life1347))
- calling the function that handles kafka messages, asynchronously [\#1355](https://github.com/fission/fission/pull/1355) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix release script tags wrong image name & sed problem on Linux [\#1353](https://github.com/fission/fission/pull/1353) ([life1347](https://github.com/life1347))
- Update CHANGELOG for 1.6.0 [\#1352](https://github.com/fission/fission/pull/1352) ([life1347](https://github.com/life1347))
- Replace `AlwaysSample` with `ProbabilitySampler` in router \(\#1215\) [\#1348](https://github.com/fission/fission/pull/1348) ([ccamel](https://github.com/ccamel))
- Refactor package CLI command [\#1345](https://github.com/fission/fission/pull/1345) ([life1347](https://github.com/life1347))
## [1.6.0](https://github.com/fission/fission/tree/1.6.0) (2019-10-10)
[Full Changelog](https://github.com/fission/fission/compare/v1.6.0...1.6.0)
## [v1.6.0](https://github.com/fission/fission/tree/v1.6.0) (2019-10-10)
[Full Changelog](https://github.com/fission/fission/compare/1.5.0...v1.6.0)
**Merged pull requests:**
- Fission 1.6.0 [\#1351](https://github.com/fission/fission/pull/1351) ([life1347](https://github.com/life1347))
- Move statefulset to apps/v1 [\#1350](https://github.com/fission/fission/pull/1350) ([life1347](https://github.com/life1347))
- Fix newdeploy failed to find serviceEntry in cache [\#1349](https://github.com/fission/fission/pull/1349) ([life1347](https://github.com/life1347))
- Support encoded path in router [\#1347](https://github.com/fission/fission/pull/1347) ([life1347](https://github.com/life1347))
- Support custom private go vendor [\#1346](https://github.com/fission/fission/pull/1346) ([life1347](https://github.com/life1347))
- Fix the namespace mismatch problem when deploying with a single YAML file [\#1344](https://github.com/fission/fission/pull/1344) ([life1347](https://github.com/life1347))
- Move charts executor service to the right place [\#1343](https://github.com/fission/fission/pull/1343) ([life1347](https://github.com/life1347))
- Allow to deploy router as DaemonSet [\#1342](https://github.com/fission/fission/pull/1342) ([life1347](https://github.com/life1347))
- add package filter feature [\#1341](https://github.com/fission/fission/pull/1341) ([jjmengze](https://github.com/jjmengze))
- Bump jvm builder JDK version [\#1340](https://github.com/fission/fission/pull/1340) ([life1347](https://github.com/life1347))
- Fix executor doesn't apply user-configured container spec correctly [\#1339](https://github.com/fission/fission/pull/1339) ([life1347](https://github.com/life1347))
- Allow to add annotations to router service in helm chart [\#1338](https://github.com/fission/fission/pull/1338) ([prabhu43](https://github.com/prabhu43))
- Remove too verbose and unhelpful debug log [\#1336](https://github.com/fission/fission/pull/1336) ([life1347](https://github.com/life1347))
- package will now be listed, sorted by lastupdatedtime [\#1334](https://github.com/fission/fission/pull/1334) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix router health route not found if no HTTP triggers created [\#1333](https://github.com/fission/fission/pull/1333) ([life1347](https://github.com/life1347))
- Fix spec doesn't update status of failed package when applying spec files [\#1332](https://github.com/fission/fission/pull/1332) ([life1347](https://github.com/life1347))
- Move Deployment API group from extensions/v1beta1 to apps/v1 [\#1331](https://github.com/fission/fission/pull/1331) ([life1347](https://github.com/life1347))
- Fix empty host value when list http triggers [\#1328](https://github.com/fission/fission/pull/1328) ([life1347](https://github.com/life1347))
- List/Delete HTTP triggers by function [\#1327](https://github.com/fission/fission/pull/1327) ([life1347](https://github.com/life1347))
- Add Ingress TLS support [\#1326](https://github.com/fission/fission/pull/1326) ([life1347](https://github.com/life1347))
- Add Ingress host, path and annotations support [\#1325](https://github.com/fission/fission/pull/1325) ([life1347](https://github.com/life1347))
- Set maxSurge to 20% for safe rolling upgrade [\#1321](https://github.com/fission/fission/pull/1321) ([life1347](https://github.com/life1347))
- Disable revision history for newdeploy [\#1319](https://github.com/fission/fission/pull/1319) ([life1347](https://github.com/life1347))
- Pre-built docker go module dependency cache image [\#1318](https://github.com/fission/fission/pull/1318) ([life1347](https://github.com/life1347))
- Fix newdeploy doesn't handle error properly [\#1316](https://github.com/fission/fission/pull/1316) ([life1347](https://github.com/life1347))
- Fix failed to update specialization timeout [\#1315](https://github.com/fission/fission/pull/1315) ([life1347](https://github.com/life1347))
- Add codecov config file [\#1314](https://github.com/fission/fission/pull/1314) ([life1347](https://github.com/life1347))
- Fix potential nil pointer problem when using multierror pkg [\#1311](https://github.com/fission/fission/pull/1311) ([life1347](https://github.com/life1347))
- Use ErrorHandler to handle proxy error [\#1310](https://github.com/fission/fission/pull/1310) ([life1347](https://github.com/life1347))
- Integrate with Codecov [\#1308](https://github.com/fission/fission/pull/1308) ([life1347](https://github.com/life1347))
- Fix executor unable to list secrets/configmaps [\#1307](https://github.com/fission/fission/pull/1307) ([life1347](https://github.com/life1347))
- Add specialization timeout default value to CLI [\#1305](https://github.com/fission/fission/pull/1305) ([life1347](https://github.com/life1347))
- Update CHANGELOG for 1.5.0 [\#1304](https://github.com/fission/fission/pull/1304) ([life1347](https://github.com/life1347))
- Fission 1.5.0 [\#1303](https://github.com/fission/fission/pull/1303) ([life1347](https://github.com/life1347))
- Implement TLS authentication for kafka mqt [\#1300](https://github.com/fission/fission/pull/1300) ([vadasambar](https://github.com/vadasambar))
- Issue 1229: Function level timeout [\#1284](https://github.com/fission/fission/pull/1284) ([parauliya](https://github.com/parauliya))
- Fix kafka producer and consumer logs show empty objects [\#1281](https://github.com/fission/fission/pull/1281) ([vadasambar](https://github.com/vadasambar))
## [1.5.0](https://github.com/fission/fission/tree/1.5.0) (2019-09-09)
[Full Changelog](https://github.com/fission/fission/compare/1.4.1...1.5.0)
@@ -51,6 +213,7 @@ filename | sha256 hash
- Allow to set deployment config uid during initialization [\#1249](https://github.com/fission/fission/pull/1249) ([life1347](https://github.com/life1347))
- Add swagger \(OpenAPI 2.0\) support [\#1245](https://github.com/fission/fission/pull/1245) ([life1347](https://github.com/life1347))
- Update go dependencies [\#1240](https://github.com/fission/fission/pull/1240) ([life1347](https://github.com/life1347))
- Allow to set log level through environment variable [\#1217](https://github.com/fission/fission/pull/1217) ([life1347](https://github.com/life1347))
## [1.4.1](https://github.com/fission/fission/tree/1.4.1) (2019-07-29)
[Full Changelog](https://github.com/fission/fission/compare/1.4.0...1.4.1)
@@ -80,7 +243,6 @@ filename | sha256 hash
- Function Update if config/secret changes [\#1224](https://github.com/fission/fission/pull/1224) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix nil pointer when CLI unable to get server version [\#1223](https://github.com/fission/fission/pull/1223) ([life1347](https://github.com/life1347))
- Reuse go docker build cache [\#1218](https://github.com/fission/fission/pull/1218) ([life1347](https://github.com/life1347))
- Allow to set log level through environment variable [\#1217](https://github.com/fission/fission/pull/1217) ([life1347](https://github.com/life1347))
- Fix roundtripper doesn't increase request timeout setting after each retry [\#1216](https://github.com/fission/fission/pull/1216) ([life1347](https://github.com/life1347))
- Configmaps/secrets in function exist check [\#1214](https://github.com/fission/fission/pull/1214) ([vishal-biyani](https://github.com/vishal-biyani))
- Add experimental environment: tensorflow-serving [\#1212](https://github.com/fission/fission/pull/1212) ([life1347](https://github.com/life1347))
@@ -93,7 +255,6 @@ filename | sha256 hash
- Fallback to get user home directory from env [\#1203](https://github.com/fission/fission/pull/1203) ([life1347](https://github.com/life1347))
- Fission v1.3.0 [\#1202](https://github.com/fission/fission/pull/1202) ([life1347](https://github.com/life1347))
- \[bugfix\] Fix CLI drops controller URL path when querying logs [\#1201](https://github.com/fission/fission/pull/1201) ([moluzhang](https://github.com/moluzhang))
- Enable go module support for go environment [\#1152](https://github.com/fission/fission/pull/1152) ([life1347](https://github.com/life1347))
## [1.3.0](https://github.com/fission/fission/tree/1.3.0) (2019-06-03)
[Full Changelog](https://github.com/fission/fission/compare/1.2.1...1.3.0)
@@ -137,6 +298,7 @@ filename | sha256 hash
- Fix the logger not working [\#1166](https://github.com/fission/fission/pull/1166) ([darkgerm](https://github.com/darkgerm))
- Change log level in executor for better log reading/troubleshooting [\#1163](https://github.com/fission/fission/pull/1163) ([life1347](https://github.com/life1347))
- Fix TravisCI go environment version to avoid go bugs [\#1154](https://github.com/fission/fission/pull/1154) ([life1347](https://github.com/life1347))
- Enable go module support for go environment [\#1152](https://github.com/fission/fission/pull/1152) ([life1347](https://github.com/life1347))
- \#1132 nodejs environment, increase body size [\#1149](https://github.com/fission/fission/pull/1149) ([JannikZed](https://github.com/JannikZed))
- Added php builder to release script fixes \#1140 [\#1145](https://github.com/fission/fission/pull/1145) ([vishal-biyani](https://github.com/vishal-biyani))
- Using templated imagePullPolicy for containers in deployment.yaml [\#1137](https://github.com/fission/fission/pull/1137) ([msshroff](https://github.com/msshroff))
@@ -284,6 +446,7 @@ filename | sha256 hash
**Merged pull requests:**
- Print status with the get option. [\#907](https://github.com/fission/fission/pull/907) ([smruthi2187](https://github.com/smruthi2187))
- Fixed the spec validation UX issue [\#898](https://github.com/fission/fission/pull/898) ([vishal-biyani](https://github.com/vishal-biyani))
- Check CRD creation error instead of doing return directly [\#897](https://github.com/fission/fission/pull/897) ([life1347](https://github.com/life1347))
- Fix failed to find release-builder dockerfile & push specific tag [\#870](https://github.com/fission/fission/pull/870) ([life1347](https://github.com/life1347))
- V0.10.0 [\#868](https://github.com/fission/fission/pull/868) ([life1347](https://github.com/life1347))
@@ -304,7 +467,6 @@ filename | sha256 hash
**Merged pull requests:**
- Fixed the spec validation UX issue [\#898](https://github.com/fission/fission/pull/898) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix CLI failed to setup port-forward caused by \#712 [\#867](https://github.com/fission/fission/pull/867) ([life1347](https://github.com/life1347))
- Replay recorded requests by ReqUID [\#864](https://github.com/fission/fission/pull/864) ([Amusement](https://github.com/Amusement))
- Add cleanup function to test scripts [\#863](https://github.com/fission/fission/pull/863) ([life1347](https://github.com/life1347))
@@ -372,6 +534,7 @@ filename | sha256 hash
- ArchiveLiteralSizeLimit: Use Constant Instead Hard Code [\#731](https://github.com/fission/fission/pull/731) ([xiekeyang](https://github.com/xiekeyang))
- Environment warning message bugfix [\#725](https://github.com/fission/fission/pull/725) ([soamvasani](https://github.com/soamvasani))
- V0.8.0 [\#722](https://github.com/fission/fission/pull/722) ([vishal-biyani](https://github.com/vishal-biyani))
- Make fetcher resource requests and limits configurable [\#708](https://github.com/fission/fission/pull/708) ([xiekeyang](https://github.com/xiekeyang))
- Add steps to render & upload fission installation YAML [\#745](https://github.com/fission/fission/pull/745) ([life1347](https://github.com/life1347))
- Fix executor not reaps idle function pods for functions with executortype newdeploy [\#744](https://github.com/fission/fission/pull/744) ([life1347](https://github.com/life1347))
- Testing with keep alive settings for connections [\#742](https://github.com/fission/fission/pull/742) ([vishal-biyani](https://github.com/vishal-biyani))
@@ -396,7 +559,6 @@ filename | sha256 hash
- Pre-install/pre-upgrade hooks to verify func references and assign restricted role bindings [\#717](https://github.com/fission/fission/pull/717) ([smruthi2187](https://github.com/smruthi2187))
- Logger daemonset's update strategy [\#714](https://github.com/fission/fission/pull/714) ([vishal-biyani](https://github.com/vishal-biyani))
- Check spec directory exists before reading spec files [\#709](https://github.com/fission/fission/pull/709) ([life1347](https://github.com/life1347))
- Make fetcher resource requests and limits configurable [\#708](https://github.com/fission/fission/pull/708) ([xiekeyang](https://github.com/xiekeyang))
- Formatted specifiers are not compatible with variables [\#706](https://github.com/fission/fission/pull/706) ([xiekeyang](https://github.com/xiekeyang))
- Indicate HTTP status code by library const [\#703](https://github.com/fission/fission/pull/703) ([xiekeyang](https://github.com/xiekeyang))
- docker-distribution version bump for windows compatibility [\#691](https://github.com/fission/fission/pull/691) ([thejosephstevens](https://github.com/thejosephstevens))
@@ -540,8 +702,10 @@ filename | sha256 hash
- Add readiness probe to go env [\#461](https://github.com/fission/fission/pull/461) ([life1347](https://github.com/life1347))
- Fix fission bundle build failure [\#456](https://github.com/fission/fission/pull/456) ([life1347](https://github.com/life1347))
- Convert build.sh to a multi-stage Dockerfile. [\#452](https://github.com/fission/fission/pull/452) ([justinbarrick](https://github.com/justinbarrick))
- Fix python environment failed to launch [\#451](https://github.com/fission/fission/pull/451) ([life1347](https://github.com/life1347))
- NewDeploy Doc [\#432](https://github.com/fission/fission/pull/432) ([vishal-biyani](https://github.com/vishal-biyani))
- Add go vet check [\#430](https://github.com/fission/fission/pull/430) ([life1347](https://github.com/life1347))
- Add fission/builder image [\#397](https://github.com/fission/fission/pull/397) ([erwinvaneyk](https://github.com/erwinvaneyk))
- Fix potential nil pointer problem [\#485](https://github.com/fission/fission/pull/485) ([life1347](https://github.com/life1347))
- Add simple usage doc for accessing secret/configmap in function [\#484](https://github.com/fission/fission/pull/484) ([life1347](https://github.com/life1347))
- Helm hook bugfixes: run on upgrade, delete on completion [\#473](https://github.com/fission/fission/pull/473) ([soamvasani](https://github.com/soamvasani))
@@ -559,7 +723,6 @@ filename | sha256 hash
**Merged pull requests:**
- Fix python environment failed to launch [\#451](https://github.com/fission/fission/pull/451) ([life1347](https://github.com/life1347))
- use time.Since instead of time.Now\(\).Sub [\#449](https://github.com/fission/fission/pull/449) ([wgliang](https://github.com/wgliang))
- Fix fission function logs [\#448](https://github.com/fission/fission/pull/448) ([prithviramesh](https://github.com/prithviramesh))
- Integration test improvements [\#447](https://github.com/fission/fission/pull/447) ([soamvasani](https://github.com/soamvasani))
@@ -578,11 +741,8 @@ filename | sha256 hash
- Executor API panics if there is err in getting function from backends [\#407](https://github.com/fission/fission/pull/407) ([vishal-biyani](https://github.com/vishal-biyani))
- fission function logs returns logs in correct order now [\#405](https://github.com/fission/fission/pull/405) ([prithviramesh](https://github.com/prithviramesh))
- Fetcher retry [\#403](https://github.com/fission/fission/pull/403) ([vishal-biyani](https://github.com/vishal-biyani))
- Add fission/builder image [\#397](https://github.com/fission/fission/pull/397) ([erwinvaneyk](https://github.com/erwinvaneyk))
- Changed podName to a generic objectReference in cache implementation [\#391](https://github.com/fission/fission/pull/391) ([vishal-biyani](https://github.com/vishal-biyani))
- Add package command [\#385](https://github.com/fission/fission/pull/385) ([life1347](https://github.com/life1347))
- Executor abstraction [\#384](https://github.com/fission/fission/pull/384) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix builder manager issues [\#367](https://github.com/fission/fission/pull/367) ([life1347](https://github.com/life1347))
## [0.4.0](https://github.com/fission/fission/tree/0.4.0) (2017-11-15)
[Full Changelog](https://github.com/fission/fission/compare/0.4.0rc...0.4.0)
@@ -592,8 +752,8 @@ filename | sha256 hash
- Added python example to demonstrate status codes. [\#395](https://github.com/fission/fission/pull/395) ([c0dyhi11](https://github.com/c0dyhi11))
- created weather.js in node.js examples, modified README.md [\#394](https://github.com/fission/fission/pull/394) ([svicenteruiz](https://github.com/svicenteruiz))
- Delete failed helm releases to prevent test case failure [\#393](https://github.com/fission/fission/pull/393) ([life1347](https://github.com/life1347))
- Added AWS to install cloud setup [\#392](https://github.com/fission/fission/pull/392) ([joshkelly](https://github.com/joshkelly))
- Fix functionReferenceResolver return out-of-date function metadata [\#390](https://github.com/fission/fission/pull/390) ([life1347](https://github.com/life1347))
- Add package command [\#385](https://github.com/fission/fission/pull/385) ([life1347](https://github.com/life1347))
- changes made to FluentD configuration to circumvent Logger daemonset [\#380](https://github.com/fission/fission/pull/380) ([prithviramesh](https://github.com/prithviramesh))
## [0.4.0rc](https://github.com/fission/fission/tree/0.4.0rc) (2017-11-08)
@@ -601,9 +761,12 @@ filename | sha256 hash
**Merged pull requests:**
- Added AWS to install cloud setup [\#392](https://github.com/fission/fission/pull/392) ([joshkelly](https://github.com/joshkelly))
- Use store to sync functions/triggers for fast synchronization [\#382](https://github.com/fission/fission/pull/382) ([life1347](https://github.com/life1347))
- Switch from ThirdPartyResources to CustomResourceDefinitions [\#381](https://github.com/fission/fission/pull/381) ([life1347](https://github.com/life1347))
- changed helm install pullPolicy from Always to IfNotPresent when building local docker image [\#378](https://github.com/fission/fission/pull/378) ([prithviramesh](https://github.com/prithviramesh))
- Reduce function resolving time [\#376](https://github.com/fission/fission/pull/376) ([life1347](https://github.com/life1347))
- Fix builder manager issues [\#367](https://github.com/fission/fission/pull/367) ([life1347](https://github.com/life1347))
- Test functions 236 [\#355](https://github.com/fission/fission/pull/355) ([vishal-biyani](https://github.com/vishal-biyani))
- Make default node-env use alpine. List envs in documentation. [\#354](https://github.com/fission/fission/pull/354) ([rapitable](https://github.com/rapitable))
- Update k8s client version to 4.0.0 [\#351](https://github.com/fission/fission/pull/351) ([life1347](https://github.com/life1347))
@@ -613,7 +776,6 @@ filename | sha256 hash
**Merged pull requests:**
- Use store to sync functions/triggers for fast synchronization [\#382](https://github.com/fission/fission/pull/382) ([life1347](https://github.com/life1347))
- dotnet20 build fixes [\#365](https://github.com/fission/fission/pull/365) ([soamvasani](https://github.com/soamvasani))
- Add experimental deploy script [\#364](https://github.com/fission/fission/pull/364) ([erwinvaneyk](https://github.com/erwinvaneyk))
- Fix workflow apiserver proxy [\#363](https://github.com/fission/fission/pull/363) ([erwinvaneyk](https://github.com/erwinvaneyk))
@@ -782,7 +944,6 @@ filename | sha256 hash
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([sanketsudake](https://github.com/sanketsudake))
- Wait for Pod IP while waiting for pod ready [\#89](https://github.com/fission/fission/pull/89) ([soamvasani](https://github.com/soamvasani))
- Added support for running C\# code in a dotnet core environment [\#84](https://github.com/fission/fission/pull/84) ([ktrance](https://github.com/ktrance))
- Poolmgr: fix pod leak bugs on specializePod failure [\#70](https://github.com/fission/fission/pull/70) ([soamvasani](https://github.com/soamvasani))
## [alpha20170124](https://github.com/fission/fission/tree/alpha20170124) (2017-01-24)
[Full Changelog](https://github.com/fission/fission/compare/kubecon...alpha20170124)
@@ -795,6 +956,7 @@ filename | sha256 hash
- Bug fix for handling a route's HTTP method in router [\#79](https://github.com/fission/fission/pull/79) ([soamvasani](https://github.com/soamvasani))
- fission-bundle: allow setting the namespace [\#77](https://github.com/fission/fission/pull/77) ([frodenas](https://github.com/frodenas))
- Delete generic pools when environments are deleted [\#75](https://github.com/fission/fission/pull/75) ([soamvasani](https://github.com/soamvasani))
- Poolmgr: fix pod leak bugs on specializePod failure [\#70](https://github.com/fission/fission/pull/70) ([soamvasani](https://github.com/soamvasani))
- Poolmgr: ensure orphaned resources are cleaned up [\#69](https://github.com/fission/fission/pull/69) ([soamvasani](https://github.com/soamvasani))
- Implement 'fission route update' [\#68](https://github.com/fission/fission/pull/68) ([soamvasani](https://github.com/soamvasani))
- Update router cache on new function version [\#67](https://github.com/fission/fission/pull/67) ([soamvasani](https://github.com/soamvasani))
+1 -1
View File
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at codeofconduct@platform9.com. All
reported by contacting the project team at slack channel. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
+1 -2
View File
@@ -34,9 +34,8 @@ If you choose a big chunk of work that involves design changes to
Fission, please talk to us while planning the change; that way we can
all be on the same page before you invest too much work into it.
* Drop by the [slack channel](http://slack.fission.io)
* Drop by the [slack channel](http://slack.fission.io).
* Say hi on [twitter](https://twitter.com/fissionio).
* Email soamvasani@platform9.com
### Contribution Howto
+150 -94
View File
@@ -1,105 +1,186 @@
# A high-level view of the internals of Fission.
A high level view of the internals of Fission.
How it works
============
## How it works
Fission is a FaaS -- users create functions (source level), register
them with fission using a CLI, and associate functions with triggers.
them with Fission using a CLI, and associate functions with triggers.
Fission wraps those functions into a service, and runs them on
Fission wraps those functions into a service and runs them on
Kubernetes on demand.
Here's an overview of the services that make up fission.
Here's an overview of the services that make up Fission.
Components
==========
## Components
Language-neutral components:
Core Components:
* Controller
* Executor
* Environment Container (language-specific)
* Router
* Builder Manager
* Storage Service
* controller
* poolmgr
* router
* kubewatcher
Optional Components:
* Logger
* Kubewatcher
* Message Queue Trigger
* Timer
Language-specific components:
Third-party components:
* InfluxDB: To store function logs.
* Prometheus: For metric collection and canary deployment.
* NATS Streaming: For message queue trigger. (Kafka, Azure are not included in charts deployment.)
* Environment container(s)
## Core Components
### Controller
Controller
----------
The controller contains CRUD APIs for functions, triggers, environments,
Kubernetes event watches, etc. This is the component that the client talks to.
The controller contains CRUD APIs for functions, http triggers,
environments, Kubernetes event watches. This is the component that
the client talks to.
All fission resources are stored in kubernetes CRDs. It needs to be able to
talk to kubernetes API service.
This is the only stateful component. It needs to be configured with a
URL to an etcd cluster and a path to a persistent volume. The volume
is used to store the functions' source code. Etcd is used as the DB.
### Executor
[Work to extend to other storage backends is planned, see issue #83.]
The executor has two simple APIs; the router calls both these endpoints.
Pool Manager
------------
* GetFunctionService takes function metadata and dispatches the corresponding executor
type to get the address of a service/pod and returns it to the router.
* TapService lets executor know a service/pod is being used; if it's not
called for a few minutes the pod(s) backing the service are killed.
Poolmgr manages pools of generic containers and function containers.
It now supports two different executor types:
It has a simple API; both these endpoints are called by the router.
* PoolManager
* NewDeploy
* GetFunctionService takes function metadata and returns the address
of a service.
* TapService lets poolmgr know a service is being used; if it's not
called for a few minutes the pod(s) backing the service are killed.
These two executor types have different strategies to launch, specialize, and manage pod(s).
You should choose one of the executor types wisely based on the scenario.
Poolmgr watches the controller API and eagerly creates generic pools
for environments. It uses Kubernetes deployments to do that. The
environment container runs in a pod with the 'fetcher' container.
Fetcher is a very simple utility that downloads a URL sent to it and
saves it at a configured location.
#### PoolManager
GetFunctionService "specializes" a pod. The implementation chooses a
pod from the pool, relabels it to "orphan" the pod from the
deployment, invokes fetcher to copy the function into the pod, and
hits the the specialize endpoint on the environment container. This
causes the function to be loaded. The pod is now specific to that
function.
PoolManager manages pools of generic containers and function containers.
This function pod is cached; it's cleaned up if it's unused for a few
minutes.
PoolManager watches the environment CRD changes and eagerly creates generic pools
for environments. It uses Kubernetes deployments to do that. The
environment container runs in a pod with the 'fetcher' container.
Fetcher is a straightforward utility that downloads a URL sent to it
and saves it at a configured location (shared volume).
Router
------
The implementation chooses a generic pod from the pool, relabels it to
"orphan". The pod from the deployment invokes fetcher to copy the function
into the pod and hits the specialize endpoint on the environment container.
This causes the function to be loaded. The pod is now specific to that
function. This function pod is cached; it's cleaned up if it's unused for a few minutes.
The router forwards HTTP requests to function pods. If there's no
running service for a function, it requests one from poolmgr, while
holding on to the request; when the function's service is ready it
forwards the request.
PoolManager selects a generic pod from the warm pool, specializes it,
and recycles the pod if there are no further requests to the function after a few minutes.
It makes PoolManager suitable for functions that are short-living
and requires a short cold start time [1].
The router is stateless and can be scaled up if needed, according to
However, PoolManager only selects one pod per function, which is not
suitable for serving massive traffic. In such cases, you should consider
using NewDeploy as executor type of function.
[1] The cold start time depends on the package size of the function. If it's
a snippet of code, the cold start time usually is less then 100ms.
#### NewDeploy
NewDeploy creates deployment, service, and HPA for functions in order to handle
massive traffic.
NewDeploy watches the function CRD changes and creates a Kubernetes deployment,
service, and HPA for a function. NewDeploy will scale the replicas of a function
deployment to the minimum feasible scale setting, if the minimum scale setting of
a function is greater than 0. The 'fetcher' inside the pod uses a URL in the
JSON payload, which is attached as a parameter to start fetcher, to download the
function package instead of waiting for calls from NewDeploy.
When a function experiences a traffic spike, the service helps to distribute the requests to
pods belonging to the function for better workload distribution and lower latency. Also,
the HPA scales the replicas of the deployment based on the conditions set by the user.
This approach though increases the cold time of a function, but also makes NewDeploy
suitable for functions designed to serve massive traffic.
### Environment Container
Environment containers run user-defined functions and are language-specific.
Each environment container must contain an HTTP server and a loader for functions.
The pool manager deploys the environment container into a pod with fetcher
(fetcher is a simple utility that can fetch an HTTP URL to a file at a
configured location). This pod forms a "generic pod" because it can
be loaded with any function in that coding language.
When the pool manager needs to create a service for a function, it calls
fetcher to fetch the function. Fetcher downloads the function into a
volume shared between fetcher and this environment container. Poolmgr
then requests the container to load the function.
### Router
The router forwards HTTP requests to function pods. If there's no
running service for a function, it requests one from executor, while
holding on to the request; the router will forward the request to
the pod once the function service is ready.
The router is the only stateless component and can be scaled up if needed, according to
load.
Kubewatcher
-----------
### Builder Manager
The builder manager watches the package & environments CRD changes and manages
the builds of function source code. Once an environment that contains a builder
image is created, the builder manager will then creates the Kubernetes service
and deployment under the fission-builder namespace to start the environment
builder. And once a package that contains a source archive is created, the
builder manager talks to the environment builder to build the function's source
archive into a deploy archive for function deployment.
After the build, the builder manager asks Builder to upload the deploy archive to the
Storage Service once the build succeeded, and updates the package status attached with build logs.
### Storage Service
The storage service is the home for all archives of packages with sizes larger than 256KB.
The Builder pulls the source archive from the storage service and uploads deploy archive to it.
The fetcher inside the function pod also pulls the deploy archive for function specialization.
## Optional Components
### Logger
Logger is deployed as DaemonSet to help to forward function logs to a centralized
database service for log persistence. Currently, only InfluxDB is supported to store logs.
Following is a diagram describe how log service works:
1. Logger watches pod changes and creates a symlink to the container log if the pod runs on the same node.
2. Fluentd reads logs from symlink and pipes them to InfluxDB
3. `fission function logs ...` retrieve event logs from InfluxDB with optional log filter
4. Logger removes the symlink if the pod no longer exists.
### Kubewatcher
Kubewatcher watches the Kubernetes API and invokes functions
associated with watches, sending the watch event to the function.
The controller keeps track of user's requested watches and associated
functions. Kubewatcher watches the API based on these requests; when
The controller keeps track of the user's requested watches and associated
functions. Kubewatcher watches the API based on these requests; when
a watch event occurs, it serializes the object and calls the function
via the router.
While a few simple retries are done, there isn't yet a reliable
message bus between Kubewatcher and the function. Work for this is
message bus between Kubewatcher and the function. Work for this is
tracked in issue #64.
Message Queue Trigger
---------------------
### Message Queue Trigger
A message queue trigger binds a message queue topic to a function:
events from that topic cause the function to be invoked with the
Events from that topic cause the function to be invoked with the
message as the body of the request. The trigger may also contain a
response topic: if specified, the function's output is sent to this
response.
@@ -108,37 +189,12 @@ Here's a diagram of the components:
![Message queue trigger Diagram](https://user-images.githubusercontent.com/202578/27012344-9457cb24-4f00-11e7-8d6b-926ff01637b3.jpg)
Environment Container
---------------------
### Timer
Environment containers run user-defined functions. Environment
containers are language specific. Each environment container must
contain an HTTP server and a loader for functions.
The timer works like kubernetes CronJob but instead of creating a pod to do the task,
it sends a request to router to invoke the function. It's suitable for the background tasks that
need to executor periodically.
Poolmgr deploys the environment container into a pod with fetcher
(fetcher is a simple utility that can fetch an HTTP url to a file at a
configured location). This pod forms a "generic pod", because it can
be loaded with any function in that language.
When poolmgr needs to create a service for a function, it calls
fetcher to fetch the function. Fetcher downloads the function into a
volume shared between fetcher and this environment container. Poolmgr
then requests the container to load the function.
Logger
------
Logger helps to forward function logs to centralized db service for log
persistence. Currently only influxdb is supported to store logs.
Following is a diagram describe how log service works:
![Logger Diagram](https://cloud.githubusercontent.com/assets/202578/23100399/b0e3ea00-f6ba-11e6-8f2f-6588cfef2e84.png)
1. Pool manager chooses a pod from the pool to execute user function
2. Pool manager makes a HTTP POST to logger helper, once helper receives
the request it creates a symlink to container log for fluentd.
3. Fluentd reads log from symlink and pipes to influxdb
4. `fission function logs ...` retrieve event logs from influxdb with
optional log filter
5. Pool manager removes function pod from pool
6. Pool manager asks logger helper to stop piping logs, logger removes symlink.
The timer works like a Kubernetes CronJob, but instead of creating a
pod to do the task, it sends a request to the router to invoke the
function. It is suitable for background tasks that need to execute periodically.
+26 -24
View File
@@ -11,36 +11,38 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: test
.DEFAULT_GOAL := build
IMAGE ?= fission/fission-bundle
VERSION ?= latest
ARCH ?= amd64
OS ?= linux
.DEFAULT_GOAL := check
test:
go test -v $(go list ./... | grep -v /examples/ | grep -v /environments/)
check: test-run build clean
build: build-bundle build-client
# run basic check scripts
test-run:
hack/verify-gofmt.sh
hack/verify-govet.sh
hack/verify-staticcheck.sh
hack/runtests.sh
@rm -f coverage.txt
build-client:
# ensure the changes are buildable
build:
go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
go build -o cmd/fetcher/fetcher ./cmd/fetcher/
go build -o cmd/fetcher/builder ./cmd/builder/
build-bundle:
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
# install CLI binary to $PATH
install: build
mv cmd/fission-cli/fission $(GOPATH)/bin
build-image:
docker build --rm --tag "$(IMAGE):$(VERSION)" cmd/fission-bundle/
install:
go install ./cmd/fission-cli/
image: build-bundle build-image
image-push: image
docker push "$(IMAGE):$(VERSION)"
# build images (environment images are not included)
image:
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
clean:
@rm -f fission-bundle/fission-bundle
@rm -f fission/fission
@rm -f cmd/fission-bundle/fission-bundle
@rm -f cmd/fission-cli/fission
@rm -f cmd/fetcher/fetcher
@rm -f cmd/fetcher/builder
+42 -19
View File
@@ -1,5 +1,5 @@
Fission: Serverless Functions for Kubernetes
============================================
# Fission: Serverless Functions for Kubernetes
[![Build Status](https://travis-ci.org/fission/fission.svg?branch=master)](https://travis-ci.org/fission/fission)
[![Go Report Card](https://goreportcard.com/badge/github.com/fission/fission)](https://goreportcard.com/report/github.com/fission/fission)
[![Fission Slack](http://slack.fission.io/badge.svg)](http://slack.fission.io)
@@ -18,7 +18,7 @@ language-specific parts are isolated in something called
_environments_ (more below). Fission currently supports NodeJS, Python, Ruby, Go,
PHP, Bash, and any Linux executable, with more languages coming soon.
### Performance: 100msec cold start
# Performance: 100msec cold start
Fission maintains a pool of "warm" containers that each contain a
small dynamic loader. When a function is first called,
@@ -26,7 +26,7 @@ i.e. "cold-started", a running container is chosen and the function is
loaded. This pool is what makes Fission fast: cold-start latencies
are typically about 100msec.
### Kubernetes is the right place for Serverless
# Kubernetes is the right place for Serverless
We're built on Kubernetes because we think any non-trivial app will
use a combination of serverless functions and more conventional
@@ -37,30 +37,53 @@ Building on Kubernetes also means that anything you do for operations
on your Kubernetes cluster &mdash; such as monitoring or log
aggregation &mdash; also helps with ops on your Fission deployment.
Getting started and documentation
===============================
# Getting started and documentation
You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io).
* See the [installation guide](https://docs.fission.io/installation/) for installing and running Fission.
* See the [troubleshooting guide](https://docs.fission.io/trouble-shooting/) for debugging your functions and Fission installation.
## Fission Concepts
Contributing
=================
Visit [concepts](https://docs.fission.io/docs/concepts/) for more details.
### Building Fission
See the [compilation guide](https://docs.fission.io/contributing/).
## Documentations
### Contact
Reach us on [slack](http://slack.fission.io) or
[twitter](https://twitter.com/fissionio).
You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io/docs).
* See the [installation guide](https://docs.fission.io/docs/installation/) for installing and running Fission.
* See the [troubleshooting guide](https://docs.fission.io/docs/trouble-shooting/) for debugging your functions and Fission installation.
## Usage
```bash
# Add the stock NodeJS env to your Fission deployment
$ fission env create --name nodejs --image fission/node-env
# A javascript one-liner that prints "hello world"
$ curl https://raw.githubusercontent.com/fission/fission/master/examples/nodejs/hello.js > hello.js
# Upload your function code to fission
$ fission function create --name hello --env nodejs --code hello.js
# Map GET /hello to your new function
$ fission route create --method GET --url /hello --function hello
# Run the function. This takes about 100msec the first time.
$ fission function test --name hello
Hello, world!
```
# Contributing
## Building Fission
See the [compilation guide](https://docs.fission.io/docs/contributing/).
## Contact
Reach us on [slack](http://slack.fission.io) or [twitter](https://twitter.com/fissionio).
Fission is a project by [many contributors](https://github.com/fission/fission/graphs/contributors).
### Community meeting
## Community meeting
A regular community meeting takes place every other Thursday at 08:30 AM PT (Pacific Time). [Convert to your local timezone](http://www.thetimezoneconverter.com/?t=08:30&tz=PT%20%28Pacific%20Time%29).
## Official Releases
# Official Releases
Official releases of Fission can be found on [the releases page](https://github.com/fission/fission/releases).
Please note that it is strongly recommended that you use official releases of Fission, as unreleased versions from
@@ -68,6 +91,6 @@ the master branch are subject to changes and incompatibilities that will not be
Builds from the master branch can have functionality changed and even removed at any time without compatibility support
and without prior notice.
## Licensing
# Licensing
Fission is under the Apache 2.0 license.
+6 -3
View File
@@ -43,10 +43,10 @@ Parameter | Description | Default
`routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer`
`repository` | Image base repository | `index.docker.io`
`image` | Fission image repository | `fission/fission-bundle`
`imageTag` | Fission image tag | `1.6.0`
`imageTag` | Fission image tag | `1.7.1`
`pullPolicy` | Image pull policy | `IfNotPresent`
`fetcherImage` | Fission fetcher repository | `fission/fetcher`
`fetcherImageTag` | Fission fetcher image tag | `1.6.0`
`fetcherImageTag` | Fission fetcher image tag | `1.7.1`
`controllerPort` | Fission Controller service port | `31313`
`routerPort` | Fission Router service port | ` 31314`
`functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function`
@@ -62,14 +62,17 @@ Parameter | Description | Default
`pruneInterval` | The frequency of archive pruner (in minutes) | `60`
`preUpgradeChecksImage` | Fission pre-install/pre-upgrade checks live in this image | `fission/pre-upgrade-checks`
`debugEnv` | If there are any pod specialization errors when a function is triggered and this flag is set to true, the error summary is returned as part of http response | `true`
`prometheusDeploy` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
`prometheus.enabled` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil`
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
`executor.adoptExistingResources` | If true, executor will try to adopt existing resources created by the old executor instance. | `false`
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
`router.svcAddressMaxRetries` | Max retries times for router to retry on a certain service URL returns from cache/executor | `5`
`router.svcAddressUpdateTimeout` | The length of update lock expiry time for router to get a service URL returns from executor | `30`
`router.svcAnnotations` | Annotations for router service | None
`router.useEncodedPath` | For router to match encoded path. If true, "/foo%2Fbar" will match the path "/{var}"; Otherwise, it will match the path "/foo/bar". | `false`
`router.traceSamplingRate` | Uniformly sample traces with the given probabilistic sampling rate | `0.5`
`router.roundTrip.disableKeepAlive` | Disable transport keep-alive for fast switching function version | `true`
`router.roundTrip.keepAliveTime` | The keep-alive period for an active network connection to function pod | `30s`
`router.roundTrip.timeout` | HTTP transport request timeout | `50ms`
+4 -4
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: fission-all
version: 1.6.0
version: 1.7.1
description: Fission is a fast serverless framework for Kubernetes.
keywords:
- fission
@@ -8,8 +8,8 @@ keywords:
home: http://fission.io/
maintainers:
- name: Soam Vasani
email: soamvasani@platform9.com
email: soamvasani+1@gmail.com
- name: Ta Ching Chen
email: contact@tachingchen.com
email: hello@tachingchen.com
engine: gotpl
appVersion: 1.6.0
appVersion: 1.7.1
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: prometheus
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.1.0
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
generated: 2019-01-03T16:29:53.158684+01:00
version: 9.3.1
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
generated: "2019-11-18T10:16:20.334338911Z"
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies:
- name: prometheus
version: 7.1.0
version: 9.3.1
repository: https://kubernetes-charts.storage.googleapis.com
condition: prometheusDeploy
condition: prometheus.enabled
+3 -3
View File
@@ -1,13 +1,13 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
Windows:
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.6.0/fission-cli-windows.exe
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
2. You're ready to use Fission!
+3 -1
View File
@@ -25,8 +25,10 @@ controller/config.go
{{- define "config" -}}
canary:
enabled: {{ .Values.canaryDeployment.enabled }}
{{- if .Values.prometheusDeploy }}
{{- if .Values.prometheus.enabled }}
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
{{- else }}
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
{{- end }}
{{- printf "\n" -}}
{{- end -}}
+39 -27
View File
@@ -137,10 +137,12 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--controllerPort", "8888"]
env:
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
@@ -169,7 +171,7 @@ spec:
ports:
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: config-volume
configMap:
@@ -205,7 +207,7 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
@@ -213,10 +215,14 @@ spec:
value: "{{ .Values.pullPolicy }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: ADOPT_EXISTING_RESOURCES
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: FETCHER_MINCPU
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
- name: FETCHER_MINMEM
@@ -225,8 +231,6 @@ spec:
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
readinessProbe:
@@ -247,7 +251,7 @@ spec:
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -275,7 +279,7 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
@@ -283,10 +287,10 @@ spec:
value: "{{ .Values.pullPolicy }}"
- name: BUILDER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: FETCHER_MINCPU
@@ -299,7 +303,7 @@ spec:
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -327,13 +331,15 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -438,7 +444,7 @@ spec:
command:
- /heapster
- --source=kubernetes:https://kubernetes.default
serviceAccount: {{ .Release.Namespace }}/fission-svc
serviceAccountName: {{ .Release.Namespace }}/fission-svc
{{- end }}
---
apiVersion: apps/v1
@@ -467,7 +473,7 @@ spec:
env:
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -498,7 +504,7 @@ spec:
# - name: kubectl-proxy
# image: {{ .Values.repository }}/lachlanevenson/k8s-kubectl
# args: ["proxy", "--port", "8001", "--address", "127.0.0.1"]
# serviceAccount: fission-svc
# serviceAccountName: fission-svc
{{- if .Values.nats.enabled }}
---
@@ -530,10 +536,8 @@ spec:
]
ports:
- containerPort: 4222
hostPort: 4222
protocol: TCP
- containerPort: 4223
hostPort: 4223
protocol: TCP
readinessProbe:
httpGet:
@@ -577,17 +581,19 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: MESSAGE_QUEUE_TYPE
value: nats-streaming
- name: MESSAGE_QUEUE_URL
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -620,7 +626,7 @@ spec:
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: MESSAGE_QUEUE_TYPE
value: kafka
@@ -628,6 +634,8 @@ spec:
value: "{{.Values.kafka.brokers}}"
- name: MESSAGE_QUEUE_KAFKA_VERSION
value: "{{.Values.kafka.version}}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
@@ -643,7 +651,7 @@ spec:
- name: kafka-secrets
mountPath: /etc/fission/secrets
{{- end }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.kafka.authentication.tls.enabled }}
volumes:
- name: kafka-secrets
@@ -708,8 +716,10 @@ spec:
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: MESSAGE_QUEUE_TYPE
@@ -723,7 +733,7 @@ spec:
key: key
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -754,8 +764,10 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: PRUNE_INTERVAL
@@ -781,7 +793,7 @@ spec:
ports:
- containerPort: 8000
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: fission-storage
{{- if .Values.persistence.enabled }}
+13 -1
View File
@@ -45,6 +45,10 @@ spec:
- name: container-log
mountPath: /var/log/
readOnly: false
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
containers:
- name: logger
{{ if .Values.repository }}
@@ -68,6 +72,10 @@ spec:
- name: docker-log
mountPath: /var/lib/docker/containers
readOnly: true
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
- name: fluentbit
{{- if .Values.repository }}
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
@@ -96,6 +104,10 @@ spec:
key: password
- name: LOG_PATH
value: /var/log/fission/*.log
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
volumeMounts:
- name: container-log
mountPath: /var/log/
@@ -106,7 +118,7 @@ spec:
- name: fluentbit-config
mountPath: /fluent-bit/etc/
readOnly: true
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: container-log
hostPath:
@@ -30,4 +30,4 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/pre-upgrade-checks" ]
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
serviceAccount: fission-svc
serviceAccountName: fission-svc
-39
View File
@@ -1,39 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: redis
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: redis
selector:
app: redis
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
selector:
matchLabels:
app: redis
serviceName: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:3.2-alpine
imagePullPolicy: {{ .Values.pullPolicy }}
ports:
- containerPort: 6379
name: redis
+7 -3
View File
@@ -33,7 +33,7 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
@@ -53,12 +53,16 @@ spec:
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
- name: USE_ENCODED_PATH
value: {{ .Values.router.useEncodedPath | default false | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
@@ -84,7 +88,7 @@ spec:
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
+30 -5
View File
@@ -20,13 +20,13 @@ image: fission/fission-bundle
pullPolicy: IfNotPresent
## Fission image version
imageTag: 1.6.0
imageTag: 1.7.1
## Fission fetcher repository
fetcherImage: fission/fetcher
## Fission fetcher image version
fetcherImageTag: 1.6.0
fetcherImageTag: 1.7.1
## Port at which Fission controller service should be exposed
controllerPort: 31313
@@ -57,12 +57,28 @@ logger:
fluentdImageRepository: index.docker.io
fluentdImage: fluent/fluent-bit
fluentdImageTag: 1.0.4
## Fluent-bit writes/reads its own sqlite database to record a history of tracked
## files and a state of offsets, this is very useful to resume a state if the ser-
## vice is restarted. For Kubernetes environment with constraints like OpenShift,
## the containers are limited to write hostPath volume. Hence, we have to enable
## security context and set privileged to true.
enableSecurityContext: false
executor:
adoptExistingResources: false
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
## Display endpoint access logs
## To be aware of enabling logging endpoint access log, it increases
## router resource utilization when under heavy workloads.
displayAccessLog: false
## Add annotations for router
# svcAnnotations:
# cloud.google.com/load-balancer-type: Internal
@@ -98,6 +114,9 @@ router:
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Message queue trigger config
### NATS Streaming, enabled by default
nats:
@@ -178,7 +197,7 @@ persistence:
## operator: In
## values:
## - app
extraCoreComponentPodConfig:
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
@@ -205,8 +224,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
## summary is returned as part of http response
debugEnv: false
## set this flag to true if prometheus needs to be deployed along with fission
prometheusDeploy: true
## Prometheus for scrapping service metrics
prometheus:
## set this flag to true if prometheus needs to be deployed along with fission
enabled: true
## If enabled is false, please assign the prometheus service URL
## that is accessible by components.
serviceEndpoint: ""
## set this flag to false if you dont need canary deployment feature
canaryDeployment:
+4 -4
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: fission-core
version: 1.6.0
version: 1.7.1
description: Fission is a fast serverless framework for Kubernetes.
keywords:
- fission
@@ -8,8 +8,8 @@ keywords:
home: http://fission.io/
maintainers:
- name: Soam Vasani
email: soamvasani@platform9.com
email: soamvasani+1@gmail.com
- name: Ta Ching Chen
email: contact@tachingchen.com
email: hello@tachingchen.com
engine: gotpl
appVersion: 1.6.0
appVersion: 1.7.1
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: prometheus
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.1.0
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
generated: 2019-06-03T10:47:50.335101619Z
version: 9.3.1
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
generated: "2019-11-18T10:16:25.945208326Z"
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies:
- name: prometheus
version: 7.1.0
version: 9.3.1
repository: https://kubernetes-charts.storage.googleapis.com
condition: prometheusDeploy
condition: prometheus.enabled
+3 -3
View File
@@ -1,13 +1,13 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
Windows:
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.6.0/fission-cli-windows.exe
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
2. You're ready to use Fission!
+3 -1
View File
@@ -24,8 +24,10 @@ controller/config.go
{{- define "config" -}}
canary:
enabled: {{ .Values.canaryDeployment.enabled }}
{{- if .Values.prometheusDeploy }}
{{- if .Values.prometheus.enabled }}
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
{{- else }}
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
{{- end }}
{{- printf "\n" -}}
{{- end -}}
+26 -16
View File
@@ -138,8 +138,10 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--controllerPort", "8888"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: FISSION_FUNCTION_NAMESPACE
@@ -168,7 +170,7 @@ spec:
ports:
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: config-volume
configMap:
@@ -205,18 +207,20 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ADOPT_EXISTING_RESOURCES
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
- name: FETCHER_MINMEM
@@ -243,7 +247,7 @@ spec:
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -271,7 +275,7 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
@@ -293,7 +297,7 @@ spec:
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -321,11 +325,13 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -353,11 +359,13 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -388,10 +396,12 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
env:
- name: PRUNE_INTERVAL
value: "{{.Values.pruneInterval}}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
volumeMounts:
@@ -400,7 +410,7 @@ spec:
ports:
- containerPort: 8000
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: fission-storage
{{- if .Values.persistence.enabled }}
@@ -30,4 +30,4 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/pre-upgrade-checks" ]
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
serviceAccount: fission-svc
serviceAccountName: fission-svc
+7 -3
View File
@@ -33,7 +33,7 @@ spec:
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
@@ -53,12 +53,16 @@ spec:
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
- name: USE_ENCODED_PATH
value: {{ .Values.router.useEncodedPath | default false | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
@@ -84,7 +88,7 @@ spec:
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
+23 -5
View File
@@ -17,7 +17,7 @@ repository: index.docker.io
image: fission/fission-bundle
## Fission image version
imageTag: 1.6.0
imageTag: 1.7.1
## Image pull policy
pullPolicy: IfNotPresent
@@ -26,7 +26,7 @@ pullPolicy: IfNotPresent
fetcherImage: fission/fetcher
## Fission fetcher image version
fetcherImageTag: 1.6.0
fetcherImageTag: 1.7.1
## Port at which Fission controller service should be exposed
controllerPort: 31313
@@ -45,11 +45,20 @@ builderNamespace: fission-builder
## Enable istio integration
enableIstio: false
executor:
adoptExistingResources: false
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
## Display endpoint access logs
## To be aware of enabling logging endpoint access log, it increases
## router resource utilization when under heavy workloads.
displayAccessLog: false
## Add annotations for router
# svcAnnotations:
# cloud.google.com/load-balancer-type: Internal
@@ -85,6 +94,9 @@ router:
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Persist data to a persistent volume.
persistence:
## If true, fission will create/use a Persistent Volume Claim
@@ -122,7 +134,7 @@ persistence:
## operator: In
## values:
## - app
extraCoreComponentPodConfig:
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
@@ -146,8 +158,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
## summary is returned as part of http response
debugEnv: false
## set this flag to true if prometheus needs to be deployed along with fission
prometheusDeploy: false
## Prometheus for scrapping service metrics
prometheus:
## set this flag to true if prometheus needs to be deployed along with fission
enabled: true
## If enabled is false, please assign the prometheus service URL
## that is accessible by components.
serviceEndpoint: ""
## set this flag to false if you dont need canary deployment feature
canaryDeployment:
+10 -11
View File
@@ -118,8 +118,8 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
}
func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{}) error {
collectorEndpoint := getStringArgWithDefault(arguments["--collectorEndpoint"], "")
if collectorEndpoint == "" {
collectorEndpoint := os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT")
if len(collectorEndpoint) == 0 {
logger.Info("skipping trace exporter registration")
return nil
}
@@ -196,18 +196,17 @@ Use it to start one or more of the fission servers:
backends.
Usage:
fission-bundle --controllerPort=<port> [--collectorEndpoint=<url>]
fission-bundle --routerPort=<port> [--executorUrl=<url>] [--collectorEndpoint=<url>]
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>] [--collectorEndpoint=<url>]
fission-bundle --kubewatcher [--routerUrl=<url>] [--collectorEndpoint=<url>]
fission-bundle --storageServicePort=<port> --filePath=<filePath> [--collectorEndpoint=<url>]
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>] [--collectorEndpoint=<url>]
fission-bundle --timer [--routerUrl=<url>] [--collectorEndpoint=<url>]
fission-bundle --mqt [--routerUrl=<url>] [--collectorEndpoint=<url>]
fission-bundle --controllerPort=<port>
fission-bundle --routerPort=<port> [--executorUrl=<url>]
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
fission-bundle --kubewatcher [--routerUrl=<url>]
fission-bundle --storageServicePort=<port> --filePath=<filePath>
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
fission-bundle --timer [--routerUrl=<url>]
fission-bundle --mqt [--routerUrl=<url>]
fission-bundle --logger
fission-bundle --version
Options:
--collectorEndpoint=<url> Jaeger HTTP Thrift collector URL.
--controllerPort=<port> Port that the controller should listen on.
--routerPort=<port> Port that the router should listen on.
--executorPort=<port> Port that the executor should listen on.
+72
View File
@@ -0,0 +1,72 @@
package app
import (
"github.com/spf13/cobra"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate"
"github.com/fission/fission/pkg/fission-cli/cmd/canaryconfig"
"github.com/fission/fission/pkg/fission-cli/cmd/environment"
"github.com/fission/fission/pkg/fission-cli/cmd/function"
"github.com/fission/fission/pkg/fission-cli/cmd/httptrigger"
"github.com/fission/fission/pkg/fission-cli/cmd/kubewatch"
"github.com/fission/fission/pkg/fission-cli/cmd/mqtrigger"
_package "github.com/fission/fission/pkg/fission-cli/cmd/package"
"github.com/fission/fission/pkg/fission-cli/cmd/spec"
"github.com/fission/fission/pkg/fission-cli/cmd/support"
"github.com/fission/fission/pkg/fission-cli/cmd/timetrigger"
"github.com/fission/fission/pkg/fission-cli/cmd/version"
"github.com/fission/fission/pkg/fission-cli/console"
"github.com/fission/fission/pkg/fission-cli/flag"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
)
const (
usage = `Fission: Fast and Simple Serverless Functions for Kubernetes
* Github: https://github.com/fission/fission
* Documentation: https://docs.fission.io/docs
`
)
func App() *cobra.Command {
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
Use: "fission",
Long: usage,
//SilenceUsage: true,
PersistentPreRunE: wrapper.Wrapper(
func(input cli.Input) error {
console.Verbosity = input.Int(flagkey.Verbosity)
return nil
},
),
}
// Workaround fix for not to show help command
// https://github.com/spf13/cobra/issues/587
rootCmd.SetHelpCommand(&cobra.Command{
Use: "no-help",
Hidden: true,
})
wrapper.SetFlags(rootCmd, flag.FlagSet{
Global: []flag.Flag{flag.GlobalServer, flag.GlobalVerbosity},
})
groups := helptemplate.CommandGroups{}
groups = append(groups, helptemplate.CreateCmdGroup("Basic Commands", environment.Commands(), _package.Commands(), function.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Trigger Commands", httptrigger.Commands(), mqtrigger.Commands(), timetrigger.Commands(), kubewatch.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Deploy Strategies Commands", canaryconfig.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Declarative Application Commands", spec.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Other Commands", support.Commands(), version.Commands()))
groups.Add(rootCmd)
flagExposer := helptemplate.ActsAsRootCommand(rootCmd, nil, groups...)
// show global options in usage
flagExposer.ExposeFlags(rootCmd, flagkey.Server, flagkey.Verbosity)
return rootCmd
}
+11 -2
View File
@@ -19,9 +19,18 @@ package main
import (
"os"
fcli "github.com/fission/fission/pkg/fission-cli"
"github.com/fission/fission/cmd/fission-cli/app"
"github.com/fission/fission/pkg/fission-cli/console"
)
func main() {
fcli.NewCliApp().Run(os.Args)
cmd := app.App()
cmd.SilenceErrors = true // use our own error message printer
err := cmd.Execute()
if err != nil {
// let program exit with non-zero code when error occurs
console.Error(err.Error())
os.Exit(1)
}
}
+6 -6
View File
@@ -86,7 +86,6 @@ func (client *PreUpgradeTaskClient) IsFissionReInstall() bool {
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
client.logger.Info("verifying function spec references for all functions in the cluster")
result := &multierror.Error{}
var err error
var fList *fv1.FunctionList
@@ -103,28 +102,30 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
zap.Int("max_retries", maxRetries))
}
errs := &multierror.Error{}
// check that all secrets, configmaps, packages are in the same namespace
for _, fn := range fList.Items {
secrets := fn.Spec.Secrets
for _, secret := range secrets {
if secret.Namespace != fn.Metadata.Namespace {
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
}
}
configmaps := fn.Spec.ConfigMaps
for _, configmap := range configmaps {
if configmap.Namespace != fn.Metadata.Namespace {
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
}
}
if fn.Spec.Package.PackageRef.Namespace != fn.Metadata.Namespace {
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
}
}
if result != nil {
if errs.ErrorOrNil() != nil {
client.logger.Fatal("installation failed",
zap.Error(err),
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
@@ -218,5 +219,4 @@ func (client *PreUpgradeTaskClient) SetupRoleBindings() {
client.logger.Info("created rolebindings in default namespace",
zap.Strings("role_bindings", []string{types.PackageGetterRB, types.SecretConfigMapGetterRB}))
return
}
-5
View File
@@ -81,11 +81,6 @@ clear
popd
#
# Record replay
#
clear
#
# Canary Deployments
#
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
fission fn delete --name hi-py
fission route delete --name $(fission route list|grep hi|cut -f1 -d' ')
fission recorder delete --name my-recorder
kubectl -n fission delete pod redis-0
-7
View File
@@ -1,7 +0,0 @@
from flask import request
from flask import current_app
def main():
name=request.args["name"]
return "Hello, %s" % name
-28
View File
@@ -1,28 +0,0 @@
#!/bin/bash
DEMO_RUN_FAST=1
ROOT_DIR=$(dirname $0)/..
. $ROOT_DIR/util.sh
desc "A simple function that takes inputs"
run "cat hi.py"
desc "Set up function"
run "fission function create --name hi-py --env python --code hi.py --entrypoint hi.main"
desc "Set up route"
run "fission route create --function hi-py --url /hi --method GET"
desc "Set up recorder"
run "fission recorder create --name my-recorder --function hi-py"
desc "Run function"
run "curl http://$FISSION_ROUTER/hi?name=world"
desc "View recording"
run "fission records view -v"
requid=$(fission records view -v|tail -1|cut -f1 -d' ')
desc "Replay recording"
run "fission replay --reqUID $requid"
+2 -4
View File
@@ -38,10 +38,8 @@ func (e *Env) ToStringEnv() []string {
func NewEnv(stringEnv []string) *Env {
env := &Env{}
if stringEnv != nil {
for _, rawEnvVar := range stringEnv {
env.SetEnv(FromString(rawEnvVar))
}
for _, rawEnvVar := range stringEnv {
env.SetEnv(FromString(rawEnvVar))
}
return env
}
+1 -1
View File
@@ -5,7 +5,7 @@
"contributors": [
{
"name": "Soam Vasani",
"email": "soamvasani@platform9.com"
"email": "soamvasani+1@gmail.com"
},
{
"name": "Gary Yeap",
+23 -2
View File
@@ -28,6 +28,7 @@ var (
// for tensorflow serving to use
MODEL_NAME = ""
API_TYPE = ""
)
type (
@@ -77,8 +78,26 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
return
}
// Tensorflow-serving supports three types of API: classify, regress, predict
// To get the API type, we need to split the entry point with separator ":"
// POST http://host:port/v1/models/${MODEL_NAME}:(classify|regress:predict)
entrypoint := strings.Split(loadreq.FunctionName, ":")
modelDir, apiType := "", ""
if len(entrypoint) == 0 {
logger.Error("unable to load model due to empty entrypoint")
w.WriteHeader(http.StatusBadRequest)
return
} else if len(entrypoint) == 1 {
modelDir = entrypoint[0]
apiType = "predict" // assign default API type
} else {
modelDir = entrypoint[0]
apiType = entrypoint[1]
}
// To ensure we load model from the expected path
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, loadreq.FunctionName)
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, modelDir)
basePath, err = filepath.Abs(basePath)
if err != nil {
msg := "error getting absolute path of model"
@@ -104,6 +123,7 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
// get directory name that holds model
MODEL_NAME = filepath.Base(basePath)
API_TYPE = apiType
argModelBasePath := fmt.Sprintf("--model_base_path=%v", basePath)
argModelName := fmt.Sprintf("--model_name=%v", MODEL_NAME)
@@ -191,7 +211,8 @@ func main() {
director := func(req *http.Request) {
req.URL.Scheme = "http"
req.URL.Host = "localhost:8501"
req.URL.Path = fmt.Sprintf("/v1/models/%v:predict", MODEL_NAME)
req.URL.Path = fmt.Sprintf("/v1/models/%v:%v", MODEL_NAME, API_TYPE)
req.Host = "localhost:8501"
}
proxy := &httputil.ReverseProxy{
+1 -1
View File
@@ -5,7 +5,7 @@
"contributors": [
{
"name": "Soam Vasani",
"email": "soamvasani@platform9.com"
"email": "soamvasani+1@gmail.com"
},
{
"name": "Gary Yeap",
@@ -0,0 +1,24 @@
# Adding podspec for builder of environment
If you see the files in the `specs` directory you will get to know that we have just generated the
environment spec using the command
```
fission env create --name python --image fission/python-env --builder fission/python-builder --spec
```
and changed the env-python.yaml file to have below `podspec` for builder for the environment.
```
nodeSelector:
machinecap: high
tolerations:
- key: "env"
value: "prod"
operator: "Equal"
effect: "NoSchedule"
```
If we create this environment, the builder pod that will be created will have the `PodSpec` that
we have mentioned for builder in the environment spec.
@@ -0,0 +1,42 @@
Fission Specs
=============
This is a set of specifications for a Fission app. This includes functions,
environments, and triggers; we collectively call these things "resources".
How to use these specs
----------------------
These specs are handled with the 'fission spec' command. See 'fission spec --help'.
'fission spec apply' will "apply" all resources specified in this directory to your
cluster. That means it checks what resources exist on your cluster, what resources are
specified in the specs directory, and reconciles the difference by creating, updating or
deleting resources on the cluster.
'fission spec apply' will also package up your source code (or compiled binaries) and
upload the archives to the cluster if needed. It uses 'ArchiveUploadSpec' resources in
this directory to figure out which files to archive.
You can use 'fission spec apply --watch' to watch for file changes and continuously keep
the cluster updated.
You can add YAMLs to this directory by writing them manually, but it's easier to generate
them. Use 'fission function create --spec' to generate a function spec,
'fission environment create --spec' to generate an environment spec, and so on.
You can edit any of the files in this directory, except 'fission-deployment-config.yaml',
which contains a UID that you should never change. To apply your changes simply use
'fission spec apply'.
fission-deployment-config.yaml
------------------------------
fission-deployment-config.yaml contains a UID. This UID is what fission uses to correlate
resources on the cluster to resources in this directory.
All resources created by 'fission spec apply' are annotated with this UID. Resources on
the cluster that are _not_ annotated with this UID are never modified or deleted by
fission.
@@ -0,0 +1,25 @@
apiVersion: fission.io/v1
kind: Environment
metadata:
creationTimestamp: null
name: python
namespace: default
spec:
builder:
command: build
image: fission/python-builder
podspec:
nodeSelector:
machinecap: high
tolerations:
- key: "env"
value: "prod"
operator: "Equal"
effect: "NoSchedule"
keeparchive: false
poolsize: 3
resources: {}
runtime:
image: fission/python-env
terminationGracePeriod: 360
version: 2
@@ -0,0 +1,7 @@
# This file is generated by the 'fission spec init' command.
# See the README in this directory for background and usage information.
# Do not edit the UID below: that will break 'fission spec apply'
apiVersion: fission.io/v1
kind: DeploymentConfig
name: podspec-example
uid: c0803d62-03a2-4934-b9b2-82f2a221a333
+3 -2
View File
@@ -15,9 +15,10 @@ $ fission pkg create --env tensorflow --deploy half_plus_two.zip
## Create Function
Here, the `--entrypoint` represents the name of top directory contains trained model.
Here, the `--entrypoint` represents the name of the top directory contains the trained model and what kind of API the model supports.
Currently, three API are supported: `predict`, `classify`, `regress`. `predict` API will be used if no API kind was given.
```bash
$ fission fn create --name t1 --pkg <pkg name> --env tensorflow --entrypoint "half_plus_two"
$ fission fn create --name t1 --pkg <pkg name> --env tensorflow --entrypoint "half_plus_two:predict"
$ fission fn test --name t1 --body '{"instances": [1.0, 2.0, 0.0]}' --method POST
```
+7
View File
@@ -0,0 +1,7 @@
# Git hooks
* pre-push: Check, build and test the changes.
```bash
$ cp githooks/* .git/hooks/
```
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
ROOT=`realpath $(dirname $0)/../..`
pushd $ROOT
make
popd
+5 -2
View File
@@ -40,7 +40,10 @@ require (
github.com/imdario/mergo v0.3.5
github.com/influxdata/influxdb v1.2.0
github.com/kr/pretty v0.1.0 // indirect
github.com/life1347/color v1.7.0
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0
github.com/nats-io/gnatsd v1.4.1 // indirect
github.com/nats-io/go-nats v1.6.0 // indirect
@@ -56,7 +59,8 @@ require (
github.com/prometheus/common v0.4.1
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
github.com/satori/go.uuid v1.2.0
github.com/spf13/pflag v1.0.3
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.3.0
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 // indirect
github.com/urfave/cli v1.20.0
@@ -69,7 +73,6 @@ require (
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 // indirect
golang.org/x/image v0.0.0-20190618124811-92942e4437e2 // indirect
golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/appengine v1.6.1 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
+34 -2
View File
@@ -31,6 +31,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
@@ -46,11 +47,15 @@ github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyV
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-oidc v0.0.0-20180117170138-065b426bd416/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.0.0-20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -188,12 +193,14 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/raft v1.0.0 h1:htBVktAOtGs4Le5Z7K8SF5H2+oWsQFYVmOgH5loro7Y=
github.com/hashicorp/raft v1.0.0/go.mod h1:DVSAWItjLjTOkVbSpWQ0j0kUADIvDaCtBxIcbNAQLkI=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb v1.2.0 h1:ZSB1cdZP9/8yyFzZhyaHimPL55Qo2kRDv2VhgnCePJ4=
github.com/influxdata/influxdb v1.2.0/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
@@ -214,15 +221,24 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/life1347/color v1.7.0 h1:Csr56ts64td/iG9T9o4p9cXNK46YB1/ZSq3V+qDwD4Y=
github.com/life1347/color v1.7.0/go.mod h1:yXW8vSPZhOJLmveaa6cN+24V2xrX2Cuf3X7nVpiRidw=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180323154445-8b799c424f57/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY=
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0 h1:581DnhoG2Q33rqM3X6Is+8agf17B2vlzV/H52/Xvcd0=
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -257,6 +273,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
@@ -288,14 +305,24 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937 h1:+ryWjMVzFAkEz5zT+Ms49aROZwxlJce3x3zLTFpkz3Y=
github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -303,6 +330,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 h1:HQWT4ta3wW5GZ790GaqLCS+w1dvuA3rMfEQxLi+UOYU=
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
@@ -310,6 +338,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
github.com/wcharczuk/go-chart v2.0.1+incompatible h1:0pz39ZAycJFF7ju/1mepnk26RLVLBCWz1STcD3doU0A=
github.com/wcharczuk/go-chart v2.0.1+incompatible/go.mod h1:PF5tmL4EIx/7Wf+hEkpCqYi5He4u90sw+0+6FhrryuE=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@@ -327,6 +356,7 @@ go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -379,15 +409,17 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4 h1:FFQWNXvutleFrNfNdz+TAJiRUdRxjFpjBtDMQ2y3psA=
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+2 -2
View File
@@ -1,4 +1,4 @@
FROM golang:1.11.6
FROM golang:1.12.13
ENV GO111MODULE on
RUN wget -qO- https://download.docker.com/linux/static/stable/x86_64/docker-17.03.0-ce.tgz | tar xvz -C /usr/local/bin/ --strip 1
RUN wget -qO- https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz | tar xvz -C /usr/local/bin/ --strip 1
RUN wget -qO- https://storage.googleapis.com/kubernetes-helm/helm-v2.16.1-linux-amd64.tar.gz | tar xvz -C /usr/local/bin/ --strip 1
+10 -8
View File
@@ -44,7 +44,7 @@ Updating Fission Repo (https://github.com/fission/fission)
1. cd to the top of the fission repo, create a branch:
git checkout -b vX.Y.Z
git checkout -b release-X.Y.Z
2. Change references of old version to new version in charts directory. You use replace and find all with a quick preview in your IDE.
@@ -52,7 +52,7 @@ Updating Fission Repo (https://github.com/fission/fission)
`./hack/release.sh <VERSION>`
This script checks to make sure you're releasing from the vX.Y.Z
This script checks to make sure you're releasing from the release-X.Y.Z
branch, and that your repo is clean (no modified/staged files).
This will take a while as it builds and pushes all images (Approx ~2-3 hours)
@@ -61,10 +61,13 @@ Updating Fission Repo (https://github.com/fission/fission)
5. As part of release script, changelog.md has been modified. Take a look at it, correct it if you want and then commit it, discard other directories etc. produced by builders after inspection.
6. Now push this vx.y.z branch to remote repo. Create a PR and merge it into master branch.
6. Push this release-x.y.z branch to remote repo. Create a PR and wait for CI passed.
a. Test build from master branch for sanity check
b. Make sure the master build is green
7. Now manually merge the release-x.y.z branch into master branch with Git command to prevent the commit SHA from being changed.
`git checkout master && git merge --ff-only release-<VERSION>`
8. Test build from master branch for sanity check and make sure the master build is green
Updating Fission Charts (https://github.com/fission/fission-charts)
------------------------------
@@ -72,8 +75,7 @@ a. Switch to fission/fission-charts repo and run `index.sh` in that repo. (Don'
b. You should have index.yaml and fission-core-*, fission-all-* charts as change, add, commit and push it to repo.
8. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created.
9. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created.
Edit it and add links to:
@@ -85,7 +87,7 @@ Before you save the release - UNCHECK the "This is a pre-release" checkbox. This
Updating Fission Docs (https://github.com/fission/docs.fission.io)
------------------------------
9. Documentatin Update
10. Documentation Update
a. Merge documentation PRs that are peer reviewed and get latest master locally.
+5 -3
View File
@@ -162,7 +162,7 @@ build_env_builder_image() {
else
# variant specified - append variant to image name and assume dockerfile
# exists with same suffix (e.g. image node-env-debian built from Dockerfile-debian)
imgname="$imgname-$imgvariant"
imgname="$imgnamebase-$imgvariant"
dockerfile="Dockerfile-$imgvariant"
fi
echo "Building $envdir -> $imgname:$version using $dockerfile"
@@ -198,8 +198,8 @@ build_charts() {
do
# https://github.com/kubernetes/helm/issues/1732
helm init --client-only
helm package -u $c/
mv *.tgz $BUILDDIR/charts/
helm package -u $c/
mv *.tgz $BUILDDIR/charts/
done
popd
}
@@ -226,6 +226,8 @@ build_yamls() {
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort > ${c}-${version}-minikube.yaml
# for environments that support LoadBalancer
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true > ${c}-${version}.yaml
# for OpenShift
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false > ${c}-${version}-openshift.yaml
# copy yaml files to build directory
mv *.yaml ${BUILDDIR}/yamls/
+34 -15
View File
@@ -6,14 +6,16 @@ set -e
DIR=$(realpath $(dirname $0))/../
BUILDDIR=$(realpath $DIR)/build
source $(realpath ${DIR}/test/init_tools.sh)
# Ensure we're on the master branch
check_branch() {
local version=$1
curr_branch=$(git rev-parse --abbrev-ref HEAD)
if [ $curr_branch != "v${version}" ]
if [ $curr_branch != "release-${version}" ]
then
echo "Not on v${version} branch."
exit 1
echo "Not on release-${version} branch."
exit 1
fi
}
@@ -21,8 +23,8 @@ check_branch() {
check_clean() {
if ! git diff-index --quiet HEAD --
then
echo "Unclean tree"
exit 1
echo "Unclean tree"
exit 1
fi
}
@@ -48,9 +50,9 @@ push_builder_image() {
push_env_image() {
local version=$1
envdir=$2
imgnamebase=$3
imgvariant=$4
local envdir=$2
local imgnamebase=$3
local imgvariant=$4
if [ -z "$imgvariant" ]
then
@@ -59,7 +61,7 @@ push_env_image() {
else
# variant specified - append variant to image name and assume dockerfile
# exists with same suffix (e.g. image node-env-debian built from Dockerfile-debian)
imgname="$imgname-$imgvariant"
imgname="$imgnamebase-$imgvariant"
fi
echo "Pushing $envdir -> $imgname:$version"
@@ -149,12 +151,21 @@ push_all() {
tag_and_release() {
local version=$1
local gittag=$version
local prefix="v"
local gopkgtag=${version/#/${prefix}}
if [[ ${version} == v* ]]; # if version starts with "v", don't append prefix.
then
gopkgtag=${version}
fi
# tag the release
git tag $gittag
git tag -a $gopkgtag -m "Fission $gopkgtag"
# push tag
git push origin $gittag
git push origin $gopkgtag
# create gh release
gothub release \
@@ -193,7 +204,7 @@ attach_github_release_cli() {
--replace \
--user fission \
--repo fission \
--tag $gittag \
--tag $gittag \
--name fission-cli-windows.exe \
--file $BUILDDIR/cli/windows/fission-cli-windows.exe
}
@@ -207,7 +218,7 @@ attach_github_release_charts() {
--replace \
--user fission \
--repo fission \
--tag $gittag \
--tag $gittag \
--name fission-all-$version.tgz \
--file $BUILDDIR/charts/fission-all-$version.tgz
@@ -215,7 +226,7 @@ attach_github_release_charts() {
--replace \
--user fission \
--repo fission \
--tag $gittag \
--tag $gittag \
--name fission-core-$version.tgz \
--file $BUILDDIR/charts/fission-core-$version.tgz
@@ -243,6 +254,14 @@ attach_github_release_yamls() {
--tag $gittag \
--name ${c}-${version}.yaml \
--file $BUILDDIR/yamls/${c}-${version}.yaml
gothub upload \
--replace \
--user fission \
--repo fission \
--tag $gittag \
--name ${c}-${version}-openshift.yaml \
--file $BUILDDIR/yamls/${c}-${version}-openshift.yaml
done
}
@@ -269,7 +288,7 @@ generate_changelog() {
# generate changelog from github
github_changelog_generator fission/fission -t ${GITHUB_TOKEN} --future-release ${version} --no-issues -o tmp_CHANGELOG.md
sed -i '' -e '$ d' tmp_CHANGELOG.md
sed -i '$ d' tmp_CHANGELOG.md
# concatenate two files
cat tmp_CHANGELOG.md >> new_CHANGELOG.md
@@ -335,7 +354,7 @@ docker build -t fission-release-builder -f $GOPATH/src/github.com/fission/fissio
# Build all binaries & container images in docker
# Here we mount docker.sock into container so that docker client can communicate with host docker daemon.
# For more detail please visit https://docs.docker.com/machine/overview/
docker run --rm -v $GOPATH/src:/go/src -v /var/run/docker.sock:/var/run/docker.sock \
docker run --rm -it -v $GOPATH/src:/go/src -v /var/run/docker.sock:/var/run/docker.sock \
-e VERSION=$version -w "/go/src/github.com/fission/fission/hack" fission-release-builder sh -c "./release-build.sh"
push_all $version
+5 -5
View File
@@ -14,12 +14,12 @@ then
fi
# Get staticcheck
STATICCHECK_VERSION=2019.1.1
if [ ! -f $TOOL_DIR/staticcheck ]
STATICCHECK_VERSION=2019.2.3
if [ ! -f $TOOL_DIR/staticcheck ] || (staticcheck -version | grep -v $STATICCHECK_VERSION)
then
curl -LO https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64
chmod +x staticcheck_linux_amd64
mv staticcheck_linux_amd64 $TOOL_DIR/staticcheck
curl -LO https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64.tar.gz
tar xzvf staticcheck_linux_amd64.tar.gz
mv staticcheck/staticcheck $TOOL_DIR/staticcheck
fi
K8SCLI_DIR=$HOME/k8scli
+1 -1
View File
@@ -4,4 +4,4 @@ set -o errexit
set -o nounset
set -o pipefail
go vet -v $(go list ./...| grep -v vendor)
go vet -v $(go list ./...| grep -v "vendor" | grep -v "examples" | grep -v "demos" | grep -v "test")
+1 -11
View File
@@ -4,14 +4,4 @@ set -o errexit
set -o nounset
set -o pipefail
ROOT=`realpath $(dirname $0)/..`
# Currently here only lists the packages that already addressed all warnings for gradual code repair.
# That means we don't allow adding new warnings to any of package in list. And eventually, the
# list will be replaced by find command.
declare -a pkgs=("pkg/builder" "pkg/builder" "pkg/crd" "pkg/logger" "pkg/buildermgr" "pkg/fission-cli" "cmd/fission-cli")
for pkg in "${pkgs[@]}"
do
find ${ROOT}/${pkg} -type d |grep -v influxdb | xargs -I@ staticcheck @
done
go list ./...| grep -v vendor | grep -v "examples" | grep -v "demos" | grep -v "test" | xargs -I@ staticcheck @
+4 -5
View File
@@ -18,13 +18,12 @@ package v1
const (
EXECUTOR_INSTANCEID_LABEL string = "executorInstanceId"
POOLMGR_INSTANCEID_LABEL string = "poolmgrInstanceId"
DEFAULT_FUNCTION_TIMEOUT int = 60
)
const (
//LastUpdateTimestamp env variable is used for updating configmaps and secrets in pods
LastUpdateTimestamp string = "LASTUPDATE_TIMESTAMP"
// ResourceVersionCount env variable is used for updating configmaps and secrets in pods
ResourceVersionCount string = "RESOURCE_VERSION_COUNT"
)
const (
@@ -54,8 +53,8 @@ const (
)
const (
ExecutorTypePoolmgr = "poolmgr"
ExecutorTypeNewdeploy = "newdeploy"
ExecutorTypePoolmgr ExecutorType = "poolmgr"
ExecutorTypeNewdeploy ExecutorType = "newdeploy"
)
const (
@@ -56,10 +56,6 @@ func (c *CanaryConfig) GetObjectKind() schema.ObjectKind {
return &c.TypeMeta
}
func (r *Recorder) GetObjectKind() schema.ObjectKind {
return &r.TypeMeta
}
func (f *Function) GetObjectMeta() metav1.Object {
return &f.Metadata
}
@@ -85,10 +81,6 @@ func (c *CanaryConfig) GetObjectMeta() metav1.Object {
return &c.Metadata
}
func (r *Recorder) GetObjectMeta() metav1.Object {
return &r.Metadata
}
func (fl *FunctionList) GetObjectKind() schema.ObjectKind {
return &fl.TypeMeta
}
@@ -110,9 +102,6 @@ func (ml *MessageQueueTriggerList) GetObjectKind() schema.ObjectKind {
func (pl *PackageList) GetObjectKind() schema.ObjectKind {
return &pl.TypeMeta
}
func (rl *RecorderList) GetObjectKind() schema.ObjectKind {
return &rl.TypeMeta
}
func (cl *CanaryConfigList) GetObjectKind() schema.ObjectKind {
return &cl.TypeMeta
@@ -140,10 +129,6 @@ func (pl *PackageList) GetListMeta() metav1.ListInterface {
return &pl.Metadata
}
func (rl *RecorderList) GetListMeta() metav1.ListInterface {
return &rl.Metadata
}
func (cl *CanaryConfigList) GetListMeta() metav1.ListInterface {
return &cl.Metadata
}
@@ -279,13 +264,3 @@ func (ml *MessageQueueTriggerList) Validate() error {
}
return result.ErrorOrNil()
}
func (r *Recorder) Validate() error {
result := &multierror.Error{}
result = multierror.Append(result,
validateMetadata("Recorder", r.Metadata),
r.Spec.Validate())
return result.ErrorOrNil()
}
+9 -35
View File
@@ -157,23 +157,6 @@ type (
Items []MessageQueueTrigger `json:"items"`
}
// Recorder allows user to record all traffic payload to a certain function.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Recorder struct {
metav1.TypeMeta `json:",inline"`
Metadata metav1.ObjectMeta `json:"metadata"`
Spec RecorderSpec `json:"spec"`
}
// RecorderList is a list of Recorders.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
RecorderList struct {
metav1.TypeMeta `json:",inline"`
Metadata metav1.ListMeta `json:"metadata"`
Items []Recorder `json:"items"`
}
// CanaryConfig is for canary deployment of two functions.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
CanaryConfig struct {
@@ -343,7 +326,8 @@ type (
// InvokeStrategy is a set of controls which affect how function executes
InvokeStrategy InvokeStrategy
// FunctionTimeout provides a maximum amount of duration wihtin which a request for a particular function execution should be complete.
// FunctionTimeout provides a maximum amount of duration within which a request for
// a particular function execution should be complete.
// This is optional. If not specified default value will be taken as 60s
FunctionTimeout int `json:"functionTimeout,omitempty"`
}
@@ -397,7 +381,6 @@ type (
TargetCPUPercent int
// This is the timeout setting for executor to wait for pod specialization.
// Currently, only newdeploy utilizes this value.
SpecializationTimeout int
}
@@ -490,6 +473,9 @@ type (
// - ImagePullPolicy
// - ReadinessProbe
Container *apiv1.Container `json:"container,omitempty"`
// PodSpec will store the spec of the pod that will be applied to the pod created for the builder
PodSpec *apiv1.PodSpec `json:"podspec,omitempty"`
}
// EnvironmentSpec contains with builder, runtime and some other related environment settings.
@@ -542,6 +528,10 @@ type (
// or unarchived file should be placed, which is then used by specialize handler.
// (This is mainly for the JVM environment because .jar is one kind of zip archive.)
KeepArchive bool `json:"keeparchive"`
// ImagePullSecret is the secret for Kubernetes to pull an image from a
// private registry.
ImagePullSecret string `json:"imagepullsecret"`
}
AllowedFunctionsPerContainer string
@@ -638,22 +628,6 @@ type (
ContentType string `json:"contentType"`
}
// RecorderSpec defines a policy for recording requests and responses
// to a function, that can be later inspected or replayed.
RecorderSpec struct {
// Name of recorder resource
Name string `json:"name"`
// Function to collect requests/responses
Function string `json:"function"`
// HTTP trigger to record the requests and responses.
Triggers []string `json:"triggers"`
RetentionPolicy string `json:"-"` // `json:"retentionPolicy"`
EvictionPolicy string `json:"-"` // `json:"evictionPolicy"`
Enabled bool `json:"enabled"`
}
// TimeTrigger invokes the specific function at a time or
// times specified by a cron string.
TimeTriggerSpec struct {
+8 -31
View File
@@ -37,7 +37,7 @@ const (
)
var (
validAzureQueueName = regexp.MustCompile("^[a-z0-9][a-z0-9\\-]*[a-z0-9]$")
validAzureQueueName = regexp.MustCompile(`^[a-z0-9][a-z0-9\\-]*[a-z0-9]$`)
// Need to use raw string to support escape sequence for - & . chars
validKafkaTopicName = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\._]*[a-zA-Z0-9]$`)
)
@@ -339,7 +339,7 @@ func (es ExecutionStrategy) Validate() error {
if es.ExecutorType == ExecutorTypeNewdeploy {
if es.MinScale < 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater or equal to 0"))
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater than or equal to 0"))
}
if es.MaxScale <= 0 {
@@ -347,7 +347,7 @@ func (es ExecutionStrategy) Validate() error {
}
if es.MaxScale < es.MinScale {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater or equal to minimum scale"))
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater than or equal to minimum scale"))
}
if es.TargetCPUPercent <= 0 || es.TargetCPUPercent > 100 {
@@ -421,7 +421,11 @@ func (spec EnvironmentSpec) Validate() error {
}
if spec.Poolsize < 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Poolsize", spec.Poolsize, "Poolsize must be greater or equal to 0"))
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Poolsize", spec.Poolsize, "must be greater than or equal to 0"))
}
if spec.TerminationGracePeriod < 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.TerminationGracePeriod", spec.TerminationGracePeriod, "must be greater than or equal to 0"))
}
return result.ErrorOrNil()
@@ -540,33 +544,6 @@ func (spec MessageQueueTriggerSpec) Validate() error {
return result.ErrorOrNil()
}
func (spec RecorderSpec) Validate() error {
result := &multierror.Error{}
// TODO: Function validation
//if len(spec.Function.Name) != 0 {
// result = multierror.Append(result, spec.Function.Validate())
//}
// TODO: Triggers validation
//for _, trigger := range spec.Triggers {
// result = multierror.Append(result, trigger.Validate())
//}
if len(spec.Name) == 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.Name", spec.Name, "not a valid name"))
}
//if len(spec.RetentionPolicy) == 0 {
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.RetentionPolicy", spec.Name, "not a valid retention policy"))
//}
//if len(spec.EvictionPolicy) == 0 {
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.EvictionPolicy", spec.Name, "not a valid eviction policy"))
//}
//log.Info("This is the RecorderSpec validation result: %v", result)
return result.ErrorOrNil()
}
func (spec TimeTriggerSpec) Validate() error {
result := &multierror.Error{}
@@ -801,87 +801,6 @@ func (in *PackageStatus) DeepCopy() *PackageStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Recorder) DeepCopyInto(out *Recorder) {
*out = *in
out.TypeMeta = in.TypeMeta
in.Metadata.DeepCopyInto(&out.Metadata)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Recorder.
func (in *Recorder) DeepCopy() *Recorder {
if in == nil {
return nil
}
out := new(Recorder)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Recorder) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecorderList) DeepCopyInto(out *RecorderList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.Metadata = in.Metadata
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Recorder, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecorderList.
func (in *RecorderList) DeepCopy() *RecorderList {
if in == nil {
return nil
}
out := new(RecorderList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RecorderList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecorderSpec) DeepCopyInto(out *RecorderSpec) {
*out = *in
if in.Triggers != nil {
in, out := &in.Triggers, &out.Triggers
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecorderSpec.
func (in *RecorderSpec) DeepCopy() *RecorderSpec {
if in == nil {
return nil
}
out := new(RecorderSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Runtime) DeepCopyInto(out *Runtime) {
*out = *in
+1 -1
View File
@@ -74,7 +74,7 @@ func MakeBuilder(logger *zap.Logger, sharedVolumePath string) *Builder {
func (builder *Builder) VersionHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
fmt.Fprintf(w, info.BuildInfo().String())
w.Write([]byte(info.BuildInfo().String()))
}
func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
+24 -11
View File
@@ -489,6 +489,19 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
return nil, err
}
pod := apiv1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: sel,
Annotations: podAnnotations,
},
Spec: apiv1.PodSpec{
Containers: []apiv1.Container{*container},
ServiceAccountName: "fission-builder",
},
}
pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec))
deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
@@ -500,16 +513,7 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
Selector: &metav1.LabelSelector{
MatchLabels: sel,
},
Template: apiv1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: sel,
Annotations: podAnnotations,
},
Spec: apiv1.PodSpec{
Containers: []apiv1.Container{*container},
ServiceAccountName: "fission-builder",
},
},
Template: pod,
},
}
@@ -518,11 +522,20 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
return nil, err
}
envw.logger.Info("creating builder deployment", zap.String("deployment", name))
if env.Spec.Builder.PodSpec != nil {
newPodSpec, err := util.MergePodSpec(&deployment.Spec.Template.Spec, env.Spec.Builder.PodSpec)
if err != nil {
return nil, err
}
deployment.Spec.Template.Spec = *newPodSpec
}
_, err = envw.kubernetesClient.AppsV1().Deployments(ns).Create(deployment)
if err != nil {
return nil, err
}
envw.logger.Info("creating builder deployment", zap.String("deployment", name))
return deployment, nil
}
+1 -1
View File
@@ -84,7 +84,7 @@ func (pkgw *packageWatcher) build(buildCache *cache.Cache, srcpkg *fv1.Package)
// Ignore duplicate build requests
key := fmt.Sprintf("%v-%v", srcpkg.Metadata.Name, srcpkg.Metadata.ResourceVersion)
err, _ := buildCache.Set(key, srcpkg)
_, err := buildCache.Set(key, srcpkg)
if err != nil {
return
}
+2 -2
View File
@@ -159,7 +159,7 @@ func (c *Cache) Get(key interface{}) (interface{}, error) {
// if key exists in the cache, the new value is NOT set; instead an
// error and the old value are returned
func (c *Cache) Set(key interface{}, value interface{}) (error, interface{}) {
func (c *Cache) Set(key interface{}, value interface{}) (interface{}, error) {
respChannel := make(chan *response)
c.requestChannel <- &request{
requestType: SET,
@@ -168,7 +168,7 @@ func (c *Cache) Set(key interface{}, value interface{}) (error, interface{}) {
responseChannel: respChannel,
}
resp := <-respChannel
return resp.error, resp.existingValue
return resp.existingValue, resp.error
}
func (c *Cache) Delete(key interface{}) error {
+3 -3
View File
@@ -31,9 +31,9 @@ func checkErr(err error) {
func TestCache(t *testing.T) {
c := MakeCache(100*time.Millisecond, 100*time.Millisecond)
err, _ := c.Set("a", "b")
_, err := c.Set("a", "b")
checkErr(err)
err, _ = c.Set("p", "q")
_, err = c.Set("p", "q")
checkErr(err)
val, err := c.Get("a")
@@ -55,7 +55,7 @@ func TestCache(t *testing.T) {
log.Panicf("found deleted element")
}
err, _ = c.Set("expires", "42")
_, err = c.Set("expires", "42")
checkErr(err)
time.Sleep(150 * time.Millisecond)
_, err = c.Get("expires")
+1 -1
View File
@@ -68,7 +68,7 @@ func (cancelFuncMap *canaryConfigCancelFuncMap) lookup(f *metav1.ObjectMeta) (*C
func (cancelFuncMap *canaryConfigCancelFuncMap) assign(f *metav1.ObjectMeta, value *CanaryProcessingInfo) error {
mk := keyFromMetadata(f)
err, _ := cancelFuncMap.cache.Set(mk, value)
_, err := cancelFuncMap.cache.Set(mk, value)
return err
}
+9 -2
View File
@@ -67,17 +67,21 @@ func MakeCanaryConfigMgr(logger *zap.Logger, fissionClient *crd.FissionClient, k
} else if strings.Contains(envVar, "PROMETHEUS_SERVER_SERVICE_PORT") {
prometheusSvcPort = getEnvValue(envVar)
}
if len(prometheusSvcHost) > 0 && len(prometheusSvcPort) > 0 {
break
}
}
if len(prometheusSvcHost) == 0 && len(prometheusSvcPort) == 0 {
return nil, errors.New("unable to get prometheus service url")
}
prometheusSvc = fmt.Sprintf("http://%v:%v", prometheusSvcHost, prometheusSvcPort)
}
logger.Info("try to start canary config manager with prometheus service url", zap.String("prometheus", prometheusSvc))
_, err := url.Parse(prometheusSvc)
if err != nil {
return nil, fmt.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc)
return nil, errors.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc)
}
promClient, err := MakePrometheusClient(logger, prometheusSvc)
@@ -443,6 +447,9 @@ func (canaryCfgMgr *canaryConfigMgr) rollback(canaryConfig *fv1.CanaryConfig, tr
functionWeights[canaryConfig.Spec.OldFunction] = 100
err := canaryCfgMgr.updateHttpTriggerWithRetries(trigger.Metadata.Name, trigger.Metadata.Namespace, functionWeights)
if err != nil {
return err
}
err = canaryCfgMgr.updateCanaryConfigStatusWithRetries(canaryConfig.Metadata.Name, canaryConfig.Metadata.Namespace,
types.CanaryConfigStatusFailed)
+7 -18
View File
@@ -53,7 +53,6 @@ type (
builderManagerUrl string
workflowApiUrl string
functionNamespace string
useIstio bool
featureStatus map[string]string
}
@@ -167,7 +166,7 @@ func (api *API) getLogDBConfig(dbType string) logDBConfig {
func (api *API) HomeHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
fmt.Fprintf(w, info.ApiInfo().String())
w.Write([]byte(info.ApiInfo().String()))
}
func (api *API) ApiVersionMismatchHandler(w http.ResponseWriter, r *http.Request) {
@@ -191,7 +190,7 @@ func (api *API) GetSvcName(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, service.Name+"."+podNamespace)
}
func (api *API) Serve(port int) {
func (api *API) GetHandler() http.Handler {
r := mux.NewRouter()
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
// Give a useful error message if an older CLI attempts to make a request
@@ -240,19 +239,6 @@ func (api *API) Serve(port int) {
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiUpdate).Methods("PUT")
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/v2/recorders", api.RecorderApiList).Methods("GET")
r.HandleFunc("/v2/recorders", api.RecorderApiCreate).Methods("POST")
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiGet).Methods("GET")
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiUpdate).Methods("PUT")
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiDelete).Methods("DELETE")
r.HandleFunc("/v2/records", api.RecordsApiListAll).Methods("GET")
r.HandleFunc("/v2/records/function/{function}", api.RecordsApiFilterByFunction).Methods("GET")
r.HandleFunc("/v2/records/trigger/{trigger}", api.RecordsApiFilterByTrigger).Methods("GET")
r.HandleFunc("/v2/records/time", api.RecordsApiFilterByTime).Methods("GET")
r.HandleFunc("/v2/replay/{reqUID}", api.ReplayByReqUID).Methods("GET")
r.HandleFunc("/v2/secrets/{secret}", api.SecretGet).Methods("GET")
r.HandleFunc("/v2/configmaps/{configmap}", api.ConfigMapGet).Methods("GET")
@@ -270,9 +256,12 @@ func (api *API) Serve(port int) {
r.Handle("/v2/apidocs.json", openAPI()).Methods("GET")
address := fmt.Sprintf(":%v", port)
return r
}
func (api *API) Serve(port int) {
address := fmt.Sprintf(":%v", port)
api.logger.Info("server started", zap.Int("port", port))
err := http.ListenAndServe(address, r)
err := http.ListenAndServe(address, api.GetHandler())
api.logger.Fatal("done listening", zap.Error(err))
}
+3 -6
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -33,7 +31,7 @@ func (c *Client) CanaryConfigCreate(canaryConf *fv1.CanaryConfig) (*metav1.Objec
return nil, err
}
resp, err := http.Post(c.url("canaryconfigs"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("canaryconfigs", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -57,7 +55,7 @@ func (c *Client) CanaryConfigGet(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -106,13 +104,12 @@ func (c *Client) CanaryConfigUpdate(canaryConf *fv1.CanaryConfig) (*metav1.Objec
func (c *Client) CanaryConfigDelete(m *metav1.ObjectMeta) error {
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
return c.delete(relativeUrl)
}
func (c *Client) CanaryConfigList(ns string) ([]fv1.CanaryConfig, error) {
relativeUrl := fmt.Sprintf("canaryconfigs?namespace=%v", ns)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
+56 -48
View File
@@ -18,38 +18,56 @@ package client
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
"golang.org/x/net/context/ctxhttp"
"github.com/pkg/errors"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/info"
)
var (
DefaultRequestHeaders map[string]string
)
type (
Client struct {
Url string
Url string
Headers map[string]string
}
)
func MakeClient(serverUrl string) *Client {
return &Client{Url: strings.TrimSuffix(serverUrl, "/")}
return &Client{
Url: strings.TrimSuffix(serverUrl, "/"),
Headers: DefaultRequestHeaders,
}
}
func (c *Client) create(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(http.MethodPost, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
}
func (c *Client) put(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(http.MethodPut, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
}
func (c *Client) get(relativeUrl string) (*http.Response, error) {
return c.sendRequest(http.MethodGet, c.v2CrdUrl(relativeUrl), nil, nil)
}
func (c *Client) delete(relativeUrl string) error {
req, err := http.NewRequest("DELETE", c.url(relativeUrl), nil)
if err != nil {
return err
}
resp, err := http.DefaultClient.Do(req)
resp, err := c.sendRequest(http.MethodDelete, c.v2CrdUrl(relativeUrl), nil, nil)
if err != nil {
return err
}
@@ -58,26 +76,42 @@ func (c *Client) delete(relativeUrl string) error {
if resp.StatusCode != 200 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return errors.New("Delete failed")
return errors.Wrap(err, "error deleting")
} else {
return errors.New("Delete failed: " + string(body))
return errors.Errorf("failed to delete: %v", string(body))
}
}
return nil
}
func (c *Client) put(relativeUrl string, contentType string, body []byte) (*http.Response, error) {
req, err := http.NewRequest("PUT", c.url(relativeUrl), bytes.NewReader(body))
func (c *Client) proxy(method string, relativeUrl string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(method, c.proxyUrl(relativeUrl), nil, reader)
}
func (c *Client) sendRequest(method string, relativeUrl string, headers map[string]string, reader io.Reader) (*http.Response, error) {
req, err := http.NewRequest(method, relativeUrl, reader)
if err != nil {
return nil, err
}
req.Header.Set("Content-type", contentType)
for _, hs := range []map[string]string{headers, c.Headers} {
for k, v := range hs {
req.Header.Set(k, v)
}
}
return http.DefaultClient.Do(req)
}
func (c *Client) url(relativeUrl string) string {
return c.Url + "/v2/" + relativeUrl
func (c *Client) v2CrdUrl(relativeUrl string) string {
return c.Url + "/v2/" + strings.TrimPrefix(relativeUrl, "/")
}
func (c *Client) proxyUrl(relativeUrl string) string {
return c.Url + "/proxy/" + strings.TrimPrefix(relativeUrl, "/")
}
func (c *Client) handleResponse(resp *http.Response) ([]byte, error) {
@@ -95,29 +129,3 @@ func (c *Client) handleCreateResponse(resp *http.Response) ([]byte, error) {
body, err := ioutil.ReadAll(resp.Body)
return body, err
}
func (c *Client) ServerInfo() (*info.ServerInfo, error) {
url := fmt.Sprintf(c.Url)
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
resp, err := ctxhttp.Get(ctx, &http.Client{}, url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
info := &info.ServerInfo{}
err = json.Unmarshal(body, info)
if err != nil {
return nil, err
}
return info, nil
}
+35 -9
View File
@@ -17,20 +17,26 @@ limitations under the License.
package client
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/pkg/errors"
"golang.org/x/net/context/ctxhttp"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fission/fission/pkg/info"
)
func (c *Client) SecretGet(m *metav1.ObjectMeta) (*apiv1.Secret, error) {
relativeUrl := fmt.Sprintf("secrets/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -54,7 +60,7 @@ func (c *Client) ConfigMapGet(m *metav1.ObjectMeta) (*apiv1.ConfigMap, error) {
relativeUrl := fmt.Sprintf("configmaps/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -75,19 +81,15 @@ func (c *Client) ConfigMapGet(m *metav1.ObjectMeta) (*apiv1.ConfigMap, error) {
}
func (c *Client) GetSvcURL(label string) (string, error) {
url := fmt.Sprintf("%s/proxy/svcname?"+label, c.Url)
resp, err := http.Get(url)
resp, err := c.proxy(http.MethodGet, "svcname?"+label, nil)
if err != nil {
return "", err
}
if resp == nil {
return "", fmt.Errorf("Failed to find service for given label: %v", label)
return "", errors.Errorf("failed to find service for given label: %v", label)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
@@ -97,3 +99,27 @@ func (c *Client) GetSvcURL(label string) (string, error) {
return storageSvc, err
}
func (c *Client) ServerInfo() (*info.ServerInfo, error) {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
resp, err := ctxhttp.Get(ctx, &http.Client{}, c.Url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
info := &info.ServerInfo{}
err = json.Unmarshal(body, info)
if err != nil {
return nil, err
}
return info, nil
}
+3 -6
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -43,7 +41,7 @@ func (c *Client) EnvironmentCreate(env *fv1.Environment) (*metav1.ObjectMeta, er
return nil, err
}
resp, err := http.Post(c.url("environments"), "application/json", bytes.NewReader(data))
resp, err := c.create("environments", "application/json", data)
if err != nil {
return nil, err
}
@@ -67,7 +65,7 @@ func (c *Client) EnvironmentGet(m *metav1.ObjectMeta) (*fv1.Environment, error)
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -117,13 +115,12 @@ func (c *Client) EnvironmentUpdate(env *fv1.Environment) (*metav1.ObjectMeta, er
func (c *Client) EnvironmentDelete(m *metav1.ObjectMeta) error {
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
return c.delete(relativeUrl)
}
func (c *Client) EnvironmentList(ns string) ([]fv1.Environment, error) {
relativeUrl := fmt.Sprintf("environments?namespace=%v", ns)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
+34 -5
View File
@@ -17,14 +17,17 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
"github.com/fission/fission/pkg/fission-cli/console"
)
func (c *Client) FunctionCreate(f *fv1.Function) (*metav1.ObjectMeta, error) {
@@ -38,7 +41,7 @@ func (c *Client) FunctionCreate(f *fv1.Function) (*metav1.ObjectMeta, error) {
return nil, err
}
resp, err := http.Post(c.url("functions"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("functions", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -62,7 +65,7 @@ func (c *Client) FunctionGet(m *metav1.ObjectMeta) (*fv1.Function, error) {
relativeUrl := fmt.Sprintf("functions/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -87,7 +90,7 @@ func (c *Client) FunctionGetRawDeployment(m *metav1.ObjectMeta) ([]byte, error)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
relativeUrl += fmt.Sprintf("&deploymentraw=1")
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -135,7 +138,7 @@ func (c *Client) FunctionDelete(m *metav1.ObjectMeta) error {
func (c *Client) FunctionList(functionNamespace string) ([]fv1.Function, error) {
relativeUrl := fmt.Sprintf("functions?namespace=%v", functionNamespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -154,3 +157,29 @@ func (c *Client) FunctionList(functionNamespace string) ([]fv1.Function, error)
return funcs, nil
}
func (c *Client) FunctionPodLogs(m *metav1.ObjectMeta) (io.ReadCloser, int, error) {
relativeUrl := fmt.Sprintf("functions/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
queryURL, err := url.Parse(c.Url)
if err != nil {
return nil, 0, errors.Wrapf(err, "error parsing the base URL '%v'", c.Url)
}
queryURL.Path = fmt.Sprintf("/proxy/logs/%s", m.Name)
console.Verbose(2, fmt.Sprintf("Try to get pod logs from controller '%v'", queryURL.String()))
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, 0, errors.Wrap(err, "error creating logs request")
}
httpClient := http.Client{}
resp, err := httpClient.Do(req)
if err != nil {
return nil, 0, errors.Wrap(err, "error executing get logs request")
}
return resp.Body, resp.StatusCode, nil
}
+3 -5
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,7 +36,7 @@ func (c *Client) HTTPTriggerCreate(t *fv1.HTTPTrigger) (*metav1.ObjectMeta, erro
return nil, err
}
resp, err := http.Post(c.url("triggers/http"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("triggers/http", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -62,7 +60,7 @@ func (c *Client) HTTPTriggerGet(m *metav1.ObjectMeta) (*fv1.HTTPTrigger, error)
relativeUrl := fmt.Sprintf("triggers/http/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -121,7 +119,7 @@ func (c *Client) HTTPTriggerDelete(m *metav1.ObjectMeta) error {
func (c *Client) HTTPTriggerList(triggerNamespace string) ([]fv1.HTTPTrigger, error) {
relativeUrl := fmt.Sprintf("triggers/http?namespace=%v", triggerNamespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -39,7 +37,7 @@ func (c *Client) WatchCreate(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta,
return nil, err
}
resp, err := http.Post(c.url("watches"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("watches", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -63,7 +61,7 @@ func (c *Client) WatchGet(m *metav1.ObjectMeta) (*fv1.KubernetesWatchTrigger, er
relativeUrl := fmt.Sprintf("watches/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -84,8 +82,7 @@ func (c *Client) WatchGet(m *metav1.ObjectMeta) (*fv1.KubernetesWatchTrigger, er
}
func (c *Client) WatchUpdate(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta, error) {
return nil, ferror.MakeError(ferror.ErrorNotImplmented,
"watch update not implemented")
return nil, ferror.MakeError(ferror.ErrorNotImplmented, "watch update not implemented")
}
func (c *Client) WatchDelete(m *metav1.ObjectMeta) error {
@@ -96,7 +93,7 @@ func (c *Client) WatchDelete(m *metav1.ObjectMeta) error {
func (c *Client) WatchList(ns string) ([]fv1.KubernetesWatchTrigger, error) {
relativeUrl := fmt.Sprintf("watches?namespace=%v", ns)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
+3 -5
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,7 +36,7 @@ func (c *Client) MessageQueueTriggerCreate(t *fv1.MessageQueueTrigger) (*metav1.
return nil, err
}
resp, err := http.Post(c.url("triggers/messagequeue"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("triggers/messagequeue", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -62,7 +60,7 @@ func (c *Client) MessageQueueTriggerGet(m *metav1.ObjectMeta) (*fv1.MessageQueue
relativeUrl := fmt.Sprintf("triggers/messagequeue/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -126,7 +124,7 @@ func (c *Client) MessageQueueTriggerList(mqType string, ns string) ([]fv1.Messag
relativeUrl += fmt.Sprintf("?mqtype=%v&namespace=%v", mqType, ns)
}
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
+3 -5
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,7 +36,7 @@ func (c *Client) PackageCreate(f *fv1.Package) (*metav1.ObjectMeta, error) {
return nil, err
}
resp, err := http.Post(c.url("packages"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("packages", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -62,7 +60,7 @@ func (c *Client) PackageGet(m *metav1.ObjectMeta) (*fv1.Package, error) {
relativeUrl := fmt.Sprintf("packages/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -121,7 +119,7 @@ func (c *Client) PackageDelete(m *metav1.ObjectMeta) error {
func (c *Client) PackageList(pkgNamespace string) ([]fv1.Package, error) {
relativeUrl := fmt.Sprintf("packages?namespace=%v", pkgNamespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
-238
View File
@@ -1,238 +0,0 @@
/*
Copyright 2018 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
"github.com/fission/fission/pkg/redis/build/gen"
)
func (c *Client) RecorderCreate(r *fv1.Recorder) (*metav1.ObjectMeta, error) {
err := r.Validate()
if err != nil {
return nil, fv1.AggregateValidationErrors("Recorder", err)
}
reqbody, err := json.Marshal(r)
if err != nil {
return nil, err
}
resp, err := http.Post(c.url("recorders"), "application/json", bytes.NewReader(reqbody))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleCreateResponse(resp)
if err != nil {
return nil, err
}
var m metav1.ObjectMeta
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) RecorderGet(m *metav1.ObjectMeta) (*fv1.Recorder, error) {
relativeUrl := fmt.Sprintf("recorders/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
var r fv1.Recorder
err = json.Unmarshal(body, &r)
if err != nil {
return nil, err
}
return &r, nil
}
func (c *Client) RecorderUpdate(recorder *fv1.Recorder) (*metav1.ObjectMeta, error) {
err := recorder.Validate()
if err != nil {
return nil, fv1.AggregateValidationErrors("Recorder", err)
}
reqbody, err := json.Marshal(recorder)
if err != nil {
return nil, err
}
relativeUrl := fmt.Sprintf("recorders/%v", recorder.Metadata.Name)
resp, err := c.put(relativeUrl, "application/json", reqbody)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
var m metav1.ObjectMeta
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) RecorderDelete(m *metav1.ObjectMeta) error {
relativeUrl := fmt.Sprintf("recorders/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
return c.delete(relativeUrl)
}
func (c *Client) RecorderList(ns string) ([]fv1.Recorder, error) {
relativeUrl := "recorders"
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
recorders := make([]fv1.Recorder, 0)
err = json.Unmarshal(body, &recorders)
if err != nil {
return nil, err
}
return recorders, nil
}
// TODO: Move to different file?
func (c *Client) RecordsByFunction(function string) ([]*redisCache.RecordedEntry, error) {
relativeUrl := fmt.Sprintf("records/function/%v", function)
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
records := make([]*redisCache.RecordedEntry, 0)
err = json.Unmarshal(body, &records)
if err != nil {
return nil, err
}
return records, nil
}
func (c *Client) RecordsAll() ([]*redisCache.RecordedEntry, error) {
relativeUrl := "records"
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
records := make([]*redisCache.RecordedEntry, 0)
err = json.Unmarshal(body, &records)
if err != nil {
return nil, err
}
return records, nil
}
func (c *Client) RecordsByTrigger(trigger string) ([]*redisCache.RecordedEntry, error) {
relativeUrl := fmt.Sprintf("records/trigger/%v", trigger)
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
records := make([]*redisCache.RecordedEntry, 0)
err = json.Unmarshal(body, &records)
if err != nil {
return nil, err
}
return records, nil
}
func (c *Client) RecordsByTime(from string, to string) ([]*redisCache.RecordedEntry, error) {
relativeUrl := "records/time"
relativeUrl += fmt.Sprintf("?from=%v&to=%v", from, to)
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
records := make([]*redisCache.RecordedEntry, 0)
err = json.Unmarshal(body, &records)
if err != nil {
return nil, err
}
return records, nil
}
+3 -5
View File
@@ -17,10 +17,8 @@ limitations under the License.
package client
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,7 +36,7 @@ func (c *Client) TimeTriggerCreate(t *fv1.TimeTrigger) (*metav1.ObjectMeta, erro
return nil, err
}
resp, err := http.Post(c.url("triggers/time"), "application/json", bytes.NewReader(reqbody))
resp, err := c.create("triggers/time", "application/json", reqbody)
if err != nil {
return nil, err
}
@@ -62,7 +60,7 @@ func (c *Client) TimeTriggerGet(m *metav1.ObjectMeta) (*fv1.TimeTrigger, error)
relativeUrl := fmt.Sprintf("triggers/time/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
@@ -121,7 +119,7 @@ func (c *Client) TimeTriggerDelete(m *metav1.ObjectMeta) error {
func (c *Client) TimeTriggerList(ns string) ([]fv1.TimeTrigger, error) {
relativeUrl := fmt.Sprintf("triggers/time?namespace=%v", ns)
resp, err := http.Get(c.url(relativeUrl))
resp, err := c.get(relativeUrl)
if err != nil {
return nil, err
}
+65 -38
View File
@@ -18,25 +18,30 @@ package controller
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httputil"
"net/url"
"sort"
"strconv"
"strings"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
restclient "k8s.io/client-go/rest"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/types"
)
func RegisterFunctionRoute(ws *restful.WebService) {
@@ -106,12 +111,6 @@ func RegisterFunctionRoute(ws *restful.WebService) {
Returns(http.StatusOK, "Only HTTP status returned", nil))
}
func (a *API) getIstioServiceLabels(fnName string) map[string]string {
return map[string]string{
"functionName": fnName,
}
}
func (a *API) FunctionApiList(w http.ResponseWriter, r *http.Request) {
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
@@ -258,9 +257,12 @@ func (a *API) FunctionLogsApiPost(w http.ResponseWriter, r *http.Request) {
svcUrl, err := url.Parse(dbCnf.httpURL)
if err != nil {
a.logger.Error("failed parse url to establish proxy to database for function logs",
msg := "failed parse url to establish proxy to database for function logs"
a.logger.Error(msg,
zap.Error(err),
zap.String("database_url", dbCnf.httpURL))
a.respondWithError(w, errors.Wrap(err, msg))
return
}
// set up proxy server director
director := func(req *http.Request) {
@@ -269,6 +271,7 @@ func (a *API) FunctionLogsApiPost(w http.ResponseWriter, r *http.Request) {
req.URL.Scheme = svcUrl.Scheme
req.URL.Host = svcUrl.Host
req.URL.Path = svcUrl.Path
req.Host = svcUrl.Host
// set up http basic auth for database authentication
req.SetBasicAuth(dbCnf.username, dbCnf.password)
}
@@ -282,27 +285,35 @@ func (a *API) FunctionLogsApiPost(w http.ResponseWriter, r *http.Request) {
func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
fnName := vars["function"]
ns := vars["namespace"]
ns := a.extractQueryParamFromRequest(r, "namespace")
podNs := "fission-function"
if len(ns) == 0 {
ns = "fission-function"
ns = metav1.NamespaceDefault
} else if ns != metav1.NamespaceDefault {
// If the function namespace is "default", executor
// will create function pods under "fission-function".
// Otherwise, the function pod will be created under
// the same namespace of function.
podNs = ns
}
f, err := a.fissionClient.Functions(ns).Get(fnName)
if err != nil {
a.respondWithError(w, err)
return
}
envName := f.Spec.Environment.Name
if err != nil {
a.respondWithError(w, err)
return
}
// Get function Pods first
selector := "functionName=" + fnName
podList, err := a.kubernetesClient.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: selector})
selector := map[string]string{
types.FUNCTION_UID: string(f.Metadata.UID),
types.ENVIRONMENT_NAME: f.Spec.Environment.Name,
types.ENVIRONMENT_NAMESPACE: f.Spec.Environment.Namespace,
}
podList, err := a.kubernetesClient.CoreV1().Pods(podNs).List(metav1.ListOptions{
LabelSelector: labels.Set(selector).AsSelector().String(),
})
if err != nil {
a.respondWithError(w, err)
return
@@ -311,31 +322,47 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
// Get the logs for last Pod executed
pods := podList.Items
sort.Slice(pods, func(i, j int) bool {
itime := pods[i].ObjectMeta.CreationTimestamp.Time
jtime := pods[j].ObjectMeta.CreationTimestamp.Time
return itime.After(jtime)
rv1, _ := strconv.ParseInt(pods[i].ObjectMeta.ResourceVersion, 10, 32)
rv2, _ := strconv.ParseInt(pods[j].ObjectMeta.ResourceVersion, 10, 32)
return rv1 > rv2
})
podLogOpts := apiv1.PodLogOptions{Container: envName} // Only the env container, not fetcher
var podLogsReq *restclient.Request
if len(pods) > 0 {
podLogsReq = a.kubernetesClient.CoreV1().Pods(ns).GetLogs(pods[0].ObjectMeta.Name, &podLogOpts)
} else {
a.respondWithError(w, errors.New("No active pods found"))
if len(pods) <= 0 {
a.respondWithError(w, errors.New("no active pods found"))
return
}
podLogs, err := podLogsReq.Stream()
// get the pod with highest resource version
err = getContainerLog(a.kubernetesClient, w, f, &pods[0])
if err != nil {
a.respondWithError(w, err)
a.respondWithError(w, errors.Wrapf(err, "error getting container logs"))
return
}
defer podLogs.Close()
_, err = io.Copy(w, podLogs)
if err != nil {
a.respondWithError(w, err)
return
}
return
}
func getContainerLog(kubernetesClient *kubernetes.Clientset, w http.ResponseWriter, fn *fv1.Function, pod *apiv1.Pod) error {
seq := strings.Repeat("=", 35)
for _, container := range pod.Spec.Containers {
podLogOpts := apiv1.PodLogOptions{Container: container.Name} // Only the env container, not fetcher
podLogsReq := kubernetesClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.ObjectMeta.Name, &podLogOpts)
podLogs, err := podLogsReq.Stream()
if err != nil {
return errors.Wrapf(err, "error streaming pod log")
}
msg := fmt.Sprintf("\n%v\nFunction: %v\nEnvironment: %v\nNamespace: %v\nPod: %v\nContainer: %v\nNode: %v\n%v\n", seq,
fn.Metadata.Name, fn.Spec.Environment.Name, pod.Namespace, pod.Name, container.Name, pod.Spec.NodeName, seq)
w.Write([]byte(msg))
_, err = io.Copy(w, podLogs)
if err != nil {
return errors.Wrapf(err, "error copying pod log")
}
podLogs.Close()
}
return nil
}
-148
View File
@@ -1,148 +0,0 @@
/*
Copyright 2018 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"encoding/json"
"io/ioutil"
"net/http"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
)
func (a *API) RecorderApiList(w http.ResponseWriter, r *http.Request) {
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(recorders.Items)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecorderApiCreate(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
return
}
var recorder fv1.Recorder
err = json.Unmarshal(body, &recorder)
if err != nil {
a.respondWithError(w, err)
return
}
tnew, err := a.fissionClient.Recorders(recorder.Metadata.Namespace).Create(&recorder)
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(tnew.Metadata)
if err != nil {
a.respondWithError(w, err)
return
}
w.WriteHeader(http.StatusCreated)
a.respondWithSuccess(w, resp)
}
func (a *API) RecorderApiGet(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["recorder"]
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
}
recorder, err := a.fissionClient.Recorders(ns).Get(name)
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(recorder)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecorderApiUpdate(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["recorder"]
body, err := ioutil.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
return
}
var recorder fv1.Recorder
err = json.Unmarshal(body, &recorder)
if err != nil {
a.respondWithError(w, err)
return
}
if name != recorder.Metadata.Name {
err = ferror.MakeError(ferror.ErrorInvalidArgument, "Recorder name doesn't match URL")
a.respondWithError(w, err)
return
}
rnew, err := a.fissionClient.Recorders(recorder.Metadata.Namespace).Update(&recorder)
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(rnew.Metadata)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecorderApiDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["recorder"]
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
}
err := a.fissionClient.Recorders(ns).Delete(name, &metav1.DeleteOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, []byte(""))
}
-95
View File
@@ -1,95 +0,0 @@
/*
Copyright 2018 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"net/http"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fission/fission/pkg/redis"
)
func (a *API) RecordsApiListAll(w http.ResponseWriter, r *http.Request) {
resp, err := redis.RecordsListAll(a.logger.Named("redis"))
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecordsApiFilterByFunction(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
query := vars["function"]
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
triggers, err := a.fissionClient.HTTPTriggers(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := redis.RecordsFilterByFunction(a.logger.Named("redis"), query, recorders, triggers)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecordsApiFilterByTrigger(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
query := vars["trigger"]
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
triggers, err := a.fissionClient.HTTPTriggers(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := redis.RecordsFilterByTrigger(a.logger.Named("redis"), query, recorders, triggers)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) RecordsApiFilterByTime(w http.ResponseWriter, r *http.Request) {
from := r.FormValue("from")
to := r.FormValue("to")
resp, err := redis.RecordsFilterByTime(a.logger.Named("redis"), from, to)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
+1
View File
@@ -69,6 +69,7 @@ func (api *API) StorageServiceProxy(w http.ResponseWriter, r *http.Request) {
req.URL.Scheme = ssUrl.Scheme
req.URL.Host = ssUrl.Host
req.URL.Path = "/v1/archive"
req.Host = ssUrl.Host
}
proxy := &httputil.ReverseProxy{
Director: director,
+1
View File
@@ -24,6 +24,7 @@ func (api *API) WorkflowApiserverProxy(w http.ResponseWriter, r *http.Request) {
req.URL.Scheme = ssUrl.Scheme
req.URL.Host = ssUrl.Host
req.URL.Path = path
req.Host = ssUrl.Host
}
proxy := &httputil.ReverseProxy{
Director: director,
-10
View File
@@ -155,13 +155,6 @@ func configureClient(config *rest.Config) {
&metav1.ListOptions{},
&metav1.DeleteOptions{},
)
scheme.AddKnownTypes(
groupversion,
&fv1.Recorder{},
&fv1.RecorderList{},
&metav1.ListOptions{},
&metav1.DeleteOptions{},
)
scheme.AddKnownTypes(
groupversion,
&fv1.CanaryConfig{},
@@ -224,9 +217,6 @@ func (fc *FissionClient) TimeTriggers(ns string) TimeTriggerInterface {
func (fc *FissionClient) MessageQueueTriggers(ns string) MessageQueueTriggerInterface {
return MakeMessageQueueTriggerInterface(fc.crdClient, ns)
}
func (fc *FissionClient) Recorders(ns string) RecorderInterface {
return MakeRecorderInterface(fc.crdClient, ns)
}
func (fc *FissionClient) Packages(ns string) PackageInterface {
return MakePackageInterface(fc.crdClient, ns)
}
-16
View File
@@ -157,22 +157,6 @@ func EnsureFissionCRDs(logger *zap.Logger, clientset *apiextensionsclient.Client
},
},
},
// Recorders
{
ObjectMeta: metav1.ObjectMeta{
Name: "recorders.fission.io",
},
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
Group: crdGroupName,
Version: crdVersion,
Scope: apiextensionsv1beta1.NamespaceScoped,
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
Kind: "Recorder",
Plural: "recorders",
Singular: "recorder",
},
},
},
// Packages: archives containing source or binaries for one or more functions
{
ObjectMeta: metav1.ObjectMeta{
-122
View File
@@ -1,122 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package crd
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
)
type (
RecorderInterface interface {
Create(*fv1.Recorder) (*fv1.Recorder, error)
Get(name string) (*fv1.Recorder, error)
Update(*fv1.Recorder) (*fv1.Recorder, error)
Delete(name string, opts *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*fv1.RecorderList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
}
recorderClient struct {
client *rest.RESTClient
namespace string
}
)
func MakeRecorderInterface(crdClient *rest.RESTClient, namespace string) RecorderInterface {
return &recorderClient{
client: crdClient,
namespace: namespace,
}
}
func (rc *recorderClient) Create(r *fv1.Recorder) (*fv1.Recorder, error) {
var result fv1.Recorder
err := rc.client.Post().
Resource("recorders").
Namespace("default").
Body(r).
Do().Into(&result)
if err != nil {
return nil, err
}
return &result, nil
}
func (rc *recorderClient) Get(name string) (*fv1.Recorder, error) {
var result fv1.Recorder
err := rc.client.Get().
Resource("recorders").
Namespace(rc.namespace).
Name(name).
Do().Into(&result)
if err != nil {
return nil, err
}
return &result, nil
}
func (rc *recorderClient) Update(r *fv1.Recorder) (*fv1.Recorder, error) {
var result fv1.Recorder
err := rc.client.Put().
Resource("recorders").
Namespace(rc.namespace).
Name(r.Metadata.Name).
Body(r).
Do().Into(&result)
if err != nil {
return nil, err
}
return &result, nil
}
func (rc *recorderClient) Delete(name string, opts *metav1.DeleteOptions) error {
return rc.client.Delete().
Namespace(rc.namespace).
Resource("recorders").
Name(name).
Body(opts).
Do().
Error()
}
func (rc *recorderClient) List(opts metav1.ListOptions) (*fv1.RecorderList, error) {
var result fv1.RecorderList
err := rc.client.Get().
Namespace(rc.namespace).
Resource("recorders").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(&result)
if err != nil {
return nil, err
}
return &result, nil
}
func (rc *recorderClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return rc.client.Get().
Prefix("watch").
Namespace(rc.namespace).
Resource("recorders").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
+77 -30
View File
@@ -17,7 +17,6 @@ limitations under the License.
package executor
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
@@ -25,11 +24,16 @@ import (
"strings"
"github.com/gorilla/mux"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/executor/client"
)
func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *http.Request) {
@@ -47,7 +51,17 @@ func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *htt
return
}
serviceName, err := executor.getServiceForFunction(r.Context(), &m)
fn, err := executor.fissionClient.Functions(m.Namespace).Get(m.Name)
if err != nil {
if k8serrors.IsNotFound(err) {
http.Error(w, "Failed to find function", http.StatusNotFound)
} else {
http.Error(w, "Failed to get function", http.StatusInternalServerError)
}
return
}
serviceName, err := executor.getServiceForFunction(fn)
if err != nil {
code, msg := ferror.GetHTTPError(err)
executor.logger.Error("error getting service for function",
@@ -70,30 +84,35 @@ func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *htt
// stale addresses are not returned to the router.
// To make it optimal, plan is to add an eager cache invalidator function that watches for pod deletion events and
// invalidates the cache entry if the pod address was cached.
func (executor *Executor) getServiceForFunction(ctx context.Context, m *metav1.ObjectMeta) (string, error) {
func (executor *Executor) getServiceForFunction(fn *fv1.Function) (string, error) {
// Check function -> svc cache
executor.logger.Debug("checking for cached function service",
zap.String("function_name", m.Name),
zap.String("function_namespace", m.Namespace))
zap.String("function_name", fn.Metadata.Name),
zap.String("function_namespace", fn.Metadata.Namespace))
fsvc, err := executor.fsCache.GetByFunction(m)
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
et, exists := executor.executorTypes[t]
if !exists {
return "", errors.Errorf("Unknown executor type '%v'", t)
}
fsvc, err := et.GetFuncSvcFromCache(fn)
if err == nil {
if executor.isValidAddress(fsvc) {
if et.IsValid(fsvc) {
// Cached, return svc address
return fsvc.Address, nil
} else {
executor.logger.Debug("deleting cache entry for invalid address",
zap.String("function_name", m.Name),
zap.String("function_namespace", m.Namespace),
zap.String("function_name", fn.Metadata.Name),
zap.String("function_namespace", fn.Metadata.Namespace),
zap.String("address", fsvc.Address))
executor.fsCache.DeleteEntry(fsvc)
et.DeleteFuncSvcFromCache(fsvc)
}
}
respChan := make(chan *createFuncServiceResponse)
executor.requestChan <- &createFuncServiceRequest{
ctx: ctx,
funcMeta: m,
function: fn,
respChan: respChan,
}
resp := <-respChan
@@ -104,25 +123,57 @@ func (executor *Executor) getServiceForFunction(ctx context.Context, m *metav1.O
}
// find funcSvc and update its atime
// TODO: Deprecated tapService
func (executor *Executor) tapService(w http.ResponseWriter, r *http.Request) {
// only for upgrade compatibility
w.WriteHeader(http.StatusOK)
}
// find funcSvc and update its atime
func (executor *Executor) tapServices(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
executor.logger.Error("failed to read tap service request", zap.Error(err))
http.Error(w, "Failed to read request", http.StatusInternalServerError)
return
}
svcName := string(body)
svcHost := strings.TrimPrefix(svcName, "http://")
err = executor.fsCache.TouchByAddress(svcHost)
tapSvcReqs := []client.TapServiceRequest{}
err = json.Unmarshal(body, &tapSvcReqs)
if err != nil {
executor.logger.Error("error tapping function service",
executor.logger.Error("failed to decode tap service request",
zap.Error(err),
zap.String("service", svcName),
zap.String("host", svcHost))
zap.String("request-payload", string(body)))
http.Error(w, "Failed to decode tap service request", http.StatusBadRequest)
return
}
errs := &multierror.Error{}
for _, req := range tapSvcReqs {
svcHost := strings.TrimPrefix(req.ServiceUrl, "http://")
et, exists := executor.executorTypes[req.FnExecutorType]
if !exists {
errs = multierror.Append(errs,
errors.Errorf("error tapping service due to unknown executor type '%v' found",
req.FnExecutorType))
continue
}
err = et.TapService(svcHost)
if err != nil {
errs = multierror.Append(errs,
errors.Wrapf(err, "'%v' failed to tap function '%v' in '%v' with service url '%v'",
req.FnMetadata.Name, req.FnMetadata.Namespace, req.ServiceUrl, req.FnExecutorType))
}
}
if errs.ErrorOrNil() != nil {
executor.logger.Error("error tapping function service", zap.Error(errs))
http.Error(w, "Not found", http.StatusNotFound)
return
}
w.WriteHeader(http.StatusOK)
}
@@ -130,24 +181,20 @@ func (executor *Executor) healthHandler(w http.ResponseWriter, r *http.Request)
w.WriteHeader(http.StatusOK)
}
func (executor *Executor) Serve(port int) {
executor.logger.Info("starting executor", zap.Int("port", port))
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
executor.ndm.Run(ctx)
executor.gpm.Run(ctx)
executor.cms.Run(ctx)
func (executor *Executor) GetHandler() http.Handler {
r := mux.NewRouter()
r.HandleFunc("/v2/getServiceForFunction", executor.getServiceForFunctionApi).Methods("POST")
r.HandleFunc("/v2/tapService", executor.tapService).Methods("POST")
r.HandleFunc("/v2/tapService", executor.tapService).Methods("POST") // for backward compatibility
r.HandleFunc("/v2/tapServices", executor.tapServices).Methods("POST")
r.HandleFunc("/healthz", executor.healthHandler).Methods("GET")
return r
}
func (executor *Executor) Serve(port int) {
executor.logger.Info("starting executor API", zap.Int("port", port))
address := fmt.Sprintf(":%v", port)
err := http.ListenAndServe(address, &ochttp.Handler{
Handler: r,
Handler: executor.GetHandler(),
})
executor.logger.Fatal("done listening", zap.Error(err))
}
+60 -28
View File
@@ -32,23 +32,31 @@ import (
"golang.org/x/net/context/ctxhttp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
)
type Client struct {
logger *zap.Logger
executorUrl string
tappedByUrl map[string]bool
requestChan chan string
httpClient *http.Client
}
type (
Client struct {
logger *zap.Logger
executorUrl string
tappedByUrl map[string]TapServiceRequest
requestChan chan TapServiceRequest
httpClient *http.Client
}
TapServiceRequest struct {
FnMetadata metav1.ObjectMeta
FnExecutorType fv1.ExecutorType
ServiceUrl string
}
)
func MakeClient(logger *zap.Logger, executorUrl string) *Client {
c := &Client{
logger: logger.Named("executor_client"),
executorUrl: strings.TrimSuffix(executorUrl, "/"),
tappedByUrl: make(map[string]bool),
requestChan: make(chan string),
tappedByUrl: make(map[string]TapServiceRequest),
requestChan: make(chan TapServiceRequest, 100),
httpClient: &http.Client{
Transport: &ochttp.Transport{},
},
@@ -87,40 +95,64 @@ func (c *Client) service() {
ticker := time.NewTicker(time.Second * 5)
for {
select {
case serviceUrl := <-c.requestChan:
c.tappedByUrl[serviceUrl] = true
case svcReq := <-c.requestChan:
c.tappedByUrl[svcReq.ServiceUrl] = svcReq
case <-ticker.C:
urls := c.tappedByUrl
c.tappedByUrl = make(map[string]bool)
if len(urls) > 0 {
go func() {
for u := range urls {
err := c._tapService(u)
if err != nil {
c.logger.Error("error tapping function service address", zap.Error(err), zap.String("address", u))
}
}
c.logger.Debug("tapped services in batch", zap.Int("service_count", len(urls)))
}()
if len(c.tappedByUrl) == 0 {
continue
}
urls := c.tappedByUrl
c.tappedByUrl = make(map[string]TapServiceRequest)
go func() {
svcReqs := []TapServiceRequest{}
for _, req := range urls {
svcReqs = append(svcReqs, req)
}
c.logger.Debug("tapped services in batch", zap.Int("service_count", len(urls)))
err := c._tapService(svcReqs)
if err != nil {
c.logger.Error("error tapping function service address", zap.Error(err))
}
}()
}
}
}
func (c *Client) TapService(serviceUrl *url.URL) {
c.requestChan <- serviceUrl.String()
func (c *Client) TapService(fnMeta metav1.ObjectMeta, executorType fv1.ExecutorType, serviceUrl *url.URL) {
c.requestChan <- TapServiceRequest{
FnMetadata: metav1.ObjectMeta{
Name: fnMeta.Name,
Namespace: fnMeta.Namespace,
ResourceVersion: fnMeta.ResourceVersion,
UID: fnMeta.UID,
},
FnExecutorType: executorType,
// service url is for executor to know which
// pod/service is currently used to serve user function.
ServiceUrl: serviceUrl.String(),
}
}
func (c *Client) _tapService(serviceUrlStr string) error {
executorUrl := c.executorUrl + "/v2/tapService"
func (c *Client) _tapService(tapSvcReqs []TapServiceRequest) error {
executorUrl := c.executorUrl + "/v2/tapServices"
resp, err := http.Post(executorUrl, "application/octet-stream", bytes.NewReader([]byte(serviceUrlStr)))
body, err := json.Marshal(tapSvcReqs)
if err != nil {
return err
}
resp, err := http.Post(executorUrl, "application/json", bytes.NewReader(body))
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return ferror.MakeErrorFromHTTP(resp)
}
return nil
}
+17 -20
View File
@@ -20,6 +20,7 @@ import (
"context"
"time"
"github.com/pkg/errors"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -29,8 +30,7 @@ import (
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
"github.com/fission/fission/pkg/crd"
nd "github.com/fission/fission/pkg/executor/newdeploy"
gpm "github.com/fission/fission/pkg/executor/poolmgr"
"github.com/fission/fission/pkg/executor/executortype"
)
type (
@@ -46,10 +46,10 @@ type (
//MakeConfigSecretController makes a controller for configmaps and secrets which changes related functions
func MakeConfigSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) *ConfigSecretController {
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) *ConfigSecretController {
logger.Debug("Creating ConfigMap & Secret Controller")
_, cmcontroller := initConfigmapController(logger, fissionClient, kubernetesClient, ndm, gpm)
_, scontroller := initSecretController(logger, fissionClient, kubernetesClient, ndm, gpm)
_, cmcontroller := initConfigmapController(logger, fissionClient, kubernetesClient, types)
_, scontroller := initSecretController(logger, fissionClient, kubernetesClient, types)
cmsController := &ConfigSecretController{
logger: logger,
configmapController: cmcontroller,
@@ -66,7 +66,7 @@ func (csController *ConfigSecretController) Run(ctx context.Context) {
}
func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClient,
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) (cache.Store, cache.Controller) {
resyncPeriod := 30 * time.Second
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "configmaps", metav1.NamespaceAll, fields.Everything())
store, controller := cache.NewInformer(listWatch, &apiv1.ConfigMap{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
@@ -81,12 +81,11 @@ func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClien
zap.String("configmap_name", newCm.ObjectMeta.Name),
zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
}
funcs, err := getConfigmapRelatedFuncs(logger, &newCm.ObjectMeta, fissionClient)
if err != nil {
logger.Error("Failed to get functions related to secret", zap.String("secret_name", newCm.ObjectMeta.Name), zap.String("secret_namespace", newCm.ObjectMeta.Namespace))
logger.Error("Failed to get functions related to configmap", zap.String("configmap_name", newCm.ObjectMeta.Name), zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
}
recyclePods(logger, funcs, ndm, gpm)
refreshPods(logger, funcs, types)
}
},
})
@@ -112,7 +111,7 @@ func getConfigmapRelatedFuncs(logger *zap.Logger, m *metav1.ObjectMeta, fissionC
}
func initSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) (cache.Store, cache.Controller) {
resyncPeriod := 30 * time.Second
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "secrets", metav1.NamespaceAll, fields.Everything())
store, controller := cache.NewInformer(listWatch, &apiv1.Secret{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
@@ -128,14 +127,12 @@ func initSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
zap.String("configmap_namespace", newS.ObjectMeta.Namespace))
}
funcs, err := getSecretRelatedFuncs(logger, &newS.ObjectMeta, fissionClient)
if err != nil {
logger.Error("Failed to get functions related to secret", zap.String("secret_name", newS.ObjectMeta.Name), zap.String("secret_namespace", newS.ObjectMeta.Namespace))
}
recyclePods(logger, funcs, ndm, gpm)
refreshPods(logger, funcs, types)
}
},
})
return store, controller
@@ -160,19 +157,19 @@ func getSecretRelatedFuncs(logger *zap.Logger, m *metav1.ObjectMeta, fissionClie
return relatedFunctions, nil
}
func recyclePods(logger *zap.Logger, funcs []fv1.Function, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) {
func refreshPods(logger *zap.Logger, funcs []fv1.Function, types map[fv1.ExecutorType]executortype.ExecutorType) {
for _, f := range funcs {
var err error
switch f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType {
case fv1.ExecutorTypeNewdeploy:
err = ndm.RefreshFuncPods(logger, f)
case fv1.ExecutorTypePoolmgr:
err = gpm.RefreshFuncPods(logger, f)
et, exists := types[f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType]
if exists {
err = et.RefreshFuncPods(logger, f)
} else {
err = errors.Errorf("Unknown executor type '%v'", f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType)
}
if err != nil {
logger.Error("Failed to recycle pods for function after configmap changed",
logger.Error("Failed to recycle pods for function after configmap/secret changed",
zap.Error(err),
zap.Any("function", f))
}
+97 -70
View File
@@ -20,6 +20,8 @@ import (
"context"
"fmt"
"net/http"
"os"
"strconv"
"strings"
"sync"
"time"
@@ -28,15 +30,16 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/executor/cms"
"github.com/fission/fission/pkg/executor/executortype"
"github.com/fission/fission/pkg/executor/executortype/newdeploy"
"github.com/fission/fission/pkg/executor/executortype/poolmgr"
"github.com/fission/fission/pkg/executor/fscache"
"github.com/fission/fission/pkg/executor/newdeploy"
"github.com/fission/fission/pkg/executor/poolmgr"
"github.com/fission/fission/pkg/executor/reaper"
"github.com/fission/fission/pkg/executor/util"
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
)
@@ -44,19 +47,16 @@ type (
Executor struct {
logger *zap.Logger
gpm *poolmgr.GenericPoolManager
ndm *newdeploy.NewDeploy
cms *cms.ConfigSecretController
executorTypes map[fv1.ExecutorType]executortype.ExecutorType
cms *cms.ConfigSecretController
fissionClient *crd.FissionClient
fsCache *fscache.FunctionServiceCache
requestChan chan *createFuncServiceRequest
fsCreateWg map[string]*sync.WaitGroup
}
createFuncServiceRequest struct {
ctx context.Context
funcMeta *metav1.ObjectMeta
function *fv1.Function
respChan chan *createFuncServiceResponse
}
@@ -66,21 +66,26 @@ type (
}
)
func MakeExecutor(logger *zap.Logger, gpm *poolmgr.GenericPoolManager, ndm *newdeploy.NewDeploy, cms *cms.ConfigSecretController, fissionClient *crd.FissionClient, fsCache *fscache.FunctionServiceCache) *Executor {
func MakeExecutor(logger *zap.Logger, cms *cms.ConfigSecretController,
fissionClient *crd.FissionClient, types map[fv1.ExecutorType]executortype.ExecutorType) (*Executor, error) {
executor := &Executor{
logger: logger.Named("executor"),
gpm: gpm,
ndm: ndm,
cms: cms,
fissionClient: fissionClient,
fsCache: fsCache,
executorTypes: types,
requestChan: make(chan *createFuncServiceRequest),
fsCreateWg: make(map[string]*sync.WaitGroup),
}
for _, et := range types {
go func(et executortype.ExecutorType) {
et.Run(context.Background())
}(et)
}
go cms.Run(context.Background())
go executor.serveCreateFuncServices()
return executor
return executor, nil
}
// All non-cached function service requests go through this goroutine
@@ -92,43 +97,65 @@ func MakeExecutor(logger *zap.Logger, gpm *poolmgr.GenericPoolManager, ndm *newd
func (executor *Executor) serveCreateFuncServices() {
for {
req := <-executor.requestChan
m := req.funcMeta
fnMetadata := &req.function.Metadata
// Cache miss -- is this first one to request the func?
wg, found := executor.fsCreateWg[crd.CacheKey(m)]
wg, found := executor.fsCreateWg[crd.CacheKey(fnMetadata)]
if !found {
// create a waitgroup for other requests for
// the same function to wait on
wg := &sync.WaitGroup{}
wg.Add(1)
executor.fsCreateWg[crd.CacheKey(m)] = wg
executor.fsCreateWg[crd.CacheKey(fnMetadata)] = wg
// launch a goroutine for each request, to parallelize
// the specialization of different functions
go func() {
fsvc, err := executor.createServiceForFunction(req.ctx, m)
// Control overall specialization time by setting function
// specialization time to context. The reason not to use
// context from router requests is because a request maybe
// canceled for unknown reasons and let executor keeps
// spawning pods that never finish specialization process.
// Also, even a request failed, a specialized function pod
// still can serve other subsequent requests.
buffer := 10 // add some buffer time for specialization
specializationTimeout := req.function.Spec.InvokeStrategy.ExecutionStrategy.SpecializationTimeout
// set minimum specialization timeout to avoid illegal input and
// compatibility problem when applying old spec file that doesn't
// have specialization timeout field.
if specializationTimeout < fv1.DefaultSpecializationTimeOut {
specializationTimeout = fv1.DefaultSpecializationTimeOut
}
fnSpecializationTimeoutContext, cancel := context.WithTimeout(context.Background(),
time.Duration(specializationTimeout+buffer)*time.Second)
defer cancel()
fsvc, err := executor.createServiceForFunction(fnSpecializationTimeoutContext, req.function)
req.respChan <- &createFuncServiceResponse{
funcSvc: fsvc,
err: err,
}
delete(executor.fsCreateWg, crd.CacheKey(m))
delete(executor.fsCreateWg, crd.CacheKey(fnMetadata))
wg.Done()
}()
} else {
// There's an existing request for this function, wait for it to finish
go func() {
executor.logger.Debug("waiting for concurrent request for the same function",
zap.Any("function", m))
zap.Any("function", fnMetadata))
wg.Wait()
// get the function service from the cache
fsvc, err := executor.fsCache.GetByFunction(m)
fsvc, err := executor.getFunctionServiceFromCache(req.function)
// fsCache return error when the entry does not exist/expire.
// It normally happened if there are multiple requests are
// waiting for the same function and executor failed to cre-
// ate service for function.
err = errors.Wrapf(err, "error getting service for function %v in namespace %v", m.Name, m.Namespace)
err = errors.Wrapf(err, "error getting service for function %v in namespace %v", fnMetadata.Name, fnMetadata.Namespace)
req.respChan <- &createFuncServiceResponse{
funcSvc: fsvc,
err: err,
@@ -138,60 +165,37 @@ func (executor *Executor) serveCreateFuncServices() {
}
}
func (executor *Executor) getFunctionExecutorType(meta *metav1.ObjectMeta) (fv1.ExecutorType, error) {
fn, err := executor.fissionClient.Functions(meta.Namespace).Get(meta.Name)
if err != nil {
return "", err
}
return fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType, nil
}
func (executor *Executor) createServiceForFunction(ctx context.Context, meta *metav1.ObjectMeta) (*fscache.FuncSvc, error) {
func (executor *Executor) createServiceForFunction(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
executor.logger.Debug("no cached function service found, creating one",
zap.String("function_name", meta.Name),
zap.String("function_namespace", meta.Namespace))
zap.String("function_name", fn.Metadata.Name),
zap.String("function_namespace", fn.Metadata.Namespace))
executorType, err := executor.getFunctionExecutorType(meta)
if err != nil {
return nil, err
}
var fsvc *fscache.FuncSvc
var fsvcErr error
switch executorType {
case fv1.ExecutorTypeNewdeploy:
fsvc, fsvcErr = executor.ndm.GetFuncSvc(ctx, meta)
default:
fsvc, fsvcErr = executor.gpm.GetFuncSvc(ctx, meta)
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
e, ok := executor.executorTypes[t]
if !ok {
return nil, errors.Errorf("Unknown executor type '%v'", t)
}
fsvc, fsvcErr := e.GetFuncSvc(ctx, fn)
if fsvcErr != nil {
e := "error creating service for function"
executor.logger.Error(e,
zap.Error(fsvcErr),
zap.String("function_name", meta.Name),
zap.String("function_namespace", meta.Namespace))
fsvcErr = errors.Wrap(fsvcErr, fmt.Sprintf("[%s] %s", meta.Name, e))
} else if fsvc != nil {
_, err = executor.fsCache.Add(*fsvc)
if err != nil {
return nil, err
}
zap.String("function_name", fn.Metadata.Name),
zap.String("function_namespace", fn.Metadata.Namespace))
fsvcErr = errors.Wrap(fsvcErr, fmt.Sprintf("[%s] %s", fn.Metadata.Name, e))
}
executor.fsCache.IncreaseColdStarts(meta.Name, string(meta.UID))
return fsvc, fsvcErr
}
// isValidAddress invokes isValidService or isValidPod depending on the type of executor
func (executor *Executor) isValidAddress(fsvc *fscache.FuncSvc) bool {
if fsvc.Executor == fscache.NEWDEPLOY {
return executor.ndm.IsValid(fsvc)
} else {
return executor.gpm.IsValid(fsvc)
func (executor *Executor) getFunctionServiceFromCache(fn *fv1.Function) (*fscache.FuncSvc, error) {
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
e, ok := executor.executorTypes[t]
if !ok {
return nil, errors.Errorf("Unknown executor type '%v'", t)
}
return e.GetFuncSvcFromCache(fn)
}
func serveMetric(logger *zap.Logger) {
@@ -222,26 +226,49 @@ func StartExecutor(logger *zap.Logger, functionNamespace string, envBuilderNames
}
restClient := fissionClient.GetCrdClient()
fsCache := fscache.MakeFunctionServiceCache(logger)
executorInstanceID := strings.ToLower(uniuri.NewLen(8))
poolID := strings.ToLower(uniuri.NewLen(8))
reaper.CleanupOldExecutorObjects(logger, kubernetesClient, poolID)
go reaper.CleanupRoleBindings(logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30)
logger.Info("Starting executor", zap.String("instanceID", executorInstanceID))
gpm := poolmgr.MakeGenericPoolManager(
logger,
fissionClient, kubernetesClient,
functionNamespace, fetcherConfig, poolID)
functionNamespace, fetcherConfig, executorInstanceID)
ndm := newdeploy.MakeNewDeploy(
logger,
fissionClient, kubernetesClient, restClient,
functionNamespace, fetcherConfig, poolID)
functionNamespace, fetcherConfig, executorInstanceID)
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, ndm, gpm)
executorTypes := make(map[fv1.ExecutorType]executortype.ExecutorType)
executorTypes[gpm.GetTypeName()] = gpm
executorTypes[ndm.GetTypeName()] = ndm
api := MakeExecutor(logger, gpm, ndm, cms, fissionClient, fsCache)
adoptExistingResources, _ := strconv.ParseBool(os.Getenv("ADOPT_EXISTING_RESOURCES"))
wg := &sync.WaitGroup{}
for _, et := range executorTypes {
wg.Add(1)
go func(et executortype.ExecutorType) {
defer wg.Done()
if adoptExistingResources {
et.AdoptExistingResources()
}
et.CleanupOldExecutorObjects()
}(et)
}
// set hard timeout for resource adoption
// TODO: use context to control the waiting time once kubernetes client supports it.
util.WaitTimeout(wg, 30*time.Second)
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, executorTypes)
api, err := MakeExecutor(logger, cms, fissionClient, executorTypes)
if err != nil {
return err
}
go reaper.CleanupRoleBindings(logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30)
go api.Serve(port)
go serveMetric(logger)
-15
View File
@@ -25,10 +25,8 @@ package executor
import (
"context"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
"testing"
"time"
@@ -99,19 +97,6 @@ func createSvc(kubeClient *kubernetes.Clientset, ns string, name string, targetP
return svc
}
func httpGet(url string) string {
resp, err := http.Get(url)
if err != nil {
log.Panicf("HTTP Get failed: URL %v: %v", url, err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Panicf("HTTP Get failed to read body: URL %v: %v", url, err)
}
return string(body)
}
func TestExecutor(t *testing.T) {
// run in a random namespace so we can have concurrent tests
// on a given cluster

Some files were not shown because too many files have changed in this diff Show More