Compare commits

...
1143 Commits
Author SHA1 Message Date
Sanket SudakeandGitHub d06ad04341 Changes for 1.13.1 release (#2087)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-21 15:22:59 +05:30
Sanket SudakeandGitHub 72c89268ec Ignore errors from zap logger Sync (#2086)
Added golang CI lint
Reference issue: https://github.com/uber-go/zap/issues/880

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-21 11:58:48 +05:30
Sanket SudakeandGitHub 3f99b483cb Correct release name in release script for non helm install (#2084)
* Correct release name in release script for non helm install

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Increase test timeout to 20 minutes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Enable codeql for master only

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-20 21:38:48 +05:30
Sanket SudakeandGitHub 9bef235252 Use codeql for code scanning (#2078)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-18 14:59:07 +05:30
18935dcfdd Lint fix (#2074)
Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-18 13:41:23 +05:30
Sanket SudakeandGitHub db2fb81654 Update changelog for 1.13.0 release (#2073)
* Update changelog for 1.13.0 release

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Just add 1.13 notes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Correct PRs for 1.13

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* minor change

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-16 18:08:02 +05:30
Sanket SudakeandGitHub 6fbd4878be Generate and archive fission cli per OS and platform (#2071)
* Generate and archive fission cli per OS and platform

* Separate tagging from release script
2021-06-16 13:10:31 +05:30
Sanket SudakeandGitHub 023a9905f6 Changes for releasing 1.13 (#2070)
* Changes for releasing 1.13

- Changed release version in charts 1.13
- Made changes in release scripts and makefile

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Update helm chart maintainers

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-15 19:50:23 +05:30
Harsh ThakurandGitHub 6facdac464 Fix golang lint errors (#2068)
* Fix golang lint errors

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Typo for fields

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Multi error fix

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Multi error fix

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Add nolint to logtostderr errcheck

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-06-15 15:03:42 +05:30
377600d0a3 Add router cache back for performance comparision (#2036)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-06-14 18:30:23 +05:30
b6cf078395 Added GCP PubSub Image, enabled Keda by default and updated versions of all Keda connector images (#2065)
* Added GCP PubSub Image, enabled Keda by default and updated versions of all Keda connector images

Signed-off-by: Vishal Biyani <vrbiyani@gmail.com>

* Fixed the hyphens, it's been long since I have written Helm templates :)

Signed-off-by: Vishal Biyani <vrbiyani@gmail.com>

* Fixed the hyphens, it's been long since I have written Helm templates :)

Signed-off-by: Vishal Biyani <vrbiyani@gmail.com>

* Update charts/fission-all/values.yaml

Co-authored-by: Harsh Thakur <harshthakur9030@gmail.com>

* Update charts/fission-core/values.yaml

Co-authored-by: Harsh Thakur <harshthakur9030@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-06-14 17:20:44 +05:30
673ca25cf2 Support for multiple HTTP verbs in routes/HTTPTrigger (#2064)
* Support for multiple HTTP verbs in routes/HTTPTrigger

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Update pkg/apis/core/v1/types.go

Co-authored-by: Harsh Thakur <harshthakur9030@gmail.com>

* Fix fallbackurl for ingress

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-06-14 14:48:27 +05:30
4038f0384b Add a SharedIndexInformer for services and deployments to NewDeploy executor (#2061)
* Add a SharedIndexInformer for services and deployments to NewDeploy executor.

This brings the NewDeploy executor behaviour into sync with GenericPoolManager behaviour
by caching Kubernetes services and deployments used in per-request function validation.

* Create informers in executer by executor label

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: James Sinclair <irgeek@btc.com.au>
2021-06-11 16:52:53 +05:30
Sanket SudakeandGitHub f5dc6ab994 Correct docker platforms and optimize make commands (#2066)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-11 13:05:08 +05:30
aa45703a99 Enable prefix based routing (#2047)
* Enable prefix based routing

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Optimize checking condition

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Disable few tests

* disable router modification for now

* run code generator

* Collect fission dump in CI

* Enable all tests back

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Remove unwanted code

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Add prefix support at more places and couple of todo's

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Few more changes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Improve function trim support

* Support for prefix based urls in fission function test

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* multi route for fission function test

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Improve validations in trigger creations

* Adjust leading / in url from fission

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Change suburl to subpath for function test

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-10 13:54:49 +05:30
Harsh ThakurandGitHub f01de5c802 Add websocket test (#2053)
* Add websocket test

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Use trap for exit code

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Remove readme

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Format, go version fix

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Update image name

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Use spec dir

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Change directory before running file

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Use

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-06-10 12:27:20 +05:30
827b64d633 Add poolsize warning for environment create/update CLI (#1837)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-08 11:53:38 +05:30
7bf82c7ea9 Move RBAC v1beta1 to v1 (#2059)
Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-08 08:25:52 +05:30
3055a3ada0 Added body in the error topic header (#1830)
Signed-off-by: therahulbhati <rjbhati009@gmail.com>

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-07 22:28:11 +05:30
5b1883802e Added fission upgrade workflow (#2050)
* Adding upgrade workflow file

* Update upgrade_test.yaml

* Update push_pr.yaml

* Update upgrade_test.yaml

* adding kube A

* Update upgrade_test.yaml

* adding script for upgrade testing

* adding fission cli from soource

* changing order

* correcting typo

* adding fission fn

* restructirung upgrade test scripts

* restructirung upgrade test scripts

* adding fission cli build

* script arrangment

* script arrangment

* changing job name

* adding supporting scripts

* adding supporting scripts

* adding supporting scripts

* script re-ordered

* script re-ordered

* script modifcation

* moved scripts under /test

* separated function test blocks

* added a sleep

* reverting main workflow changes

* added stable version installation step

* added stable version installation step

* stable fn test

* adding latest version build

* adding latest version build

* adding new tests

* adding new tests

* adding new tests

* adding new tests

* adding new tests

* adding new tests

* adding new tests

* adding new tests

* adding new stable release

* adding new stable release

* disabling skaffold build and using docker build

* disabling skaffold build and using docker build

* disabling skaffold build and using docker build

* disabling skaffold build and using docker build

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* fission upgrade using helm

* adding helm upgrade with dependency update

* cleanup scripts

* added crd deletion step before helm upgrade

* added crd deletion step before helm upgrade

* added crd deletion step before helm upgrade

* adding run tests

* added test apache deployment

* change in repo name

* helm list added

* changed pullpolicy

* troubleshooting

* troubleshooting

* troubleshooting

* troubleshooting

* troubleshooting

* troubleshooting

* removed hardcoded enteries from helm charts

* fixing alignment

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* removed temp files [cleanup]

* removed timeout

* adding preupgradechecks image build

* adding fission object creation after upgrade

* removing fissin object creation after upgrading...

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* workflow step split-up

* clean-up

* clean-up

* output formatting

* added a sleep to re-create resources

* added a sleep to re-create resources

* added a sleep to re-create resources

* excluded examples from upgrade work flow

* removed helm stable update step from workflow

* removed helm stable update step from workflow

* added pr corrections

* typo correction

* troubleshooting

* troubleshooting

* troubleshooting

* pr corrections

* pr corrections

* pr corrections

* removed sleep after helm upgrade

* fixing typo

* remvoed sleep after fn creation

* clean-up

* clean-up

* added workflow_dispatch

* added workflow_dispatch

* added workflow_dispatch

* added workflow_dispatch

Co-authored-by: Jithindevasia <jithindevasia@Infraclouds-MacBook-Pro.local>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-07 21:20:06 +05:30
bef677678b make router resources configurable (needed for router HPA setup) (#1857)
Co-authored-by: Daniel Candrea <daniel.candrea@complyadvantage.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-06 14:13:07 +05:30
Sanket SudakeandGitHub 61c59b514f Collect fission dump if CI tests fails & enable manual trigger (#2058)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-06 10:42:43 +05:30
8f998e799d Feature/router core component pod config (#1936)
* Update router.yaml

* Update router.yaml

* Update README.md

* Update values.yaml

* Update values.yaml

* Update Chart.yaml

* Update Chart.yaml

* Update Chart.yaml

* Update Chart.yaml

* Update Chart.yaml

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-03 21:15:17 +05:30
Sanket SudakeandGitHub c2f455ec1b Capture timestamp whenever cleanup is triggered in tests (#2054)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-03 14:31:40 +05:30
Sanket SudakeandGitHub 3a8af97eb9 Wait for small time to avoid timeout in specs tests (#2052)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-03 10:57:10 +05:30
Sanket SudakeandGitHub e6c13057ce Change container name for runtime container to environment name in newdeploy (#2044)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-02 16:23:53 +05:30
5f47a25711 Multiarch release (#1929)
* Adding release script for multiarch

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Comment on buildx

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Remove need of triggering buildx script explicitly in build

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-02 14:40:11 +05:30
Sanket SudakeandGitHub 4c9b67ead4 Add role required by fetcher pod to fetch events & pods in helm chart (#2048)
* Add role required by fetcher pod to fetch events & pods in helm chart

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Add prometheus repo in Github PR flow

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-06-02 11:42:41 +05:30
Harsh ThakurandGitHub adef5e0e6a Add targets for CRDs and CLI (#2049)
Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-06-01 14:58:10 +05:30
4e2632e100 Keda podspec (#2021)
* Add podspec to MQT

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Add preupgrade check

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Use zap logger

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-27 14:21:34 +05:30
4ff204a0c4 updated charts to v2 and updated prometheus chart url, version (#1923)
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-27 12:31:25 +05:30
1e0baf5f6c Crds update (#2033)
* Add code generated using latest code-generator

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Update client-go and respective dependencies to v0.19.2

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Upgrading CRD version

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Minor changes

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Resolved client-go calls as per new generated code

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Function validations fix

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Fix environment and package validations

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Add basic validation to all CRDs

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Remove CRD installation related code

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Modify GHA for CRD installation

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Fix Package and HTTPTrigger validations

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Change Go version in CI to 1.15

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Style: kubebuilder marker change

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Fix test with deprecated fields

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Update kind node image to v1.16.15 in CI

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Update kind node image to v1.19.11 in CI

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Replace context Background with TODO for future implementation

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Optimize initial CRD check code

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Use Get call only to check CRDs

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

* Add kustomize for CRD apply

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-26 15:07:03 +05:30
a9c56e5bb2 Add a warning if spec is applied on a dirty worktree (#1966)
* Add a warning if spec is applied on a dirty worktree

* Update go dependencies after rebase

* Use the console package for showing the warning

* Fix merge conflicts

* Handle errors and use better messages

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-24 21:36:14 +05:30
4a1fc11b2d OnlyOnce preupgrade check (#2037)
* OnlyOnce preupgrade check

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Update preupgradechecks.go

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-24 14:32:11 +05:30
Sanket SudakeandGitHub 42c22a7bbb Change examples references to examples repostiory (#2038)
Since we recently migrated all fission examples to fission/examples repository, we need to change
respective references.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-24 13:25:32 +05:30
Sanket SudakeandGitHub 369537e515 Cleanup and remove hardcoding from delete-crds script (#2035)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-23 13:23:30 +05:30
3880279e89 do not use deprecated functions/methods (#2027)
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-21 13:53:28 +05:30
Sanket SudakeandGitHub 524e7bcfd3 Use latest 1.14 go version in CI (#2032)
We are facing issue in CI for multiple PRs due to mlock. It depends on kernel version or ulimit. Trying to switch to latest go version from 1.14 and see if it helps!

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-20 11:49:30 +05:30
3bac1d2d9d Fix log sort order when multiple series are returned (#1956)
Series are sorted internal by "order by", but the set of all series returned is not. Tried some ways to sort completely on database, found no way .. client side sort works at least

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-05-20 07:55:36 +05:30
d7ac0ee17a feat: Add image pull policy when create KEDA connector deployments (#1944)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-05-20 01:22:25 +05:30
Rahul BhatiandGitHub 462b7d861d Serve only one request and garbage collect (#1978)
Adding once only execution pattern to pool manager based functions. This is for use cases where you don't want to share the samne pod for another execution instance!
2021-05-19 22:48:49 +05:30
Harsh ThakurandGitHub f523f8b2e3 Add preupgrade check for RPP (#2014)
* Add preupgrade check for RPP

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Change from panic to error, and better logging

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Minor changes

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Modify function to return CRD

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Remove redundant error logging

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-05-18 18:53:32 +05:30
Harsh ThakurandGitHub 279b009882 Add metrics to Reaper (#2019)
* Add metrics to Reaper

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>

* Change duration to seconds and fix labels

Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
2021-05-18 17:30:21 +05:30
Sanket SudakeandGitHub ee4feb17c4 Handle SIGTERM signal in mqtrigger subscriber (#2029)
In test_mqtrigger.sh and test_mqtrigger_error.sh tests, we timeout program
if not received right output. Ensuring we capture timeout signal and do program
cleanup accordingly. Also printing due to which signal program failed.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-18 16:26:44 +05:30
Sanket SudakeandGitHub 2a014e56b0 Add Google Analytics reporting in place of existing custom reporting (#2015)
Replacing the older analytics with a new Google Analytics based mechanism.
2021-05-12 12:24:27 +05:30
040763ebb2 fix: hack/Dockerfile to reduce vulnerabilities (#2016)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-DEBIAN10-OPENSSL-567125
- https://snyk.io/vuln/SNYK-DEBIAN10-PERL-570792
- https://snyk.io/vuln/SNYK-DEBIAN10-PERL-570797
- https://snyk.io/vuln/SNYK-DEBIAN10-PERL-570802
- https://snyk.io/vuln/SNYK-DEBIAN10-SUBVERSION-1071814

Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2021-05-10 18:19:37 +05:30
Sanket SudakeandGitHub dfd8d340a0 Change alpine base image from 3.10 to 3.13 (#2017)
Alpine 3.10 has reached end-of-support. Using alpine 3.13 instead.
Reference: https://alpinelinux.org/releases/
2021-05-10 12:50:36 +05:30
VishalandGitHub ca6bc12cfc Restoring one example as it is used in many places including Helm charts (#2011)
Some tests were pointing to examples directory which has been moved out. Also kept one node.js examples as it is widely used in Helm charts etc.
2021-05-09 23:36:39 +05:30
VishalandGitHub 5b4bf5964e Moving out Environments to own repo (#1810)
Moved out environments and examples out of main Fission repo to their own repo. This is to allow changes to environment releases to be independent of main Fission releases.
2021-05-01 15:42:35 +05:30
Harsh ThakurandGitHub f72bfd8f3a Websocket Support: Pod Reaper (#1982)
Websocket event support for cleaning up pods only after WS connection is terminated. The support for websocket is right now in the environment itself and router simply acts as a proxy for WS communication!
2021-04-27 21:06:22 +05:30
Harsh ThakurandGitHub 0d93c109fb Maintain CRD folder to keep track of Schemas (#1938)
Adds CRD Yaml files needed for upgrade as the OpenAPISchema validation has been added.
2021-04-27 17:20:03 +05:30
Rahul BhatiandGitHub 1cd8f4d4f7 Increase default concurrency (#1980)
Increase the default concurrency to 500 from 5 set in the function. Usually, it is good to error on the higher side and if needed, users can always fine-tune it to their needs.
2021-04-06 14:52:14 +05:30
Rahul BhatiandGitHub 25acd7fd16 Feature request per pod (#1946)
This feature enables routing more than one request to a pod at the same time. This is the first draft of the work and might involve more optimizations later.
2021-03-31 12:35:30 +05:30
Ta-Ching ChenandGitHub 3e6dae9616 Fix wrong checksum was assigned (#1968) 2021-03-29 16:20:21 +05:30
James SinclairandGitHub 1dce070245 Add a SharedIndexInformer for pods to router. (#1951)
Improving efficiency with cache
2021-03-22 16:50:24 +05:30
Rahul BhatiandGitHub cc552d9777 Add function in payload instead of just metadata (#1919)
Passing information of function from router to executor is more efficient than calling the K8S API. This change does that instead of passing only metadata and then executor calling the K8S API again.
2021-03-10 14:52:23 +05:30
c7d448ca49 Add fields to pod spec (#1932)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-23 15:16:45 +05:30
Rahul BhatiandGitHub fe0bd3ff67 Release 1.12.0 (#1937) 2021-02-11 22:22:37 +05:30
Rahul BhatiandGitHub b5adc2bf93 Updated tags of connector images (#1934)
Signed-off-by: therahulbhati <rjbhati009@gmail.com>
2021-02-10 21:50:47 +05:30
6f9bad3d05 Spec validation option (#1865)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-08 11:14:38 +05:30
f28799cc4c Fix status code for rate limit (#1924)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-05 16:52:43 +05:30
e2376c27b4 Envupdate crossupdate fix (#1866)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-05 15:39:59 +05:30
e4a0aa3480 Migrating to keda2.0 (#1868)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-05 10:28:54 +05:30
045a365a1b Exit with status code 1 on failed package builds (#1926)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
2021-02-04 21:57:38 +05:30
Rahul BhatiandGitHub 1059e9873a Updated role and permission for fission-crd cluster role (#1867) 2021-02-04 18:07:43 +05:30
e0522cc20e Updates required for multi-architecture builds. (#1891)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
2021-02-03 23:03:04 +05:30
ef83d4314e Put message to error topic when exceed max retries in kafka mqt (#1885)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
2021-02-02 23:20:40 +05:30
3b4ca09931 Improved readyPod queue implementation and bugfix (#1890)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-02 17:11:54 +05:30
19adf0cd7e Fixing issue of pulling docker image twice in CI (#1903)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2021-02-02 12:25:03 +05:30
Rahul BhatiandGitHub 3fb1fdf16a Updated go plugin version for Github Action CI/CD (#1922) 2021-01-29 10:28:22 +05:30
Gaurav GahlotandGitHub 695b0759e4 Fixed golangci-lint issues: /fission/pkg (#1902) 2021-01-19 23:29:20 +05:30
TosoneandGitHub 6dbdf4d88b Remove unnecessary import package. (#1897) 2020-12-28 18:48:02 +05:30
Rahul BhatiandGitHub e55430f61a Replace build status badge to use GH Actions status (#1887) 2020-12-21 22:51:27 +05:30
Rahul BhatiGitHubVishalsahil-lakhwaniagiwalpooja20abhisheks-infracloud
a68f3edcd4 Github Actions Workflows (#1876)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
Co-authored-by: sahil-lakhwani <sahilakhwani@gmail.com>
Co-authored-by: agiwalpooja20 
Co-authored-by: abhisheks-infracloud
2020-12-17 19:00:44 +05:30
Gaurav GahlotandGitHub e438df87fa Fixed golangci-lint issues: /fission/pkg/executor (#1842) 2020-12-03 22:29:35 +05:30
Rahul BhatiandGitHub bb9f4136f5 Readypod optimization in executor (#1860)
A ready pod which can be specialized was fetched for every function earlier, this has been changed to a queue and cache implementation in client-go to improve performance.
2020-11-19 15:23:02 +05:30
Gaurav GahlotandGitHub aaf9f18d93 Fixed golangci-lint issues: /fission/pkg/router (#1831) 2020-11-03 16:15:50 +05:30
2f23120a64 Update nats streaming image name in values.yaml and deployments yaml (#1839)
Co-authored-by: GT <gtalekar@infracloud.io>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-28 23:37:47 +05:30
7743583f4d in-progress golint warning fixes (#1799)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-28 11:44:35 +05:30
fe5542845e Fix golint warnings for publisher package (#1822)
Co-authored-by: Shajitha Mohammed <shajithamohammed28@gmail.com>
2020-10-27 21:19:28 +05:30
Rahul BhatiandGitHub e65bfcdacf Release 1.11.2 (#1843) 2020-10-21 08:47:26 +05:30
9d199c86c5 Fix env resources getting pruned due to CRD Validation (#1833)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-16 23:46:50 +05:30
fca0a60e5b Fixed typos across fission repo (#1832)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-16 17:25:11 +05:30
VishalandGitHub 6e3c42f238 Release 1.11.1 (#1838)
Release 1.11.1 along with some changes to release script
2020-10-15 11:06:05 +05:30
ab94b68571 Update aws-kinesis image name in values.yaml (#1817)
Co-authored-by: GT <gtalekar@infracloud.io>
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
2020-10-14 17:20:26 +05:30
0662a44017 Update aws-sqs image name in values.yaml (#1714)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-14 14:49:08 +05:30
78e530f506 Improvements from scale testing (#1812)
Poolmanager when tested at high load had some issues and this PR fixes one set of them which were found so far. 

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-10-14 13:23:03 +05:30
Rahul BhatiandGitHub ab0b43d51c Added flag for insecureSkipVerfiy (#1829) 2020-10-13 21:03:19 +05:30
Rahul BhatiandGitHub d975534bf7 Added field to preserve fields during CRD validation (#1818) 2020-10-13 12:38:24 +05:30
Darsh ShahandGitHub ec22e22bbd fix(docs): Update Readme (#1742)
Minor adjustments to readme in first section
2020-10-01 15:35:17 +05:30
Parikshit HoodaandGitHub 0face3e966 Update README.md - fix typo (#1737)
changed **meetnigs** to **meetings**.
2020-09-30 22:37:27 +05:30
Ahmet TürkmenandGitHub 823aacdeba [skip ci] fix contributing.md link on readme (#1731) 2020-09-29 15:08:53 +05:30
c605d1d2c6 Added code to prevent deletion of active fn pod (#1724)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-28 14:09:55 +05:30
ef65602b79 Added concurrency field to schema validation (#1727)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-24 23:06:37 +05:30
VishalandGitHub 778f047376 Improving contributing docs (#1726)
Improved contributing docs, added DO logo in sponsors.
2020-09-23 13:38:39 +05:30
VishalandGitHub 2b805fc7ca Release 1.11.0 (#1716) 2020-09-16 22:27:02 +05:30
f3fe3123b3 Adding Concurrency in Pool Manager (#1698)
Concurrency in the pool manager allows specializing pods concurrently based on a specified limit. 

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-16 18:48:08 +05:30
VishalandGitHub c1ac7fcd38 Bumping up release of Helm for release script (#1715)
Upgrading to Helm3 for all CI testing
2020-09-16 16:07:48 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>sahil-lakhwaniVishal
7e7d9720be Bump jetty-server from 9.0.4.v20130625 to 9.4.17.v20190418 in /environments/jvm-jersey (#1706)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sahil-lakhwani <sahilakhwani@gmail.com>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-11 14:51:54 +05:30
4fbaae4b12 Non-root users access Secrets and ConfigMaps (#1697)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-11 10:24:28 +05:30
07b294778a logs: change timestamp to ISO (#1708)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-11 08:04:29 +05:30
VishalandGitHub 8c0a368969 Skaffold: Typo in Helm values for Prometheus (#1709) 2020-09-10 18:28:15 +05:30
99c2020795 Addition of openapischemav3 to fission CRDs to support kubectl explain (#1702)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-10 14:31:27 +05:30
Sahil LakhwaniandGitHub 54b384efec jvm-jersey-env (#1677)
A new Jersey framework based JVM environment which is lightweight and simpler.
2020-09-08 21:24:25 +05:30
975286c2ac Add headers to Kafka MQT error topics (#1701)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-09-07 19:13:36 +05:30
VishalandGitHub 70b01eb9c8 Skaffold kind (#1700) 2020-09-04 17:37:07 +05:30
1755d3a017 Adding NodeJS version 12 env (#1683)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com>
2020-08-28 10:24:22 +05:30
Rahul BhatiandGitHub 22f385b809 Update values.yaml with mqt keda configuration (#1670) 2020-08-27 21:45:46 +05:30
Rahul BhatiandGitHub f751546913 Removed code related to mqtrigger (#1680) 2020-08-06 20:59:08 +05:30
587b166a4e 1665: Python env sentry integration (#1669)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-08-04 09:46:12 +05:30
b208528d3d Add serviceaccount for nats-streaming (#1646)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-07-31 17:02:29 +05:30
882abff431 Added prefix tag in fluentbit filter stanza (#1671)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-07-30 21:03:13 +05:30
892da2478b Allow user to override value of influxdb image (#1642)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-07-23 14:50:50 +05:30
28f5cd7852 (fix) Dependencies and steps for building examples/java locally (#1653)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-07-17 15:18:31 +05:30
Rahul BhatiandGitHub 8e0571c7c9 Fission MQT integration with keda (#1657)
Fission MQT integration based on Keda with Kafka connector
2020-07-14 21:35:48 +05:30
d6fc9f71d0 Allow user to override nats-streaming image (#1645)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-06-30 15:14:46 +05:30
108ef50bd5 Allow user to define busybox image (#1643)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-06-30 10:42:30 +05:30
VishalandGitHub 90b7680392 Release 1.10.0 (#1658) 2020-06-30 08:56:30 +05:30
a8a9831c16 [WIP] (feat) Added Exponential BackOff for Retry in builder (#1614)
Co-authored-by: Rahul M Chheda <rahul.chheda@mayadata.io>
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-06-29 12:01:29 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
a1f39bb7d3 Bump rack from 2.0.8 to 2.1.4 in /environments/ruby (#1654)
Bumps [rack](https://github.com/rack/rack) from 2.0.8 to 2.1.4.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/2.0.8...2.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-25 12:57:56 +05:30
VishalandGitHub a50c9f76ec For fixing staticcheck issue (#1652)
The S3 feature PR caused some static check issues after the merge, those are fixed now.
2020-06-23 15:31:59 +05:30
f6e679e70e S3 backend for storage service (#1629)
Co-authored-by: Alok Kumar <rajalokan@gmail.com>
2020-06-15 19:13:13 +05:30
17bb1ac39f Python env changes for pip3 (#1633)
Co-authored-by: agiwalpooja20 <agiwalpooja20@gmail.com>
2020-06-05 16:03:46 +05:30
33c23c1341 Fixing verify-staticcheck.sh (#1622)
Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-06-04 15:16:09 +05:30
Rahul BhatiandGitHub 9dd084810f Added support for setting bodyParser limit param via environment variable (#1618)
In the NodeJs environment, the body-parser was set to 1MB, this change makes it configurable with an env variable.
2020-05-24 00:16:03 +05:30
VishalandGitHub d4e1cd4f1e Skaffold registry (#1617) 2020-05-22 10:39:01 +05:30
VishalandGitHub aa8c27fd5d Added codecov badge (#1604) 2020-05-13 21:24:49 +05:30
darkworonandGitHub 806104626f Make mergePodSpec pick up enableServiceLinks (#1601)
Attribute enableServiceLinks can be now configured in PodSpec so that environment variables are not injected in function pods and DNS is used for discovery
2020-05-13 14:42:07 +05:30
VishalandGitHub 2331dffe4c Update issue templates (#1602) 2020-05-13 10:26:04 +05:30
Rahul BhatiandGitHub 2d69542265 Added support for kube-context flag, to specify kubernetes context (#1595) 2020-05-11 18:54:06 +05:30
VishalandGitHub 3e8cbe112f Release 1.9.0 (#1597) 2020-05-11 01:26:46 +05:30
VishalandGitHub 31ff3f0290 Kind config (#1587)
A simple Kind cluster config for local development of Fission
2020-04-30 16:30:38 +05:30
Ta-Ching ChenandGitHub f606c3705f Show short flag on CLI usage (#1580) 2020-04-24 15:04:52 +08:00
758ee32aa9 External nats streaming (#1576)
Support for external NATS streaming instead of the one deployed with Fission

Co-authored-by: Shaun Cutts <shaunc@factfiber.com>
2020-04-19 21:53:27 +05:30
VishalandGitHub 163b1d0731 Skaffold Default Repo (#1575)
Skaffold default-repo enables users to use the Skaffold file without any change and by maintaining the docker repo in their local configuration.
2020-04-19 19:26:38 +05:30
e732cf59e0 [chart] Add PSP for logger (#1568)
Add PSP for logger

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
2020-04-19 15:17:41 +05:30
VishalandGitHub a571c7b72c [WIP] Skaffold Fix (#1567)
Switched to dynamic tag and dynamic values for those fields in the deploy section. Also, switched to latest version of Skaffold.
2020-04-13 00:19:52 +05:30
VishalandGitHub 9340e62895 Python Env Build issue due to gevent (#1572) 2020-04-12 23:26:03 +05:30
Jared DavisandGitHub efd86e1b27 Create fission environment for go version 1.14 (#1570) 2020-04-12 23:02:06 +08:00
VishalandGitHub f1e243c145 Adding community meeting link and document (#1563)
Adding community meeting link and document as well as Fission image to readme
2020-03-26 23:34:08 +05:30
Ta-Ching ChenandGitHub e867b220a1 Return Kubernetes full error message (#1560)
This PR let the controller returns the detail error message
of kubernetes error which makes users understand what's
happening instead of meanless error msg.
2020-03-24 00:15:25 +08:00
Ta-Ching ChenandGitHub a04c40d016 Use stock InfluxDB image (#1557) 2020-03-20 16:52:16 +08:00
deluccaandGitHub 4fb1a8fbe8 Bump Python environment to latest Alpine (#1547) 2020-03-03 22:48:50 +08:00
dependabot[bot]andGitHub b959dd2e49 Bump nokogiri from 1.10.4 to 1.10.8 in /examples/ruby/parse (#1544)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-02-26 22:47:53 +08:00
Ta-Ching ChenandGitHub 5c09099084 Avoid exposing sensitive data to client (#1543)
This PR changes the behavior of controller API which
wrongly exposes sensitive data to the client. Now, the
API only returns success if secret/configmap exists;
otherwise, an error will be returned.
2020-02-24 20:02:33 +08:00
Ta-Ching ChenandGitHub fc5711ce7c Support Function-level idle timeout setting (#1538)
This PR allows users to specify the idle timeout setting at Function-level.
Fix #1050
2020-02-21 02:01:26 +08:00
Ta-Ching ChenandGitHub cc14044b6b Add message queue service factory (#1537) 2020-02-20 23:30:39 +08:00
Ta-Ching ChenandGitHub e0dc7f2f81 Retry querying package info when "not found" (#1540)
In some cases, creating a package and querying the package info
immediately the Kubernetes API server will return "not found"
error. So retry the query again after some time.
2020-02-20 22:20:43 +08:00
Ta-Ching ChenandGitHub 03ce1e27c7 Fix function test timeout doesnt works (#1539) 2020-02-19 17:03:02 +08:00
Ta-Ching ChenandGitHub 735f9abef7 Update NATS-Streaming dependencies version (#1533) 2020-02-12 20:35:20 +08:00
Ta-Ching ChenandGitHub f2ddaa7921 Fix Git issue on case-insensitive OS (#1532) 2020-02-12 16:08:05 +08:00
Ta-Ching ChenandGitHub 75321d306a Reorganize message queue trigger directory structure (#1531) 2020-02-12 15:40:00 +08:00
Ta-Ching ChenandGitHub d2e9364e5e Put package deploy archive to fix path (#1529)
In some cases (#1384), users may want to access the file in the directory of deploy archive, however, we use the function UID name as the directory name and make it difficult for users to use as they don't know the real path of the directory.

This PR uses the fix name "deployarchive" to make things easier.
2020-02-12 09:29:27 +08:00
Ta-Ching ChenandGitHub b61f994746 Append Environment labels to function pod labels (#1530) 2020-02-11 17:49:14 +08:00
Ta-Ching ChenandGitHub 633593e412 Fix github_changelog_generator error (#1527) 2020-02-04 00:02:42 +08:00
Ta-Ching Chen e7c0ff7d41 CHANGELOG 1.8.0 2020-02-03 10:56:52 +00:00
Ta-Ching Chen bda974a72c Release 1.8.0 2020-02-03 15:19:16 +08:00
Ta-Ching Chen dbb2b49b55 Fix wrong path in release build script 2020-02-03 15:19:16 +08:00
Ta-Ching ChenandGitHub e770c619e5 Revert "Temporarily disable building JVM image during CI builds" (#1525)
This reverts commit 3687602508.
2020-02-03 15:02:48 +08:00
Ta-Ching ChenandGitHub 0d8d07d474 Update TerminationGracePeriod usage text (#1524) 2020-02-03 13:05:15 +08:00
Ta-Ching ChenandGitHub dd07c68201 Set package initial status if its empty (#1522)
If the user applies package YAML file has no status field,
the package won't be able to be compiled or deployed due
to lack of status. This PR aims to add a check at buildermgr
to set initial package status to those packages.
2020-02-02 00:39:02 +08:00
Ta-Ching ChenandGitHub e9804a5b76 Update slack invitation link (#1521) 2020-01-30 09:34:53 +08:00
Ta-Ching ChenandGitHub 85c384c64a Fix Java spec example (#1519) 2020-01-29 18:04:32 +08:00
Sahil LakhwaniandGitHub fed5fd4c5e JVM env: Add XML dependency (#1512) 2020-01-29 16:40:30 +08:00
Ta-Ching ChenandGitHub eec35b285e Fix executor wrongly deletes rolebindings (#1517)
Executor wrongly deletes role bindings if the user
creates an environment in the reserved namespaces. This
PR is a quick fix to solve the problem by checking if
an environment is under reserved namespaces.
2020-01-29 00:01:21 +08:00
Ta-Ching ChenandGitHub e2f1f778f3 Show global options in usage (#1516) 2020-01-28 19:37:07 +08:00
Ta-Ching ChenandGitHub 7b87d7c52c Add fake client for local command operation (#1515)
This PR adds a fake controller client for local CLI operations like 
offline spec generation or for unit test purposes. The fake client 
now only implements the "Version()" function and more functions 
will be implemented once we figure out how to achieve the goals 
mentioned above.
2020-01-28 17:38:43 +08:00
Ta-Ching ChenandGitHub c88fe59c71 Set prometheus.enabled=false in core chart (#1513) 2020-01-28 01:23:41 +08:00
Ta-Ching ChenandGitHub 9eac1512fb Fix poolmanager wrongly delete env pool (#1511)
The root cause of the problem is that eagerPoolCreator
tries to create the deployment when the poolmanager
is trying to delete it. To avoid this, start eager pool
creator after executor starts serving requests.
2020-01-28 00:58:37 +08:00
Ta-Ching ChenandGitHub 8f8afaf139 Use patch for robust pod metadata update in poolmgr (#1509)
Use "Patch" to update pod metadata instead of "Update" to avoid 
dropping fields that the old client-go doesn't support.
2020-01-28 00:04:22 +08:00
Ta-Ching ChenandGitHub e651433727 CI build steps optimize to reduce waiting time (#1508) 2020-01-27 21:05:17 +08:00
Ta-Ching ChenandGitHub 8ac7db46e0 Add Go 1.13 support and upgrade Go 1.12 version (#1507) 2020-01-27 20:07:39 +08:00
1e8148c051 Add resource exists error on spec validate (#1506)
Co-authored-by: Anubhav <50611570+anubhav6663@users.noreply.github.com>
2020-01-27 19:09:35 +08:00
Ta-Ching ChenandGitHub 520cc0e130 Add --dry option to view the generated spec without saving (#1504) 2020-01-24 20:43:42 +08:00
Ta-Ching ChenandGitHub 2338fbb06f Add sponsor logos (#1499) 2020-01-24 03:59:19 +08:00
Ta-Ching Chen 3687602508 Temporarily disable building JVM image during CI builds 2020-01-24 01:33:19 +08:00
Ta-Ching Chen 49ec161c5e Let unit tests run in different namespaces to avoid resource conflict 2020-01-24 01:33:12 +08:00
Ta-Ching ChenandGitHub 4923708836 Move to new CI cluster (#1500)
* Move to new CI cluster
* Regenerate test id before creating a new HTTP trigger
2020-01-23 13:35:26 +08:00
Ta-Ching ChenandGitHub 11f9ef1045 Follow kubernetes APIs directory structure (#1497) 2020-01-20 17:06:46 +08:00
Ta-Ching ChenandGitHub bb3e6d6907 Codebase cleanup & optimization (#1493)
Remove old v1 types that are no longer used and move fetcher structs to fetcher directory.
2020-01-16 16:47:32 +08:00
Ta-Ching ChenandGitHub 574fb55fcf Use code-generator to generate clientset/informer/lister (#1492)
To reduce maintenance effort and avoid writing duplicate informer code,
use code-generator to generate clientset/informer/lister code.
2020-01-16 15:18:38 +08:00
Ta-Ching ChenandGitHub b96ca0735d Add config for fetcher resource requests & limits (#1489)
This PR adds fetcher resource requests&limits chart setting 
and remove unreasonable limits value from the charts.
2020-01-15 11:21:48 +08:00
Ta-Ching ChenandGitHub c421e655c5 Update analytics URL (#1490) 2020-01-14 21:02:54 +08:00
Ta-Ching ChenandGitHub 66d4669f36 Push php-builder to dockerhub (#1477) 2019-12-30 19:27:59 +08:00
Ta-Ching ChenandGitHub 953f63c7bd Fix terminationGracePeriod is 0 due to wrong flag type (#1476) 2019-12-25 10:21:35 +08:00
Sahil LakhwaniandTa-Ching Chen fca1123ee5 Fix hello-spec-example (#1474) 2019-12-22 08:28:51 +08:00
AnubhavandTa-Ching Chen 5eaf11b8aa Add failed/success output to spec validate (#1471) 2019-12-20 12:00:47 +08:00
Ta-Ching ChenandGitHub 0274ceb312 Add message queue nats-streaming example (#1472) 2019-12-20 02:19:11 +08:00
dependabot[bot]andTa-Ching Chen 38f96c7e46 Bump rack from 2.0.6 to 2.0.8 in /environments/ruby (#1470)
Bumps [rack](https://github.com/rack/rack) from 2.0.6 to 2.0.8.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/2.0.6...2.0.8)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-20 00:45:46 +08:00
AnubhavandTa-Ching Chen 7b3cc8fdf0 Add spec list feature (#1468)
Adding fission spec list functionality. It lists Functions, Environment, Packages, HTTPTrigger, MessageQueueTriggers, Canary Config, TimeTrigger, KubeWatch created by an application specification.
2019-12-19 19:41:59 +08:00
Ta-Ching ChenandGitHub c184e7be65 Fix go-server failed to load plugin (#1469)
The 3rd party package version used by the go server 
may be different from the one in the user's source code 
and will cause plugin version mismatched. Hence, we 
should never import any external packages except the 
Fission or built-in packages.

This PR replaces all 3rd-party packages with built-in packages.
2019-12-19 02:54:31 +08:00
Ta-Ching ChenandGitHub bfbb80efcf Add controller API client interface (#1467)
This PR adds an interface for controller API client, it allows us to
implement mock API client for unit testing with ease and we are
able to generate spec file without accessing the real Fission server.
2019-12-16 23:14:14 +08:00
Sahil LakhwaniandTa-Ching Chen 01bdc5bf89 Remove FISSION_ROUTER for fn test (#1465) 2019-12-15 14:32:29 +08:00
Vivek SinghandTa-Ching Chen 711d7c2c41 Show the not present configmap/secret name while fn create in err message [CLI-UX] (#1462) 2019-12-10 22:58:52 +08:00
Ta-Ching Chen 2b4e53e926 CHANGELOG 1.7.1 2019-12-09 05:09:54 +00:00
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
Ta-Ching Chen 08b6d43ac1 Fission 1.6.0 2019-10-11 01:11:58 +08:00
Ta-Ching ChenandGitHub 53b075a315 Move statefulset to apps/v1 (#1350) 2019-10-10 23:42:40 +08:00
Ta-Ching ChenandGitHub b8311d43ce Fix newdeploy failed to find serviceEntry in cache (#1349)
When a function with executor type newdeploy got created, Newdeploy
is expected to create deployment/HPA/service for it and insert serviceEntry
to the cache for later use. Once clients call the function, newdeploy returns
the serviceEntry to the router.

However, the log shows that the newdeploy was unable to find the entry and
prints "Resource not found - key 'xxx' not found". The root cause is that the
informer controller instead of processing items in parallel, it dispatches XXFunc
to process items one by one. So if there is any problem during the creation of the
kubernetes resource, it takes a longer time to process the next item and hence
the serviceEntry was not inserted before clients call the function.

This PR lets the newdeploy to process items in extra goroutines instead of blocking
the process loop. It's a workaround to solve the problem above, we should consider
using workqueue to solve it in the future.
2019-10-10 23:32:36 +08:00
Ta-Ching ChenandGitHub 1075c5da13 Support encoded path in router (#1347)
Encoded path means the URL path contains encoded string like "/foo%2Fbar".
Gorilla/Mux by default doesn't enable encoded path support, you need to enable
it when initializing the router.

This PR adds a new environment variable USE_ENCODED_PATH to the router
deployment to enable encoded path support.
2019-10-10 02:23:41 +08:00
Ta-Ching ChenandGitHub 59c8569190 Support custom private go vendor (#1346) 2019-10-10 01:44:44 +08:00
Suraj BanakarandTa-Ching Chen 395a8adf37 Implement TLS authentication for kafka mqt (#1300)
* use secrets to store keys and certificates
2019-10-10 00:18:57 +08:00
Ta-Ching ChenandGitHub d358a29b17 Fix the namespace mismatch problem when deploying with a single YAML file (#1344)
If a user deploys fission in the namespace which is different from the one in the single YAML file generated by helm, fission components won't be able to talk to each other due to the wrong namespace appends after the service address.

This PR adds --namespace when generating the YAML file to prevent the mismatch problem.
2019-10-09 01:14:56 +08:00
Ta-Ching ChenandGitHub e253d2a376 Move charts executor service to the right place (#1343) 2019-10-07 18:44:58 +08:00
Ta-Ching ChenandGitHub bfd005a295 Allow to deploy router as DaemonSet (#1342)
ReplicaSet generated by Deployment distributes pods to nodes based
on nodes resource usage, which means in some cases the newly created
pods may be assigned to only a few nodes. The requests will go to the
same node if there multiple pods on it and may increase the node
resource usage and overall request latency.

To solve the problem mentioned above, this PR allows users to deploy
the router as DaemonSet so that we can distribute requests across all
nodes for better workload distribution and lower latency.
2019-10-07 18:09:36 +08:00
MengZeLeeandTa-Ching Chen c1a3bdd895 Add package filter feature (#1341) 2019-10-05 01:47:17 +08:00
Ta-Ching ChenandGitHub b18462b10b Fix executor doesn't apply user-configured container spec correctly (#1339)
The merge function executor used wasn't merge container correctly, and it
didn't merge all fields in spec except volumeMount & Env which confused people.

To apply the user-configured container correctly, this PR changes the way of merge
and follows rules:

1. Slices are merged and return an error if the elements in the slice have name conflicts.
2. Maps are merged, the value of map of dst container are overridden if the key is the same.
3. The rest of the fields of dst container are overridden directly.
2019-10-04 05:16:04 +08:00
Ta-Ching ChenandGitHub 30dba5dae9 Bump jvm builder JDK version (#1340) 2019-10-03 14:24:22 +08:00
Prabhu JayakumarandTa-Ching Chen f12880fb5c Allow to add annotations to router service in helm chart (#1338) 2019-10-02 14:48:36 +08:00
Ta-Ching ChenandGitHub c61442ee76 Remove too verbose and unhelpful debug log (#1336) 2019-10-02 01:35:23 +08:00
Vivek SinghandTa-Ching Chen 96ae708163 package will now be listed, sorted by lastupdatedtime (#1334) 2019-10-01 15:30:51 +08:00
Suraj BanakarandTa-Ching Chen b47b3ecb70 Fix kafka producer and consumer logs show empty objects (#1281) 2019-09-29 23:47:05 +08:00
Ta-Ching ChenandGitHub 7cdc146515 Move Deployment API group from extensions/v1beta1 to apps/v1 (#1331)
In 1.9, kubernetes prompted Deployment to apps/v1 and finally deprecated
extensions/v1beta1 support in 1.16. Users will see the following error message
in log when fission components try to submit Deployment to the k8s API server
and specify extensions/v1beta1 as API group.

error: unable to recognize "deployment": no matches for kind "Deployment" in version "extensions/v1beta1"

This PR updates call to k8s API server and apiKind in chart files to avoid fission failure in 1.16.
2019-09-29 22:16:33 +08:00
Ta-Ching ChenandGitHub e734fa3554 Fix router health route not found if no HTTP triggers created (#1333)
Router readiness probe failed due to kubelet cannot find router healthz endpoint.
This is caused that the healthz endpoint is added only when there is any update request
send to the updateRouterRequestChannel, and makes router failed.

This PR sends an update request right before the router is started to avoid the problem.
2019-09-28 17:43:04 +08:00
Ta-Ching ChenandGitHub 71b587b58e Use ErrorHandler to handle proxy error (#1310)
The router prints error no matter what error type it is.
It's useful for troubleshooting, however, it also prints
the context canceled error, which means that users abort
request before reply and its really normal nowadays. Also,
the router returns 502 if error is not nil and may confused
client if it's a timeout error.

To solve these problems, this PR adds an error handler to
reverse proxy to examine the return error and change the
status code when needed.
2019-09-28 14:22:20 +08:00
Ta-Ching ChenandGitHub 81ae6f38fc Fix spec doesn't update status of failed package when applying spec files (#1332)
Previously, the spec doesn't update the package status if nothing
in the spec file changed. Due to this, the failed package will
always stay in the failed state.

This PR adds a check to see whether a package is in the failed state.
If yes, then changes the state to pending for builder manager to rebuild it.
2019-09-28 04:35:57 +08:00
Ta-Ching ChenandGitHub 7fbb4098a4 Fix empty host value when list http triggers (#1328) 2019-09-28 00:28:14 +08:00
Ta-Ching ChenandGitHub f8af8b91f5 List/Delete HTTP triggers by function (#1327)
Previously, a user has to delete HTTP triggers point to
the same function one by one. This PR adds new flag --function
to list & delete commands. So that user can delete or list all
triggers with the same function. However, this feature is not
working for triggers with canary deployment setup.
2019-09-27 17:21:11 +08:00
Ta-Ching ChenandGitHub b5341edec0 Add Ingress TLS support (#1326)
This PR aims to add the Ingress TLS support by specifying the
TLS secret when creating/updating the HTTP trigger.

Command example:

fission route create --name foo \
    --url /foo/{bar} --function foofn --createingress \
    --ingressannotation "nginx.ingress.kubernetes.io/ssl-redirect=false" \
    --ingressannotation "nginx.ingress.kubernetes.io/use-regex=true" \
    --ingressrule "*=/foo/*"
    --ingresstls "foobartls"
2019-09-27 00:49:23 +08:00
Ta-Ching ChenandGitHub 49d60b19f3 Add Ingress host, path and annotations support (#1325)
For each ingress controller, the format of ingress host,
path and annotations are different. To support different
kinds of controller, this PR adds new ingress config field
to http trigger spec. A user can set annotations, host and
path based on the type of underlying ingress controller
with CLI.

Command example:

fission route create --name foo \
    --url /foo/{bar} --function foofn --createingress \
    --ingressannotation "nginx.ingress.kubernetes.io/ssl-redirect=false" \
    --ingressannotation "nginx.ingress.kubernetes.io/use-regex=true" \
    --ingressrule "*=/foo/*"
2019-09-26 16:54:16 +08:00
Ta-Ching ChenandGitHub 82a7acf408 Set maxSurge to 20% for safe rolling upgrade (#1321) 2019-09-23 16:11:56 +08:00
Ta-Ching ChenandGitHub 7bd57c208a Disable revision history for newdeploy (#1319) 2019-09-23 14:25:49 +08:00
Ta-Ching ChenandGitHub 27ec605955 Pre-built docker go module dependency cache image (#1318) 2019-09-18 05:07:53 +08:00
Ta-Ching ChenandGitHub c94e02b302 Fix newdeploy doesn't handle error properly (#1316) 2019-09-16 15:43:36 +08:00
Ta-Ching ChenandGitHub 5d2d65f05c Fix failed to update specialization timeout (#1315) 2019-09-16 13:21:25 +08:00
Ta-Ching ChenandGitHub 6d3d277cb9 Fix potential nil pointer problem when using multierror pkg (#1311) 2019-09-16 11:03:23 +08:00
Ta-Ching ChenandGitHub 4d654c6fe7 Add codecov config file (#1314) 2019-09-16 09:20:49 +08:00
Ta-Ching ChenandGitHub ecb97db913 Integrate with Codecov (#1308) 2019-09-11 14:52:45 +08:00
Ta-Ching ChenandGitHub 082c244b0b Fix executor unable to list secrets/configmaps (#1307) 2019-09-11 10:47:20 +08:00
parauliyaandTa-Ching Chen 678a2c7ad8 Configurable function level timeout (#1284) 2019-09-10 23:28:08 +08:00
Ta-Ching ChenandGitHub 78026ac573 Add specialization timeout default value to CLI (#1305) 2019-09-10 17:24:35 +08:00
Ta-Ching ChenandGitHub 4cfd459317 Update CHANGELOG for 1.5.0 (#1304) 2019-09-09 17:06:44 +08:00
Ta-Ching ChenandGitHub e481c234ee Fission 1.5.0 (#1303) 2019-09-09 15:38:27 +08:00
Ta-Ching ChenandGitHub 0d872020e3 Refactor support dump CLI (#1301) 2019-09-04 14:42:47 +08:00
moluzhangandTa-Ching Chen 62016b2f83 Support reverse query function for query log (#1298) 2019-09-02 18:02:07 +08:00
Ta-Ching ChenandGitHub 58811ab522 Fix unit tests failure (#1297) 2019-08-30 23:39:45 +08:00
David SheldonandTa-Ching Chen 19c60d1592 Fix environment version validation (#1253) 2019-08-30 19:02:18 +08:00
Vivek SinghandTa-Ching Chen cd36047660 Support for providing multiple CMs and secrets in fn create/update (#1282) 2019-08-30 17:13:24 +08:00
Ta-Ching ChenandGitHub ef8289ff73 Support nodejs function with 0 argument (#1295) 2019-08-30 15:31:04 +08:00
Emil NikolovandTa-Ching Chen ff47a8c1ed Fix wrong go environment error log for specializeHandlerV2 (#1294) 2019-08-30 13:37:32 +08:00
Ta-Ching ChenandGitHub 86b506c9b6 Add troubleshooting guide link (#1292) 2019-08-28 14:41:13 +08:00
Ta-Ching ChenandGitHub e762471d78 Bump Go version to 1.12 (#1290) 2019-08-28 13:47:40 +08:00
dependabot[bot]andTa-Ching Chen 1040a0d7e9 Bump nokogiri from 1.10.1 to 1.10.4 in /examples/ruby/parse (#1291)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.1 to 1.10.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.1...v1.10.4)

Signed-off-by: dependabot[bot] <support@github.com>
2019-08-28 12:23:37 +08:00
Ta-Ching ChenandGitHub c49377569e Refactor environment CLI command (#1265) 2019-08-27 15:43:59 +08:00
Ta-Ching ChenandGitHub 560aa34ce2 Fix typo extraCoreComponmentPodConfig -> extraCoreComponentPodConfig (#1287) 2019-08-27 14:12:51 +08:00
Ta-Ching ChenandGitHub ee18a88664 Update go dependencies (#1240)
NOTES for update k8s dependencies

In go.mod

require (
    k8s.io/api kubernetes-x.x.x
    k8s.io/apiextensions-apiserver kubernetes-x.x.x
    k8s.io/apimachinery kubernetes-x.x.x
    // check here https://github.com/kubernetes/client-go#compatibility-matrix
    k8s.io/client-go v12.0.0+incompatible
)
2019-08-23 16:17:12 +08:00
VishalandTa-Ching Chen 31b8c1ee3b Added community meetings and some other changes (#1273) 2019-08-23 13:20:09 +08:00
Ta-Ching ChenandGitHub 97b9350651 Improve CI integration test script (#1285) 2019-08-22 16:01:53 +08:00
Ta-Ching ChenandGitHub b9997b2ece Add swagger (OpenAPI 2.0) support (#1245)
* Add swagger (OpenAPI 2.0) support
* Gererate swagger_doc before building bundle image
2019-08-21 15:49:41 +08:00
Suraj BanakarandTa-Ching Chen 9c63975497 Fix typo "consumer" => "producer" (#1278) 2019-08-20 19:45:56 +08:00
Ta-Ching ChenandGitHub 8cafe1ebf3 Set full URL path to request header (#1266) 2019-08-20 16:44:21 +08:00
Ta-Ching ChenandGitHub 4dccfcc156 Fix go 1.9.2 & 1.11.4 shows "go mod not found" (#1276) 2019-08-20 10:12:48 +08:00
Suraj BanakarandTa-Ching Chen 7af711a48b Fix typo "specialing" -> "specializing" (#1275) 2019-08-19 16:19:28 +08:00
Suraj BanakarandTa-Ching Chen 80910562b3 Make NewDeployment specialization timeout configurable (#1260)
* Add specializationtimeout flag to function create/update
* Set specialization timeout of 120 seconds if not present
* Add default newdeploy timeout for rest of the test cases
* Comment out specialization timeout in validations for compatibility
* Add warning if specializationtimeout is lower than default value
2019-08-16 23:15:17 +08:00
cocoifly10andTa-Ching Chen 88b5343775 Fix Kafka message queue trigger panic problem caused by err.Error() (#1271)
fix bug: panic: runtime error: invalid memory address or nil pointer dereference
2019-08-14 17:07:29 +08:00
Ta-Ching ChenandGitHub a6e75b4da6 Use fuzzy version for openJDK dependency (#1269) 2019-08-13 16:17:10 +08:00
parauliyaandTa-Ching Chen 8fb0e9e10c Allow empty repository tag in chart values.yaml (#1259)
This fix allows the empty repository tag in values.yaml file. The changes are done in the templates of deployment and fluentbit where repository tag will be added in the docker image name only when specified with some value in case of empty repository tag image name contain the name of image and tag only.
2019-08-13 14:22:23 +08:00
msshroffandTa-Ching Chen 747d774a3c Make imagePullPolicy of logger pod configurable (#1263)
Added correct imagePullPolicy in fluentbit.yaml (logger)
2019-08-09 15:48:31 +08:00
Ta-Ching ChenandGitHub 7bbcaf2174 Allow to set deployment config uid during initialization (#1249) 2019-08-01 22:53:04 +08:00
Ta-Ching ChenandVishal ac21c037d6 Fix release script tagging wrong image name (#1257) 2019-07-30 14:51:25 +05:30
Ta-Ching ChenandGitHub 3b47daa8fc Update tensorflow serving image name in env README (#1256) 2019-07-30 14:30:16 +08:00
VishalandGitHub dff08a0a8e V1.4.1 (#1255)
Release 1.4.1
2019-07-29 16:14:49 +05:30
Ta-Ching ChenandGitHub 74ad096158 Fix wrongly replace spec api version (#1254) 2019-07-29 13:49:05 +08:00
David SheldonandTa-Ching Chen be84f9ec93 Revert change of product name in README (#1250) 2019-07-26 19:37:55 +08:00
VishalandTa-Ching Chen 6e440f11cd Analytics env fix in chart (#1247) 2019-07-25 19:25:34 +08:00
Ta-Ching ChenandGitHub 655a76447e Fix CI unable to start test due to the same travis build ID (#1246) 2019-07-25 15:54:12 +08:00
VishalandGitHub dc0fc839ed V1.4.0 (#1244)
For release 1.4.0
2019-07-25 11:39:33 +05:30
Ta-Ching ChenandGitHub efe1209550 Update flask version to resolve CVE alert (#1243) 2019-07-23 11:08:23 +08:00
VishalandTa-Ching Chen 93c5b53b77 Function Update if config/secret changes (#1224)
* Config and secret change to invoke function update
* Added recycle function for pool manager as well - where it recycles the specialized pods
* Switched to rolling update of pods and env variable based change instead of deleting pods in new deploy executor
2019-07-23 09:27:43 +08:00
Ta-Ching ChenandGitHub 1beaa9ec13 Change log-level for better performance and less annoying logs (#1231)
This PR removes not so useful logs and changes most of Info level
log to Debug/Error level in hot path while preserving some of them
that is helpful for troubleshooting.
2019-07-19 12:38:36 +08:00
Ta-Ching ChenandGitHub 6e00733f68 Fix roundtripper doesn't increase request timeout setting after each retry (#1216) 2019-07-19 00:46:57 +08:00
David SheldonandTa-Ching Chen 3bffd27c74 Fix typo where "spec" is spelt "sepc" in some dump directories. (#1239) 2019-07-16 09:47:07 +08:00
Ta-Ching ChenandGitHub 971a314d63 Fix fetcher client doesn't handle error properly (#1238) 2019-07-15 21:01:32 +08:00
Ta-Ching ChenandGitHub 40e1689e49 Fix build failed due to script unable to find configmap (#1237) 2019-07-15 17:54:37 +08:00
Ta-Ching ChenandGitHub fe8fa94c77 Enable concurrent CI builds (#1236)
Currently, only one CI build can be started at the same time due to we only have only one testing cluster. This PR aims to enable multiple concurrent builds can be triggered to reduce the waiting time for CI builds. The major changes listed below:

1. Each build generate unique images for testing and debugging
2. Check whether the testing cluster is being used by another build.
3. Cache docker image & go mod after build finished
4. Improve dockerfiles for reusing docker build cache
2019-07-15 16:33:26 +08:00
Ta-Ching ChenandGitHub a9dd4bf81a Fix fetcher of newdeploy pod error out when starting up (#1210)
* Connect to k8s API server to ensure network connectivity
* Fix readiness probe path
2019-07-14 21:09:35 +08:00
Ta-Ching ChenandGitHub 56beac6508 Make router keep-alive setting configurable (#1225) 2019-07-12 12:12:04 +08:00
Ta-Ching ChenandGitHub b0b29da388 Replace localhost with 127.0.0.1 to prevent DNS resolving problem (#1227) 2019-07-12 09:16:10 +08:00
Ta-Ching ChenandGitHub c1cb9603a5 Fix release script wrongly tags builder as env image (#1226) 2019-07-10 16:03:14 +08:00
Ta-Ching ChenandGitHub 58722f849a Enable go module support for go environment (#1152) 2019-07-10 14:00:29 +08:00
Ta-Ching ChenandGitHub 9e7dd5aa27 Fix nil pointer when CLI unable to get server version (#1223) 2019-07-07 09:55:00 +08:00
Ta-Ching ChenandGitHub 9d13081803 Allow to set log level through environment variable (#1217) 2019-07-07 04:39:42 +08:00
Ta-Ching ChenandGitHub 78a774cfd9 Reuse go docker build cache (#1218) 2019-07-06 09:30:27 +08:00
Ta-Ching ChenandGitHub 9f51f9064d Fix poolmanager specializes a function pod repeatedly if istio is enabled (#1208) 2019-07-03 11:26:35 +08:00
Ta-Ching ChenandGitHub b229d6e1b0 Add experimental environment: tensorflow-serving (#1212) 2019-07-02 15:43:55 +08:00
Ta-Ching ChenandGitHub 2ba66afb9f Fix Istio-proxy cannot collect HTTP-level information (#1209) 2019-07-02 00:08:29 +08:00
VishalandTa-Ching Chen 36e544b537 Configmaps/secrets in function exist check (#1214) 2019-07-01 18:09:07 +08:00
cocoifly10andTa-Ching Chen 5ec841cf2e Modify code to make log collection comprehensive (#1206) 2019-06-24 16:33:42 +08:00
Ta-Ching ChenandGitHub 981bb21756 Reuse maven build cache in JVM environment build process (#1207) 2019-06-20 17:03:17 +08:00
Ta-Ching ChenandGitHub a297a67385 Fix executor panic problem when specialization timeout (#1211) 2019-06-20 13:56:02 +08:00
moluzhangandTa-Ching Chen 5445b75af9 [bugfix] Fix CLI drops controller URL path when querying logs (#1201) 2019-06-17 18:31:02 +09:00
Ta-Ching ChenandGitHub e189ac4fc2 Fallback to get user home directory from env (#1203) 2019-06-05 12:56:30 +08:00
Ta-Ching Chen 4bc5d49792 Add ruby/dotnet20 environment builder to release script 2019-06-03 20:57:55 +08:00
Ta-Ching Chen 3860039f9a Update v1.3.0 changelog 2019-06-03 20:15:49 +08:00
Ta-Ching Chen cb8605cf60 Fission 1.3.0 2019-06-03 18:26:34 +08:00
Ta-Ching ChenandGitHub 4c4bb1bc2e Check fission CLI & server git commit SHA before test (#1200)
Check fission CLI & server git commit SHA before test 
to make sure we test against with the same commit.
2019-06-03 14:27:58 +08:00
Ta-Ching ChenandGitHub a3fd606197 Update bug issue templates (#1198) 2019-06-03 08:24:07 +08:00
Soam VasaniandTa-Ching Chen a473335ceb Allow non-toplevel modules in python environment (#1042) 2019-06-02 15:16:10 +08:00
Ta-Ching ChenandGitHub 93d4f2c77a Add static code analysis to CI test (#1197) 2019-06-02 14:29:38 +08:00
Ta-Ching ChenandGitHub 1562cba420 Add readiness/liveness probes to nat-streaming (#1199) 2019-06-02 13:41:24 +08:00
Soam VasaniandTa-Ching Chen 6bab9dcbaa Analytics bugfix (#1195) 2019-06-02 10:10:44 +08:00
Ta-Ching ChenandGitHub 1d266537b0 Show warning message if spec alters poolsize while env version < 3 (#1193) 2019-05-31 17:49:56 +08:00
Ta-Ching ChenandGitHub a0e9a39511 Move packages to proejct/pkg to follow go project folder structure convention (#1190) 2019-05-31 16:28:55 +08:00
Chia-Chun TaiandTa-Ching Chen 1c5fd92ad6 Add Terraform configuration and upgrade helm version (#1194)
* Use terraform to manage ci cluster. Upgrade ci cluster to 1.13
* Upgrade helm version
* Do not break the test if no previous resources
* Do not skip install helm if helm is old version
2019-05-31 15:44:42 +08:00
VishalandTa-Ching Chen d578539391 Add kubernetes podSpec support in fission spec (#1106) 2019-05-29 03:31:14 +08:00
VishalandGitHub 49f9944b86 Skaffold for Fission (#1172)
Skaffold for development of Fission and switching to multi-stage Dockerfile for all components.
2019-05-27 12:51:00 +05:30
Chia-Chun TaiandTa-Ching Chen c3177f9ebd Test framework improvement (#1128) 2019-05-23 22:52:39 +08:00
Soam VasaniandTa-Ching Chen 1e8dfa38da router analytics -- close http response body (#1180) 2019-05-22 21:41:57 +08:00
Laurence HudsonandTa-Ching Chen 897771546b Add affinity support (#1170)
* Add support for setting nodeSelector/affinity/tolerations on all deployments of fission components.
* Add extraCoreComponmentPodConfig helm value to allow setting of affinty/tolerations/nodeSelectors/etc on core pods
2019-05-22 17:09:29 +08:00
Paras PatidarandTa-Ching Chen 4632269314 Created dotnet2.0 Builder Image and Added /v2/specialized Endpoint to dotnet2.0 Envrionment (#1001) 2019-05-15 16:35:55 +08:00
Ta-Ching ChenandGitHub 56fa8fe766 Remove prometheus server connectivity test during controller initialization (#1179)
The prometheus server may not come up in a short time or when a cluster doesn’t have a storage class config. Because of this, the connectivity test will increase controller initialization time and so the controller will fail at readiness probe detection. Since we don’t want to delay the time that controller comes up also canary config manager prints error log when it failed at connecting to prometheus server, remove the connectivity test here.
2019-05-10 14:25:24 +08:00
VishalandGitHub 09589ea9ef V1.2.1 (#1178)
Release 1.2.1
2019-05-09 15:36:06 +05:30
VishalandGitHub 69de5e03d3 Fixes broken config path for functions (#1177) 2019-05-09 13:12:52 +05:30
Caner PatırandTa-Ching Chen f8dfc75872 Fix dotnet/dotnet20 example (#1175) 2019-05-08 21:21:21 +08:00
VishalandGitHub a2c276e0cd V1.2.0 (#1171)
Release 1.2.0
2019-05-04 09:06:40 +05:30
JZinklandSoam Vasani 84da480ff4 #1132 nodejs environment, increase body size (#1149)
This will increase the maximum body-size in the nodejs environment to 1mb, to reflect the NATS maximum message size.  The old limit was 100kb.
2019-05-02 12:23:25 -07:00
VishalandGitHub c88033fc0b DRY up fetcher configuration (#1168)
Consolidates the addition of the fetcher container to the pod into a new type FetcherConfig and takes care of serviceAccountName if not set. Also added PreStop lifecycle handler if pod set TerminationGracePeriodSeconds
2019-05-02 21:39:42 +05:30
Soam VasaniandGitHub 23f3585245 Add simple anonymous usage metrics (#1167)
This change reports total function call count to an analytics url once a day.

It's done behind the existing analytics flag.
2019-04-30 15:48:04 -07:00
msshroffandVishal 9a3cc517d0 Using templated imagePullPolicy for containers in deployment.yaml (#1137)
Configured imagePullPolicy to be used from values.yaml for some system container such as InfluxDB, Heapster etc.
2019-04-26 16:05:11 +05:30
Chia-Chun TaiandVishal 3cbb02465b Fix the logger not working (#1166) 2019-04-26 14:03:51 +05:30
Erwin van EykandVishal 47c5cee459 Add links to examples for each Fission environment (#1090) 2019-04-25 20:36:14 +05:30
VishalandGitHub 1a5b0ec567 Function update after change in env (#1116)
If an environment image changes then the new deployment function also should be updated with the newer image
2019-04-25 17:03:56 +05:30
Erwin van EykandGitHub 664ad5f26e Add configurable timeout to fission fn test (#1091)
Currently the implementation of the CLI (or any Fission component) specifies any timeout on
the fission fn test functionality. If a user function or environment does not specify any
timeout the command will stall. Nor is there any parameter to set a timeout if the user
wanted to.

This change sets the sensible default for the timeout to 30 seconds, to avoid new
users having to figure this out the hard way. The alternative could be to set the timeout to
0 (no timeout).

Future work: extend this timeout parameter to a global flag, and support
timeouts on all CLI commands.
2019-04-24 13:08:28 +02:00
Ta-Ching ChenandGitHub 8015ab9a1e Change log level in executor for better log reading/troubleshooting (#1163) 2019-04-15 23:02:55 +08:00
VishalandTa-Ching Chen 85c1474c60 Added php builder to release script fixes #1140 (#1145) 2019-04-09 21:55:22 +08:00
Ta-Ching ChenandGitHub 94046eeffd Fix TravisCI go environment version to avoid go bugs (#1154)
From go release history (https://golang.org/doc/devel/release.html#go1.11)
and travis ci build history, looks like 1.11.7 and 1.11.8 contains unknown
bugs that breaks build. To avoid this, fix go version to 1.11.6 for now.
2019-04-09 16:38:40 +08:00
Ta-Ching ChenandGitHub 1662bafb50 Migrate from glide to official dependencies management tool: Go Module (#1136) 2019-04-04 22:33:26 +08:00
Ta-Ching ChenandGitHub 913888a29d Fix misleading log when setup portforward (#1134) 2019-04-01 17:03:19 +08:00
Jon CarlandTa-Ching Chen 24600c20c5 Support KUBECONFIG with multiple kube config files (#1126)
* support KUBECONFIG with multiple kube config files
* use a more cross-platform friendly implementation to get the current users home dir
2019-04-01 15:25:05 +08:00
VishalandGitHub b7a41cbd89 V1.1.0 (#1129)
Fission Release 1.1.0
2019-03-25 18:56:02 +05:30
Erwin van EykandTa-Ching Chen adceee1be0 Support --plugin parameter in Fission CLI (#1111)
* Added support for --plugin parameter in Fission CLI

This fixes the issue that renaming fission  to fission-XYZ would cause a fork bomb, due to the CLI recursively calling itself to discover plugins.
2019-03-20 00:15:29 +08:00
Ta-Ching ChenandGitHub cdcc6fb3ab Add connection lost handler for NATS-streaming (#1125) 2019-03-19 21:13:49 +08:00
Ta-Ching ChenandGitHub 3a8b9ccd80 Bump base image version of Go environment to 1.11.4 (#1026) 2019-03-19 18:29:19 +08:00
VishalandTa-Ching Chen c496d35d12 Change RBAC api version to v1 (#1124)
As of K8s 1.8, RBAC mode is stable and backed by the rbac.authorization.k8s.io/v1
API. Using v1beta1 API version for RBAC based objects fails helm deployment
of fission on minikube
2019-03-18 23:45:16 +08:00
VishalandGitHub 92d66fa82b Configurable zero pool size in case of newdeploy function (#1121)
It should be possible to keep zero pool size when the environment is created so that there are no idle resources for a newdeploy function. Fixes: https://github.com/fission/fission/issues/1104
2019-03-18 15:52:29 +05:30
Soam VasaniandTa-Ching Chen 4e4c8aa14f Switch from fluentd to fluentbit for log forwarding (#1086)
This removes fluentd in favor of using fluentbit, which is lighter (in
memory usage) and seems to be more actively maintained.

Fluentbit's config file format is different from fluentd's.  It also
doesn't support the same record modification stuff that fluentd
supports, so we have to change the influxdb query slightly.  This
means that after an upgrade, the new CLI may won't work for querying older 
logs.  Hopefully, this slight breakage is acceptable; if users 
really need older logs they can use the older CLI.
2019-03-18 15:42:37 +08:00
Jon CarlandVishal 0fc864f230 use zap for logging (#1112)
Use zap for logging
2019-03-14 21:11:15 +05:30
Brendan StennettandTa-Ching Chen c717f182b6 Added support for Ruby v2 Specialization (#1101)
* Added support for Ruby v2 Specialization
* Added ruby v2 example with builder code
2019-03-13 22:55:26 +08:00
Alberto LopezandTa-Ching Chen f104f0b46b PHP 7.3 v2 Specialization (#1110)
* Added support for PHP 7.3 v2 Specialization
* Add builder dockerfile for PHP7
* Support mcrypt in PHP 7.3
2019-03-07 17:05:23 +08:00
VishalandGitHub 38b8cfaa0a Adding annotations for prometheus scraping to fission-core (#1098) 2019-03-06 17:34:23 +05:30
Ta-Ching ChenandVishal 49e0c3587b Fix canary config manager creation error in controller (#1105)
Fixing failure of the controller startup when Prometheus is provided as env variable and it fails to parse correctly
2019-03-06 15:50:09 +05:30
Erwin van EykandVishal f8ad9c421a Python examples: Added a minimal 'getting started' (#1103)
This adds a simple README with (1) a description of the examples in this directory, and (2) the minimal steps to getting started.
2019-03-04 17:37:59 +05:30
Bhavin GandhiandVishal 3358fca753 [Kafka MQT] Add warning about Kafka version (#1083)
For Kafka version < 0.11.0.0 log a warning about headers not being passed in the HTTP request
2019-02-26 16:35:17 +05:30
VishalandGitHub d65a0cb9dc Added draft proposal for CI/CD (#1084)
A proposal for CI/CD with Fission functions
2019-02-25 15:38:17 +05:30
VishalandGitHub 9ec0084c8b V1.0.0 (#1100)
Fission 1.0.0 release
2019-02-14 08:00:51 +05:30
VishalandGitHub 8e6ac31e49 V1.0 (#1094)
Changelog and chart change for 1.0
2019-02-09 09:47:32 +05:30
VishalandGitHub 5d2abdd95b OpenTracing for Fission (#1079)
Added Opentracing integration using opencensus libraries for all Fission components.
2019-02-07 11:56:41 +05:30
Ta-Ching ChenandGitHub 8b0a201f69 Fix executor tries to create same name deployment (#1082)
The root cause of the issue was introduced by PR https://github.com/fission/fission/pull/1009/files .
To be short, even the CRD of environment was delete, it still takes time for executor (poolmgr) to destroy env pool. In our cases, the previous test creates an env and delete it when test finished, then the next one creates the same name env, but failed to create pool due to the deploy name conflict. So the executor selects the pod from the first created env pool. Then, executor starts to delete the env pool, and makes the pod state became Termination state. To fix this problem, a unique name of deployment will be returned after this PR to prevent the name conflict.
2019-01-30 22:14:14 +08:00
Bhavin GandhiandTa-Ching Chen 1806259637 Consider Pod Phase in IsReadyPod (#1080) 2019-01-28 13:15:38 +08:00
Chia-Chun TaiandTa-Ching Chen 6893403ba7 Fix unable to update the function value of route (#1081) 2019-01-28 10:22:33 +08:00
Ta-Ching ChenandGitHub f24b016346 Fix goroutines change DialContext of http.DefaultTransport in router (#1063) 2019-01-26 04:48:10 +08:00
Chia-Chun TaiandTa-Ching Chen b5b689973b Improve helm charts README (#1064) 2019-01-26 02:05:08 +08:00
VishalandTa-Ching Chen 101e188f41 Clear message in case of function/pod failure (#1069)
* Clear message in case of function/pod failure
* Added err handling while getting pods
* Using multierror instead of strings
2019-01-23 22:26:13 +08:00
Ta-Ching ChenandGitHub 5ff875b1ac Fix fluentd plugin version to prevent version incompatible problem (#1076) 2019-01-23 20:18:37 +08:00
VishalandTa-Ching Chen 1dbb4f4fb7 Adding requirements file check for python environment (#1067)
* Adding check for requirements file, in case user is simply using a source file and --src flag
* Adding bash check as per review comment
2019-01-22 10:26:21 +08:00
VishalandTa-Ching Chen 68a511184f Fix spec archives one zip file twice (#1068) 2019-01-22 00:07:57 +08:00
Chia-Chun TaiandTa-Ching Chen 2efa255eb4 Prevent helm from adding meaningless blank lines to kubernetes objects YAML (#1065) 2019-01-21 19:54:40 +08:00
VishalandGitHub 3c4fdb0659 Mac test utility (#986)
A utility for running individual or all tests on a Mac dev machine without changing the test script.
2019-01-20 16:51:45 +05:30
Bhavin GandhiandSoam Vasani e4746007da Make extra configuration a sub heading (#1062)
- That makes it easy to link at different places
2019-01-17 11:12:44 -08:00
Ta-Ching ChenandGitHub 5e1e8f85cd Remove/Redirect out-of-date docs to fission doc site (#1061) 2019-01-17 16:29:15 +08:00
Ta-Ching ChenandGitHub 273c6c002f Replace router svcAddrUpdateLocks with new throttler package for code readability&reusability (#1047)
Rename svcAddrUpdateLock to Throttler and move it to the top-level directory as a package for code import.
2019-01-16 12:37:46 +08:00
VishalandGitHub a21dbd182c Bumped up default Max CPU for fetcher, fixes #1058 (#1059)
Default Max CPU for fetcher should be higher so that the unzipping of larger files can use more CPU if needed.
2019-01-16 07:49:46 +05:30
VishalandGitHub 0c3d7da5c8 V1.0 rc2 (#1056)
Release 1.0-rc2
2019-01-15 00:15:01 +05:30
smruthi2187andTa-Ching Chen db5165e032 Send the error message to user when enabling canary feature fails. (#990)
* Send the error message to user when enabling canary feature fails.
* Fix controller doesn’t reply canary error when promClient tries connect to invalid prometheus server
2019-01-14 22:43:27 +08:00
VishalandTa-Ching Chen 89081b087b Changed Kafka topic name validation (#1051)
* Changed Kafka topic name validation so that capital characters are also allowed
* Removing support for \ in Kafka topic name
* Using raw string some specific sequences
2019-01-14 19:23:06 +08:00
Bhavin GandhiandVishal 37f37c0b8b Add support for Kafka record headers (#1025)
Added support for Kafka headers to be passed and retrieved from functions. The headers and supported and work only for Kafka version 0.11.0.0 and higher.
2019-01-12 21:16:13 +05:30
VishalandGitHub ad4c4cd014 New deploy should clean up objects it created if there are errors (#1040)
The PR cleans up resources left behind if there is an error while creating resources for new deployment executor functions
2019-01-11 13:27:02 +05:30
Erwin van EykandVishal 16efdaa25c Add fluentd.conf as a configmap (#792)
Logger's - FluentD config can be passed as a configmap so that user can customize the configuration to their needs
2019-01-10 17:39:22 +05:30
Peng QiaoandSoam Vasani 0651291e2d solve kubernetes/client-go nested vendor (#1048) 2019-01-08 18:07:25 -08:00
VishalandGitHub 914a0c48d2 Draft proposal for annotations (#992)
Draft proposal for annotations on httptriggers and other resources in future
2019-01-08 11:00:29 +05:30
VishalandGitHub c0502c7b7c Makes router URL for Kafka trigger configurable (#1045) 2019-01-04 15:12:02 +05:30
Josh KatzandSoam Vasani 6cd7c4dff0 Include All Currently Supported Trigger Types (#1043)
Update README to include all currently supported trigger types with links to documentation.
2019-01-03 12:57:34 -08:00
Ta-Ching ChenandGitHub 37846a5827 Fix requests are sent to unready function pod (newdeploy) (#1005)
* Refactor specialization process
* Separate readiness and liveness probe to different routes

For newdeploy, readiness probe should check whether a fetcher specializes env container successfully or not. In this commit, fetcher returns the actual state of current specialization status instead of returning 200ok directly.
2018-12-27 16:29:31 +08:00
Ta-Ching ChenandVishal 04e6433d5d Fix cli create archive with nonexistent file (#1036)
CLI should return an error if user specifies a file that does not exist
2018-12-27 11:06:39 +05:30
Ta-Ching ChenandGitHub f9f5fe436a Fix go env panic when failed at loading plugin (#1031)
Fix go env panic when failed at loading plugin to make it easier for troubleshooting.
2018-12-27 00:14:22 +08:00
Ta-Ching ChenandGitHub f68572ce78 Refactor RoundTrip function for better code reading (#991) 2018-12-25 13:31:15 +08:00
Ta-Ching ChenandGitHub ecd99177bb Update dotnet and perl environment docs for rebuilding env images (#1035) 2018-12-23 17:48:09 +08:00
Bhavin GandhiandTa-Ching Chen 3f4eb49c2f [python-env] PEP8 Fixes for server.py (#1034)
Fixes PEP8 errors for environments/python/server.py
2018-12-21 14:20:12 +08:00
Ta-Ching ChenandGitHub 8e6f6ffda9 Use Header.Set() to override the existing header value (#1032)
Header.Add() appends string if there are same header key exists. Use Header.Set() to prevent this.
2018-12-20 17:23:26 +08:00
Ta-Ching ChenandGitHub 85f8dcc2b2 Fix builder shows "http: multiple response.WriteHeader calls" (#1029) 2018-12-20 01:29:15 +08:00
Ta-Ching ChenandGitHub 0a135173b4 Fix builder & newdeploy not using latest image during CI build (#1033) 2018-12-19 22:35:28 +08:00
Bhavin GandhiandTa-Ching Chen 34b9be0bd3 Add link to values.yaml in charts' README.md (#1023)
Makes it easy to find the values.yaml of fission-all chart
2018-12-14 15:33:15 +08:00
Ta-Ching Chen 6f2d8f5372 Update charts version & changelog to v1.0-rc1 2018-12-13 17:45:50 +08:00
Ta-Ching Chen 045ab734c6 Fission v1.0-rc1 2018-12-13 15:45:32 +08:00
Soam VasaniandTa-Ching Chen 2699aa6069 Handle duplicate archive and package specs; handle multifile archives better (#1018)
Archives with multiple files should have all files in the inputs.
Also clean up some inconsistent variable naming -- archive name,
archive file path, and archive input files were all stored in
incorrectly-named variables.
2018-12-11 16:35:31 +08:00
Ta-Ching ChenandGitHub f0c0936b87 Validate command flag input by adding cli hook (#1017) 2018-12-10 23:48:33 +08:00
Ta-Ching ChenandVishal 314e16a88e Pre-create kubernetes resources for function with minScale=0 (#976)
Pre-create Kubernetes resources if functions has MinScale=0 and then scale when first function is called.
2018-12-03 15:52:07 +05:30
Ta-Ching ChenandGitHub 72faa927de Use executor type as a delimiter to prevent deploy name conflict (#1009) 2018-11-30 13:04:44 +08:00
VishalandTa-Ching Chen 19b52938c3 Improve archive package user experience (#927) 2018-11-29 23:00:38 +08:00
Ta-Ching ChenandGitHub 7cedf8d580 Fix issues when specifying resources/scales during updating/creation process (#970) 2018-11-29 20:46:48 +08:00
Ta-Ching ChenandGitHub 17cbc5baad Upgrade environment dependencies for security alert (#1006) 2018-11-29 16:38:38 +08:00
Ta-Ching ChenandGitHub c2bcbb06a9 Rename canary flag name from funcN/funcN-1 to newfunction/oldfunction (#1003) 2018-11-28 16:27:29 +08:00
VishalandTa-Ching Chen 152c899e8b Added warning when package env and environment env mismatched (#996)
Fix issue #946
2018-11-26 19:05:00 +08:00
Ta-Ching ChenandGitHub c476f54a6c Fix MQ trigger (NATS) wrongly sends error message to response topic (#1002) 2018-11-25 10:07:46 +08:00
Ta-Ching ChenandGitHub 4b5ab0ad93 Shorten executor kubernetes objects name (#975) 2018-11-24 20:41:38 +08:00
smruthi2187andTa-Ching Chen 82af0e554a Fix Read on Closed body error (#963) 2018-11-21 14:27:52 +08:00
Harald NordgrenandTa-Ching Chen b456dec138 Update formatting directive logic to unbreak tests 2018-11-20 17:24:41 +08:00
Ta-Ching Chen 4a8c200c37 Fix helm command not found issue when kubeconfig is not provided. 2018-11-20 17:24:37 +08:00
VishalandTa-Ching Chen 52b736c892 Package info error should warn user (#995) 2018-11-20 00:44:20 +08:00
Ta-Ching ChenandVishal d9eee058ce Newdeploy - change only in minscale should not restart deployment 2018-11-15 15:31:28 +05:30
Soam VasaniandVishal 3676602fa2 Specs for JVM example (#825) 2018-11-15 00:00:26 +05:30
Ta-Ching ChenandGitHub 4f3b7de04a Fix release script failed to generate yaml for nonhelm installation (#978) 2018-11-14 15:02:43 +08:00
VishalandTa-Ching Chen cdf5838420 Upgrade OpenJDK8 to latest available version (#985) 2018-11-13 18:00:38 +08:00
Soam VasaniandTa-Ching Chen a714983c28 Fix the analytics jobs in the YAMLs (remove duplicates) (#977) 2018-11-08 14:39:37 +08:00
Steven DakeandSoam Vasani b9547160b5 Properly render Helm charts (#969)
* Properly render Helm charts

Fixes: https://github.com/fission/fission/issues/968

* Addres reviewier comments
2018-11-06 13:27:17 -08:00
Ta-Ching ChenandGitHub bfa8e6a45f Show builder image when list all envs (#971) 2018-11-05 23:18:37 +08:00
Ta-Ching ChenandGitHub 9764eff05d Fix CLI not shows package name when creating a function (#966) 2018-11-05 17:19:05 +08:00
Ganesh GuttikondaandTa-Ching Chen 253e44fdbe Updating the compile documentation link (#965)
* Updating the compile documentation link
* Changing the protocol to https
2018-11-05 15:41:22 +08:00
smruthi2187andGitHub 585d86448f V0.12.0 (#967) 2018-11-01 15:57:25 -07:00
smruthi2187andGitHub dad7b6632e Keep prometheus and canary deploy set to false in fission-core (#964) 2018-11-01 13:02:46 -07:00
Soam VasaniandGitHub 4e9e025ca4 Remove version from release name since it contains illegal chars for names (#939)
* Remove version from release name since it contains illegal chars for names

* Put version in release name for uniqueness, but remove invalid chars

* Remove prometheus=false yaml
2018-10-31 14:54:25 -07:00
Ta-Ching ChenandGitHub b6ea85e353 Fix failed to pull influxdb image from dockerhub (#957)
* Fix failed to pull influxdb image from dockerhub
* Disable jvm test temporarily (issue 958)
2018-10-31 16:32:45 +08:00
Ta-Ching ChenandGitHub 29aabaabda Optimize function latency when cache expired/invalid under high concurrency (#856)
* Optimize router response time by adding update lock

In 0.9.2, the router sends multiple GetServiceForFunction requests to executor
to get the service URL. However, the response time of executor will increase
under high-concurrency situation due to too many requests are waiting for
processing.

To solve the problem, an update lock was added to the router. All of goroutines belongs
to the same function need to grab the update lock before sending the request.
Only the first goroutine which gets the update lock is allowed to send request.
In this way, we reduce the burden of executor and lower the failure rate.
2018-10-27 23:35:00 +08:00
David McGillicuddyandSoam Vasani 394c5b13f4 Update readme to include JVM (#953) 2018-10-24 09:03:27 -07:00
smruthi2187andGitHub 0a8c6e97a6 Feature flag to enable/disable canary + optional prometheus install (#937) 2018-10-22 15:24:43 -07:00
VishalandGitHub e7f1d4564a Kafka tests (#944)
A simple test for Kafka integration which runs locally provided cluster has Kafka and Fission install has Kafka integratiom enabled (mqtrigger-kafka deployment present).
2018-10-22 20:07:51 +05:30
Ta-Ching ChenandGitHub 619b390af3 Support for full url (base on aalubin changes) (#941) 2018-10-21 04:04:07 +08:00
smruthi2187andGitHub 1488d0ca2d fix a few canary deployment issues (#943) 2018-10-19 14:56:40 -07:00
smruthi2187andGitHub dd35750482 Return the error on failed specializations with fn test --debug (#917) 2018-10-19 11:17:58 -07:00
Ta-Ching ChenandGitHub 5aeba59b75 Bump flask version (#942) 2018-10-18 22:56:04 +08:00
Soam VasaniandGitHub 8329ef36b3 demo script updates (#934)
Demo script updates.  Record-replay, a bugfix in the canary demo script, etc.
2018-10-15 14:48:01 -07:00
VishalandGitHub 4cc42fb216 Adding JVM heap options to environment (#936) 2018-10-15 23:01:43 +05:30
Ta-Ching ChenandGitHub d23b210f4e Add X-Forwarded-Host to request header (#890) 2018-10-15 14:17:18 +08:00
VishalandGitHub 803dbd6d39 Added build and push procedures for Nodejs builder environment (#916) 2018-10-03 08:07:23 +05:30
Ta-Ching ChenandGitHub e4213f6eb6 Fix flag not found problem when running canary demo scripts (#914) 2018-10-02 22:07:03 +08:00
VishalandGitHub 2d2576cf2d V0.11.0 (#913)
Release v0.11.0
2018-10-02 00:08:29 +05:30
VishalandGitHub 96cbee185d Kafka integration (#831)
Kafka integration with Fission enables invoking a function when a message arrives in a Kafka topic
2018-10-01 18:03:31 +05:30
VishalandGitHub 9f83d70b63 Fixes #758, uses v2 specialize for env versions 2 or higher (#911) 2018-10-01 10:07:49 +05:30
VishalandGitHub 7deb45bed2 Making the Maven build quite for Java env test, right now it is too verbose for CI (#902) 2018-10-01 08:00:45 +05:30
smruthi2187andVishal 12d3a04bf9 Print status with the get option. (#907) 2018-09-28 22:19:24 +05:30
smruthi2187andGitHub fa565b75ae Canary deployments for fission functions. (#892) 2018-09-25 18:26:26 -07:00
Michael GaidaandVishal 437d4dc04d Configurable namespace creation (#855)
Configurable namespace creation defaulting to true (backward compatible)
2018-09-25 13:49:08 +05:30
VishalandGitHub 188138ccd8 Fixed the spec validation UX issue (#898)
Improved some of warnings/messages shown to the user when using `fission spec` command. The `spec validate` command now shows appropriate warnings instead
2018-09-21 14:52:49 +05:30
Ta-Ching ChenandGitHub 6b49c194ca Fission supportability: Add dump command to dump information for debugging (#754)
* Add v1 support tool proposal
* Fission supportability: Add dump command to dump information for debugging
2018-09-19 14:35:51 +08:00
Ta-Ching ChenandGitHub a86c9431d3 Check CRD creation error instead of doing return directly (#897) 2018-09-18 16:30:56 +08:00
Gary YeapandTa-Ching Chen 6f60f3eef8 Add v2 interface support for nodes env (#836) 2018-09-14 14:28:04 +08:00
VishalandGitHub d18777bed4 Used hidden flag instead of removing command completely (#886)
The `fission spec helm` is now a hidden command since it is not implemented yet.
2018-09-13 15:27:22 +05:30
Ta-Ching ChenandGitHub 82d23b9bf8 Fix fetcher not close file descriptor correctly (#889)
* Fix fetcher not close file descriptor correctly
* Call Sync() before chmod
2018-09-11 14:15:56 +08:00
Ta-Ching ChenandGitHub a4f58fbf10 Check pod container ready state (#861)
Ensure pod is ready by checking pod’s containers state and deletionTimestamp
2018-09-07 22:17:07 +08:00
Adam BouhenguelandSoam Vasani 2dbae32f20 FIX CleanupOldExecutorObjects in all namespaces (#879)
Don't just look in functionNamespace anymore
2018-08-29 15:12:31 -07:00
Ta-Ching ChenandGitHub 21b0a1d852 Fix failed to find release-builder dockerfile & push specific tag (#870) 2018-08-26 23:02:07 +08:00
Ta-Ching ChenandGitHub f8535be7da V0.10.0 (#868) 2018-08-19 19:05:19 +08:00
Nafisa Shaziaandsmruthi2187 95eef49cf8 Replay recorded requests by ReqUID (#864) 2018-08-17 13:17:54 -07:00
Ta-Ching ChenandGitHub 2d01382a82 Add cleanup function to test scripts (#863) 2018-08-18 02:11:08 +08:00
Ta-Ching ChenandGitHub d443f8b2ef Scale deployment to zero when function is in idle state (#775) 2018-08-17 23:03:34 +08:00
Ta-Ching ChenandGitHub dffb5cdf8b Fix CLI failed to setup port-forward caused by #712 (#867) 2018-08-17 16:05:13 +08:00
Erwin van EykandTa-Ching Chen 5c1d8bc90c Extensible Fission CLI (#743)
This PR introduces extensibility to the Fission CLI. The principle behind the design of this extensibility is taken from the approach git uses: the main binary (fission) calls other binaries (fission-workflows) - which it discovers using simple prefix-rules - based on specific commands (fission workflow <command>).
2018-08-17 15:20:46 +08:00
smruthi2187andTa-Ching Chen ad28922871 Fix for #662: avoid unnecessary builds (#866) 2018-08-17 13:53:37 +08:00
Ta-Ching ChenandGitHub 9d7355cbaa Fix newdeploy fail to update HPA, deployment of a function after function update (#862) 2018-08-15 19:56:30 +08:00
Nafisa ShaziaandTa-Ching Chen 74a3a54543 Recorder CRD, Records API, Redis deployment (#818) 2018-08-15 05:28:40 +08:00
Ta-Ching ChenandGitHub 07ca5df8d0 Fix router not taps function services (#860) 2018-08-13 19:45:49 +08:00
Ta-Ching ChenandGitHub e730376e3e Add rebuild subcommand to pkg command (#808) 2018-08-12 04:13:25 +08:00
VishalandTa-Ching Chen ee61c8c333 Update route without providing function reference (#718) 2018-08-06 11:31:05 +08:00
Ta-Ching ChenandGitHub 27b74a7cf2 Fix router panic when trying to update route (#811) 2018-08-05 01:06:47 +08:00
Ta-Ching ChenandGitHub 088e665d28 Fix spec failed to archive single directory (#837) 2018-08-03 21:26:19 +08:00
Erwin van EykandTa-Ching Chen 9438f3c4ec Updated binary environment README (#773)
- Added usage instructions for getting started quickly.
- Added instructions for using the builder
2018-08-03 15:07:08 +08:00
Ta-Ching ChenandGitHub b5a906b2f4 Do resources validation when validate spec files (#840) 2018-08-03 13:00:29 +08:00
Ta-Ching ChenandGitHub 0e40cb5f4f Fix newdeploy not updates deployment after function's entrypoint changed (#838) 2018-08-02 21:00:27 +08:00
Ta-Ching ChenandGitHub 1a1ac49ce0 Fix CLI failed to set up port-forwarding when multiple controller pods exist in the same namespace (#712)
* Fix CLI failed to set up port-forwarding when multiple controller pods exist in the same namespace
* Check pod healthy state before establishing the connection
2018-08-02 17:20:53 +08:00
VishalandTa-Ching Chen 4356378301 Uses a real go project to showcase vendor example so glide works (#828) 2018-08-01 23:55:54 +08:00
xiekeyangandTa-Ching Chen 6123873d2a Add gevent based Python server to benchmark test cases (#794)
This add the benchmark test cases, which is using gevent based on wsgi
framework.
2018-08-01 21:22:03 +08:00
Ta-Ching ChenandGitHub 9a7ffc2f5b Add more meaningful error messages to executor when getServiceForFunction (#752) 2018-07-30 09:10:48 +08:00
VishalandGitHub f3857abdf5 Fixed the name of JVM builder image name (#824) 2018-07-27 23:28:11 +05:30
VishalandSoam Vasani e977c7caca V0.9.2 (#817)
* Release 0.9.2

* Added changelog
2018-07-25 12:59:30 -07:00
VishalandGitHub f40688435d Added readme for JVM environment & examples (#768)
Instructions for JVM environment and examples
2018-07-25 09:26:01 +05:30
Erwin van EykandTa-Ching Chen e8b2a26a3b Add query options to function test (#782) 2018-07-24 23:00:08 +08:00
VishalandGitHub 27c3a50d23 Java env builder with Maven (#783)
Java environment builder with support for Maven builds. Default build comman runs `mvn clean package` and picks up target/*with-dependencies.jar for function.
2018-07-24 15:16:21 +05:30
Erwin van EykandTa-Ching Chen ec495fbd1d Added Helm lint check (#799) 2018-07-19 11:49:28 +08:00
WrathZAandVishal 80fadcc7b8 Typo correction (#797) 2018-07-17 18:18:10 +05:30
VishalandGitHub 4b37b9ac03 Fixed typos from from goreportcard (#760) 2018-07-16 16:24:05 +05:30
VishalandGitHub 16d0f6a94f Updating release notes with details and structure (#738) 2018-07-16 14:41:28 +05:30
xiekeyangandTa-Ching Chen cc40d1ed2e change image pull policy of builder manager (#793)
This changes image pull policy from Always to IfNotPresent. The previous
policy forbid customer to use the exact image existing on K8S Node.
And it should be OK to use fixed policy here. Customer need not set policy by
their own.
2018-07-16 10:48:47 +08:00
Ta-Ching ChenandGitHub 425e447e5c Add go environment vendor directory support (#781)
* Add go environment vendor directory support
* Use symbolink instead of copying files to gopath
* Add go vendor example package & test
2018-07-13 13:16:22 +08:00
xiekeyangandSoam Vasani 3707b95edb Round Tripper of Fission Router: parameters be configurable (#713)
The Round Tripper parameters of timeout, keep alive time and Max retry
times is configured in router system environment.

And they are set to Round Tripper when router service initializing.

This setup new nested structure `tsRoundTripperParams` to transfer them.
2018-07-12 12:08:52 -07:00
Ta-Ching ChenandGitHub 2982efebb8 Delete namespace in background to reduce build time (#791)
* Delete namespace in background
* TPR is no longer exists
2018-07-12 11:00:19 +08:00
Ta-Ching ChenandGitHub 14db705891 Break & Stop the build immediately if a non-zero exit code was returned (#790) 2018-07-11 20:15:03 +08:00
Ta-Ching ChenandGitHub 9c885ef6f5 Fix spec command overrides existing archive's url of a package (#764) 2018-07-11 13:03:45 +08:00
smruthi2187andGitHub 34e8d0ee3d Add changelog. (#789) 2018-07-06 22:00:14 -07:00
smruthi2187andGitHub 728979636f Updating charts to version 0.9.1 (#788) 2018-07-06 19:11:35 -07:00
Ta-Ching ChenandGitHub 462db2f00c Fix “rm: missing operand” in release script (#779) 2018-07-06 14:15:20 +08:00
Ta-Ching ChenandGitHub 2504408803 Fix go env panic “plugin: not implemented” (#784) 2018-07-06 12:24:46 +08:00
Ta-Ching ChenandGitHub 61569d1c38 Change flag name to KeepArchive for backward compatibility (#787) 2018-07-06 03:13:07 +08:00
smruthi2187andGitHub 5b6582698c changelog for release 0.9.0. (#780) 2018-07-04 02:08:47 -07:00
smruthi2187andGitHub 81f0f1df6d Changes in charts for release 0.9.0 (#778) 2018-07-04 00:27:47 -07:00
Ta-Ching Chenandsmruthi2187 44be0f6859 Move build process from host to docker container during release process (#682) 2018-07-03 21:14:06 -07:00
smruthi2187andGitHub 9daf97a9ab router tracks function liveness before forwarding request (#701) 2018-07-03 15:51:52 -07:00
Erwin van EykandTa-Ching Chen 032d1a8b9a Support annotations in environment specs (#733)
* Added annotations to runtime and builder environment specs
* Use crd annotations for env pod
2018-06-30 05:38:22 +08:00
VishalandGitHub 65fd1d9fbb Java env alpha (#656)
This change adds support for JVM based environment for running Java functions. This is alpha release of JVM environment and might undergo changes.
2018-06-27 21:39:24 +05:30
John GallagherandSoam Vasani a35cd7f4a4 Convert go-env Dockerfile into a multi-stage build (#683)
Converting to a multi-stage build reduces the size of the final image from ~750MB to ~15MB.
2018-06-26 13:21:36 -07:00
xiekeyangandSoam Vasani 74212f1810 envns should be availabe in message line (#734)
This line warns the user that dependent environment doesn’t exist, and presents the command line
for creating an environment.

When the variable `envNamespace` is specified, the `envns` option should be available as well.
2018-06-26 11:15:41 -07:00
Nafisa ShaziaandTa-Ching Chen 1ed59f0789 Push error messages to error topic when NATS mqtrigger fail (#724) 2018-06-27 00:27:57 +08:00
xiekeyangandTa-Ching Chen 71d8b769d5 Python Environment: add gevent based WSGI server framework (#750)
* Python Environment: add gevent based WSGI server framework

This supply gevent based WSGI server framework to Python Environment, to
allow customer to run their functions under multi-threads.

* classify the flask based application

This set up the flask based application as individual class, to make
sure the consistent and integrity.

* Add instruction of WSGI server selection applied in Python Environment

* Python Environment starting logger: provide framework name
2018-06-26 15:50:06 +08:00
Ta-Ching ChenandGitHub c863616b38 Add release steps to render & upload fission installation YAML (#745) 2018-06-26 13:41:43 +08:00
xiekeyangandsmruthi2187 09b62e514e Replace the hard-coded archive size from error message with actual value (#735) 2018-06-25 17:48:43 -07:00
Ta-Ching ChenandGitHub c705ba355e Fix executor not reaps idle function pods for functions with executortype newdeploy (#744) 2018-06-21 17:54:42 +08:00
VishalandGitHub 7642dcf05f Disable caching of connections from router to function pods (#742)
A temporary fix for #723 which needs to be optimized in future. Disables caching of connections from the router to function pod/service.
2018-06-21 12:45:11 +05:30
Ta-Ching ChenandGitHub 58a5f1cb0b Fix executor wrongly passes loop variable reference to function (#751) 2018-06-19 09:55:41 +08:00
VishalandGitHub 1b86c367a0 Added a flag to control the extraction of archive based on user input (#675)
For certain environments, the archive should not be extracted and kept as it is (For ex. for Java the jar file should not be extracted). This change enables an environment level flag to control this behaviour.
2018-06-14 12:32:40 +05:30
VishalandGitHub 6d08e6e0bc Archives bigger than 256K size need env variable for uploading (#697)
For archives bigger than 256K, the Storage service was called from the client side, this needed few environment variables to be set. This change uses port forwarding to achieve the same and does not need environment variables to be set.
2018-06-14 01:12:06 +05:30
xiekeyangandVishal ef7d4ae385 Make fetcher resource requests and limits configurable (#708)
This change allows fetcher container resource requests and limits to be configurable.
2018-06-13 16:12:55 +05:30
Erwin van EykandTa-Ching Chen cf1f944069 Extract portforward to separate package (#728)
* Extract port-forward from CLI to own package (for reuseability)
* Extract CLI logging to subpackage
2018-06-13 11:26:39 +08:00
VishalandSoam Vasani ddff7100e9 Temporarily disabling the tests so that other PRs can be worked on, will enable after closure on #723 (#737) 2018-06-08 15:07:50 -07:00
xiekeyangandSoam Vasani a5bc2a6d4c add build exe to gitignore (#736)
This is a built binary, should be ignore when git committion.
2018-06-08 10:46:17 -07:00
Soam VasaniandGitHub 952b48bd68 Environment warning message bugfix (#725) 2018-06-07 14:17:27 -07:00
Joe StevensandTa-Ching Chen 2ad07d68b6 Fix for Windows CLI Port Forwarding (#715) 2018-06-07 16:37:37 +08:00
xiekeyangandTa-Ching Chen 8c96d9c6a0 ArchiveLiteralSizeLimit: Use Constant Instead Hard Code (#731)
This use constant to instead hard code for ArchiveLiteralSizeLimit. That ensure if the limitation
value is changed in cli, the controller server can follow it. Otherwise, the condition will return
error, and make error HTTP response.

Later, we should delete it in fission-cli, and make it configurable it chart, to work in fission-
servers only.
2018-06-07 15:45:32 +08:00
VishalandGitHub 46d9808173 V0.8.0 (#722)
Release v0.8.0
2018-06-06 00:01:00 +05:30
smruthi2187andGitHub 2e37611da8 pre-upgrade job to verify function references and restricted privileges for fetcher and builder SA (#717)
It is mandatory (from this release onwards) for function to refer to secrets, config-maps and packages in its own namespace to ensure isolation of users sharing the same cluster.
This change runs a pre-upgrade job to verify function references for all functions created prior to this release and fails the upgrade by printing a list of functions that violate this restriction.
2018-06-04 19:30:27 -07:00
Ta-Ching ChenandGitHub 0057270551 Add time trigger cron spec examination tool (#680) 2018-06-04 19:02:54 +08:00
Ta-Ching ChenandGitHub 7a7d15b50c Update k8s dependencies to 1.10 (#687) 2018-06-01 15:43:19 +08:00
VishalandGitHub 202cc3cb7e Changing the logger daemonset's update strategy (#714)
Changing the logger daemonset's update strategy from OnDelete to RollingUpdate (Ref: https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy)
2018-05-31 23:42:23 +05:30
VishalandGitHub a761393816 Ingress integration (#688)
Ingress integration to allow the optional creation of ingress for a given route. The ingress controller needs to be set up by the user separately so that ingress path is accessible outside the cluster.
2018-05-31 11:27:55 +05:30
Ta-Ching ChenandGitHub fedf6b6e5b Check spec directory exists before reading spec files (#709)
* Check spec directory exists before reading spec files
* Fix spec example
2018-05-31 03:01:40 +08:00
xiekeyangandSoam Vasani 6eec55223d Formatted specifiers are not compatible with variables (#706)
It missed specifier for namespace
2018-05-29 09:08:38 -07:00
xiekeyangandTa-Ching Chen 940b9adabd Indicate HTTP status code by library const (#703) 2018-05-24 19:10:45 +08:00
smruthi2187andGitHub 8984e4916e Enabling multi-tenancy for fission objects. (#655)
This feature allows creation of fission objects in different namespaces, in addition to retaining the existing behavior of creating fission objects in default namespace if user doesnt provide one. 
It also removes cluster admin roles for fission-fetcher and fission-builder Service Accounts and grants them only those privileges that they need.
2018-05-23 13:22:46 -07:00
Joe StevensandSoam Vasani c9d2757760 docker-distribution version bump for windows compatibility (#691) 2018-05-21 18:41:53 -07:00
Soam VasaniandGitHub d846aed612 Fission metrics integration (#677)
Add prometheus metrics collection endpoints to router and executor. Add prometheus annotations to router and executor pods.
2018-05-21 13:57:18 -07:00
VishalandGitHub d9b5b9b8a8 Java Environment Design proposal
Java environment design decisions and considerations.
2018-05-14 13:45:01 +05:30
Ta-Ching ChenandGitHub 9c91f00cb4 Replace Werkzeug with Bjoern as underlying WSGI server (#672) 2018-05-09 14:00:40 +08:00
Ta-Ching ChenandGitHub 0a648d1d75 Version -> 0.7.2 (#670) 2018-05-05 20:01:23 +08:00
Ta-Ching ChenandGitHub 6a3e326f36 Add benchmark script (#666) 2018-05-05 12:42:16 +08:00
smruthi2187andTa-Ching Chen f0dc2554a1 Meaningful error message when fetch request is received for a package when build is not successful. (#661) 2018-05-03 22:51:48 +08:00
VishalandTa-Ching Chen 2ece0db13f Fixed the issue with update wiping original values & added resources in listing, fixes #654 (#663) 2018-05-02 22:29:08 +08:00
Ta-Ching ChenandGitHub 0e3a270d27 Delete deployment with proper delete propagation policy (#630) 2018-05-01 23:25:50 +08:00
Ta-Ching ChenandGitHub 6a7381c575 Fix newdeploy backend failed to delete deployment due to incorrect resource version (#657) 2018-05-01 16:48:34 +08:00
VishalandTa-Ching Chen 0aff2f214d Fixes the issue with fn test and adds relevant test cases, fixes #650 (#651)
* Fixes the issue with fn test and adds relevant test cases, fixes #650
* Checking log size for invalid function
* Testing the invalid function logs a few time beforr quitting
* Disabling the test for now, linked to issue #653
2018-04-30 14:14:46 +08:00
VishalandTa-Ching Chen dec4a39c15 Function update should be possible without change to code (#652) 2018-04-30 11:35:19 +08:00
Ta-Ching ChenandGitHub 7577339912 Change time precision for fluentd influxdb plugin to nano second (#646) 2018-04-26 20:57:55 +08:00
Ta-Ching ChenandGitHub 6375819195 Fix test cases occasional failure (#647) 2018-04-26 14:39:16 +08:00
VishalandGitHub 0b34abcada Update .travis.yml
Seems a small item is missing, causing notifications not to work. Similar block in fission-workflows does work.
2018-04-25 23:15:32 +05:30
smruthi2187andTa-Ching Chen 772fdfa15c Setting package buildStatus to pending when functions source is updated. (#637) 2018-04-24 15:24:46 +08:00
VishalandGitHub 7198b24028 Fission upgrade tests (#605)
Tests for upgrading Fission from the last version to current branch and testing. Currently test is very simple and more tests can be added in future
2018-04-24 12:51:17 +05:30
VishalandGitHub eb696432d8 Testing proposal: Requirements and frameworks exploration (#581)
Proposal for revamping the testing framework and tests in general based on needs of Fission project
2018-04-24 00:45:09 +05:30
Ta-Ching ChenandGitHub 2d359f879a Fix SEGFAULT issue when buildmgr failed to update package (#635) 2018-04-21 23:17:33 +08:00
smruthi2187andGitHub 94e2f11ea6 Remove port forward in tests for router, controller and nats pods (#611) 2018-04-20 19:00:22 -07:00
VishalandTa-Ching Chen ff01cf2452 Removed the fn pods functionality (#594) 2018-04-19 14:32:16 +08:00
Ta-Ching ChenandGitHub 400e19a48f Fix executor does not reap specialized function pod when env no longer exists (#633) 2018-04-19 07:39:37 +08:00
Ta-Ching ChenandGitHub 0194f53e12 Fix SEGFAULT issue when build manager failed to update package (#626) 2018-04-17 09:36:11 +08:00
John GallagherandSoam Vasani fef1469c61 Update readme to point to the proper link (#628) 2018-04-16 11:30:27 -07:00
Ta-Ching ChenandGitHub cf53e17be5 Remove confusing default value description & add default value to cli flag (#619) 2018-04-16 17:27:10 +08:00
smruthi2187andGitHub 449f49515a Changes needed for release 0.7.1 (#622)
bump up the version to 0.7.1 in charts and adding changelog.
2018-04-10 18:03:08 -07:00
Ta-Ching ChenandGitHub d01b309fc7 Add validate function to crd resource and do validate before creation/update (#580) 2018-04-08 00:56:13 +08:00
smruthi2187andGitHub 12299df811 Prevent releasing idle connections because transport is shared. (#609)
The transport in RoundTripper is the default transport and there's just one object shared between different http requests and releasing the idle Connections ended up releasing the idle connections that were established with the executor service address too.

So every time a http request was made to get a service for function, the transport layer ended up having to dial a new connection (that was timing out due to various reasons).

By removing the CloseIdleConnections, we minimize the need for transport to dial a new connection to executor for every request, thereby minimizing the occurrence of dial timeouts.
2018-04-06 13:23:25 -07:00
Soam VasaniandGitHub 95a50dbbd6 --spec flags for env and trigger creates (#607) 2018-04-06 09:00:01 -07:00
smruthi2187andGitHub 8014c83b02 Invalidate stale router cache entry with podIP's for deleted pods. (#546)
The router's cache entry for a function might become stale if the pod that had the function specialized gets deleted somehow. In such a case, we'd retry getting a new service for the function from executor and retry forwarding the user request to the newly created service.
2018-04-05 13:47:47 -07:00
smruthi2187andGitHub db2f620121 Updating releasing guideliness with a few more details. (#599) 2018-04-05 13:44:17 -07:00
Soam VasaniandGitHub f9ca626940 E2E test for NATS-streaming trigger (#338)
E2E test for NATS-streaming trigger: move ad-hoc shell script into CI tests.
2018-04-05 10:07:00 -07:00
Ta-Ching ChenandGitHub 1dbf8f9243 Fix components crash before crds creation (#602)
* Wait for CRDs creation for 30 sec when component start
* Fix ensureCRD return nil while the error is not empty
2018-04-04 15:40:55 +08:00
Ta-Ching ChenandGitHub 9406720e8a Add deprecated message to subcommand pods (#592) 2018-04-04 01:26:27 +08:00
Ta-Ching ChenandGitHub 2a06705320 Use a separate controller loop to watch functions change and create a service (#544) 2018-04-04 01:17:51 +08:00
smruthi2187andGitHub d39944e04d updates to changelog. (#598) 2018-04-02 18:08:15 -07:00
smruthi2187andGitHub 6f6b52438a changes needed for release 0.7.0 (#597) 2018-04-02 15:32:22 -07:00
Soam VasaniandGitHub 5baf67f143 Spec validator, better errors, apply waits for previous build (#560)
Adds a validator, invoked through `fission spec validate` and before `fission spec apply`. The validator checks for duplicate names, dangling references, and unused resources.

Also attempts to fix a race between CLI and builder.  Avoids replacing a package while it's building, instead waiting for the build status to change from pending before updating it.
2018-04-02 14:33:31 -07:00
xiekeyangandSoam Vasani 6d61f6e5eb bug fix: spec dir flag (#595)
The cli spec dir flag name should be `specdir`, not `specs`, that should match to:

```go
specDirFlag := cli.StringFlag{Name: "specdir", Usage: "Directory to store specs, defaults to ./specs"}
```

in fission/main.go

Currently it cause the specific specs dir not to work.

```
$ fission spec apply --specdir <my spec dir>
Everything up to date.
```
2018-04-02 05:51:46 -07:00
Ta-Ching ChenandGitHub 6ab902e7a3 Add steps for how to set FISSION_ROUTER env variable & update docs (#593) 2018-03-31 01:10:40 +08:00
smruthi2187andTa-Ching Chen ed7d088bbc Check if the requested file already exists in fetcher and skip fetch (#584) 2018-03-30 16:33:06 +08:00
smruthi2187andGitHub c0058153a0 Adding routerUrl parameter for kubewatch, timer, mqueue trigger deployments (#591)
* This is to enable these triggers to be able to talk to fission router if deployed in a namespace other than fission.
2018-03-29 17:38:50 -07:00
VishalandGitHub a8482a8b89 Function logs: Uses proper way to get server URL
After changes related to port forwarding, function logs was getting empty URL, fixed to use the appropriate method instead.
2018-03-29 15:26:47 +05:30
VishalandGitHub a23f8acffc Tests for function update (#550)
Tests for updates to a function of new deployment executor type. Tests check for changes in the environment, scale, secrets etc. Also checks conversion of function executor type from new deployment to pool manager and vice versa
2018-03-28 20:32:04 +05:30
smruthi2187andSoam Vasani 77be3379b2 Prepending a slash to user input url if missing. (#547)
* Prepending a slash to user input url if missing.

* Adding the url slash check for spec.
2018-03-26 12:31:02 -07:00
Ta-Ching ChenandSoam Vasani 03046170dc Add post-upgrade-job to track fission upgrade (#564) 2018-03-26 12:28:35 -07:00
VishalandSoam Vasani c0acaa74c3 Fixes the issue #559 with env versions (#569)
Do not set automatically set env version if user has already specified it.
2018-03-26 12:25:16 -07:00
Soam VasaniandGitHub 8708fdec93 Add verbosity flag and verbose logs for portforwarder (#575)
Also, parse flags before connecting to server.
2018-03-26 12:23:45 -07:00
Chris LeeandSoam Vasani 6b188c053a Add golang example to installation guide (#578)
Use --src instead of --code for Go example.
2018-03-26 10:04:25 -07:00
Soam Vasani 0fd6114218 Update release checklist 2018-03-22 14:05:51 -07:00
Soam Vasani 9ae06f56c8 Update generated changelog 2018-03-22 14:03:02 -07:00
Soam Vasani 704a8094e6 Bump version in charts, forgot one file 2018-03-22 11:33:23 -07:00
Soam Vasani 6f54565195 Bump version in charts 2018-03-22 11:26:58 -07:00
Soam Vasani 90206fbaa0 Release checklist updates 2018-03-22 11:26:41 -07:00
yiqundingandSoam Vasani 8fb4aca231 This change fixes an error in a yaml file in the fission-core chart. (#563)
The Deployment definition for executor, controller, router contains readines/liveness probes. The port definition for those probes should be numbers, instead of string, i.e. port: "8888" should be port 8888.
2018-03-22 11:14:47 -07:00
Erwin van EykandSoam Vasani 70a93a7302 Add Container object to environment build and runtime specs (#413)
Environment Specs so far had only an image URL to specify a container image.

This was fine for public images but fell short in a few of cases:
(a) Using private image registries
(b) Specifying environment variables (this is needed for workflows helm install)
(c) Setting a SecurityContext for the container

This change adds the Container object to both build and runtime Environments. 

Compatibility is preserved -- the existing ImageURL field is still used.  See the comments in types.go for the overriding rules in the case that both Container and ImageURL are specified.
2018-03-22 00:13:02 -07:00
Bo-Yi WuandSoam Vasani c76b6bacc0 [ci skip] update release number (#561) 2018-03-21 16:16:43 -07:00
VishalandGitHub 15bedfb688 Warning when updating function from poolmgr type to newdeploy executor type
When changing the function executor type from pool manager to new deployment - warning should not be given about ignore environment resources
2018-03-20 14:11:30 -07:00
Ta-Ching ChenandGitHub 1447e6949d Show fission deployment version with cli (#538)
Add version information to binary through go ldflags
2018-03-19 14:14:55 +08:00
Ta-Ching ChenandGitHub 048ab6149a Fix executor failed to clean cache & kubeobjs after function deleted (#534) 2018-03-14 02:29:12 +08:00
Soam Vasani 8a0abc59db use specific go env version in example 2018-03-11 11:54:30 -07:00
Ta-Ching ChenandGitHub 039e003af6 Always retry for function pod specialization when istio feature is enabled. (#536) 2018-03-11 23:17:05 +08:00
Soam VasaniandGitHub 1ea665386a Docs update (#542)
* Misc doc updates

* Some theme updates: no all caps headers, remove blue arrows
2018-03-09 11:26:15 -08:00
Soam VasaniandGitHub e7c9a67a68 Release script updates (#541) 2018-03-08 13:48:57 -08:00
Ta-Ching ChenandGitHub afd7f7f436 Show warning when trying to create a route with non-existent function (#539) 2018-03-09 02:45:30 +08:00
Ta-Ching ChenandGitHub b4300feabc Fix executor tries to create a new deployment when a function is updated (#524)
Newdeploy manager now checks the existence of function service cache by function UID before trying to create a new deployment. And return the cached fsvc directly if the cache exists.
2018-03-08 02:52:36 +08:00
smruthi2187andGitHub a3826046a5 Delete healthz log (#525)
Silencing the healthz logs.
2018-03-02 15:50:48 -08:00
Soam Vasani d852ddd91c Version update: 0.6.0 2018-03-01 13:43:59 -08:00
Soam VasaniandGitHub 1edb9723e8 Release checklist (#522)
* release checklist

* release checklist updates
2018-03-01 12:46:56 -08:00
Soam VasaniandGitHub ca51a5fe4c Add chart version to job name (#516) 2018-03-01 12:17:17 -08:00
Soam VasaniandGitHub 714f32d290 Detect fission namespace in cli (#519)
Remove the hard coded default "fission" namespace that was added in the last PR, replacing it with some logic to figure out where fission is installed and connecting to it if there's exactly one installation. If there is more than one fission installation, error out with a useful message.

Also improve the error message for a missing kubeconfig file.
2018-03-01 12:16:50 -08:00
Soam VasaniandGitHub 7ddbea59a2 Default values for FISSION_* env vars (#518)
This makes set up easier for new users.  Users can still set
FISSION_NAMESPACE but it will default to "fission".  Users can also
still set KUBECONFIG, but it will default to $HOME/.kube/config.

Also, update the post-install chart notes.txt and the install guide to
use "fission function test" as the first step after install.  This
means that if there's anything wrong with the setup, the user will see
useful errors instead of "internal server error".  Also, they can test
their setup without worrying about nodeports or ingresses or whatever.

All existing functionality of FISSION_URL and FISSION_ROUTER continues
to work.
2018-02-28 18:14:57 -08:00
VishalandGitHub b895f98e88 Update Fn: Executor New Deployment (#504)
Enables updating functions of executor type new deployment and switching between executor types for a function.
2018-02-28 16:33:39 +05:30
VishalandGitHub 1b1c4f1380 Documentation Revamp (#496)
Added a new documentation structure with details of concepts, tutorials and examples
2018-02-28 11:46:44 +05:30
Ta-Ching ChenandGitHub 5e2f984136 Fix CLI not update function's secret/configmap correctly (#512)
This PR addressed some issues introduced in PR399. Also, now env builders and function pods can mount shared secret/configmap volumes correctly.
2018-02-28 05:28:05 +08:00
Ta-Ching ChenandGitHub 23942fdf7d Istio integration (#421)
This the very first step for fission to integrate with Istio, which is an open platform to connect, manage, and secure microservices. With Istio, users are able to monitor functions usage and trace requests latency through dashboards. For more information, please visit http://fission.io/docs/
2018-02-28 04:09:32 +08:00
prithvirameshandsmruthi2187 b9a559af2f Service type ClusterIP - Controller port forward through CLI (#431)
setting serviceType to ClusterIP as default for fission controller and corresponding changes in fission cli to be able to port-forward the controller pod.
2018-02-27 08:22:57 -08:00
Ta-Ching ChenandGitHub 1428c64b4f Fix post-install-job container failure due to curl command not found (#514) 2018-02-27 18:08:16 +08:00
smruthi2187andGitHub 866e0288c9 Replace the release with the latest tag. (#513) 2018-02-26 18:35:38 -08:00
VishalandGitHub f83512f176 Fixes the backward compatibility with for environments created in earlier versions (#508)
Makes environment poolsize & pod cleanup tags compatible with previous versions
2018-02-26 23:21:09 +05:30
VishalandGitHub bd609fa18e Latest tags for fetcher and fission-bundle (#509)
Added latest tags for fission bundle and fetcher and push to dockerhub
2018-02-24 20:18:22 +05:30
VishalandGitHub e5b137fe24 Adds default resources for fetcher pod (#500)
The fetcher needs a relatively smaller set of resources and does not have to be same as the function container/defaults. This change adds defaults for fetcher containers in function pods.
2018-02-24 01:07:02 +05:30
smruthi2187andGitHub 245506efe3 Delete and list orphan pkgs (#468)
* prevent leaking packages; add new clis to list and delete orphan packages.

* Fixes after testing.

* Address review comment.

* Removing deleting orphan packages from fnUpdate and fnDelete.

* goFmt and removing unwanted code.
2018-02-20 15:21:10 -08:00
Soam VasaniandGitHub a1ed698fa8 Go: Set image to right version, update example readme (#497) 2018-02-15 20:39:25 -08:00
Soam VasaniandGitHub 9a21e14a84 Remove a noisy log from the router (#495) 2018-02-12 16:27:55 -08:00
Ta-Ching ChenandSoam Vasani f695a81c46 Improve release script (#494)
* Add step for releasing environment builder image

* Strip $GOPATH from strack trace
2018-02-12 15:42:23 -08:00
smruthi2187andGitHub 9e9a0c1ec6 Merge pull request #491 from fission/ciImprovements
CI modifications
2018-02-09 19:00:19 -08:00
smruthi2187 281a492149 Addressing review comments. 2018-02-09 14:26:32 -08:00
Peter HueneandSoam Vasani 4d0e6af5de Implement support for Azure storage message queue triggers (#371)
These commits implement support for consuming messages from an Azure storage queue to trigger Fission functions.

* Add stubbed Azure message queue implementation and modify Helm charts.

This commit stubs an implementation for an Azure storage message queue trigger
that will be completed by future commits.

It also modifies the Helm chart to add support for deploying Fission with an
mqtrigger configured for Azure storage queue triggers.

* Add Azure Go SDK to glide.

This commit adds the Azure Go SDK to glide for the upcoming work to support
Azure storage queue triggers.

* Implement Azure message queue trigger.

This commit implements a message queue trigger based on Azure storage queues.

Required message queue trigger manager environment variables:

* AZURE_STORAGE_ACCOUNT_NAME - the Azure storage account to use.
* AZURE_STORAGE_ACCOUNT_KEY - the Azure storage account key.

When creating a message queue trigger, the topic will be the Azure storage
queue to receive messages from.

* Add CA certificates to fission-bundle.

This commit adds the root CA certificates to the fission-bundle image. This
allows Fission to contact third-party APIs that use HTTPS with root CA
signed certificates.

* Add Makefile to build and test.

This commit adds a simple Makefile for building the client and bundle, running
tests, creating the Docker image, and pushing the Docker image.
2018-02-09 10:38:06 -08:00
Ta-Ching ChenandGitHub 46895b03c8 Update SHA256 HASH in CHANGELOG.md due to binaries update (#493)
Update SHA256 HASH in CHANGELOG.md due to binaries update due to build flags change.
(Strip GOPATH from stack trace)
2018-02-10 00:47:44 +08:00
Soam VasaniandGitHub d9b5c2e560 Go builder for single file functions (#492)
Add support to go builder for building a single file (otherwise even a single file needs to be archived in a .zip)
2018-02-08 18:55:49 -08:00
smruthi2187 841c7ef845 Adding safelist to travis.yml and correcting a typo 2018-02-08 14:03:27 -08:00
smruthi2187 7752abaf05 Refining some stuff. 2018-02-08 13:58:44 -08:00
smruthi2187 818876dd08 Reduce verbosity of docker build, gofmt and uncommenting helm uninstall 2018-02-08 13:58:44 -08:00
smruthi2187 266922da26 exporting echo_log and adding a debug in controller for stackTrace 2018-02-08 13:58:44 -08:00
smruthi2187 a98370ca63 Added describe pods in case of integration test failures. 2018-02-08 13:58:44 -08:00
smruthi2187 bce45d6d25 Added sigHandler to print stackTrace, modified probe params 2018-02-08 13:58:44 -08:00
smruthi2187 93dde93afe We dont need these. 2018-02-08 13:58:44 -08:00
smruthi2187 08898cdd17 Rebuilding images. 2018-02-08 13:58:44 -08:00
smruthi2187 2effade15d Deleting ns and adding a sleep. 2018-02-08 13:58:44 -08:00
smruthi2187 610790244b Adding an extra info. 2018-02-08 13:58:44 -08:00
smruthi2187 054f9bcd85 Uninstalling prev release. 2018-02-08 13:58:44 -08:00
smruthi2187 ebdb13f7d0 fixing typo. 2018-02-08 13:58:44 -08:00
smruthi2187 8ad365aaec Commenting out uninstall fission from install fission function. 2018-02-08 13:58:44 -08:00
smruthi2187 982665f448 Prevent docker rebuild for new CIs. 2018-02-08 13:58:44 -08:00
smruthi2187 feaa6746c3 Removing tstamp 2018-02-08 13:58:44 -08:00
smruthi2187 b61bf9324f wrapping all echo statements with timestamp. 2018-02-08 13:58:44 -08:00
smruthi2187 b18c965860 Adding readiness, liveness probe for storagesvc. 2018-02-08 13:58:44 -08:00
smruthi2187 8f19a9bedb commenting out helm installation. 2018-02-08 13:58:44 -08:00
smruthi2187 1bf38cbca6 gofmt 2 files. 2018-02-08 13:58:44 -08:00
smruthi2187 ce110a8dff Re-organizing some functions. 2018-02-08 13:58:44 -08:00
smruthi2187 802ae08adb exporting two functions. 2018-02-08 13:58:44 -08:00
smruthi2187 77430f7438 Fixing tiller pod logs and ports for probes. 2018-02-08 13:58:44 -08:00
smruthi2187 3aaabc909b Fixing indentation errors in yaml 2018-02-08 13:58:44 -08:00
smruthi2187 4e445bb3cc All improvements in one commit. 2018-02-08 13:58:44 -08:00
Ta-Ching ChenandGitHub a5cb1d3e3d Add simple usage doc for accessing secret/configmap in function (#484) 2018-02-08 13:05:30 +08:00
Ta-Ching ChenandGitHub 582c9808b5 Add upgrade guide from 0.4.x to 0.5.0 (#490) 2018-02-08 13:05:04 +08:00
Ta-Ching ChenandGitHub 398c58365a Version -> 0.5.0 (#489) 2018-02-08 03:39:02 +08:00
Ta-Ching ChenandGitHub 9deb4f53db Fix binary environment build failure due to package not found (#487)
Subpackage k8s.io/client-go/pkg/api/v1 is no longer exist in HEAD.
(https://github.com/kubernetes-incubator/external-storage/issues/324)
For now, just duplicate the FunctionLoadRequest struct like what go environment did.
2018-02-07 21:44:12 +08:00
Ta-Ching ChenandGitHub 3c513c7f61 Migrate project.json to dotnet.csproj & do build in dotnet container (#488) 2018-02-07 21:43:51 +08:00
Ta-Ching ChenandSoam Vasani c56ed598cb Fix potential nil pointer problem when both watchResources and waitForBuild are equal to false (#485) 2018-02-06 15:14:47 -08:00
VishalandSoam Vasani e6191e3c69 Executor backends wip doc (#432) 2018-02-06 15:08:11 -08:00
Soam VasaniandGitHub e7dbba634c Helm hook bugfixes: run on upgrade, delete on completion (#473) 2018-02-06 15:06:21 -08:00
Erwin van EykandTa-Ching Chen a033d3c432 Removed limit on max number of channels in NATS Streaming deployment (#482) 2018-02-06 22:30:35 +08:00
Ta-Ching ChenandGitHub 3f81510729 Fix possible context leak problem (#483) 2018-02-06 21:34:01 +08:00
Soam VasaniandGitHub 07c7b759d2 Declarative application specifications for Fission (#422)
This change enables users to have declarative specifications for Fission resources. Users can specify their "app" in a set of spec files, and use a new fission CLI command to "apply" these specs to a running cluster.

The new "spec" CLI also includes archiving of local source files, and a file watcher that re-builds archives and uploads them on file changes, and a package build watcher that waits for package builds on the CLI. 

A "--spec" option is also added to "function create", and will be added to other resources in future changes.  This option causes a YAML to be outputted to the specs directory instead of the resource being created on the cluster.

The CLI "fission spec --help" outputs usage information.
2018-02-05 21:58:44 -08:00
Moritz Grosch (LittleFox)andSoam Vasani 6af13e7e29 Extend perl examples to use more http features (#479) 2018-02-05 14:37:13 -08:00
Ta-Ching ChenandGitHub cc62e62229 Add glide flag to strip nested vendor (#480)
Adds --strip-vendor (-v) to travis.yml when installing dependencies.
For more information about the flag, please check dependency flattening (https://glide.readthedocs.io/en/stable/getting-started/)
2018-02-06 02:31:06 +08:00
prithvirameshandTa-Ching Chen 1eb0453ce4 Functions have access to secrets/configmaps specified by the user (#399)
This commit solves part of the issue #52 , functions are able to access secrets/configmaps specified by the user. For now, CLI only accept one secret/configmap. For advanced users, it will be able to use YAML to declare multiple secrets/configmaps in later changes.
2018-02-05 17:49:26 +08:00
VishalandTa-Ching Chen 4cf195768e Newdeploy backend (#387)
A newdeploy backend which uses new deployment to serve requests. This is the second phase of #193 and builds on top of changes in #384 .

* Executor layer added on top of pool manager

* Removed the external server for executor

* Minor changes to keep existing semantics as much possible

* Separating the executor vs. poolmgr backend functionality and associated data members

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed references to poolmgr in tests

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Executor layer added on top of pool manager

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed podName to a generic objectReference in fscache (#391)

Changed podName to a generic objectReference in function service cache implementation.

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Merged from master with latest changes

* Executor layer added on top of pool manager

* Removed the external server for executor

* Minor changes to keep existing semantics as much possible

* Separating the executor vs. poolmgr backend functionality and associated data members

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed references to poolmgr in tests

* update compiling.md to use helm

* Compile instructions: changed pullPolicy to IfNotPresent (#378)

Containers will get stuck in ErrImagePull/ImagePullBackOff state otherwise

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Fetcher called when pod is created for newDeploy backend but also supports older way, this is WIP and still needs pod specialization and creating & exposing a service so the URL can be hit by end user

* WIP Specializing the POD as part of startup along with fetching

* Working specialization of a new deployment. Needs some work on caching, cleanup etc.

* Switched to service based address instead of POD address

* Minor formating issue fixed

* Added logging to pods and a readiness check, the readiness check is flaky though ATM

* Fixed some rebase issues that were failing build

* Better names for K8S objects and methods

* Switched usage of FuncSvc in backends from pod to api.ObjectReference

* Adding retry to fetcher request, for now just using default retry client which might need tweaking in future

* Switching to plain old retry, some issue in getting retryablehttp with glide import

* Removed stale executor service & deployment from previous merge

* Addressed review comments, still testing some areas

* Added types in FunctionSpec

* Resolved conflicts due to merge from executor_abstraction branch

* Added backend type on EnvironmentSpec along with operations for create/list/update, the pools are created/destroyed based on change in backend type

* Backend from types and a minor err return issue fixed

* Draft version of CPU and memory parameters added to environment

* Added resourceReq to newDeploy, though it has some issues

* Issue with resourceName fixed, now newdeploy pods also pick up resources from the environment config

* Adding scale params, removing validation on CPU params for now

* Fixed a formatting issue

* Checking if slight more delay helps in the test which is currently failing for internal routes

* The resourceList newly added in Env can not be compared by compiler, hence must use breakdown comparison instead

* Added strategy selection on client side

* Added caching, informers, delete operations for newdeploy backend functions

* Deleted a stale directory

* A simple HPA based on scale parameters, testing still WIP

* Fixed a small issue in delete function, added HPA delete too when deleting a function

* Previous merge missed the pkg flag for update fn command somehow, fixed that

* Fixed comments from review

* Changed poolmgr cleanup to be generic cleanup and moved to executor, added instanceID labels to newdeploy so that cleanup works

* Moved instanceIdLabel to types to avoid cyclic dependency

* More review fixes

* Tweaking sleep to see results

* If user does not provide poolsize, then it should not default to zero

* Switched to naming convention for now, fixed default poolsize if not provided

* Changed error return behaviour in delete fn, also changed cleanup to look based on obj type though support for additional type will need more work

* Changed check location so avoid false logging

* Test for newdeploy backend

* Adding tests for poolmgr backend

* Fixed an issue with glide dependency version, already fixed in master

* Added instanceId for NewDeploy, Initial cleanup now cleans older objects of newdeploy backend, removed eagercreate flag and instead using minScale to drive eager creation

* Moved cleanup to executor layer with cleanup for newDeploy backend, changes to use the new Cache impl

* Cleaning up pod & rs along with deployment for newdeploy backend

* Enhanced fn and env listing to show min/maxscale and resuorces respectively

* Added conditional heapster deployment and fixed a small issue with resources for fetcher container in function pod

* Addressed review comments from previous change

* Addressed some more review comments - majorly create only on NotFoundError

* Added TargetCPU as an input for scaling

* Bumped target CPU to be greater than 0 and added a default value

* Min replicas should be 1 even if the minScale is 0 when creating deployment

* Changed name from 'backend' to executorType, added additional test for minscale 0 case, changed TargetCPU to TargetCPUPercent
2018-02-03 01:02:28 +08:00
smruthi2187andTa-Ching Chen 31ba992726 Archive pruner (#471)
All functions have a pkg reference. This can be a package with either source and a deploy archives, or, a deploy archive. Everytime a function is updated, a new package is created. With archive pruner, the archives that are pointed to by old pkg reference can be deleted from the storage.

* High level spec for package pruning.
* Skeleton for archive pruning
* Adding meat 1 to skeleton.
* Adding meat #2. Separated storage service into a httpHandler component and
Storage Layer component.
* Adding meat #3. getOrphanedArchives in pruner and getItems on
stowClient.
* Restructured archivePruner methods.
* Commiting the day's work. Ready for testing #1.
* Fixing compile errors.
* Test ready. added a few logs for debugging.
* Adding a filter for getItems in stowClient.
* After testing.
* Added a test for archivePruner.
* Adding helm value pruneInterval for testing.
* Modified test.
* Final test.
* Fixing interval from seconds to minutes.
* Small change.
* Changing debugs to info.
* Removing the WIP design
* Ran gofmt on all these files.
* Fixing prune_interval as string in ENV var.

* Addressing all comments, but one.

* changing getFile method in stowClient to stream it into a response.

* All comments incorporated.
* Introducing a new flag for running archivePruner.
1. This flag is disabled for archivePruner to run in unit test.
2. This flag is enabled for archivePruner to run in production.
3. Also disabling test_archive_pruner.sh in this PR. Follow up with
next PR to enable it.

* Addressing review comments.

* Changing the command to generate a file dynamically.

* Enabling arching_pruner_test

* giving execute permissions to test_archive_pruner.sh

* Making changes of positional parameters after recent commit.
Change test case permission and removing kubectlPortForward.

* Adding debug to see why test_utils.sh passed junk pruneInterval.

* shell needs special handling for positional parameters from 10.
2018-02-01 18:13:36 +08:00
Erwin van EykandTa-Ching Chen 0c92f59c38 Installation instructions for Fission Workflows (#453) 2018-02-01 03:59:46 +08:00
VishalandTa-Ching Chen c00f76b561 Fix fluentd image tag issue in tests - an additional tag was appended (#469) 2018-02-01 03:03:15 +08:00
Soam VasaniandGitHub 91094cf659 Fix broken redirect (#467)
By default, flask turns redirects into absolute URLs. This is
undesired behaviour on Kubernetes, because the Pod's own IP address is
not really useful to any client that's not in the cluster (and even
within the cluster most clients will want to use the address of a
Service, not a Pod).
2018-01-30 12:00:30 -08:00
Ta-Ching ChenandGitHub 1935098404 Add readiness probe to go env (#461) 2018-01-30 21:36:13 +08:00
Soam VasaniandTa-Ching Chen 7d83859cfb Build and push fluentd image on release; update chart to use that image (#462)
* build and push logger image during release
* Update chart to get the right fluentd image
2018-01-30 21:35:13 +08:00
JustinandTa-Ching Chen 986b300b8c Convert build.sh to a multi-stage Dockerfile. (#452) 2018-01-28 11:49:31 +08:00
Ta-Ching ChenandSoam Vasani 4f7eb19b7c Show warning when user tries to create a function with a non-existent environment (#436)
Show warning when user try to create a function with non-existent environment
2018-01-26 16:35:17 -08:00
Ta-Ching ChenandGitHub 0a733b20c3 Block build requests until environment builder is ready (#437)
* Add readiness probe
* Remove builder manager http api interface since we don’t use/need it
* Check environment builder status and block build requests until builder is ready
* Replace deprecated api extension interface
* Add healthy check to python env
2018-01-26 01:13:36 +08:00
Ta-Ching Chen b7c97cec8c Fix fission bundle build failure 2018-01-24 15:38:52 +08:00
Wang GuoliangandTa-Ching Chen b578819202 Optimize code 2018-01-24 13:43:51 +08:00
Ta-Ching Chen 01bcfad44a Update docs-site 2018-01-23 13:27:10 +08:00
Ta-Ching ChenandSoam Vasani 8df520721c Add go vet check (#430)
* Add go vet check

* Replace go vet with go tool vet to avoid printing exit message
2018-01-22 09:28:16 -08:00
Soam Vasani db372c11eb Version -> 0.4.1 2018-01-20 06:15:11 -08:00
Ta-Ching ChenandSoam Vasani 6a1da19e73 Fix python environment failed to launch due to port needs integer not string (#451) 2018-01-20 06:06:50 -08:00
Soam Vasani 816fd25a6c Version -> 0.4.1 2018-01-20 06:05:19 -08:00
prithvirameshandSoam Vasani c03bb01bca Fix fission function logs (#448)
Remove hard coded field indices in influx query, instead searching for them by name.
2018-01-19 17:37:12 -08:00
VishalandSoam Vasani bed189c715 Fscache support for multiple kubernetes objects (#435)
Modifies the fsCache to support a list of arbitrary kubernetes objects instead of just one pod.  This allows better support for the newdeploy backend.

Also removes the byKubeObject cache index; cleanup is changed to use the byFunction index, and byKubeObject is no longer needed.
2018-01-16 13:05:24 -08:00
Soam VasaniandGitHub 80a4bcbcff Integration test improvements (#447)
A few improvements to the integration test:

* Search for test files recursively in the test dir
* Output a test report at the end for a quick summary of what tests passed/failed/were skipped
* Add support skipping test files; skip the logging test since it's broken (#446 is tracking this)
* Switch to latest helm version
* Cleanup namespace
2018-01-15 16:08:38 -08:00
Graham RoundsandSoam Vasani f420383882 Use storageClassName in Helm Charts (#444) (#445) 2018-01-13 00:24:44 -08:00
Soam Vasani fac508c7e0 Demo script bugfix 2018-01-02 14:10:23 +05:30
Ta-Ching ChenandSoam Vasani 64a82747a9 Improve travi-ci test scripts (#434)
Make our travis-based integration test less flaky:

* Wait for tiller ready before installation

* Remove all existing old releases before installation
2018-01-01 11:34:11 +05:30
Ta-Ching ChenandSoam Vasani 5f9e54bbeb Fix glide failed to check out github.com/dsnet/compress & update gorilla pkg version (#429) 2017-12-14 05:23:49 +05:30
Valentin OuvrardandSoam Vasani 8d6b33258d Format fetcher and specialize URLs correctly in case of IPv6 (#408) 2017-12-11 01:26:13 -06:00
Adam BouhenguelandSoam Vasani be84a864fb Add support for Host matching in HTTP triggers (#425)
Include Host in httptrigger output table and fix duplicate error detection to consider Host as well.
2017-12-11 01:22:05 -06:00
Soam Vasani dff34b08e9 Update install link 2017-12-07 17:33:24 -06:00
Soam VasaniandGitHub 1e6b7a4fc8 Golang v2 environment -- runtime and builder (#427)
v2 environment for Go; includes runtime and builder.
2017-12-06 23:03:05 -06:00
Ta-Ching ChenandSoam Vasani eed3018458 [Issue 423] build logs not saved on build error (#426)
* Fix builder return empty buildlogs when encounters errors

* Append error logs to build logs

* Builder manager updates package with build logs plus error log

* Fix potential nil pointer bug

* Replace numeric status code with built-in const

* Remove no use parameter

* Fix go fmt
2017-12-06 22:20:41 -06:00
Karim BoumedhelandSoam Vasani fa810e6f80 Removed openshift specifics as they are no longer necessary (#424)
tested fission on openshift 3.7.0 and installed fine, without having to use openshift variables
those variables were used prior to switching to custom resource definitions, and as such are obsolete
2017-12-04 13:25:39 -08:00
Soam Vasani b1483e5e78 minor comment update in fetcher 2017-12-01 10:45:31 -08:00
Ta-Ching ChenandSoam Vasani 43fea01bd9 Overwrite request host with internal host to prevent request rejection (#419) 2017-11-30 23:58:14 -08:00
Ta-Ching ChenandSoam Vasani 49169e672d Fix pool manager crash problem if failed at http call (#418) 2017-11-30 13:40:17 -08:00
Ta-Ching ChenandSoam Vasani 140b132c8e Update nats dependencies (#411) 2017-11-28 16:12:31 -08:00
Ta-Ching ChenandSoam Vasani 36008f28d8 Add package command (#385)
Add package command support: This PR adds package command to CLI. package provides some useful subcommands to use such as packages CRUD and display package detail information. Also it is able to reuse existing package at function creation.

* Check function existence before creating package

* Check package existence

* Add support for downloading archive from given url

The functionality was supported before e238776bf7. Add this functionality back for more flexible usage.

* Add output flag to save archive content in specific file

* Add logs when package create/update

* Fix fnCreate requires environment argument when a pkg is specified

* Fix fnUpdate failed to update function pkg info when a package is specified

* Add package command test

* Fix wrong python test image in test script

* Remove package description fields

* Fix package command not update package but creating a new one

* Set package as pending status only when there is no deploy archive

* Rename function from fetchArchiveFromArbitraryURL to downloadToTempFile

* Use io.Copy to prevent loading all body into memory

* Revise some messages

* Allow user to update package build command

* Allow user to update package content when using function update

* Retrieve pkgName from function packageref if it’s not specified

* Fix function failed to update due to resource conflict

* Fix test case failure due to single quote

* kick ci

* Fix failed to update function packageRef

* kick ci

* kick ci
2017-11-25 06:54:43 -08:00
Soam Vasani 8fc1bf4bc1 script to update and copy hugo site 2017-11-23 09:55:16 -08:00
prithvirameshandSoam Vasani 2247d3118a fission function logs returns logs in correct order now (#405)
Fix a bug in `fission function logs` due to which logs with the same timestamp were printed in the wrong order.
2017-11-22 18:05:49 -08:00
VishalandSoam Vasani 04531850d5 Executor API panics if there is err in getting function from backends (#407) 2017-11-22 14:06:36 -08:00
VishalandSoam Vasani 13a58e715d Fetcher retry (#403)
Before this change, poolmgr tried to hit fetcher just once.  However if the pod has just started, fetcher may not be up yet, causing the initial request to fail with a connection refused error.  This change adds a similar retry loop that we currently use on the specialize endpoint of the runtime environment container.
2017-11-22 11:27:37 -08:00
Erwin van EykandSoam Vasani b2678783b6 fission/builder image, log collection improvement in builder (#397)
Create a container image with the buidler, so we can avoid copying the builder binary into the env container during the env container build. 

Gather both stdout and stderr of a build into the logs.
 

* Add Dockerfile for builder + update release scripts

* Improve logging of buildermgr and builder

* Add support for environment-scoped buildcmd

* Fix fork/exec wd when package is a file

* Update tests to also include builder image

* Add logging to builder's fork/exec
2017-11-20 23:58:33 -08:00
VishalandSoam Vasani da820186f0 Executor abstraction (#384)
This change adds a layer of abstraction over poolmgr. Poolmgr is now just one of the ways to turn a function into a service; other implementations will be added. The executor abstraction is a uniform API over all these implementations.

* Executor layer added on top of pool manager

* Removed the external server for executor

* Minor changes to keep existing semantics as much possible

* Separating the executor vs. poolmgr backend functionality and associated data members

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed references to poolmgr in tests

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Executor layer added on top of pool manager

* Executor logic separated from Poolmgr backend completely, placeholder for new backend

* Changed podName to a generic objectReference in fscache (#391)

Changed podName to a generic objectReference in function service cache implementation.

* Moved poolmgr to it's package, as a side effect moved Cache to its's package (was causing cyclical dependency) and had to make some data structures exposed outside package

* Rebased from master and changed references to tpr -> crd

* Merged from master with latest changes

* Removed stale executor service & deployment from previous merge

* Addressed review comments, still testing some areas
2017-11-20 20:51:14 -08:00
VishalandSoam Vasani 7bb397dfee Changed podName to a generic objectReference in fscache (#391)
Changed podName to a generic objectReference in function service cache implementation.
2017-11-15 13:57:19 -08:00
Soam Vasani 8a097abf9b Chart version update 2017-11-15 13:25:28 -08:00
Soam Vasani 6d0ebfd881 update version to 0.4.0 in docs 2017-11-15 13:18:50 -08:00
Soam Vasani 310183a944 update version to 0.4.0 2017-11-15 13:18:22 -08:00
Soam Vasani 8fc3479428 only set nodeports when servicetype == nodeport 2017-11-15 13:18:22 -08:00
Josh KellyandSoam Vasani b2883a30de Added AWS to install cloud setup (#392)
Add AWS instructions to setup commands, since AWS only provides service hostname, not IP.
2017-11-15 12:49:19 -08:00
prithvirameshandSoam Vasani 8b40ad0b33 Refactor logging to remove logger, use fluentd with kubernetes filter (#380)
Remove the `logger` container from the logging daemonset. 

Remove the outgoing call from the poolmgr to the logger.  Use Fluentd's Kubernetes filter to add function name and UID to influx metadata.  

This means fluentd now figures out when to start collecting function logs on its own, without being informed by poolmgr.  This is great for other execution strategies, and for autoscaling, where fission isn't in direct control of function pod creation.

Also adds an integration test to make sure logging keeps working.
2017-11-14 18:08:57 -08:00
svicenteruizandSoam Vasani 74e05ba3a1 created weather.js in node.js examples, modified README.md (#394) 2017-11-14 15:33:41 -08:00
Cody HillandSoam Vasani e77a3946d7 Added python example to demonstrate status codes. (#395) 2017-11-14 05:51:37 -08:00
Soam Vasani bcf04b1a6c Build both python 3.5 and 2.7 images from the same env 2017-11-09 14:01:02 -08:00
Soam Vasani d8844ab13c release script: use helm package to create charts 2017-11-09 13:38:01 -08:00
Soam Vasani 2e63787b96 rename readme to format markdown 2017-11-09 08:12:47 -08:00
Soam Vasani de19a42b8b multifile example 2017-11-09 08:11:02 -08:00
Ta-Ching ChenandSoam Vasani da07b35a96 Use common controller/store for httpTriggerSet and functionReferenceResolver (#390)
This fixes a bug where functionReferenceResolver returned out-of-date function metadata and caused the router to proxy requests to old function pods.

It also uses the go context package to shutdown the controller when the router is shutting down.
2017-11-09 07:07:14 -08:00
Ta-Ching ChenandSoam Vasani 9694ba4fd1 Delete failed helm releases to prevent test case failure (#393) 2017-11-09 06:04:06 -08:00
Soam Vasani 3644760f19 hugo config 2017-11-08 17:15:54 -08:00
Soam Vasani b89576ff7d chart version update 2017-11-08 15:51:23 -08:00
Soam Vasani d4b4385596 0.4.0rc version update 2017-11-08 12:45:09 -08:00
Soam Vasani b8eb27d276 Upgrade guide doc update 2017-11-07 15:45:39 -08:00
Ta-Ching ChenandSoam Vasani a63b8b372f Builder manager bugfixes (#367)
This contains a few different builder manager fixes:

* Update the zip file structure to avoid an extra subdirectory
* Annotate packages with what functions are using them
* Only trigger builds when there is no deployment archive
* Python environment loadpath bugfixes
* Other bugfixes
2017-11-06 23:01:46 -08:00
Ta-Ching ChenandSoam Vasani 380b7d1bcd Use k8s client store to sync functions and triggers for fast synchronization (#382) 2017-11-06 12:58:19 -08:00
Ta-Ching ChenandSoam Vasani 5f14b9b0ae Switch from ThirdPartyResources to CustomResourceDefinitions (#381)
Switch Fission's storage over to the new CustomResourceDefinitions, from the deprecated ThirdPartyResources. This allows us to be compatible with Kubernets 1.8 and onwards.

This also adds a CLI tool for dumping state from an old fission version and restoring state into new CRDs.

The storage service is unaffected by this change.
2017-11-04 14:55:16 -07:00
VishalandSoam Vasani 746c51901d Test functions 236 (#355)
A single CLI command to invoke a function, print results, and get logs if the function fails. Meant to be an easy way to do testing from the CLI.
2017-10-30 22:32:15 -07:00
Ta-Ching ChenandSoam Vasani 439e7d4535 Use Kubernetes informer and cache in router (#376)
Use Kubernetes client's informer and cache to watch functions and triggers in the router. This replaces the polling loop we were using so far.
2017-10-25 15:10:44 -07:00
prithvirameshandSoam Vasani 8abb0005f6 Compile instructions: changed pullPolicy to IfNotPresent (#378)
Containers will get stuck in ErrImagePull/ImagePullBackOff state otherwise
2017-10-16 13:39:46 -07:00
Soam Vasani c8f4647373 update compiling.md to use helm 2017-10-05 16:24:25 -07:00
rapitableandSoam Vasani 5c47073518 Make default node-env use alpine. List envs in documentation. (#354)
closes #319 

* Make default node-env use alpine, and support separate debian env. List envs in documentation.

* Copy ONBUILD base image commands into node Dockerfiles

* Copy more commands from onbuild image

* Tidy dockerfiles
2017-10-04 19:05:43 -07:00
Soam Vasani fd1461cc98 doc formatting fixes 2017-10-02 14:54:40 -07:00
Ta-Ching ChenandSoam Vasani a25c167d23 Update k8s client version to 4.0.0 (#351)
Move to client-go v4.0.0 from 1.5.
2017-09-29 07:37:36 -07:00
Soam Vasani e4d42797e6 set versions to 0.3.0 2017-09-28 23:44:53 -07:00
Soam VasaniandGitHub 6a394889f6 dotnet20 build fixes (#365)
Fix the dotnet20 build, use docker for builds, and re-enable dotnet20 in the release script.
2017-09-28 23:36:11 -07:00
Erwin van EykandSoam Vasani 59c18693fa Fix workflow apiserver proxy (#363) 2017-09-28 22:45:53 -07:00
Erwin van EykandSoam Vasani 0537c4b805 Added experimental deploy script (#364) 2017-09-28 22:19:55 -07:00
Soam VasaniandGitHub 6734bfbf7b Differentiate by environment in fscache eviction (#361) 2017-09-28 10:00:23 -07:00
Soam Vasani 557c2ee6fc Time out post-install hooks in 5 sec 2017-09-27 19:03:45 -07:00
Soam Vasani 52c77c5bf5 Disable dotnet20 build for now (issue #359) 2017-09-27 07:46:00 -07:00
Soam Vasani 63a2cbb417 chmod +x dotnet20/build.sh 2017-09-27 06:55:54 -07:00
Soam Vasani d2f4be7a44 Set version to 0.3.0-rc 2017-09-26 23:35:08 -07:00
Erwin van EykandSoam Vasani 33f967b61b Fission workflow env integration (#336)
Add a flag to the environment to control multiple specialization -- the max number of functions per container. This can be set to 1 or infinity. 

Add an api proxy to workflow apiserver from the controller.

Add function metadata to FunctionLoadRequest; every v2 environment now knows which function it's loading (but can ignore that information if it wants to).

Add function identity headers to router. This is useful for multiple specialization, so the router can disambiguate between different function calls. (If this turns out to be a non-trivial perf overhead, we could add these headers conditionally, but for now they are always added.)
2017-09-26 18:36:07 -07:00
Soam VasaniandGitHub 3f58247b59 Dump package resources at the end of tests (#357) 2017-09-26 12:55:03 -07:00
Erwin van EykandSoam Vasani 45756363bc Add bodyparser for text/* mime types to node-env (#349) 2017-09-25 11:11:43 -07:00
Ta-Ching ChenandSoam Vasani e587eca08f Add builder manager support (#308)
This change orchestrates function builds.

Environments (in v2) define a builder image, just like they do a runtime image. The builder image contains a build script that's invoked with source and deployment paths (as env vars).

The buildermgr watches for environments with build images defined, and creates build deployments and services.

Functions can define source and deployment. Buildermgr watches for functions with source code (and build status == pending) and invokes the environment's builder when appropriate. It captures logs from the build and sets the build status (success/failure) and build lots into the PackageStatus.
2017-09-25 07:53:09 -07:00
Ta-Ching ChenandSoam Vasani a720377f3c Use Containers to find matched storage containers (#350) (#353)
Use stow api correctly to find our function storage container on restarts.
2017-09-24 10:36:06 -07:00
Ta-Ching ChenandSoam Vasani 42819ba362 Fix storage service failed to start after restarting it (#352) 2017-09-24 08:21:13 -07:00
Ta-Ching ChenandSoam Vasani e56e6482b3 Fix missing checksum from CLI uploads (issue #342) (#343)
Archive upload from the CLI wasn't filling in the checksum field, causing validation to fail.
2017-09-22 12:27:42 -07:00
James SturtevantandSoam Vasani 0d252fabcd copy trigger metadata directly from map (#341) 2017-09-22 06:54:05 -07:00
Soam Vasani dedeef7077 Add dotnet20 to release.sh 2017-09-21 11:47:11 -07:00
João AlmeidaandSoam Vasani 7bd3f20ad6 Fission dotnet 2.0 env (#337)
Adding a new dotnet environment, supporting dotnet core 2.0.

Project structure changed. Project.json was abandoned. Project.csproj is now used.
2017-09-21 11:30:15 -07:00
Daijiro WachiandSoam Vasani dc1ffa859d Update a dependency in the package.json (#339)
Since `mz` has already bumped for several times without
breaking change, it's better to follow the updates.

```console
$ npm outdated
Package  Current  Wanted  Latest  Location
mz         2.1.0   2.1.0   2.7.0  fission-nodejs-runtime
```

Fixes: https://github.com/fission/fission/issues/167
2017-09-21 05:55:45 -07:00
Soam VasaniandGitHub c63a427ca3 Fix internal route setup bug (#335)
Fixes #334 which broke internal routes, and adds a test.
2017-09-20 06:51:56 -07:00
Soam VasaniandGitHub e4a4ec4bff Post-install hook to poke analytics function (#325)
Send chart name and chart version after installation to an analytics function. Users can opt-out with --set analytics=false.
2017-09-19 15:39:36 -07:00
TAKAHASHI YutoandSoam Vasani 7190661360 Tag and push the latest environment images (#333)
Update release script to push the latest tag for env images.
2017-09-19 06:34:31 -07:00
Soam VasaniandGitHub 67c38f2f29 Function service cache partial support for multiple specialization (#332)
This adds partial support for multiple specialization to the
function service cache. It allows Add() to succeed if the pod and
address maps already contain entries.

But it doesn't deal with DeletePod and TouchByAddress. That's ok for
now, because the workflow engine never deletes the environment pod
(that pod is the workflow engine).

However, if/when we want full support for multiple specialization,
that will require updating both DeletePod and TouchByAddress.
2017-09-18 15:57:06 -07:00
Myles BorinsandSoam Vasani 23e20115da Upgrade Node Environment to 8.x (#329)
7.x has not been maintained since April. 8.x is going into LTS
during October and will receive another 30 months of support.
2017-09-17 05:11:11 -07:00
Erwin van EykandSoam Vasani 5072a13c7c Removed obsolete Kubernetes YAMLs (#327)
We've switched to helm, and the switch seems to be going well, so that's the only supported installation method now.
2017-09-14 13:34:52 -07:00
Soam Vasani 9d8a46e847 fix broken helm download command in instructions, again 2017-09-12 16:46:39 -07:00
Soam Vasani dca2915a7e fix broken helm download command in instructions 2017-09-12 16:45:33 -07:00
Soam VasaniandGitHub bc02d159f3 update readme with latest install instructions (#324) 2017-09-12 15:16:56 -07:00
Soam Vasani dc50ebb889 Release script bugfix 2017-09-11 20:11:06 -07:00
Soam Vasani e68872ba84 set versions to v0.2.1 2017-09-11 18:32:25 -07:00
Soam VasaniandGitHub 4287d14000 Upgrade tool for 0.1 -> 0.2.1 (#320)
Allows dumping v0.1 state to a json file and restoring it into a new v0.2.1 fission installation.

Usage guide is at: /Documentation/docs-site/content/upgrade-from-v0.1.md
2017-09-11 18:31:36 -07:00
Soam Vasani 787396e904 release script: replace existing binaries 2017-09-11 07:25:44 -07:00
Soam Vasani e7c8e5418b 0.2.1-rc2 docs version update 2017-09-10 12:29:39 -07:00
Soam VasaniandGitHub 951468006d Release automation script -- attach helm charts, tag env images (#318)
Remove yaml manipulation from release script, package up and attach helm charts.
Build, tag and push fetcher image and all environment runtimes.
2017-09-10 09:16:16 -07:00
Soam Vasani 98c2a0863f set version to 0.2.1-rc2 2017-09-10 00:36:50 -07:00
Soam Vasani 12d3ad44ce update helm chart urls 2017-09-08 23:28:39 -07:00
Soam Vasani 04eef11fce Set version to 0.2.1-rc in CLI, API and helm charts 2017-09-08 20:48:00 -07:00
Soam Vasani 12fce0baa5 Doc updates: base url, minor bugfixes 2017-09-08 20:36:31 -07:00
Soam Vasani cd73f3c6bb Parameterize logger nodeport; remove ui service 2017-09-08 20:19:32 -07:00
Soam Vasani 373716269b remove compiled hugo site 2017-09-08 20:09:37 -07:00
Soam Vasani cb861e72a9 doc theme 2017-09-08 19:13:41 -07:00
Soam Vasani f2a9f8a938 Install and upgrade guide updates 2017-09-08 19:12:16 -07:00
Soam Vasani 3a0ebdd93b futz with doc css 2017-09-08 19:12:04 -07:00
Soam Vasani 0b1b663f98 remove inadvertently created submodule 2017-09-08 19:05:28 -07:00
Soam VasaniandGitHub d590dcf4ef Hugo-based documentation site (#317)
Not much content yet; this is a start.
2017-09-08 16:47:59 -07:00
Soam VasaniandGitHub f2091d0d80 Move builds to package level (#297)
Introduce _Archives_ as a type to reference arbitrary blobs.

_Packages_ are a pair of Source and Deployment archives. Packages have an environment reference.

Functions reference a package. Multiple functions can reference the same package.
2017-09-08 14:19:39 -07:00
Ta-Ching ChenandSoam Vasani 9d7bd49338 Use latest function metadata to check cached function service. (#316)
Watch functions in the router and use that to trigger functionReferenceResolver cache invalidation.

We might want to rate-limit syncTriggers in a future change, since we might be triggering it more often than needed.
2017-09-08 13:53:02 -07:00
Soam VasaniandGitHub 45c766061a Storage service helm chart integration + bugfixes (#315)
Add storage service and a persistent volume claim to helm charts. A few bugfixes for the api proxy.
2017-09-08 04:49:14 -07:00
Moritz Grosch (LittleFox)andSoam Vasani 6142ac3648 Added perl environment (#311)
Perl runtime environment and example function.
2017-09-07 23:42:40 -07:00
Ta-Ching ChenandSoam Vasani 1b9fa5bc30 Unarchive zip file after fetcher downloads the package (#301)
Fetcher now uncompresses archive files. 

This is triggered by automatically detecting the file format, although maybe we should make that explicit or at least move the detection into the client.
2017-09-01 07:50:47 -07:00
Soam VasaniandGitHub 8d103fa35b Large functions: API proxy for storage svc, upload support in the CLI (#304)
This change contains CLI support for uploading large functions to the storage service.

It also adds a reverse proxy into the storage service to the fission API.

The helm chart is not yet updated to actually run the storage service -- that will come in the next change.
2017-08-31 15:42:59 -07:00
Ta-Ching ChenandSoam Vasani 9d1b096bac Add Environment v2 Builder (#298)
Build server and client for environments.

This build server will run inside environment builders and invoke environment-specific scripts for doing builds. It provides a uniform language-independent API for builds to the fission build manager.

The change also includes an implementation of a builder for Python -- this "builder" acts on requirements.txt and runs `pip install` to collect all function deps.
2017-08-31 10:56:40 -07:00
Soam VasaniandGitHub d83c89df69 Storage service and client (#300)
A very rudimentary storage service for archives larger than what can
fit in TPR/CRD resources. The library used allows for using local
files, AWS S3, or other cloud storage APIs. For now only local paths
are set up.

The storage service doesn't know anything about functions or packages;
it can be used for arbitrary archives.

There's no CLI integration yet.
2017-08-31 00:44:25 -07:00
Ta-Ching ChenandSoam Vasani c03f1a6d9c Add env builder & srcpkg through cli (#296)
CLI support for specifying an environment builder and source packages.
2017-08-28 10:44:31 -07:00
Liu YangandSoam Vasani 4fc55b3b3c Add link to the logs section of INSTALL.md (#299) 2017-08-28 09:19:18 -07:00
Soam VasaniandGitHub 6f017cf400 Split out the Package type into a first class Kubernetes resource (#295)
Split out the Package type into a first class Kubernetes resource. Before this change, packages were implicitly tied to functions.

This wasn't ideal because:
 * Functions will need to share packages
 * A package storage system may be more generally useful than just
   functions (for example, for storing static assets)

This change does the following:
* Updates the fission and tpr types to add a new Package and PackageSpec.  It also creates a PackageRef type, and a FunctionPackageRef type. The PackageRef simply references a package, but the FunctionPackageRef includes the name of a function within the package. This allows us to share packages between different functions.
* Updates fetcher and other components for first-class packages
* Allows customization of fetcher image pull policy in the helm charts
2017-08-25 13:40:45 -07:00
Soam Vasani b19be5c0a3 Reduce slack spam 2017-08-24 11:10:41 -07:00
Soam Vasani 9920008916 Project credits: link to Platform9 and contributor list 2017-08-23 11:25:09 -07:00
Soam Vasani 68ab7efcd4 Add slack notification token to travis 2017-08-23 08:11:29 -07:00
Soam VasaniandGitHub 3693082004 Helm chart bugfixes + end to end test bugfixes (#293)
Helm Chart fixes: bump chart version, parameterize image pull policy, pass poolmgr url to router.

E2E test: add a simple hello world test. Make test runner dump fission logs after test.
2017-08-23 07:00:49 -07:00
George BuckerfieldandSoam Vasani dd6bfd73e2 Minor documentation fix for the go example (#292) 2017-08-22 07:51:58 -07:00
rapitableandSoam Vasani fe9f200606 Improve error message if an older CLI attempts to make a request (#291)
Closes #290
2017-08-21 23:46:45 -07:00
Soam Vasani 3165fe7719 tpr description typo 2017-08-21 15:12:10 -07:00
Erwin van EykandSoam Vasani a4124abeb2 Update list of environments currently in README (#289) 2017-08-21 13:56:58 -07:00
Soam Vasani 789a7d25ce Empty commit to kick ci 2017-08-18 16:11:35 -07:00
Ta-Ching ChenandSoam Vasani 31f94dbc12 Set fetcher image through poolmgr env (#280)
Add a helm value for the fetcher image. Pass the fetcher image path to poolmgr through an env var.
2017-08-18 15:12:10 -07:00
Ta-Ching ChenandSoam Vasani 6bca24a3f5 Fix fetcher failed to access TPR if RBAC is enabled (#288) 2017-08-18 15:01:21 -07:00
Ta-Ching ChenandSoam Vasani 961ee069ed Set message content-type based on the trigger.Spec.ContentType (#279) 2017-08-17 10:30:24 -07:00
Soam Vasani b5e3e4e625 Scripts for a couple of simple fission demos 2017-08-16 15:18:31 -07:00
Soam VasaniandGitHub 00a8430a24 Fix bug that causes us to skip our new e2e tests (#285)
Various e2e test bugfixes. The test runner now compiles fission bundle and cli, installs helm, installs kubectl, and uses helm to install fission, run all scripts under test/tests/, and uninstalls fission.

The change also removes go tip tests -- I think we can get by without them, but we'll add them back if the next go version update brings some surprises.
2017-08-15 17:00:27 -07:00
Soam VasaniandGitHub f79d44156b End to end test runner (#281)
Build fission-bundle and fission cli. Install the fission-bundle using
the fission-all helm chart. Run all files matching test_*.sh from the
tests/ directory.

This change doesn't contain any real tests, just the build and test
runner scripts.

Skips the tests when there are no cluster credentials available.
2017-08-14 16:17:24 -07:00
Ta-Ching ChenandSoam Vasani a52425a31d Parse metadata.Name before creating tpr resource (#284) 2017-08-14 08:55:31 -07:00
Ta-Ching ChenandSoam Vasani 45f3095fb1 Remove etcd from fission-all chart (#282)
Since we use Kubernetes APIs for storing our state now, etcd can be removed.
2017-08-12 16:04:30 -07:00
Soam Vasani 96ae2d3d86 Update with our new codeofconduct@ alias 2017-08-11 17:36:53 -07:00
Soam Vasani 6f8a2e4789 Don't set KUBECONFIG when there is no reachable cluster
Travis doesn't pass secret env vars to tests run on forks, so we need
a way to skip the tests when there are no credentials passed in.

This change unsets KUBECONFIG when there's no reachable cluster. The
Go tests already check for KUBECONFIG and skip when it's not defined.
2017-08-11 15:02:14 -07:00
Soam VasaniandGitHub 00c2883235 Helm chart updates (#273)
Remove hardcoded "fission" namespace in various places.

Remove etcd deployment and service, since we use K8s APIs now.

Add ClusterRoleBinding for the fission service account, to allow fission components to access TPRs. We currently make the service account a cluster admin. This is more permissive than it should be; we should define a specific role for just fission resources.
2017-08-09 23:52:13 -07:00
Soam Vasani 42261d8810 Remove retries from poolmgr eagerPoolCreator
This was initially added to avoid restarts if poolmgr starts before
fission api; but we don't really need that since k8s will restart
it. Also, poolmgr now talks to the k8s api directly instead of the
fission api.
2017-08-09 22:37:55 -07:00
Soam VasaniandGitHub 7d83f5713a Kubernetes access for Travis CI tests (#272)
Sets up Travis CI tests to use a Kubernetes cluster on GKE. All tests have access to $KUBECONFIG which points at a kubeconfig file with credentials to a cluster.

I had to skip the poolmgr unit test because it currently assumes NodePort services; that will be fixed in another change.

Also, because some of the tests don't work properly in parallel, I've ended up reducing the concurrency to 1. If this becomes a problem we'll have to fix the tests, but for now I don't mind just waiting a few minutes longer.
2017-08-08 17:01:34 -07:00
Soam VasaniandGitHub e238776bf7 V2 types and TPR (#266)
This changes the core fission function, environment and trigger types. It also changes Fission's storage to use ThirdPartyResources.

 - Functions are now specified by packages. Functions can also have both source and deployment packages. A package can be specified by a literal, or by a URL.
 - Environments have a build and runtime component.
 - Triggers reference functions by a FunctionReference. This is a layer of indirection between triggers and functions, and will allow things like incremental function upgrades in future releases.

See Documentation/wip/env-v2.md for design discussion about points 1 and 2.

Changes:

* V2 Types

All types now have a spec, following the pattern of K8s objects.

Functions now have source and deployment packages. A Package can be
specified by literal, or by URL.

Environments now have a builder and runtime component.

All triggers use a new FunctionReference to specify the function. This
for now only uses a function name, but in the future can be extended
to be more flexible.

A new FunctionLoadRequest type is added for specialization requests to
the environment runtime.

* TPR types, TPR init code, and a "fission client"

Implements TPR types using the spec types in fission/types.go.

Adds code for adding creating TPR types, and convenient types for crud
operations on each of our resource types.

Adds code for connecting to K8s API and configuring a REST client with
fission types set up.

* Change old stateful controller into a thin apiserver

This apiserver is now simply a stateless api layer on top of the TPR
types. At the moment it doesn't do anything that couldn't be done by
simply talking to the TPR types. In the future we can have better
validation and potentially some higher level APIs (like versioning for
example) in here.

* Split controller client into files and update for v2 types.

* Update CLI for v2 types.

As far as possible we keep the CLI flags the same. We'll have to add
flags for source/deploy packages and builder/runtime
environments. That will come in the next change.

* Update poolmgr and fetcher for v2 types.

Also adds a poolmgr_test.

* Update router for new types.

Also adds a function reference resolver, which separates out the job
of resolving a FunctionReference to a function.

* Update kubewatcher and timer for v2 types.

* Update Message Queue trigger type for v2 types.

* Minor odds and ends.

* Fission bundle CLI updates

Remove controllerUrl flag, since we don't need it any more.

* Remove etcd deployment (replaced by storing state in TPR)

Also update the poolmgr commandline, and use an env var for the
fetcher image URL.

* Explicit ChecksumType and consts

* Clarify separation of environment interface types
2017-08-05 01:18:30 -07:00
Ta-Ching ChenandSoam Vasani 37aa266a4d Update/Add fission-core & fission-all helm charts (#239)
Improve fission helm chart; split it into "fission core" and "fission all". fission-core is the minimal install, and fission-all will have all the bells and whistles.

* Update/Add fission-core & fission-all helm charts
* Fix incompatible types for comparison
* Add message queue trigger
* Rename openshiftRBAC to openshift
* Update documentation & comments
* Fix logger & kubewatcher failed to access kubernetes resource due to RBAC
2017-07-31 14:10:26 -07:00
Erwin van EykandSoam Vasani 85983c91cd Binary Environment (#256)
Adds a fission environment for arbitrary linux binaries.
2017-07-26 12:29:54 -07:00
Ta-Ching ChenandSoam Vasani a8fc7a7029 Fix nats trigger replies message to non-existing resptopic (#260) 2017-07-26 11:43:23 -07:00
Ta-Ching ChenandSoam Vasani 2036d80778 Fix logger prints wrong log (#263) 2017-07-20 13:44:23 -07:00
Ta-Ching ChenandSoam Vasani 46ff55ab49 Fix unstoppable kubewatcher (#208)
Fix a bug due to which watches could never be stopped; simplify control flow a bit.
2017-07-10 16:01:48 -07:00
S. Brent FaulknerandSoam Vasani 51c84f3cfc Ruby logger (#251)
* Add logger for ruby environment

* Update readme and example for ruby logger

* ruby-env: log load time for user code
2017-07-07 18:05:11 -07:00
S. Brent FaulknerandSoam Vasani fe4015fab2 fix typo funtion -> function (#252) 2017-07-07 09:37:35 -07:00
Soam Vasani 22e0c10d07 Update install guide links to latest release 2017-07-05 17:49:40 -07:00
Ta-Ching ChenandSoam Vasani e4fe007838 Add message queue trigger support (#218)
Adds support for message queue triggers based on the NATS-Streaming message queue.

This lets the user map a queue topic to a function, and optionally send the function's response into another queue topic.

The message queue trigger manager is designed to be message queue independent, so we should be able add support for more queues by adding implementations for the relatively simple mqtrigger.MessageQueue interface.
2017-07-05 17:19:58 -07:00
S. Brent FaulknerandSoam Vasani 0fd60eab3b include path parameters in params hash for ruby environment (#249)
* include path parameters in params hash for ruby environment

* Improve code organization and documentation for ruby environment.

* Document Ruby examples
2017-07-04 23:44:18 -07:00
Soam Vasani ae87c0ea37 Fix curl command in install instructions (#248) 2017-07-03 16:29:09 -07:00
Soam Vasani 55651d49e0 Environment v2 interface doc (wip) 2017-06-30 09:23:35 -07:00
Soam Vasani 1f0ca47550 release helper script 2017-06-28 15:50:25 -07:00
Soam Vasani e619a70661 add sections to cli download 2017-06-28 15:07:23 -07:00
Soam Vasani d248bb89ea Install docs improvements
Keep install docs in one place INSTALL.md instead of two.

Use github releases for all YAMLs and CLIs. This has a few advantages:
 (a) it makes releasess more transparent
 (b) all yaml/cli files are transferred over HTTPS
 (c) CLIs and YAMLs being from the same release ensures that people
     always get compatible versions (we will still occasionally break
     api compatibility, until beta)
2017-06-28 15:00:42 -07:00
Ta-Ching ChenandSoam Vasani 5fe4b276eb Fission update must require at least one change to function (#241) 2017-06-26 22:22:09 -07:00
Soam Vasani 8f1b27bd72 Remove image tags from yamls 2017-06-21 00:09:31 -07:00
yang qfandSoam Vasani ce4d3ac42d Fix creation of redundant pods on heavy load cold start (#232)
Modifies function specialization so that concurrent requests for the same function cause only one pod to be created.
2017-06-19 18:56:38 -07:00
Soam Vasani 3328014ee6 Fix image version in fission-openshift.yaml 2017-06-17 21:14:27 -07:00
yang qfandSoam Vasani b1e66663bd Retrieve URL params in functions (#226)
Addresses #158. Adds URL params into HTTP headers. A URL param named `KEY` with the value `VALUE` in the actual URL will appear as the header "X-Fission-Params-KEY: VALUE" in the fission function.
2017-06-17 21:12:12 -07:00
yang qfandSoam Vasani c1dd8a9f35 Aggregate tap service request in interval (#229)
The poolmgr client now aggregates successive tapService() calls and sends them to the poolmgr service every 5 sec, instead of sending them immediately.
2017-06-17 20:58:10 -07:00
Ta-Ching ChenandSoam Vasani d9b98830cf Fix http response body not closed correctly, return immediately on error (#210)
* Fix controller timer handler not return when error occurred

* Fix controller not close http response correctly

This PR aims to fix controller not close response correctly. Also, I’ve check all over the project there is no more resource leak issues exist after this patch.

* Fix controller not return immediately when error occurred

* Sort import
2017-06-17 13:10:54 -07:00
S. Brent FaulknerandSoam Vasani a8e7ec534b Add Ruby environment (#223)
Adds a Ruby environment and examples.
2017-06-17 10:48:05 -07:00
Soam VasaniandGitHub 0207d13b23 Specify full golang version in Dockerfiles and build helper script (#227)
Addresses #222.

Plugins and the binaries loading them need to be built with the exact
same go version.

Also update README instructions.
2017-06-09 15:36:09 -07:00
Niko KurttiandSoam Vasani 93ef6fac53 Fix s/Sirupsen/sirupsen/ for logrus (#224)
Fix s/Sirupsen/sirupsen/ for logrus
2017-06-08 13:44:07 -07:00
Ta-Ching ChenandSoam Vasani c43cde8891 Fix pool contains wrong environment metadata (#221)
The generic pool manager creates a generic pool with the reference of environment metadata. Since the reference is address of loop variable, so the content of metadata will be replaced with the last element of envs. So pool manager sets up logging with wrong env.
2017-06-08 11:11:58 -07:00
Soam VasaniandGitHub 62aa9d6d73 Update golang instructions 2017-06-07 10:52:11 -07:00
Javier CastellanosandSoam Vasani cde2f26a9d Added support for pods and replication controllers to watchers (#216) 2017-06-01 10:49:57 -07:00
Mark PeekandSoam Vasani 75d65adcc0 Fix two links in Roadmap doc (#213) 2017-05-31 11:32:32 -07:00
Ta-Ching ChenandSoam Vasani 2f6cd6d659 Print log when timetrigger is removed (#209) 2017-05-30 14:21:41 -07:00
Ta-Ching ChenandSoam Vasani 990d943f21 Retrieve function logs from controller (#207)
Establish a proxy server from the controller to the log database.

Redirect query commands send from client to database then proxy back the db response.

Use parameter binding instead of fmt.Sprintf to prevent SQL injection.
2017-05-30 14:19:22 -07:00
Soam Vasani 531f69a037 Roadmap doc links 2017-05-18 15:21:36 -07:00
Soam Vasani 3ea9ad2449 Roadmap doc formatting 2017-05-18 15:04:01 -07:00
Soam Vasani bc61396071 Roadmap.md for an overview of roadmap and areas 2017-05-18 12:17:33 -07:00
Quinn MurphyandSoam Vasani 6185e842b5 Adding fission-rbac.yml for (#183)
Set up RBAC role bindings to allow fission to create pods in the fission-function namespace.
2017-05-17 16:27:10 -07:00
yang qfandSoam Vasani a8c6347ed0 Add Time Trigger API and client (#153) (#161)
This change adds a timer trigger API, client, and implementation.  Users can trigger a function with a cron-compatible string. 

This change also moves the publisher interface and webhook-based publisher implementation out of kubewatcher and into a separate `publisher` package.
2017-05-17 15:13:56 -07:00
gonrialandSoam Vasani e5f5050ea6 Modify the stock example to show how to change the Content-Type (#124) 2017-05-12 15:36:12 -07:00
yang qfandSoam Vasani 03e3a63581 Move fission-ui intro to Install.md (#159) 2017-05-09 11:36:07 -07:00
mgandSoam Vasani 747a3d2197 Update INSTALL.md with install instructions for openshift (#179) 2017-04-27 14:20:16 -07:00
Fernando AlvarezandSoam Vasani 9bd21d2380 Add OpenShift support (#107) (#168)
Adds the minimal OpenShift components needed to deploy Fission with the
same functionality as with Kubernetes, using only a deployment template
file (fission-openshift.yaml). No need of objects creation via CLI.

Update deployment instructions in README.md
2017-04-27 14:19:32 -07:00
Ashley PenneyandSoam Vasani a15c867812 Make the chart work with helm 2.2 (#170)
Primarily this involved removing the release namespace, which is
controlled by helm.  If you want resources in a namespace you set
--namespace= with helm install, anything else leaves helm unable
to properly manage the resources.

I think the functions namespace won't work either on a delete.
2017-04-27 14:17:30 -07:00
Soam Vasani e1067ab4e5 update guestbook example css 2017-04-25 12:09:19 -07:00
Soam Vasani d2b7dc36ab Update fission.yaml to 3/28 image 2017-04-24 08:25:38 -07:00
syassamiandSoam Vasani 1abe961869 Lighten up the python3 base image (alpine) (#171)
Saves 241 MB from the base example image, bringing things down to 242MB in total.
2017-04-21 11:15:52 -07:00
Soam Vasani 01b399187e Work around 'too old resource version' 2017-03-28 12:42:59 +02:00
Soam Vasani b4dd7a83df Better error checking in watch restarts 2017-03-28 12:06:07 +02:00
Soam Vasani 137d8f7285 Track resourceVersion from event objects 2017-03-28 10:01:11 +02:00
Soam Vasani c9f63e8173 Pass last resource version to restart watch 2017-03-28 10:01:11 +02:00
Soam Vasani a71756762b Restart watches when they stop unexpectedly 2017-03-28 10:01:11 +02:00
Soam VasaniandGitHub a6eb4c6d31 Go build helper script (#163)
Create a docker container and a script to call it, to help people build go plugins for use with fission.
2017-03-27 23:26:59 -07:00
Ta-Ching ChenandSoam Vasani a13015e75a Add function logs support (#53) (#131)
Add function log aggregation and persistence using Fluentd and InfluxDB.

Fluentd and a helper sidecar run as a daemonset.  The poolmgr sets up logging for each function pod, using the helper sidecar. Fluentd forwards logs to InfluxDB, which is run as a deployment and service. The client CLI directly queries InfluxDB for logs.

Fluentd supports many outputs besides InfluxDB, so we aren't very tied to InfluxDB.

The setup is somewhat manual, which we should be able to improve by integrating this into the helm chart.

Diagram of component interactions: https://cloud.githubusercontent.com/assets/202578/23100399/b0e3ea00-f6ba-11e6-8f2f-6588cfef2e84.png
2017-03-22 15:59:42 -07:00
Valentin TjonckeandSoam Vasani 1665235c14 Golang runtime (#125)
Minimal golang runtime.  

Functions are built as Go plugins, and the plugin is uploaded to fission.

See `environments/go/README.md` for instructions and `examples/go` for a usage example.

For now, we're re-using the 'code' field of the function to store the binary plugin. With v2 environments, this will be stored separately as a binary package.
2017-03-21 17:13:29 -07:00
Lingxian KongandSoam Vasani a3f8016442 Set correct Content-Type in the http response (#147)
When the request is handled successfully, json data is returned, this
patch changes the response Content-Type header from text/plain to
application/json

Fixes: #144
2017-03-21 13:51:54 -07:00
Soam Vasani a390c1baa8 Bugfixes in nodejs environment server and examples 2017-03-19 19:36:00 -07:00
J. Gavin RayandGitHub b5b10a4a27 Merge pull request #157 from fission/travis-go-18
Drop Go 1.7, use Go 1.8
2017-03-16 09:25:19 -07:00
Soam Vasani aa77d8686f Drop Go 1.7, use Go 1.8 2017-03-16 09:18:49 -07:00
Robert HerholdandSoam Vasani 68c006cd33 Add README for Node.js examples (#155) 2017-03-14 17:32:13 -07:00
maxwellandSoam Vasani b561f7d948 use fmt.Errorf instead of error.New() (#149) 2017-03-14 16:23:32 -07:00
Robert HerholdandSoam Vasani 9bdaf3c74e Upgrade node environment to Node.js 7.6.0+ (#151)
Upgrades the node environment to NodeJS 7.6.0.  Functions can now use async/await and promises; they can return a promise instead of using a callback.  The change preserves compatibility with the callback style.  

* Upgrade node environment to Node.js 7.6.0+

* Bump package version

* Preserve compatibility for callbacks

* Cleanup

* Re-add hello callback example

* Make sure not returning won't blow everything up

* Update stock example with request promise
2017-03-14 16:00:26 -07:00
Robert HerholdandSoam Vasani e1cb5f6e09 Return HTTP status 201 for created resources (#148)
Have the controller return status 201 for created resources, and have the client check for 201 response on created resources.

#143
2017-03-12 20:05:19 -07:00
yang qfandSoam Vasani a6869ab746 Fix function delete with uid (#142)
If no uid is provided, all versions of function files and function metadata will be deleted.  If a uid is provided, only that specific version is deleted, and the "latest" version of the function moves back to the previous one.

Fixes #152
2017-03-12 13:04:56 -07:00
Robert HerholdandSoam Vasani 365eabb027 Make it more clear where to clone this repo (#145)
Make it clear that the repo should be cloned into the $GOPATH.
2017-03-08 15:30:41 -08:00
Ta-Ching ChenandSoam Vasani ad63ba63c8 Fixed pod has no ip (#139) (#141)
Fixes #139.  The code before this change was saving up pointers to the loop variable in a slice. So loop was useless and we always chose the last pod in the list, whether it was ready or not.  With this fix, choosePod should always return a ready pod.

Also adds a check for the pod phase, before looping over the containers in the pod, and discard pods that aren't running yet.
2017-03-05 11:01:47 -08:00
Simon DittlmannandSoam Vasani 6af605bfe8 fix kubeEventsSlack example: typo and wrong variable name (#140)
- change comma to semicolon
- change variable name `path` to `slackWebhookPath`
2017-03-04 14:08:23 -08:00
Robert HerholdandSoam Vasani 4d16a4be08 Fix Markdown table (#136) 2017-03-02 11:35:59 -08:00
Robert HerholdandSoam Vasani 6e5b1cf8db Ignore the vendor folder (#137) 2017-03-02 11:33:11 -08:00
Soam VasaniandGitHub ca3bf8e83e Symlink user function's node_modules to server's node_modules (#133)
Fixes #132
2017-02-23 10:19:42 -08:00
Soam Vasani 92cd5334ec Add a default handler for the / route
Before this change, if the user doesn't define a route for /, the
router happily 404s at that path.  This breaks GKE Ingress, which uses
that request as a health check.  So this change adds a handler for
"GET /", unless the user already has one.

Also, log the delay for slow requests.
2017-02-20 23:57:40 -08:00
Sanket SudakeandSoam Vasani f4b6558e79 Remove redundant hello.js from charts directory (#130) 2017-02-20 15:14:56 -08:00
Soam Vasani 3b75a86773 Instructions in the README were leading to a malformed file
Switch to using a curl command to download sample code, instead of
dealing with nested quotes and stuff.

Addresses #128.
2017-02-17 15:34:02 -08:00
Soam VasaniandGitHub 8cf382c2b3 Handle errors in filestore init (#127)
Fixes issue #108
2017-02-17 15:21:36 -08:00
Toby CrawleyandSoam Vasani ab6e2e8021 Improve command-line client error output (#122)
Motivation: The output when an error occurs shows an integer error code,
which isn't very helpful. And in the case of an error when creating a
resource, you also get a redundant log message from the controller
client.

Modifications:
* the controller client no longer logs errors
* the generated String() allows for the enum name to be displayed in the
  error output
* each errorCode enum member has a hand-generated description
* the format of the error message from the CLI client was modified to
  display the error description with the error message

Related to #112
2017-02-16 13:58:59 -08:00
Soam Vasani eae5150bff Initial test script
Test script that sets up fission on a cluster, runs tests and
uninstalls it.

Yet to come:

1. The actual tests
2. Builds (for fission-bundle, client, and envs)
3. Automation with github pull requests
2017-02-16 12:55:38 -08:00
Soam Vasani d4dc166039 Use Helm's built-in support for namespaces
Remove our non-standard namespace variable and use .Release.Namespace
to put fission deployments and services into.

(We still need the functionNamespace parameter, to customize what
namespace fission puts functions into.)
2017-02-16 12:01:26 -08:00
Soam Vasani 41baa7b6bf Add fission and fission-function namespaces to template variables
Also, update readme.
2017-02-16 11:08:47 -08:00
Soam Vasani 6e4115cb5d Update use cases, talk a bit about implementation 2017-02-15 11:21:51 -08:00
Kaustubh PhatakandSoam Vasani 9e5db82cc9 Check for unique HTTP route & method (#102) (#111)
Check for uniqueness in HTTP routes, returning error 409 when a route + method combination is duplicated.
2017-02-13 15:58:19 -08:00
Matt RickardandSoam Vasani 6be861afc8 Upgrade minikube version in docs to v0.16.0 (#120) 2017-02-13 14:17:33 -08:00
Toby CrawleyandSoam Vasani 430639a1cf Report KeyNotFound from etcd as a 404 (#121)
This allows for proper classification of the error on the client side.
2017-02-13 13:16:12 -08:00
Toby CrawleyandSoam Vasani c8b5bb2972 Better convey duplicate name errors to client (#116)
Motivation: Creating duplicate resources currently results in a 500
error being displayed by the client, with no information about the true
nature of the failure.

Modifications:
* ResourceStore now converts any errors from the etcd client into
  fission errors, capturing the reason for the error in the case of a
  duplicate key (as ErrorNameExists)
* ErrorNameExists errors are signaled to the client with a
  409 (Conflict) HTTP status
* MakeErrorFromHTTP() now reads the body of the error response to
  retrieve the actual error message instead of using the HTTP status
  message
* the controller client now uses MakeErrorFromHTTP() to centralize
  status code -> error code mapping
* tests for all of the resources now check that duplicate resources are
  reported properly

Result: The client can now provide more context when a duplicate name is
given

related to #112
2017-02-13 08:58:52 -08:00
Sanket SudakeandSoam Vasani 99d6a95bc1 Helm chart for fission (#90)
Helm Chart for Fission.  See NOTES.txt for usage.
2017-02-12 00:13:24 -08:00
Ta-Ching ChenandSoam Vasani 14c55912f5 Fix failure to delete function when function's file doesn't exist (#118) 2017-02-10 23:38:13 -08:00
Soam VasaniandGitHub 858fe9f62b Merge pull request #117 from tobias/gitignore-updates
Update gitignore to include dev artifacts
2017-02-10 14:10:50 -08:00
Toby Crawley 25afe7bd78 Update gitignore to include dev artifacts 2017-02-10 13:53:46 -05:00
Soam VasaniandGitHub 3420a614bb Merge pull request #114 from fission/issue-113
Don't wait for ready pod in MakeGenericPool
2017-02-09 16:27:17 -08:00
Soam Vasani d4d917ad04 Don't wait for ready pod in MakeGenericPool
Addresses issue #113.  poolmgr.MakeGenericPool does not need to wait
for a ready pod.  Kubernetes already retries image fetching, so
there's no need to repeat the task in fission.  And if it's a
non-retriable error (like the image URL being wrong), then the
deployment will stay broken, and the user can fix the environment with
'fission env update' (or 'fission env delete' followed by 'fission env
create').
2017-02-09 15:27:57 -08:00
Soam Vasani d0ad377d72 Add README to NodeJS env 2017-02-08 16:43:19 -08:00
Soam VasaniandGitHub 4046c811b1 Merge pull request #109 from tobias/build-sh-as-sh
Make build an actual sh script
2017-02-06 18:02:25 -08:00
Soam VasaniandGitHub 8127a1f57f Merge pull request #110 from tobias/readme-updates
Minor improvements to build instructions in README
2017-02-06 18:01:23 -08:00
Toby Crawley 20cac31635 Minor improvements to build instructions in README 2017-02-06 15:33:46 -05:00
Toby Crawley fd07a8a75e Make build an actual sh script
This allows it to be executed from alternative shells (fish, for
example).
2017-02-06 15:28:46 -05:00
Soam VasaniandGitHub 0d4d2e32a8 Merge pull request #106 from kaustubhvp/fix-func-validations
Fixing validations of fn actions
2017-02-06 09:12:43 -08:00
Soam VasaniandGitHub 436057e15b Merge pull request #105 from ktrance/master
Http request support
2017-02-06 09:12:00 -08:00
Kaustubh Phatak 33f7647ea7 Fixing validations of fn actions 2017-02-05 12:51:52 -08:00
Klavs Madsen a1d255f038 Added usage examples
* Cleaned up project.json

* Updated README with example on how to deserialize json request body

* Added reference to System.Runtime.Serialization.Json as this would seems a common usage

* Added C# example files to the /Examples directory
2017-02-05 12:57:49 +01:00
Klavs Madsen c9ea73786b Http request support
Added support for accessing basic http request information
2017-02-04 17:58:03 +01:00
Kaustubh PhatakandSoam Vasani 76d4ea7b04 function code download using HTTP URL (#100)
* function code download using HTTP URL

* Addressing review comments

* Updating help-text for function
2017-02-02 15:14:00 -08:00
Damien GoujardandSoam Vasani 2725da6b1b Add initial support for PHP7 (#97)
* Add initial support for PHP7

* Update PHP env with now an PSR3 logger (Monolog). Now you can also create a handler function with PSR7 Http message and PSR3 logger in parameter.

* Add examples for PHP7 environement

* For development you can create a function in this path /app/userfuncdev.php it will be loaded

* Switch to alpine base image

* handler now receive an array with request, response and logger object
2017-02-02 11:28:28 -08:00
Laurent CrisciandSoam Vasani c353e7f230 Error when env name/image not provided (#98)
I also renamed image to envImg for consistency
2017-02-02 10:23:16 -08:00
Soam VasaniandGitHub 7b58ef389d kubewatcher example: send watch updates to slack (#96)
This example sends change events from a watch to a Slack webhook.
2017-01-31 12:23:45 -08:00
Soam VasaniandGitHub 9db35b6ff2 Merge pull request #94 from andrewstuart/bugfix/https
bugfix (cli) Update the URL check to work with https
2017-01-31 11:37:08 -08:00
Andrew Stuart 1cc1fac151 Satisfy golint, clarify logic 2017-01-31 08:25:57 -07:00
Andrew Stuart 39fb45d8da bugfix (cli) Update the URL check to work with https 2017-01-31 08:11:54 -07:00
Soam Vasani 1b04f042cd Note limitations of dynamic loading in pods 2017-01-26 22:18:38 -08:00
Soam VasaniandGitHub 7485dca7d8 Merge pull request #84 from ktrance/master
Added support for running C# code in a dotnet core environment
2017-01-26 11:39:21 -08:00
Soam VasaniandGitHub 20baa2ee9d Wait for Pod IP while waiting for pod ready (#89)
Addresses issue #88.
2017-01-25 15:32:34 -08:00
Soam Vasani 2fc9fd9603 Update YAML to point at alpha20170124 fission-bundle image 2017-01-24 11:27:01 -08:00
Soam VasaniandGitHub 0465ccd352 Merge pull request #87 from AlekSi/patch-1
Make go vet happy
2017-01-24 08:40:55 -08:00
Alexey PalazhchenkoandGitHub 9e01b2f1a7 Make go vet happy 2017-01-24 17:11:26 +03:00
Soam Vasani cb08118164 Update README, create separate install instructions 2017-01-23 23:55:23 -08:00
Soam Vasani 043ae0c2b1 Add a contributing.md 2017-01-23 22:36:15 -08:00
Soam Vasani bba71d65a2 Fix incorrect log printf 2017-01-23 19:49:13 -08:00
Soam VasaniandGitHub f3e1f8b88c Merge pull request #86 from fission/travis-failure
Ignore glide cache in gofmt check
2017-01-23 19:43:47 -08:00
Soam Vasani da15e5cdb7 Ignore glide cache in gofmt check 2017-01-23 19:29:45 -08:00
Soam Vasani 90e7f0212a Programming model doc update 2017-01-23 19:13:02 -08:00
Soam Vasani 000b74d4ad Doc updates 2017-01-23 19:11:37 -08:00
Klavs Madsen 760e021141 Added basic logging, just a facade for now
Added FissionContext class
Changed name on both class and function for input code to avoid namespace clashes when adding FissionContext
Updated README
Added section on how to develop/debug the code to README, might be obvious for some but not all
Changed code input from static function to method
2017-01-22 15:45:08 +01:00
Klavs Madsen f5270d97b1 Added support for running C# code in a dotnet core environment 2017-01-21 13:57:45 +01:00
Soam VasaniandGitHub 8339e120ce Merge pull request #81 from fission/bugfix-internal-routes
Bugfix for internal routes
2017-01-19 09:54:00 -08:00
Soam Vasani 1d4875ff74 Bugfix for internal routes
Poolmgr removed the default-latest-version semantics to simplify
caching.  But this broke the router's internal function routes, which
are used by kubeWatcher.  The router now exposes a versionless url
and regularly updates that to point to the latest version.
2017-01-19 09:27:05 -08:00
Soam Vasani e0c7682996 Improve environment doc 2017-01-18 16:59:39 -08:00
Soam Vasani 4f9b36b042 Add README to python env 2017-01-18 16:53:03 -08:00
Soam Vasani e268ae68e7 Create python env conditionally 2017-01-18 15:43:29 -08:00
Soam Vasani 928d96c080 A trivial guestbook app
Functions for GET and POST endpoints. A redis.yaml to deploy redis on
kubernetes.  And a deploy.sh to deploy the fission functions with
routes.
2017-01-18 15:30:51 -08:00
Soam Vasani 9ffba72c11 Add redis client to python env 2017-01-17 23:42:05 -08:00
Soam VasaniandGitHub b1cf2a0182 Merge pull request #79 from fission/router-handle-method-bug
Bug fix for handling a route's HTTP method in router
2017-01-17 22:27:44 -08:00
Soam Vasani 3ed5e772cf Update test to include method 2017-01-17 22:06:02 -08:00
Soam Vasani 3f02ccaf34 Bug fix for handling a route's HTTP method in router 2017-01-17 18:42:54 -08:00
Soam VasaniandGitHub 324af61192 Merge pull request #77 from frodenas/namespace-flag
fission-bundle: allow setting the namespace
2017-01-13 11:22:37 -08:00
Ferran Rodenas 86a8430c52 fission-bundle: allow setting the namespace 2017-01-13 13:10:13 +01:00
Soam Vasani 93ca9cbf3e Add slack badge 2017-01-12 11:54:46 -08:00
Soam VasaniandGitHub 9ea7c80977 Merge pull request #75 from fission/cleanup-deleted-pools
Delete generic pools when environments are deleted
2017-01-11 13:42:44 -08:00
Soam Vasani 5460f8ac05 Delete generic pools when their environment is deleted 2017-01-11 13:35:28 -08:00
Soam Vasani 6af56753ea Cleanup deleted pools, partly implemented 2017-01-09 16:17:30 -08:00
Soam VasaniandGitHub ac4c11bfb4 Merge pull request #70 from fission/poolmgr-delete-pods-on-failure
Poolmgr: fix pod leak bugs on specializePod failure
2017-01-06 23:31:45 -08:00
Soam Vasani 0fb12af4e5 add log on specializePod error/clean up 2017-01-06 22:16:49 -08:00
Soam Vasani 3e386fb41d Handle pod cleanup on svc creation error 2017-01-06 22:09:17 -08:00
Soam Vasani e4f7027a69 Reorganize a bit to avoid duplicated error handling 2017-01-06 21:54:15 -08:00
Soam Vasani ebb486d121 Delete pods that failed to load user function 2017-01-06 17:43:03 -08:00
Soam VasaniandGitHub d5516686c8 Merge pull request #69 from fission/poolmgr-gc
Poolmgr: ensure orphaned resources are cleaned up
2017-01-06 17:25:06 -08:00
Soam Vasani 37a00b6116 Add cleanup.go 2017-01-06 17:14:54 -08:00
Soam Vasani eccde4fe74 Poolmgr: clean up orphaned resources on restart
Label all poolmgr-created resources with an id that's unique to a
running poolmgr instance.  On poolmgr start up, clean up resources
created by old instances.  Resources that are idle are killed
immediately; resources that could be running a user function are
killed after the maximum function timeout.
2017-01-06 17:01:21 -08:00
Soam VasaniandGitHub 595e634617 Merge pull request #68 from fission/cli-route-update
Implement 'fission route update'
2017-01-05 16:15:19 -08:00
Soam Vasani e73242f85c Implement 'fission route update'
"fission route update" can now be used to update a route to point to a
different function.
2017-01-05 15:59:39 -08:00
Soam VasaniandGitHub 5829552c3b Merge pull request #67 from fission/function-versioning-cache-bug
Update router cache on new function version
2017-01-05 15:27:29 -08:00
Soam Vasani fa272f20a0 Update router cache on new function version
Addresses issue #51. Makes versioning in poolmgr explicit, so its
cache needs no invalidation on version update.  Functions in poolmgr
are always cached by name and UID.

Router now updates implictly versioned routes with the latest version
of a function.

This means that users will see requests to implicitly-versioned routes
go to the latest version of a function within 3 seconds.  (Those 3 sec
will go away when we use a real watch instead of polling the
controller.)

There's no change in behaviour for routes that explictly specify a
function UID.
2017-01-05 15:02:16 -08:00
Soam VasaniandGitHub cb5cae6501 Merge pull request #66 from fission/changeOrg
Changed Package Names to Match new Github Organization
2016-12-24 10:50:41 -08:00
J. Gavin Ray ea2bb9952c Changed package names and documentation to match the new git organization 2016-12-24 08:12:15 -08:00
J. Gavin Ray 943d430870 # This is a combination of 2 commits.
# This is the 1st commit message:

Changed package names to match the new organization

# This is the commit message #2:

Forgot Cache
2016-12-24 08:11:35 -08:00
J. Gavin RayandGitHub c7d2216400 Updated glide.yaml
Changed package to reflect the new organization.
2016-12-24 07:38:33 -08:00
Soam Vasani 63d7c666e0 Merge branch 'code-of-conduct' 2016-12-21 12:56:01 -08:00
Soam Vasani 3e24cbcca2 Add code of conduct (contributor covenant, v1.4)
We still need to write a nice contributor guide; for now let's just
add a code of conduct.
2016-12-21 12:53:42 -08:00
Soam VasaniandGitHub 08d1e55251 Merge pull request #65 from platform9/route-create-with-fn-create
Add HTTP route create params to function create command
2016-12-20 19:36:48 -08:00
Soam Vasani a5d96b928c Add HTTP route create params to function create command
This allows users to add --method and --url params to their "fission
fn create" command line.  It sets up the route to call the latest
version of the function; user can edit the route with the "fission
route update" command, if they want to.
2016-12-20 17:42:23 -08:00
Soam VasaniandGitHub f0b31564f0 Merge pull request #56 from platform9/kubewatcher
Kubewatcher: trigger functions from Kubernetes Watch callbacks
2016-12-20 14:30:32 -08:00
Soam Vasani d721df998d Fix object-type header passed to event handlers 2016-12-20 14:16:33 -08:00
Soam Vasani c5425180e8 Make webhook publisher use relative urls 2016-12-20 12:19:51 -08:00
Soam Vasani 8704761fd0 watch.Url renamed to watch.Target 2016-12-20 12:11:54 -08:00
Soam Vasani 4d75c3fa4e Make internal urls relative (as before) 2016-12-20 12:11:22 -08:00
Soam Vasani 0456df0d63 Refactor kubewatcher/webhook publisher
Create a Publisher interface. Refactor webhook publisher to satisfy
that interface.

Add some limited retries to webhook publisher.
2016-12-19 14:38:44 -08:00
Soam VasaniandGitHub 7493759134 Merge pull request #61 from platform9/add-kubectl-instructions
Add kubectl download to install instructions
2016-12-16 17:47:16 -08:00
Soam Vasani 1fe894ab1c Add kubectl download to install instructions 2016-12-16 17:42:35 -08:00
Soam VasaniandGitHub cbc4749779 Merge pull request #60 from platform9/readme-minikube-instructions
Readme minikube instructions
2016-12-16 15:24:06 -08:00
Soam Vasani 1c5954ae61 mac/linux instructions 2016-12-16 14:53:34 -08:00
Soam Vasani d503834901 mac/linux download url for minikube 2016-12-16 14:41:12 -08:00
Soam Vasani dcc17d50b8 Include minikube setup instructions 2016-12-16 14:22:40 -08:00
Soam VasaniandGitHub ea4a9faceb Merge pull request #59 from platform9/fission-cli-bug
Check for name in 'function delete'
2016-12-16 13:50:40 -08:00
Soam Vasani f84827e384 Check for name in 'function delete' 2016-12-16 13:43:00 -08:00
Soam VasaniandGitHub 943b15f5a7 Merge pull request #57 from kaustubhvp/adding-go-report-card
adding go-report card and fixing minor typo in README
2016-12-16 09:35:19 -08:00
Soam Vasani dddb50c00f cli watch impl 2016-12-16 00:54:06 -08:00
Soam Vasani de30886c9e compile error 2016-12-16 00:43:45 -08:00
Kaustubh Phatak 96cc8e402e adding go-report card and fixing minor typo in README 2016-12-15 20:57:08 -08:00
Soam Vasani 215f4fc30f comments 2016-12-15 19:48:45 -08:00
Soam Vasani 53c49d1485 Add an atomic bool to track if a watch is stopped
Saw a watch channel close once without actually calling watch.Stop.
Need to investigate this a bit and handle it if necessary.
2016-12-15 09:34:03 -08:00
Soam Vasani 4bc7480acd Add request logging to router 2016-12-15 09:33:02 -08:00
Soam Vasani 5c6dcca19d Pass obj type to functions 2016-12-12 08:46:19 -08:00
Soam Vasani b7906905c2 Make the internal triggers point to the latest version 2016-12-11 19:59:10 -08:00
Soam Vasani f1e1da4ceb Bugfix in fission-bundle arg parsing 2016-12-11 19:58:26 -08:00
Soam Vasani 5e3adc0b59 Log on function exception 2016-12-11 19:58:04 -08:00
Soam Vasani 0fb4cc1536 Use latest version of function for watches 2016-12-11 00:07:25 -08:00
Soam Vasani 193cf594be Let fission CLI tolerate URL with/without leading http:// 2016-12-10 19:56:45 -08:00
Soam Vasani 7918b89fd2 Bugfix in kubewatcher deployment yaml 2016-12-10 19:56:15 -08:00
Soam Vasani 2379cb6f81 Add watches to fission CLI 2016-12-10 19:55:43 -08:00
Soam Vasani f29e69c581 Fix cleanup on duplicate function specialization 2016-12-10 19:55:20 -08:00
Soam Vasani ddb189bda2 Kube requests: add content-type 2016-12-10 19:54:01 -08:00
Soam Vasani 188280488c Fix bug in populating watch url 2016-12-10 19:53:13 -08:00
Soam Vasani 9dcd2b711f Add kubewatcher deployment to yaml 2016-12-09 23:58:31 -08:00
Soam Vasani 4ae0ab98e8 Add kubewatcher to fission-bundle 2016-12-09 23:43:27 -08:00
Soam Vasani a69834157f Controller crud for Watch type
Controller and client crud, API routes, and a unit test for the Watch
type.
2016-12-09 23:42:03 -08:00
Soam Vasani 3a6d5bb070 Add "internal" routes for all functions
These routes allow us to call any function without explicitly defining
a route for them.  TODO: if we can serve these routes from a separate
instance of router (controlled by a commandline flag or env var), we'd
be able to keep this instance of the router "private" by not assigning
it a loadbalancer/nodeport or other externally-visible service.
2016-12-09 23:34:46 -08:00
Soam Vasani e49af8ca78 Watch type
Contains parameters to start a Kubernetes watch, and a function to
call when the watch triggers.
2016-12-09 23:25:29 -08:00
Soam Vasani fa093829bc Kubernetes events watcher
Kubewatcher watches the Kubernetes API for Watches that have been
configured on the fission controller.  It then posts that event to the
function configured in the watch.
2016-12-09 23:22:18 -08:00
Soam VasaniandGitHub 85b0a239c0 Merge pull request #49 from kaustubhvp/py-common-libs
adding commonly used python libraries
2016-12-08 17:00:21 -08:00
Kaustubh Phatak cfd503af8b removing stevedore and websocker-client libs from python env 2016-12-08 15:42:19 -08:00
Kaustubh Phatak 01249c2d4a adding commonly used python libraries 2016-12-08 15:27:04 -08:00
Soam VasaniandGitHub 88f33b9382 Merge pull request #48 from platform9/python-setup-logger
Setup app.logger for python environment

Fixes #47
2016-12-08 14:22:00 -08:00
Soam Vasani 4a6a088eca Modify example a bit 2016-12-08 14:13:01 -08:00
Soam Vasani 5f02f6c8ca Setup app logger in python environment
The user's functions can now use `current_app.logger`, and use
`kubectl logs` to see the logs that the function outputs.
2016-12-08 14:03:27 -08:00
Soam Vasani ab96ed2917 Add a python example showing how to get at request data 2016-12-08 11:59:59 -08:00
Soam VasaniandGitHub e8a84dcaa3 Merge pull request #46 from platform9/add-build-badge
Add build badge
2016-12-05 09:57:56 -08:00
Soam Vasani e627a55988 move status badge 2016-12-05 09:31:42 -08:00
Soam Vasani ed426db4a4 Add travis build status badge back to README 2016-12-04 20:12:05 -08:00
Soam VasaniandGitHub 5e56d99415 Merge pull request #45 from platform9/run-etcd-in-travis
Install and run etcd on travis
2016-12-04 18:44:48 -08:00
Soam Vasani cd5325090b Background etcd in travis run script 2016-12-04 18:33:50 -08:00
Soam Vasani 4c14f34969 Install and run etcd on travis 2016-12-04 18:19:03 -08:00
Soam VasaniandGitHub f3aeb28add Merge pull request #44 from platform9/poolmgr-test
Bugfix in functionServiceCache test
2016-12-04 15:31:58 -08:00
Soam Vasani 571fa6b0e7 function service cache test bugfix 2016-12-04 15:23:55 -08:00
Soam VasaniandGitHub ea03e0abc2 Merge pull request #42 from platform9/travis-test
#25 Continuous Testing
2016-12-04 14:58:16 -08:00
J. Gavin Ray e92521deab #25 - Addressing suggestions 2016-12-04 14:44:22 -08:00
Soam VasaniandGitHub dd08d07d59 Merge pull request #43 from platform9/fix-cache-test
Fix cache test
2016-12-04 14:15:22 -08:00
Soam Vasani 675cc4f360 Fix cache test
cache.Set() returns existing value; update the test accordingly.
2016-12-04 14:10:02 -08:00
J. Gavin Ray f4be8a73b3 added build status to README 2016-12-04 12:49:31 -08:00
J. Gavin Ray 69cd025a66 added Go versions to test against 2016-12-04 12:04:17 -08:00
Soam VasaniandGitHub c8c0afc68f Merge pull request #41 from carmark/travis
Add travis integration test and fix the tag for client-go in glide.yaml.
2016-12-03 23:10:41 -08:00
Lei Xue e9c29a8ec8 add travis test 2016-12-04 14:28:20 +08:00
Lei Xue 3478d0643b update glide.yaml with k8s client tag v1.5.0 2016-12-04 14:28:09 +08:00
Lei Xue c4b7043e70 format poolmgr/gp.go 2016-12-04 14:27:51 +08:00
Soam VasaniandGitHub 5a007184d4 Merge pull request #39 from pirogoeth/patch-1
Fix `environment` command typo.
2016-11-30 20:01:18 -08:00
Sean JohnsonandGitHub 08da045f43 Fix environment command type. 2016-11-30 18:51:44 -06:00
Soam VasaniandGitHub 3672abbe82 Merge pull request #38 from platform9/edit-readme
Streamline the README's setup instructions a bit.  Add links to Mac & Linux CLI binaries.
2016-11-30 16:12:12 -08:00
Soam Vasani 36e056c1f4 make cli download into 1 copy-pasteable command 2016-11-30 16:00:41 -08:00
Soam Vasani 87e2daf455 minor readme edits 2016-11-30 15:47:17 -08:00
Soam Vasani a37b71e063 link to gke; other readme edits 2016-11-30 15:45:48 -08:00
Soam Vasani 654763cac1 Mac/linux CLI 2016-11-30 14:30:00 -08:00
Soam Vasani 460db87bd7 Merge env var section to setup 2016-11-30 14:13:00 -08:00
Soam Vasani 3aa0c2e803 Streamline setup instructions a bit 2016-11-30 13:48:42 -08:00
Soam VasaniandGitHub 9e452fd325 Merge pull request #36 from efexen/patch-1
Updated README to include protocol scheme for FISSION_URL prefix
2016-11-29 21:00:48 -08:00
Soam VasaniandGitHub e94f0c0d6f Merge pull request #34 from johscheuer/update-readme
Add minikube example in readme; split fission.yaml into core + one for LoadBalancer services and another for NodePort services.
2016-11-29 20:52:53 -08:00
Ville Hellman (FxN)andGitHub cca8c0dad1 Updated README to include protocol scheme for FISSION_URL prefix 2016-11-29 22:09:19 +00:00
Johannes Scheuermann 6593c15e23 Add minikube example in readme 2016-11-29 21:19:45 +01:00
Soam VasaniandGitHub 18dd175c9f Merge pull request #32 from philips/patch-1
README: use kubectl create -f http
2016-11-28 18:50:58 -08:00
Brandon PhilipsandGitHub ab3f45936a README: use kubectl create -f http
Instead of getting curl involved just use kubectl
2016-11-28 17:39:14 -08:00
Soam Vasani 84851922f3 Fixes #31: Explicitly tag fission-bundle image in fission.yaml 2016-11-28 14:52:13 -08:00
Soam VasaniandGitHub 53e9ba6283 Merge pull request #30 from platform9/python-improvements
Python environment improvements
2016-11-19 20:15:40 -08:00
Soam Vasani 640e65f35f Use Flask for Python environment
Flask gives us easy routing support, and simple interface for getting
at request data.
2016-11-19 20:04:46 -08:00
Soam Vasani 8a9559be1f Pass a valid context 2016-11-19 11:01:28 -08:00
Soam VasaniandGitHub 04efe0bad4 Merge pull request #29 from platform9/readme-updates
Readme updates
2016-11-17 16:36:55 -08:00
Soam Vasani a2df49c04f typo 2016-11-17 16:35:56 -08:00
Soam Vasani c213f18bbb k8s benefits 2016-11-17 16:33:48 -08:00
Soam Vasani c3187a2d23 web and twitter links 2016-11-17 16:31:24 -08:00
Soam Vasani 05bc663b3f readme updates 2016-11-17 16:28:41 -08:00
Soam Vasani 3b5139dca3 readme updates 2016-11-17 16:22:10 -08:00
Soam Vasani c733864df5 readme updates 2016-11-17 16:11:56 -08:00
Soam Vasani 6cdae1ae3a Update README with some more project explanation 2016-11-17 16:07:42 -08:00
Soam VasaniandGitHub 54bf4abbcb Merge pull request #28 from platform9/cli-function-edit
Add "fission function edit <function>" command
2016-11-15 16:16:56 -08:00
Soam Vasani 1a19f718d4 Add a "fission function edit" command
The new command invokes editor on a copy of the source code, and
uploads the new source code.  It's an easy way to manually edit
functions from a terminal.
2016-11-15 15:51:47 -08:00
Soam Vasani 2a9f229c17 Fix incorrect JSON in version message 2016-11-15 14:33:31 -08:00
Soam Vasani 2eceb8263d Remove unused imports 2016-11-15 14:21:08 -08:00
Soam Vasani d6efca07a2 Add a tag argument to push.sh 2016-11-15 14:05:05 -08:00
Soam Vasani 96e14180c4 Don't check controller filestore path
It's created on-demand by fileStore.
2016-11-15 14:04:32 -08:00
Soam VasaniandGitHub 679590883d Merge pull request #27 from platform9/move-to-latest-client
Move client-go dependency to 1.5
2016-11-14 16:33:39 -08:00
Soam Vasani 9aab4f0795 Move client-go dependency to 1.5
Client 1.5 is compatible with Kubernetes version 1.3 through 1.5.
2016-11-14 16:25:23 -08:00
Soam Vasani 92846da7c2 README formatting 2016-11-12 10:38:52 -08:00
Soam VasaniandGitHub 26aa0998fd Use http for fission.io link
fission.io is on github pages, which doesn't seem to support SSL on custom domains.  Use http for now.
2016-11-12 08:43:27 -08:00
Soam Vasani 87a7fa6e26 Use glide for dependency mgmt; update README
And compilation instructions to README.
2016-11-11 14:15:59 -08:00
628 changed files with 90036 additions and 5657 deletions
+15
View File
@@ -0,0 +1,15 @@
ignore:
- "charts"
- "demos"
- "Documentation"
- "examples"
- "test"
- "tools"
- "pkg/apis/genclient"
coverage:
status:
project:
default:
threshold: 2
# Disable patch coverage check since we focus on project coverage.
patch: off
+15
View File
@@ -0,0 +1,15 @@
*.md
*.sh
Documentation
charts
examples
environments/*
!environments/fetcher
demos
test
Makefile
LICENSE
glide.*
.travis.yml
.gitignore
.git
+10
View File
@@ -0,0 +1,10 @@
---
name: Blog
about: Suggest a blog
title: ''
labels: ''
assignees: ''
---
+46
View File
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Please answer these questions before submitting your issue. Thanks! -->
<!-- Documentation URL: https://docs.fission.io/ -->
<!-- Troubleshooting guide: https://docs.fission.io/trouble-shooting/ -->
**Fission/Kubernetes version**
<!-- If you tested with other services, for example Istio, please also provide the version of service as well. -->
<pre>
$ fission --version
$ kubectl version
</pre>
**Kubernetes platform (e.g. Google Kubernetes Engine)**
**Describe the bug**
<!--A clear and concise description of what the bug is.-->
**To Reproduce**
<!-- Please provide steps for reproducing the error. -->
**Expected result**
<!--A clear and concise description of what you expected to happen.-->
**Actual result**
**Screenshots/Dump file**
<!--If applicable, add screenshots/fission dump file to help explain your problem.-->
<pre>
$ fission support dump
</pre>
**Additional context**
<!--Add any other context about the problem here.-->
+10
View File
@@ -0,0 +1,10 @@
---
name: Documentation
about: Suggest changes/addition to documentation
title: ''
labels: ''
assignees: ''
---
**Describe something that is unclear or not documented and needs a documentation update
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+32
View File
@@ -0,0 +1,32 @@
name: Code Scanning
on:
push:
branches:
- master
paths:
- '**.go'
pull_request:
branches:
- master
paths:
- '**.go'
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
CodeQL-Build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
+106
View File
@@ -0,0 +1,106 @@
name: Fission CI
on:
push:
branches:
- master
paths:
- '**.go'
- 'charts/**'
- 'test/**'
pull_request:
branches:
- master
paths:
- '**.go'
- 'charts/**'
- 'test/**'
workflow_dispatch:
jobs:
# Job to run change detection
integration-test:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2.3.4
- name: Checkout sources
uses: actions/checkout@v2.3.4
with:
repository: fission/examples
path: examples
- name: setup go
uses: actions/setup-go@v2.1.3
with:
go-version: "1.15.12"
- name: Helm installation
uses: Azure/setup-helm@v1
with:
version: v3.3.4
- name: Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
config: kind.yaml
- name: Configuring and testing the Installation
run: |
kubectl cluster-info --context kind-kind
kind get kubeconfig --internal >$HOME/.kube/config
kubectl get nodes
sudo apt-get install -y apache2-utils
- name: Static code analysis
run: |
./hack/verify-gofmt.sh
./hack/verify-govet.sh
helm lint charts/fission-all/ charts/fission-core/
- name: Run unit tests
run: ./hack/runtests.sh
- name: Helm update
run: helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
skaffold version
- name: Build and Install Fission
run: |
kubectl create ns fission
kubectl create -k crds/v1
skaffold run -p kind-ci
- name: Build and Install Fission CLI
run: |
go build -o fission cmd/fission-cli/main.go
sudo mv fission /usr/local/bin
fission version
- name: Port-forward fission components
run: |
kubectl port-forward svc/router 8888:80 -nfission &
kubectl port-forward svc/controller 8889:80 -nfission &
kubectl port-forward svc/nats-streaming 8890:4222 -nfission &
- name: Integration tests
run: ./test/kind_CI.sh
- name: Collect Fission Dump
if: ${{ failure() }}
run: |
fission support dump
- name: Archive fission dump
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: fission-support-dump
path: fission-dump/*.zip
retention-days: 5
+67
View File
@@ -0,0 +1,67 @@
name: Fission CI upgrade
on:
push:
branches:
- master
paths:
- '**.go'
- 'charts/**'
- 'test/**'
pull_request:
branches:
- master
paths:
- '**.go'
- 'charts/**'
- 'test/**'
workflow_dispatch:
jobs:
upgrade-test:
runs-on: ubuntu-latest
steps:
- name: Checkout action sources
uses: actions/checkout@v2.3.4
- name: Setup go
uses: actions/setup-go@v2.1.3
with:
go-version: '1.15.12'
- name: Setup Helm
uses: Azure/setup-helm@v1
with:
version: v3.3.4
- name: Setup Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
config: kind.yaml
- name: Setup kubectl & fetch node information
run: |
kubectl cluster-info --context kind-kind
kind get kubeconfig --internal >$HOME/.kube/config
kubectl get nodes
- name: Dump system info
run: |
source ./test/upgrade_test/fission_objects.sh dump_system_info
- name: Install and configure previous stable fission
run: |
source ./test/upgrade_test/fission_objects.sh install_stable_release \
&& create_fission_objects \
&& test_fission_objects
- name: Upgrade fission to latest
run: |
source ./test/upgrade_test/fission_objects.sh build_docker_images \
&& kind_image_load \
&& install_current_release \
&& install_fission_cli
- name: Test previously created fission objects with new release
run: |
source ./test/upgrade_test/fission_objects.sh test_fission_objects
+32
View File
@@ -1 +1,33 @@
# Binaries
cmd/fission-bundle/fission-bundle
cmd/fission-cli/fission
cmd/fission-cli/fission-cli
cmd/fetcher/fetcher
cmd/builder/builder
cmd/preupgradechecks/pre-upgrade-checks
cmd/reporter/reporter
# Logs
test/logs/
# Pycharm IDE
.idea
environments/php7/vendor/
# terraform files
.terraform/
*.tfstate
*.backup
# Common backup files
*.swp
*.bak
*.tmp
*~
*.tgz
.DS_Store
vendor/
local/
build/
+7
View File
@@ -0,0 +1,7 @@
linters-settings:
errcheck:
ignore: go.uber.org/zap:Sync
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/trussworks/my-cli-tool
+1278
View File
File diff suppressed because it is too large Load Diff
+74
View File
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
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 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.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
+239
View File
@@ -0,0 +1,239 @@
Thanks for helping make Fission better😍!
There are many areas we can use contributions - ranging from code, documentation, feature proposals, issue triage, samples, and content creation.
First, please read the [code of conduct](CODE_OF_CONDUCT.md). By participating, you're expected to uphold this code.
Table of Contents
=================
* [Choose something to work on](#choose-something-to-work-on)
* [Get Help.](#get-help)
* [Contributing - building &amp; deploying](#contributing---building--deploying)
* [Prerequisite](#prerequisite)
* [Getting Started](#getting-started)
* [Use Skaffold with Kind/K8S Cluster to build and deploy](#use-skaffold-with-kindk8s-cluster-to-build-and-deploy)
* [Validating Installation](#validating-installation)
* [Understanding code structure](#understanding-code-structure)
* [cmd](#cmd)
* [pkg](#pkg)
* [Charts](#charts)
* [Environments](#environments)
# Choose something to work on
* The easiest way to start is to look at existing [issues](https://github.com/fission/fission/issues) and see if there's something there that you'd like to work on. You can filter issues with label "[Good first issue](https://github.com/fission/fission/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)" which are relatively self sufficient issues and great for first time contributors.
- If you are going to pick up an issue, it would be good to add a comment stating the intention.
- If the contribution is a big change/new feature, please raise an issue and discuss the needs, design in the issue in detail.
* For contributing a new Fission environment, please check the [environments repo](https://github.com/fission/environments)
* For contributing a new Keda Connector, please check the [Keda Connectors repo](https://github.com/fission/keda-connectors)
### Get Help.
Do reach out on Slack or Twitter and we are happy to help.
* Drop by the [slack channel](http://slack.fission.io).
* Say hi on [twitter](https://twitter.com/fissionio).
# Contributing - building & deploying
## Prerequisite
- You'll need the `go` compiler and tools installed. Currently version 1.12.x of Go is needed.
- You'll also need [docker](https://docs.docker.com/install) for building images locally.
- You will need a Kubernetes cluster and you can use one of options from below.
- [Minikube](https://github.com/kubernetes/minikube)
- [Kind](https://kind.sigs.k8s.io/)
- Cluster in cloud such as GKE (Google Kubernetes Engine cluster)/ EKS (Elastic Kubernetes Service)/ AKS (Azure Kubernetes Service)
- Kubectl and Helm installed.
- [Skaffold](https://skaffold.dev/docs/install/) for local development workflow to make it easier to build and deploy Fission.
- And of course some basic concepts of Fission such as environment, function are good to be aware of!
## Getting Started
Get the code locally and after you have made changes - you can verify formatting and other basic checks.
```sh
# Clone the repo
$ git clone https://github.com/fission/fission.git $GOPATH/src/github.com/fission/fission
$ cd $GOPATH/src/github.com/fission/fission
$ go mod vendor
# Run checks on your changes
$ ./hack/verify-gofmt.sh
$ ./hack/verify-govet.sh
```
### Use Skaffold with Kind/K8S Cluster to build and deploy
You should bring up Kind/Minikube cluster or if using a cloud provider cluster then Kubecontext should be pointing to appropriate cluster.
* For building & deploying to Cloud Provider K8S cluster such as GKE/EKS/AKS:
```
$ skaffold config set default-repo vishalbiyani // (vishalbiyani - should be your registry/Docker Hub handle)
$ skaffold run
```
* For building & deploying to Kind cluster use Kind profile
```
$ kind create cluster
$ kubectl create ns fission
$ skaffold run -p kind
```
## Validating Installation
If you are using Helm, you should see release installed:
```
helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
fission fission 1 2020-05-19 16:31:46.947562 +0530 IST success fission-all-1.11.0 1.11.0
```
Also you should see the Fission services deployed and running:
```
$ kubectl get pods -n fission
NAME READY STATUS RESTARTS AGE
buildermgr-6f778d4ff9-dqnq5 1/1 Running 0 6h9m
controller-d44bd4f4d-5q4z5 1/1 Running 0 6h9m
executor-557c68c6fd-dg8ld 1/1 Running 0 6h9m
influxdb-845548c959-2954p 1/1 Running 0 6h9m
kubewatcher-5784c454b8-5mqsk 1/1 Running 0 6h9m
logger-bncqn 2/2 Running 0 6h9m
mqtrigger-kafka-765b674ff-jk5x9 1/1 Running 0 6h9m
mqtrigger-nats-streaming-797498966c-xgxmk 1/1 Running 3 6h9m
nats-streaming-6bf48bccb6-fmmr9 1/1 Running 0 6h9m
router-db76576bd-xxh7r 1/1 Running 0 6h9m
storagesvc-799dcb5bdf-f69k9 1/1 Running 0 6h9m
timer-7d85d9c9fb-knctw 1/1 Running 0 6h9m
```
## Understanding code structure
### cmd
`cmd` package is entry point for all runtime components and also has Dockerfile for each component. The actual logic here will be pretty light and most of logic of each component is in `pkg` (Discussed later)
| Component | Runtime Component |Used in|
| :------------- |:------------- |:-|
| fetcher | Docker Image |Environments|
| fission-bundle | Docker Image |Binary for all components|
| fission-cli | CLI Binary |CLI by user|
| preupgradechecks | Docker Image |Pre-install upgrade|
```
.
cmd
├── fetcher
│   ├── Dockerfile.fission-fetcher
│   ├── app
│   └── main.go
├── fission-bundle
│   ├── Dockerfile.fission-bundle
│   ├── main.go
│   └── mqtrigger
├── fission-cli
│   ├── app
│   ├── fission-cli
│   └── main.go
└── preupgradechecks
├── Dockerfile.fission-preupgradechecks
├── main.go
└── preupgradechecks.go
```
**fetcher** : is a very lightweight component and all of related logic is in fetcher package itself. Fetcher helps in fetching and uploading code and in specializing environments.
**fission-bundle** : is a component which is a single binary for all components. Based on arguments you pass to fission-bundle - it becomes that component. For ex.
```
/fission-bundle --controllerPort "8888" # Runs Controller
/fission-bundle --kubewatcher --routerUrl http://router.fission # Runs Kubewatcher
```
So most server side components running on server side are fission-bundle binary wrapped in container and used with different arguments. Various arguments and environment variables are passed from manifests/helm chart
**fission-cli** : is the cli used by end user to interact Fission
**preupgradechecks** : is again a small independent component to do pre-install upgrade tasks.
### pkg
Pkg is where most of core components and logic reside. The structure is fairly self-explanatory for example all of executor related functionality will be in executor package and so on.
```
.
├── pkg
│   ├── apis
│   ├── builder
│   ├── buildermgr
│   ├── cache
│   ├── canaryconfigmgr
│   ├── controller
│   ├── crd
│   ├── error
│   ├── executor
│   ├── fetcher
│   ├── fission-cli
│   ├── generator
│   ├── info
│   ├── kubewatcher
│   ├── logger
│   ├── mqtrigger
│   ├── plugin
│   ├── publisher
│   ├── router
│   ├── storagesvc
│   ├── throttler
│   ├── timer
│   └── utils
```
### Charts
Fission currently has two charts - and we recommend using fission-all for development.
```
.
├── charts
│   ├── README.md
│   ├── fission-all
│   └── fission-core
```
### Environments
Each of runtime environments is in fission/environments repo and fairly independent. If you are enhancing or creating a new environment - most likely you will end up making changes in that repo.
```
.
├── environments
│   ├── binary
│   ├── dotnet
│   ├── dotnet20
│   ├── go
│   ├── jvm
│   ├── nodejs
│   ├── perl
│   ├── php7
│   ├── python
│   ├── ruby
│   └── tensorflow-serving
```
+156 -63
View File
@@ -1,107 +1,200 @@
# A high-level view of the internals of Fission.
A high level view of the internals of Fission.
## How it works
Components
==========
Fission is a FaaS -- users create functions (source level), register
them with Fission using a CLI, and associate functions with triggers.
Language-neutral components:
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.
## Components
Core Components:
* Controller
* Container Pool Manager
* Container Specializer
* Executor
* Environment Container (language-specific)
* Router
* Builder Manager
* Storage Service
Language-specific components:
Optional Components:
* Logger
* Kubewatcher
* Message Queue Trigger
* Timer
* Language Build Container
* Language Run Container
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.)
## Core Components
Controller
----------
### Controller
Function and Trigger CRUD APIs. APIs to watch for changes are also
included (useful for other components that cache state).
The controller contains CRUD APIs for functions, triggers, environments,
Kubernetes event watches, etc. This is the component that the client talks to.
See api/swagger.json for API details.
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
will be used to store the functions' source code.
### Executor
Etcd is used as the DB.
The executor has two simple APIs; the router calls both these endpoints.
* 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.
Container Pool Manager
----------------------
It now supports two different executor types:
Manage pool of generic containers.
* PoolManager
* NewDeploy
Probably use K8s RCs. Can we Use labels to move pods from one rc to
another? What about jobs?
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.
Container Specializer
---------------------
#### PoolManager
Inputs: a running generic language run container, a user function,
optionally an http trigger URL.
PoolManager manages pools of generic containers and function containers.
Calls Language Run Container and sets up Router to point to it.
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).
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.
Router
------
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].
- Cache trigger -> container instance mapping; implement cache miss and expiration.
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.
- Invoke Specializer, setup up k8s API
[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.
- Forward requests
#### NewDeploy
The Router is stateless -- it can be scaled or killed at any time.
NewDeploy creates deployment, service, and HPA for functions in order to handle
massive traffic.
There's a lot of functionality overlap with K8S Ingress Controllers.
We should clearly use Ingress and Ingress Controllers in some way.
It's not exactly clear at the moment how -- should make a whole new
Ingress Controller perhaps based on the contrib/nginx
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.
Autoscaler
----------
### Environment Container
This autoscales the language run containers that are backing a
trigger.
Environment containers run user-defined functions and are language-specific.
Each environment container must contain an HTTP server and a loader for functions.
What metrics this is based on is TBD.
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.
- Number of requests/sec
- "Backlog" -- number of outstanding requests not yet started -- how to measure this?
- Change in turn-around time?
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
Language Build Container
------------------------
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 Language Build Container is a container that is invoked for a
build. It takes one user-created function and outputs something
that can be run by the corresponding Language Run Container.
The router is the only stateless component and can be scaled up if needed, according to
load.
* The Build Container must implement the Language Build Container
interface.
### 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.
Language Run Container
----------------------
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.
* The Language Run Container is the container in which user functions
run.
### Storage Service
* The Run Container is started without the user function. It must
start as a "Generic Container". It must implement the
"specialization interface". In short, it must implement an HTTP
server that can receive a piece of code, verify its signature, and
map it to an HTTP endpoint. See
Documentation/specs/LanguageRunContainerSpec.md for details.
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 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
tracked in issue #64.
### 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
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.
Here's a diagram of the components:
![Message queue trigger Diagram](https://user-images.githubusercontent.com/202578/27012344-9457cb24-4f00-11e7-8d6b-926ff01637b3.jpg)
### Timer
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.
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.
+55
View File
@@ -0,0 +1,55 @@
# BUILDING MULTI-ARCHITECTURE IMAGES
While the Docker images for Fission can be built by running:
```
make image
```
the stable images are build for multiple architectures (and automatically pushed to the repository) by
```
make images-multiarch
```
However, there are several options and requirements for building these images, which are explained here.
## BUILDERS
We use `docker buildx` to build images for multiple architectures. At the moment, this is considered an
experimental feature by Docker, and as such it requires access to experimental features to be enabled
in the daemon.json file.
By default, this will use BuildKit and QEMU emulation support to build the image for each architecture
locally. However, for faster building, it is possible to use native nodes to build each architecture,
either simple remote Docker instances or a Kubernetes cluster. For information on how to set this up,
please see the blog article here:
<https://www.docker.com/blog/multi-arch-images/>
And/or the command reference here:
<https://docs.docker.com/engine/reference/commandline/buildx_create/>
## BUILD OPTIONS
### PLATFORMS
The PLATFORMS variable can be set to a comma-separated list of platforms for which images should be
built when running the multi-arch build. If unset, it defaults to _linux/amd64,linux/arm64,linux/arm_.
### REPOSITORY SELECTION
By default, the multi-arch build will automatically try to push the resulting images to the fission/*
repositories, under the dev tag; i.e. fission/fission-bundle:dev, fission/fetcher:dev, and
fission/builder:dev. However, for convenient, this can be customized by setting the REPO and TAG
environment variables to set a different repository prefix and tag for the images.
For example:
```
REPO=randomdev TAG=test make images-multiarch
```
would build and push the images randomdev/fission-bundle:test, randomdev/fetcher:test, and
randomdev/builder:test . Private Docker repositories can be used in the same manner.
-71
View File
@@ -1,71 +0,0 @@
Programming Model
=================
This document describes the programming model for fission functions.
See TERMINOLOGY for definitions of terms, such as _function_,
_instance_, and _trigger_.
Idempotency
===========
Fission assumes that functions are idempotent. Functions whose instances
die without a result are restarted, upto a certain restart limit.
Time Limits
===========
By default, there is no time limit on fission functions.
Idle running instances may be killed at any time (usually after the
default idle timeout of 10 minutes, but this is configurable).
Mapping
=======
This section specifies the mapping between: (1) HTTP and other
triggers, and (2) function parameters, return values, and exceptions.
In other words, this section describes how a function should be called
based on a given trigger, and how the functions behaviour affects the
result returned from the trigger.
The HTTP Trigger
----------------
NodeJS
------
NodeJS functions are called with a context object.
context.request contains the nodeJS Request object.
In addition,
context.queryString contains the parsed querystring
context.body contains the parsed body
context.status sets the HTTP response status code. If context.status
is an invalid HTTP status, then the HTTP status is set to 500.
Exceptions result in a HTTP 500 error.
XXX Should we have a "context.done()"? What are the pros and cons?
XXX Who handles serialization and deserialization? Should we do json
automatically based on content-type and accept headers?
Python
------
Same as node, pretty much.
+4
View File
@@ -0,0 +1,4 @@
Fission Document
=================
* Please visit [here](https://docs.fission.io/) for fission documentation.
+106
View File
@@ -0,0 +1,106 @@
# Fission Roadmap
## Function features ([area-func](https://github.com/fission/fission/labels/area-func))
- Secrets, configmaps, env vars
- Volumes
- Mem requests and limits
- Function exec time deadline
- Expose a regular K8s Service for a function
## Fission API ([area-api](https://github.com/fission/fission/labels/area-api))
- CRD-based controller
- API authentication
- Aggregated API server
## Development Workflows ([area-dev](https://github.com/fission/fission/labels/area-dev))
- Function Versioning
- Versioning for a group of functions
- Rolling upgrades
- for one function
- for multiple functions
- for functions + other kubernetes deployments
- Unit testing
## API Gateway / Ingress features ([area-ingress](https://github.com/fission/fission/labels/area-ingress))
- Function authn hooks
- K8s Ingress flag
- Bundle an ingress controller?
## Workflows and Function composition ([area-composition](https://github.com/fission/fission/labels/area-composition))
- Simple Composition - Sync
- Simple Composition - Async
- Hooks (pre, post, on-error)
- Workflows
- Testing in the presence of function composition
## Events ([area-events](https://github.com/fission/fission/labels/area-events))
- NATS
- Kafka
- AWS: SNS, SQS
- Google PubSub
- RabbitMQ
- Other event sources
- Bundle an event queue (NATS streaming, most probably)
## Operability ([area-ops](https://github.com/fission/fission/labels/area-ops))
### Fission Install/Upgrade ([area-install](https://github.com/fission/fission/labels/area-install))
- Helm Installer for Fission
- Helm installation for fission functions
- CLI installer/upgrader? ("fission upgrade")
- Upgrade checker/reminder (like minikube does)
- CLI auto-upgrader
### Function observation ([area-observe](https://github.com/fission/fission/labels/area-observe))
- Function Logging
- Tracing -- Opentracing
- Metrics -- Prometheus
- Function exception tracking
- Logging function load errors
- Tracing fission overheads for each function
## Function Security
- Function isolation (is authz hook sufficient or do we need something like mutual TLS?)
- Function service accounts
## UX, especially for beginners ([area-ux](https://github.com/fission/fission/labels/area-ux))
- Fission CLI should include a tutorial
- Fission CLI should have a way to drop you into the UI
- Eliminate FISSION_URL, just use kube client to find fission url. Also useful to grab credentials.
## Documentation ([area-doc](https://github.com/fission/fission/labels/area-doc))
- Installation guide improvements
- Troubleshooting guide for common problems
- FAQ
- Performance overview
- Render docs nicely to fission.io
## Web UI (tracked separately in the fission-ui repo)
## Performance and Scalability ([area-perf](https://github.com/fission/fission/labels/area-perf))
- Autoscaling
- Cold-start optimization -- optimistically choose from pool, save about ~20msec
- Cold-start optimization -- preload funcs in fetcher
- Cold-start optimization -- preload libraries in envs (v2) -- mem vs. speed tradeoff
## Function extensibility ([area-ext](https://github.com/fission/fission/labels/area-ext))
- Env v2: easy addition of dependencies etc.
- Integration with Service Broker
## Multi-area stuff
- Execution strategies: cold-start pool vs create-pod-on-cold-start -- one size doesn't fit all, at least with current tech; abstract over execution strategies according to requirements
-22
View File
@@ -1,22 +0,0 @@
_Function_: A _function_ is the smallest unit of a program in Fission.
It's a program with an function as an entry point -- it doesn't have
to be just one function.
_Trigger_: Triggers are what cause functions to be called. For
example the HTTP trigger causes functions to be called on HTTP
requests.
_Instance_: Fission creates and runs servers containing these
functions. The running server is called an _instance_. You normally
don't need to worry about instances: their management is completely
automatic and transparent to you. However, certain configuration
settings allow you to tweak the behaviour of instances -- for example,
you can configure the strategy for destroying unused instances.
_Generic Instance_: An instance with no user code in it. The process
of including the user code to a Generic Instance is _Specialization_,
and the resulting instance is a _Specialized Instance_.
_Specialized Instance_: See _General Instance_.
-15
View File
@@ -1,15 +0,0 @@
Fission is functions-as-a-service for Kubernetes.
You write some functions, and setup some way for them to be invoked
("triggers"). Triggers can be HTTP requests (HTTP Triggers) or timers
(Time Triggers).
Topics
======
Testing
-------
Function Updates
----------------
+66
View File
@@ -0,0 +1,66 @@
# Multi-tenancy in Fission
Multi-tenancy in Fission allows users to create Fission objects, i.e functions, packages, environments and triggers in different namespaces.
It mandates that a function reference secrets, configmaps and its package (if explicitly referenced during function create/update operation) to be present in the same namespace as the function.
This allows user separation and prevents in-advertent access to sensitive data of other users sharing the same cluster.
However, users are allowed and encouraged to share environments to ensure optimal utilization of cluster resources. To achieve this, users can create all the necessary environments in a ns, say ns1 and then go on to create functions in different namespaces and refer to env in ns1.
Users that prefer complete isolation can create their env, functions in the same ns.
## Roles and privileges
1. Cluster-Admin Role : Fission's services need cluster-admin privileges to monitor, create, update and delete resources across namespaces.
2. Package-getter Role : This role has privileges to do a get, watch and list on fission package objects.
3. Secret-Configmap-getter Role : This role has privileges to do a get, watch and list on secrets and configmaps.
## Service Accounts
1. fission-fetcher
This SA is created in every namespace that a user creates runtime environments in.
Also created in function namespaces where a user creates functions that use NewDeploy executor backend.
2. fission-builder
This SA is created in every namespace that a user creates builder environments in.
## Role-bindings
1. Package-getter-binding
Every time a user creates a package explicitly in a namespace, this role binding is created in package's namespace (which is also function's namespace). This grants package-getter role to fission-fetcher SA present in the referenced environment's namespace.
If the package is a source package, then, fission-builder SA present in the environment namespace is also added to this role binding.
Next when the user creates a function in the same namespace, if the function's executor type is newdeploy, then, the fission-fetcher SA present in function namespace is also added to the same role binding.
Note : For functions that have executor type poolmgr, the env pods are created in the namespace that env object is created. Whereas, for those functions that have executor type New deploy mgr, the function pods are created in the namespace that function object is created in.
This is because, poolmgr allows env sharing and optimal resource utilization. so generic env pools are created in a different namespace and all functions that prefer sharing this env pool can reference these pools.
If users require strict isolation, they can either create functions with new deploy backend, or, create envs in different namespaces and not share them across functions.
2. Secret-Configmap-getter-binding
Every time a user creates a function in a namespace, Secret-Configmap-getter-binding is created in the same namespace, granting secret-configmap-getter role to fission-fetcher SA present in the referenced environment's namespace in case the executor type is poolmgr.
If the executor type is newdeploymgr, then the same role binding is created in the same namespace as the function, granting the same secret-configmap-getter role to fission-fetcher SA present in the function namespace.
## Examples
1. create a generic python runtime env in ns 1 and function with poolmgr executor type in ns 2 that references it.
```bash
$ fission env create --name python --image fission/python-env --envns ns1
$ fission function create --name func1 --env python --code hello.py --fns ns2
```
2. create a builder and runtime environment in ns3, a source pkg in ns3 and a function referring to this src pkg also in ns3. (for complete isolation, all objects are in ns3)
```bash
$ fission env create --name python-builder-env --builder fission/python-builder --image fission/python-env --ns3
$ fission package create --src src-pkg.zip --env python-builder-env --buildcmd "./build.sh" --pkgns ns3
$ fission fn create --name func3 --fns ns3 --pkg $pkg --entrypoint "user.main"
```
## Note
1. To maintain backward compatibility, fission objects that are created without the ns flags are created in default namespace. Also, the run time env pods in such a case will continue to live in fission-function ns and builder env pods in fission-builder ns
2. Since all envs in a namespace have the same fission-fetcher SA mounted in them, even though multiple envs are created in a namespace and referenced by functions in different namespaces, the SA will have privileges to view those function's secrets if any.
3. Similarly, if there are multiple functions in different namespaces but all sharing an env in one namespace, the fission-fetcher SA in that namespace will have privileges to see all of their secrets.
+24
View File
@@ -0,0 +1,24 @@
# Programming Model
This document describes the programming model for fission functions.
## Time Limits
By default, there is no time limit on fission functions.
Idle running instances may be killed at any time (usually after the
default idle timeout of 10 minutes, but this is configurable).
## HTTP Triggers
Functions triggered over HTTP receive the HTTP request object in the
context. The request's query string, POST body, etc. can be retrieved
from this object. The interface is language-specific: see [TODO] for
documentation on the context object in each environment.
## Kubernetes Watch Event Triggers
Kubernetes watches can be used to trigger functions. These functions
receive the Kubernetes watch.Event object in JSON-serialized form.
+91
View File
@@ -0,0 +1,91 @@
# Annotations
Annotations are used by the core Kubernetes system and to even larger extent by projects such as Istio Ingress Controllers and Prometheus and such.
Users want to add annotations to some objects such as ingress (https://github.com/fission/fission/issues/989).
To enable the users to use annotations, here are some thoughts and ideas:
## Defining annotations
Annotations can be defined fairly easily in the spec file for any object as part of metadata.
``` yaml
apiVersion: fission.io/v1
kind: HTTPTrigger
metadata:
creationTimestamp: null
name: spectest
namespace: default
annotations:
test-anno: some-test-value
spec:
createingress: true
```
These annotations can be merged to target object using a merging mechanism - so that additional annotations put by Fission can also be preserved.
## Considerations
- More often than not the annotations are needed by a Kubernetes objects created by one of the function CRDs/controllers. For example ingress created by route needs the annotation and not the route object itself.
### Implementation 1
- Most annotations use a convention which we can use to determine if an annotation is meant for an ingress object or to be applied on a pod.
For example. look at annotations:
|Annotation name| Description|
|:-------------|:-------------|
|`prometheus.io/scrape`| Prometheus - applied to pod|
|`sidecar.istio.io/inject`|Istio - applied to pod|
|`helm.sh/hook`| Used by helm to apply to pods/jobs|
|`traefik.ingress.kubernetes.io/app-root`|Used by Trafeik ingress controller, applied to ingress|
|`nginx.ingress.kubernetes.io/add-base-url`|Used by Nginx ingress controller, applied to ingress|
So we can write a simple logic - to check if a annotation is applicable for an ingress and based on that apply or not apply annotations to ingress.
### Implementation 2
- One of the side effects is that the annotations will still stay on the source CRD object - for example annotation will stay on the httptrigger as well as the ingress object. This can cause problems in certain cases where something like Prometheus uses annotations to scrape objects. So instead we wrap the annotations needed by an object into another annotation name. This also solves problem of having to guess which annotations to apply to which object.
```yaml
apiVersion: fission.io/v1
kind: HTTPTrigger
metadata:
creationTimestamp: null
name: spectest
namespace: default
annotations:
ingress-annotations: '{"nginx.ingress.kubernetes.io/add-base-url": "true", "nginx.ingress.kubernetes.io/app-root": "somevalue"}'
```
This is specifically important because for example newdeploy function will create a deployment, service and HPA and all three might have different set of annotations.
```yaml
annotations:
service-annotations: '{"service.annotation1": "somevalue"}'
deployment-annotations: '{"deploy.annotation1": "somevalue"}'
```
### Implementation 3
Based on discussion in the team there is a additional option of adding a explicit field in the spec to hold the annotations. For now this assumes that we are only considering HTTPTriggers for annotations and not other objects such as Functions.
```
HTTPTriggerSpec struct {
Host string `json:"host"`
RelativeURL string `json:"relativeurl"`
CreateIngress bool `json:"createingress"`
Method string `json:"method"`
FunctionReference FunctionReference `json:"functionref"`
Annotations map[string]string `json:annotations`
}
```
## Final thoughts
- The implementation idea 2 & 3 look better than 1. The third option involves HTTPTrigger Spec change.
- For both (2) & (3) - if in future we have to implement annotations for Functions etc. we will have to consider the fact that a function will in turn create 3 objects (Service, Pod & HPA) and annotations for all three would need to be accommodated.
+101
View File
@@ -0,0 +1,101 @@
# Continuous Integration and Delivery of Fission functions
This document outlines a simple CI/CD process for Fission functions which can be extended to any CI/CD tool. Before we start, some level setting for terminology used as the terms are used rather broadly in industry.
## Continuous Integration
CI is made up of a series of broad areas:
- The first step is to compile the source code and convert into artifact which is pushed to artifact repository. Traditionally this has been building a Py or wheel package (Python) or Jar file (Java) but as containers became mainstream the container image became the package. The traditional artifact repositories were replaced by the Docker registries.
- Execution and reporting of unit testing has been a crucial part of the CI cycle and is done after the source code can be compiled successfully.
- Running a static/dynamic code analyzer is the next step in continuous integration. The static code analysis is usually used to measure and report quality metrics and dynamic code scanning/analysis for security.
In the draft version of this proposal we will only consider the source to artifact conversion part and will not dive into unit testing or code scanning/analysis cycles of the CI.
## Continuous Delivery
CD is also composed of a few broad areas focusing on different aspects:
- After CI cycle completes successfully - deploying the artifact to a Dev/Staging environment so that it can be tested by developers and QA teams.
- Once the tests & teams have verified that a function works, the same function should be promoted from Dev/Stage to higher/production environment. The number of environment that a organization maintains varies but the idea of promotion from one environment to higher environment does exist. There are very few organizations who deploy the newer versions of functions directly in production with a A/B setup but that is as of this writing is an exception and not the norm.
- Another aspect of promoting from one environment to higher environment is the configuration for both environments will be different. For ex. the DB connection string will be different for each environment. Or the "maxscale" property for production environment could be higher than that for Dev. The ability to store all these environment specific configurations in some sort of system (Github for normal values and some sort of KMS for sensitive data) and being able to combine the logic and configurations for each environment when deploying is important.
Beyond these points there are integration/automation points such as being able to call a test suite after deployment is done etc. but we will skip for now for brevity.
## 1 Fission specs in a container
Let's start with a simple Fission function which uses specs. A typical directory structure looks like below:
```
.
├── multifile
│   ├── README.md
│   ├── __init__.py
│   ├── main.py
│   ├── message.txt
│   └── readfile.py
└── specs
├── README
├── env-python.yaml
├── fission-deployment-config.yaml
└── function-pyz.yaml
```
Irrespective of if source code that needs to be built or not, there is a simple command to fire to update the function, which will build (if applicable) and deploy the function:
```
$ fission spec apply
```
If we look at this from CI/CD perspective this process requires:
1. Source code & specs
2. A github push event when any one of the two change
3. Fission CLI
4. Kubernetes Config so that the apply command can be run
So if we build a container - which has the above requirements met as installed software (Ex. Fission & Kubectl CLI) or available as environment variable (Github pull token or Kubeconfig), the container can be used as part of CI workflow in any tool such as - Jenkins, Argo, Github Actions, GitLab etc.
The idea is to build a generic container with Fission CLI, Kubernetes CLI and a way to read Github token and Kubeconfig from env variable/mounted files and being able to run `fission spec apply` command.
### 1.1
Instead of building a container in previous section - the same can be achieved by a function. The Github webhook can call a function endpoint which in turn can execute the process similar to inside the container.
## 2 Environment Configurations
There are use cases and reasons to have environment configuration different for each environment such as Dev/Staging etc. Let's assume that we want to vary the `maxscale` in functions and `DB_CONNECTION` in environment
```
spec:
InvokeStrategy:
ExecutionStrategy:
ExecutorType: newdeploy
MaxScale: 2 // <-- Varies based on environment deployed in
MinScale: 1
```
```
container:
env:
- name: DB_CONNECTION
value: "http://database.url" // <-- Varies based on environment deployed in
```
Without changing anything in Fission spec it is possible to change these things from environment to environment and some of strategies used by people are:
1. Generate and maintain specs for each environment. This is not a best practice as it leads to drift in code and configuration between environment over time.
2. Use placeholder variables (i.e. $DB_CONNECTION_VALUE) and replace them for each environment before deploying. This is better in the sense that you are combining changes specific to each environment with spec code but is still a work around sort of.
For environment specific configurations, it is possible to use some sort of templates or overlay mechanism. One of interesting projects using overlays is [Kustomize](https://github.com/kubernetes-sigs/kustomize). In any case as of today the fission spec command does not have a way to use template or modify values using overlay and it is worth exploring this approach for fission spec.
## 3 Promotion from one environment to another
This necessarily does not fall in the area of Fission per se but it would be fairly easy to build a pipeline in the the tool used for CI/CD if we have container mentioned in (1) and even work around mentioned in (2).
## Action Items
As a first step it would be good to build a simple container mentioned in (1) and use it in various tools to understand the value it adds and any unknowns. The next steps would be to build a full end to end pipeline from source to production.
+128
View File
@@ -0,0 +1,128 @@
# Fission CLI Extensibility
### Approach
To sum up the approach: git-style plugins.
Plugins are named with the fission prefix `fission-*`. When fission is invoked with an undefined/non-core subcommand
is called (like `fission foo`). Fission will look in the PATH
**Installing Fission**
```bash
# The same as before
$ curl -Lo fission https://github.com/fission/fission/releases/download/0.7.2/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
```
**Installing Fission Workflows**
```bash
# The same process as Fission cli itself
$ curl -Lo fission https://github.com/fission/fission-workflows/releases/download/0.4.0/fission-workflows-osx && chmod +x fission-workflows && sudo mv fission-workflows /usr/local/bin/
```
**Invoking Fission Workflows**
```bash
$ fission workflows invocation get b1278e802a
# Which is equivalent to:
$ fission-workflows invocation get b1278e802a
```
General flow:
1. fission does not recognize `workflows` subcommand
2. fission checks the path for a binary called `fission-workflows`
3. fission finds the binary.
4. fission invokes the `fission-workflows`, passing the remainder of the arguments.
**Discoverability: fission --help**
```bash
$ fission --help
USAGE:
fission [global options] command [command options] [arguments...]
VERSION:
0.6.0
COMMANDS:
function, fn Create, update and manage functions
httptrigger, ht, route Manage HTTP triggers (routes) for functions
timetrigger, tt, timer Manage Time triggers (timers) for functions
mqtrigger, mqt, messagequeue Manage message queue triggers for functions
environment, env Manage environments
watch, w Manage watches
package, pkg Manage packages
spec, specs Manage a declarative app specification
upgrade Upgrade tool from fission v0.1
tpr2crd Migrate tool for TPR to CRD
help, h Shows a list of commands or help for one command
PLUGINS:
workflows, wf Inspect and manage workflow executions
ui Start the user interface
GLOBAL OPTIONS:
--server value Fission server URL (default: "http://127.0.0.1:65356")
--help, -h show help
--version, -v print the version
```
Of course Fission needs to be able to find all plugins for this. There are several ways in which we can provide discoverability. The simplest one is for Fission to look in the path for all binaries starting with the `fission-*` prefix. Optionally, fission could invoke a specific command on the subcommand to get info about the plugin (such as version, help text, aliases...)
With Fission Workflows this info would look something like this:
```bash
$ fission-workflows --plugin
name: workflows
version: 0.4.0
help: Inspect and manage workflow executions
```
The idea is that this plugin info is all completely optional.
If it is not available, we simply degrade the results to user.
This way users/we can easily prototype or add plugins without having to worry about adhering to some interface.
**List version**
```bash
$ fission --version
client:
fission: 0.8.0
fission-workflows: 0.4.0
server:
fission: 0.8.1
fission-workflows: 0.3.0
```
Again, versioning info for fission-workflows is taken from the plugin info of the commands.
Note: a related issue is to have some more formalized plugin support/discoverability on the server-side,
but that is out of the scope of this issue.
### Other (optional) extensions and notes
- Like git we could setup a preferred binary path, where fission looks first when searching for the subcommand.
This could optionally be defined with a `FISSION_EXEC_PATH`.
- With the current approach we cannot have aliases for commands---fission will not be able to find fission-workflows
when the user calls `fission wf`. This might be UX issue, with these long path names. One option is let the user fix
it themselves by symlinking `fission-wf` to `fission-workflows`; using the plugin info Fission can recognize and
merge aliases together.
- To help detect versioning conflicts (old version of fission, too new version of fission workflows). We could add
a `requires` field to the fission-workflows plugin info. Then we could throw a warning or error, when two out of sync
versions are being used.
- To avoid unhelpful errors to the user when they have not installed a plugin, we could add a heuristic to check
`https://github.com/fission/SUBCOMMAND` to see if the subcommand might be an uninstalled plugin.
OR, we could lookup a simple text file that contains common plugins `https://github.com/fission/fission/plugins.txt`
and list them as suggestions to the user. OR we could of course just default to a bit help text that says something
like `unknown subcommand 'foo'. If this is a plugin, ensure that it is present on your PATH`.
---
### Motivation
The proposed approach is to use the git-based plugin system for now. Reasons for this approach over a sophisticated,
integrated plugin-based approach:
- It is low effort to implement.
- It is easy to extend with minimal to no required interface.
- The binaries remain standalone, allowing users to separate them if needed and make independent development on the
binaries easy.
Limitations of the proposed approach:
- The user still has to do some work, adding binaries to the PATH; ensuring that permissions are correct; ensuring
that the binary is executable; how to deal with duplicate binaries on the PATH. All this makes this approach assume
basic/intermediate knowledge of the OS from the user.
- I have to admit: I am not entirely sure if this approach requires any changes for Windows. Probably not.
- Upgrading fission with many plugins could be cumbersome, as you would need to upgrade each binary one by one.
Improving this is probably best left to future work.
The more heavyweight solution solves some of these limitations to an extent, but these do not way up to the increased
development and maintenance cost IMO. If needed we could explore this option (or some hybrid option) in the future.
+120
View File
@@ -0,0 +1,120 @@
# Environment V2 Fission-Environment API
Fission Environments are the language-specific component of fission.
They must satisfy the interface in this spec.
## Meta
This is version 2.0-alpha of the Fission-Environment API.
(It's unstable and may change without warning until 2.0-beta.)
## Overview
Fission V2 Environments consist of:
* Metadata
* A runtime image
* A builder image (optional)
* Function Interface Specification
* User Documentation
* Examples
### Metadata
See EnvironmentSpec, Runtime, and Builder in types.go.
## Runtime Image
An environment runtime image is a docker container image. It must run
a server that has two jobs:
(a) Loading a "function" from a file path on demand
(b) Invoking that function on request
### Function Loading
The environment must expose a single HTTP endpoint (at the port and
URL specified in the metadata) that loads a function. The function
load request is a JSON-serialized `FunctionLoadRequest`.
The function load request contains a filepath to load the function
from. Fission does not define in any way the contents of the path; it
is completely environment-dependent. It may be a single file, or a
directory (in case of deployment packages).
The load request may contain an EntryPoint. If it does, the loader
must interpret this; usually it's the name of a function in a module
or package containing multiple functions. If there is no entry point,
the environment must use a default; again, the value of this default
is environment-specific.
The load request may contain a URL. If it does, requests to that URL
should be routed to the function. It defaults to "/".
### Function Invocation
Functions are invoked on HTTP request to the server. The port for the
request on the runtime container is defined in the Runtime metadata,
and the URL for the request is specified in the FunctionLoadRequest.
The interface of the function is environment specific; the environment
must come with a spec for this interface.
## Builder
The builder is a container image that contains tools to build a
function from source. The source may be a single file or a directory
of files.
The builder container is invoked with the specified command, with the
following params:
1. File path of the source
2. File path where the output should go
3. Other env or function-specific params passed by the user
The first two parameters are file paths, and all remaining params are
environment-specific.
The output of the builder should be something that the runtime can
load and run -- there should be no intermediate steps that need user
intervention.
### Errors
## Function Interface Spec
The function interface spec is a document that specifies the interface
of functions and their semantics. It must specify:
* How functions are invoked (sync, async)
* How the request context is provided to the function (URL, headers, request type, request body)
* Function logging
* Semantics of function errors and exceptions
## Documentation
The docs should contain everything necessary to use the environment:
* How to add it to a fission cluster
* How to write and build functions for this environment (link to the interface spec)
* How to modify and rebuild the environment itself
## Examples
Suggested examples to provide:
* A simple "Hello world"
* A function that demonstrates use of the request context: url params,
request headers, request body
* A function that does logging
* A multi-file function package
* A function with dependencies
* Functions with shared code
## Compatibility with v1
V1 environment images can be used as v2 environment runtime images.
+327
View File
@@ -0,0 +1,327 @@
# Fission Environments Redesign
As Fission supports more languages and reaches a wider set of use
cases, it's time to ask how well the current Environments design is
holding up.
## Environments V1: What we learned
Environments V1 is very simple idea: an environments is one Docker
image with an HTTP server + dynamic loader for that language; it's run
in a pod with a language-agnostic sidecar (fetcher) that downloads and
saves the function into a volume shared with the language-specific
container.
### Pros:
* Abstracted away images.
* Very fast cold start
* No image registry to manage (neither for the user nor for fission
implementation)
* Relatively small amount of language specific code. (python env is <
100 lines)
### Cons:
* Doesn't work well for compiled languages
* Users have to rebuild the image to add dependencies
* Only one file supported
* Errors in loading are not surfaced properly. It is especially
annoying to wait until runtime to see a syntax error that could have
been caught on function upload.
* Starting a Pod without knowing the functions has its limitations: we
can't set CPU/memory limits, we can't mount volumes (persistent
volumes, secrets, configmaps). We also can't change the namespace
the Pod is in.
* Not great for a large code base
* Some people want to operate at the image level but still get the
on-demand execution semantics of FaaS. This is a cost-optimization
use case.
### Discussion
Early feedback shows that almost evey user ends up rebuilding images
to add some dependencies. Some sort of automated dependency resolution
would be very nice to have and improve the development workflow. In
other words, just attach a package.json(nodejs) or
requirements.txt(python) with a function, and fission will do the
rest. There's also the possibility of supporting buildpacks (simple
zipfiles), a la AWS Lambda.
Though we can support compiled languages by doing the compilation
inside the cold-start, that's not a great solution because: (a)
compile errors would be reported at runtime, and (b) because the
overhead of compilation doesn't really need to be inside the
cold-start latency.
Non-trivial functions will need multiple files. That also helps for
common code across functions. So we need a way for the user to define
a function as a collection of code with an entry point.
Finally, Docker images remain the most flexible way to package an app.
Today, users can always rebuild an environment image to include
anything they want. But those images must still run a server that
implements fission-environment interface (i.e. the specialize
endpoint). So perhaps there could be a way for users to say "don't
use environments, I've already packaged up my function, here it is".
## Environment V2 Requirements
Roughly in order of priority:
0. Retain the simplicity of the simple use cases. First user
experience should remain trivial -- write a function, map a URL,
done.
1. Support compiled languages. Support error reporting on function
upload rather than cold start.
2. Support functions as a collection of files rather than just one
file.
3. Support automated environment-specific dependency resolution.
(#3 may end up having the same solution as #1. You could think of
gathering deps as a "compilation" of package.json,
requirements.txt, etc.)
4. Support functions as images.
### User stories
#### Environment Creation
V1 Environments were just an image. V2 Environments will be a yaml
file with the following properties:
* Run time image (required)
* Version (required)
* Builder image (optional)
* Build invocation command (required if builder image specified)
* File name extension(s) (optional)
The version will be used to distinguish V2 environments from V1.
```
$ cat golang.yaml
type: Environment
metadata:
name: go
spec:
runtimeImage: fission/go-runtime
builderImage: fission/go-builder
buildCommand:
- "/build.sh"
fileExtentions:
- go
$ fission env create -f golang.yaml
```
#### Function creation for compiled languages
User writes a function in a compiled language, for example Go.
```
$ fission function create --code blah.go
<compilation errors>
<user edits file>
$ $EDITOR blah.go
<fixes errors>
$ fission function update --code blah.go
<success>
$ fission route ... # routes work as usual
```
This same user story applies to interpreted languages too, where the
"compilation" step can be used to check for syntax errors.
#### Compiled language, without using fission builds
User compiles their function locally, resulting in a set of one or
more binaries. The user packages these up as a zip file, creating a
"deployment package".
```
$ fission function create --deployment-package foo.zip
$ fission route ... # routes work as usual
```
In this use case, fission is no longer operating at the source
level. Builds are left to the user and fission only sees the
deployment package package.
#### Collections of source files
The user can create a source package -- a set of source files in a
zip.
```
$ fission function create --source-package foo.zip
```
This workflow works similarly to providing a single source file.
In addition, fission CLI could support automatic creation of source packages, e.g.
```
$ fission function create --source-files *.js
```
This is purely client-side "syntactic sugar" -- the CLI creates the
source package instead of the user having to do it manually. It
doesn't change semantics; the source package is still handled as one
object.
#### Handling Dependencies
The source package of a function can contain dependency specs.
Fission framework proper does not treat this spec in any special way;
it's just another file in the source package. These will be
interpreted by the environment builder.
```
$ fission function create --source-files *.js --source-files package.json
```
In this case, the CLI will create a source package containing the JS
files and package.json. The NodeJS environment builder will create a
deployment package out of these files. The runtime environment will
load and run the deployment package.
#### V1 Compatibility
V1 Environments will continue to be supported. Existing commands will
continue to work. V1 environments won't support newer features like
builds, source and deployment packages, etc.
### Implementation
#### Environment Type
The environment type has a set of new properties: version, runtime
image, builder image, build command, file extension(s).
#### Function Type
The function type has new properties: source package, deployment
package. The literal code string continues to be supported, but it
will have a specified size limit, say 512KB.
#### Source and Binary Packages
A package is just a zip file. It's contents are opaque to fission:
the meaning of its contents is defined by the environment. Fission's
job is to manage the storage and delivery of the package into build
and runtime environments.
#### Storage Service
The storage service will have an HTTP API to upload and download
files. It can store the packages on a persistent volume or as objects
in cloud storage services such as S3.
Storage service has a garbage collection API endpoint. When invoked,
it will remove all packages that are not referenced from any function.
#### Fetcher
Fetcher gets some new responsibilities:
1. It must now also handle zip/unzip of packages
2. It must know how to upload to the storage service (so it's not
exactly "fetcher" any more, but...)
#### Runtime Environment Interface
The V2 runtime environment interface is very similar to V1
environments. Environments must support a dynamic loader and have an
HTTP server that forwards requests to the loaded module.
The differences:
* V2 runtimes must support loading a deployment package. Fetcher is
responsible for unzipping a deployment package, but interpretation
of the contents is up to the environment's code. For example, it
may have to include the directory where the deployment package is
unzipped in its module load path.
[TODO any other differences?]
#### Buildmgr
A new service that will manage builds. Its design is similar to
poolmgr, except it is triggered on creation or update of a function,
rather than HTTP requests.
Buildmgr creates a builder deployment+service for each environment.
Pods in this deployment run the environment's build container, and
fetcher, with a shared volume between the two containers.
When a function is created or updated with a source package, buildmgr
notices this and triggers a build. First, it calls fetcher to
download the source package into a shared volume with the build
container. It then invokes the builder by running the build
invocation command in the build container. Next, it calls fetcher to
package up the output of the builder and store the built package into
the the storage service.
Finally, it updates the function object in the controller API with a
reference to the built package.
[We can collapse this workflow into one request into the builder
service, which would make it easier to scale up the builder
deployment; if we used multiple requests we'd need some sort of
affinity rule, but k8s services only support IP based affinity.]
#### Poolmgr
Poolmgr remains relatively unchanged. Instead of constructing URLs for
function metadata, it uses the deployment package URL in the function
object.
#### CLI
Client libraries and CLI have to deal with the new properties in
functions and environments.
The CLI will now talk to both storage service and controller. When a
function is created, the user can specify the function in one of 3
ways:
1. One source file, same as v1.
2. A source package (or a set of source files, which is turned into a
source package by the CLI)
3. A deployment package
If the file is specified as a source file, fission CLI will use the
code literal if it's under the size limit; otherwise it should use the
storage service. This will allow users to use fission deployments
with no storage service, but with a size limit on functions.
For the case of a source or deployment package, the CLI first does an
upload to the storage service, then creates a function object with a
reference to the uploaded package.
+47
View File
@@ -0,0 +1,47 @@
# Fission Pool manager
Fission's currently uses a pool of running "environments" and specialized them for execution of a function. This design served the cold start use cases well but this is not the only strategy for creation and execution of functions. For example requirements for a new execution backend have been discussed in https://github.com/fission/fission/issues/193. This document aims to discuss the currently under development "newdeploy" backend and related thoughts
# Executor
A new layer - executor now sits between the router and actual backends are responsible for all of heavy lifting for execution of functions. Executor layer is responsible for accepting requests from router and checking with cache before calling on a backend for execution of a function.
# Backend
A backend is responsible for execution of a function - which can involve provisioning appropriate objects in Kubernetes. So with the new design Pool manager becomes one of the backends. As of this writing there are two backends which are described as:
### Pool Manager Backend
Pool manager backend uses a pool of environment pods and specialized them when a function is invoked. The specialized pods are cleaned up if not in use after a few minutes. More details on Pool manager can be found here: https://github.com/fission/fission/blob/5c470735185b980c1f7987921db360e91c65573b/Documentation/Architecture.md
### New Deploy Backend
New Deploy backend create a Kubernetes deployment, a Kubernetes Service for a given function. It additionally creates a HorizontalPodAutoscaler if scale parameters are provided. The creation of deployment and service can be eager or lazy based on input.
### Execution Strategy
While this is still a WIP, parameters that affect execution behavior of function are based on `InvokeStrategy`. A invoke strategy defines the `strategyType` and actual strategy parameters encapsulated in the strategy object.
```
InvokeStrategy struct {
ExecutionStrategy ExecutionStrategy
StrategyType StrategyType
}
```
For example in above case the strategy type is `ExecutionStrategy` and the corresponding parameters are listed below.
```
ExecutionStrategy struct {
Backend BackendType
MinScale int
MaxScale int
EagerCreation bool
}
```
In future there could be more strategies for different use cases.
## Dispatch to backend
As of now one of the backends is chosen based on a simple flag in `ExecutionStrategy`. In future there might be a intelligent/hybrid ways of choosing a backend. For example initial requests of a function could be served from a pool manager while later scaling could be served by a NewDeploy backend
+67
View File
@@ -0,0 +1,67 @@
# Java Environment : Design & considerations
This document documents the design and thoughts that lead to design of Java environment. Before we dive deeper, some important points:
- When we say Java, we really mean JVM. That does not mean that all languages will work seamlessly, so support will be added gradually based on validation. Some of popular languages as of today are:
- Scala
- Groovy
- Kotlin (Server side with Spring)
- In Java there are a few prominent frameworks which have a ecosystem of their own (See list below). How these framework fit in the environment will be detailed later, but it is important to understand their place in ecosystem and design for it.
- A large percentage of enterprise developers use [Spring framework](https://spring.io/) as has been shown by multiple surveys
- Reactive has taken up recently with data intensive operations [Reactive extensions for JVM](https://github.com/ReactiveX/RxJava)
- [Spark](http://sparkjava.com/) is a micro web framework
A draft implementation of the Java environment design is in the branch [java_env_alpha](https://github.com/fission/fission/tree/java_env_alpha). Also a earlier implementation based on Vort.x framework [can be found here](https://github.com/tobias/fission-java-env/)
## Function interface
The goal is here is to minimize the lock in for the user into any framework as much as possible. Java 8 introduced an interface called ```Function``` which could be a great fit here. The user has to implement the ```Function<T, R>``` class and to meet the contract implement the apply method:
```
public class HelloWorld implements Function<T, R> {
public R apply(T str) {
```
Now - the T & R could be different things and we discuss some options below:
### Body in request and response
From the early implementation in the branch mentioned above, the environment extracts the body and send it as a JSON string. The JSON then can be transformed into the appropriate object by the function.
This works well, but has one major limitation: the function does not get access to other things like headers etc. The same thing applies to the response: function can send the body but looses control over status code etc.
### HttpServletRequest and HttpServletResponse
It is possible to send the [HttpServeletRequest](https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html) request object as it is to the function class but then the interface becomes a bit too low level. For example the function user has to retrieve the body of request using ```getInputStream``` which gives raw input stream and needs additional work.
Also most enterprise applications today use a framework of some sort for web applications instead of dealing with the raw HttpServlet
### Custom/Context Object
A custom object which encapsulates all needed fields etc. can be used to pass the data from environment to the function. But this means the user has to import a Fission object/library for this object in the application code.
This approach has been taken in the implementation done earlier for a Java environment in Fission and [object interface can be found here](https://github.com/tobias/fission-java-env/blob/master/src/main/java/io/fission/api/Context.java). Related discussion is in the [issue](https://github.com/fission/fission/issues/91)
AWS Lambda also uses a context object, but the purpose is very different, [details of context object here](https://docs.aws.amazon.com/lambda/latest/dg/java-context-object.html).
### Spring's HttpEntity
If we have to depend on a class/library, it is probably better to depend on a class which is part of ecosystem. So instead of using the low level interface of Servlet, we can use [HttpEntity's subclasses RequestEntity and ResponseEntity](https://docs.spring.io/spring/docs/5.0.5.RELEASE/javadoc-api/org/springframework/http/HttpEntity.html). This ensures that the function user is not locked in the Fission object contract, but also gets the full access to request/response object.
The Spring cloud function project also discusses the issue of not having access to other things in request and [related issues are here](https://github.com/spring-cloud/spring-cloud-function/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+header)
### Thoughts
- If we only intend to pass request/response object to function - then using HttpEntity might be a good choice
- If there is a need for additional exchange of information between the environment and function execution in future, then a custom/context object is a better option. We can wrap the HttpEntity's fields and additional fields in the custom context object
## Environment Design
JVM environment design is based on Spring boot and Spring MVC frameworks. The details can be found in branch, but here are some key points:
- All classes in the function and dependent classes are loaded into JVM. Which means the user should supply the uber/fat jar for execution.
- The entrypoint class is specified by the user as ```entrypoint``` flag on the class. The method is by convention (```apply``` as per the Function interface contract)
+62
View File
@@ -0,0 +1,62 @@
# Fission Support Tool
Fission now has rich functionality supported by multiple services, however, it brings the complexity of troubleshooting.
This proposal tends to give a picture of fission support tool that can help both user and developer to locate the problem in short time.
To achieve this, the support tool will dump related kubernetes objects, fission resources and pod logs from the given cluster.
# Functionality
## Environment Information Collection
Before troubleshooting, some of the basic information is needed to give others an overview of kubernetes/fission user test with so that we can locate the problem in short time.
* Fission version
* Client/Server version
* Kubernetes cluster version
* Cluster version (i.e v1.9.7-gke.0)
* Running environment (i.e GKE, AKS and minikube)
* Nodes version and other information
## Service Logs Collection
The component logs and the logs of interaction between components are important for people to understand what really happened in cluster. Following are components need to collect logs from.
* All fission component pods
* Function pods
* Builder pods
* Environment pods
## Object dumping
Fission is deeply coupled with Kubernetes, most of the objects are created and maintained by it. There is two major type of objects need to be dumped from kubernetes:
* K8S objects
* CRD resources
All objects should be dumped into a readable file format. It will be great if people can reproduce similar environment with these files.
## Information upload
Upload dump files to the specific backend server for support channel to analysis
# CLI Interface
```
$ fission support collect
NAME:
fission support collect - Collect pod logs, fission resources and related kubernetes objects for troubleshooting
USAGE:
fission support collect [command options] [arguments...]
OPTIONS:
--dumpdir value Directory to save dump kubernetes objects and fission resources (default: "fission-dump")
--fissionns value Namespace of fission installation (default: "fission")
--builderns value Namespace of fission package builder (default: "fission-builder")
--funcns value Namespace of fission function pod (default: "fission-function")
```
# Thoughts?
1. What to do with sensitive objects like secrets and configmap? Ignore the dump for such objects?
2. The functionality is necessary but not listed above?
+209
View File
@@ -0,0 +1,209 @@
# Testing Proposal
This proposal was initially started as a upgrade testing proposal but soon problems that were posed resulted in a bigger proposal.
### Kinds of testing
Most of current integration tests are CLI driven. Fission CLI is used to test execute various test cases. In future we would have to also focus on API level testing as a UI is built for Fission.
## Needs & patterns
This section only explains the problems/best practices without going into tooling and language used for implementation.
### Separating the test & data
Separating the tests from test data has two aspects - one is separation of concerns and second is scaling the tests without touching the test logic. The test data is a simple data structure which holds all information and test can take data and execute the logic.
As an example today we test "Hello world" for nodejs environment with a simple hello.js like this:
```
fission env create --name nodejs --image fission/node-env
fission fn create --name $fn --env nodejs --code $ROOT/examples/nodejs/hello.js
fission route create --function $fn --url /$fn --method GET
response=$(curl http://$FISSION_ROUTER/$fn)
```
The variables here are environment image, function code & route URL.
If tomorrow if we had to scale this test for all environments, we will have to repeat ourselves. (Violate DRY principle). Instead of that if we encapsulate the test setup & test in a simple function:
```
test_hello_env(envImage, codePath, routeURL){
}
```
And feed it with a dictionary which has all possible combination of tests:
```
{
node: {"fission/node-env", "test/hello.js", "/hellonode"},
python: {"fission/python-env", "test/hello.py", "/hellopy"},
golang: {"fission/go-env", "test/hello.go", "/hellogo"},
binary: {"fission/binary-env", "test/hello.sh", "/hellobinary"},
}
```
This would achieve a few things:
- Separate the test execution logic from the data it needs clearly.
- For adding new kind of environments, you just need to add one more entry into data structure.
Testing all environments may not be most apt example for this, but there can be potential use cases like this.
### Separating the test & setup/teardown
When we run a test there are typically three distinct phases:
- Setup (Create env, fn, route)
- Test (Curl the function)
- Cleanup (Delete fn, route & env)
It should be possible to separate the before test and after test parts from actual tests at two levels:
- Each test
- A whole test suite
The ability to have clean and separate before and after blocks, apart from separation of concerns, enables:
- Running a suite of tests for same setup (See tagging for suite of tests)
### Tagging tests & running a selection
Over a period of time as tests grow, there will be unit, smoke, integration, performance, soak tests and so on. Ability to run a particular test suite only or a combination of them makes it easy to run for specific purpose.
### Measuring test times
[Good to have, not a must] Measuring time for tests and reporting somewhere helps over time to monitor trends. Although this job is better done by performance/benchmark tests so it is not a strict requirement
### Cleaner Logging
It would be good to have cleaner/relevant logging as part of build & test. For example something that Ginkgo framework does is it shows error logs only for failed tests.
### Tests in Parallel
It would be good to be able to run tests in parallel.
## Evaluating the tools/alternatives
### BATS
Bash Automated Testing System is like a enhanced version of bash with support for @test tags and before and after steps & ability to skip tests etc. While it enhances the bash to certain extent, the overall improvement is only marginal.
```
#!/usr/bin/env bats
@test "addition using bc" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
$ bats addition.bats
✓ addition using bc
✓ addition using dc
2 tests, 0 failures
```
#### Links
- Bats repo: https://github.com/sstephenson/bats
- Runc uses Bats https://github.com/opencontainers/runc/tree/master/tests/integration
### Go Test
The testing package of Go also is quite feature rich for most of the use cases we need. Go 1.7 onwards there is support for setup & teardown parts and parallelism etc.
#### Go - Testing package
- Support for setup and teardown based on https://golang.org/pkg/testing/#hdr-Main
- Go testing already supports and has examples of table driven tests (Separating test & data), measuring test times and parallel tests
#### Shell execution: Go's Exec Library
GO provides a built in Exec library for working with CLI commands. The package seems good enough for us to work, though a few working examples will help decide better
https://golang.org/pkg/os/exec
### Using CLI package
Currently we build a CLI and then execute the tests. The tests basically call one of functions from CLI package. If we decide to use a go lang based framework, then we can import the CLI package and then call those functions by providing them context. This is as good as calling the Fission from CLI, with added benefit of programmability of Go language.
```
func TestSomething(t *testing.T) {
// Build the Cli context with flags etc.
ctx := cli.Context{}
// Pass the ctx to create function
fnCreate(ctx)
}
```
Some of benefits of using above pattern are:
- We can build a small framework around above core where we can pass various flag combinations etc. and exercise all flags in great detail
- We can use rest of Go testing library and other libraries to build matchers, looping, parallelism etc.
- It allows us to exercise the logic in CLI as well as validate the API at the same time.
### Ginkgo & Gomega
Ginkgo is a BDD framework which works with Gomega matcher library. I will state relevant portions of these two frameworks which can be utilized:
From Ginkgo:
- Global `BeforeSuite` and after `AfterSuite` can be used to have global setup and tear down phases
- For tests `BeforeEach` and `AfterEach` and more such variants to do before and after test tasks.
From Gomega:
Gomega is a matcher library but the `gexec` library makes it really easy to interact with OS execution environment. Some working examples:
- Build and cleanup the Fission CLI before & after the tests
```
var fissionCli string
BeforeSuite(func() {
var err error
fissionCli, err = gexec.Build("github.com/fission/fission")
Ω(err).ShouldNot(HaveOccurred())
})
AfterSuite(func() {
gexec.CleanupBuildArtifacts()
})
```
- Following will run Fission commands with Fission CLI and print error if there is one (verbosity is configurable)
```
command := exec.Command(fissionCli, "fission env create --name nodejs --image fission/node-env")
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
```
- Use Fission CLI's output to validate test results
```
Eventually(session.Out).Should(gbytes.Say("hello [A-Za-z], world"))
```
#### Gomega Matchers
- Gomega provides quite a few built in matchers - so you don't have to code those small usual checks, for example:
```
Ω(ACTUAL).Should(BeTrue()) // The output should be true
Ω(ACTUAL).Should(BeAnExistingFile()) // The file should already exist
```
There are many more matchers which cane be found here: http://onsi.github.io/gomega/#provided-matchers
- We can build custom matchers in Go language for reusable logic.
#### Links
Ginkgo: http://onsi.github.io/ginkgo/
Gomega: http://onsi.github.io/gomega/
## Thoughts & Next actions
Based on the discussion with team, here are current thoughts and next action items:
### Thoughts
- As far as possible we should stick to Go's built in testing package
- Ginkgo's cleaner logging feature (Onlu log if there are errors) - is very useful. We can decide to incorporate this in future.
- Gomega's (gexec)[http://onsi.github.io/gomega/#gexec-testing-external-processes] is really neat and some matchers can be used if necessary
### Action items
- How will upgrade test for Fission fit in the framework?
- How will migration of tests happen over time:
- Aim is to keep existing tests around so that enough validation is in place
- May be migrate one test at a time
- How much of current setup etc. will move into framework? For example it is clear that helm commands should be part of test framework as part of setup/teardown. But other sections may or may not be. A RCA needs to be done to analyze and come up with clear demarcation.
## References
- EngineYard uses BATS: https://www.engineyard.com/blog/bats-test-command-line-tools
- AWS CLI Tests, written in Python (CLI itself is also in Python): https://github.com/aws/aws-cli/tree/develop/tests
- Kubernetes uses Ginkgo and Gomega extensively: https://github.com/kubernetes/kubernetes/search?l=Go&q=onsi&type=
- Hashicorp's Mitchell's talk on Advanced testing with go talks about some good patterns to use: https://www.youtube.com/watch?v=8hQG7QlcLBk
+136
View File
@@ -0,0 +1,136 @@
# Copyright 2017 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.
.DEFAULT_GOAL := check
# Platforms to build in multi-architecture images.
PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
# Repository prefix and tag to push multi-architecture images to.
REPO ?= fission
TAG ?= dev
DOCKER_FLAGS ?= --push --progress plain
VERSION ?= master
TIMESTAMP ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
COMMITSHA ?= $(shell git rev-parse HEAD)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
BINDIR ?= build/bin
FISSION-CLI-SUFFIX :=
ifeq ($(GOOS), windows)
FISSION-CLI-SUFFIX := .exe
endif
GO ?= go
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.GitCommit=$(COMMITSHA) $(GO_LDFLAGS)
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.BuildDate=$(TIMESTAMP) $(GO_LDFLAGS)
GO_LDFLAGS := -X github.com/fission/fission/pkg/info.Version=$(VERSION) $(GO_LDFLAGS)
GCFLAGS ?= all=-trimpath=$(CURDIR)
ASMFLAGS ?= all=-trimpath=$(CURDIR)
### Static checks
check: test-run build-fission-cli clean
code-checks:
hack/verify-gofmt.sh
hack/verify-govet.sh
hack/verify-staticcheck.sh
# run basic check scripts
test-run: code-checks
hack/runtests.sh
@rm -f coverage.txt
### Binaries
fission-cli:
@mkdir -p $(BINDIR)
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build \
-gcflags '$(GCFLAGS)' \
-asmflags '$(ASMFLAGS)' \
-ldflags "$(GO_LDFLAGS)" \
-o $(BINDIR)/fission-$(VERSION)-$(GOOS)-$(GOARCH)$(FISSION-CLI-SUFFIX) ./cmd/fission-cli
all-fission-cli:
$(MAKE) fission-cli GOOS=windows GOARCH=amd64
$(MAKE) fission-cli GOOS=linux GOARCH=amd64
$(MAKE) fission-cli GOOS=linux GOARCH=arm
$(MAKE) fission-cli GOOS=linux GOARCH=arm64
$(MAKE) fission-cli GOOS=darwin GOARCH=amd64
install-fission-cli: fission-cli
mv $(BINDIR)/fission-$(VERSION)-$(GOOS)-$(GOARCH)$(FISSION-CLI-SUFFIX) /usr/local/bin/
### Container images
FISSION_IMGS := fission-bundle-multiarch-img \
fetcher-multiarch-img \
builder-multiarch-img\
pre-upgrade-checks-multiarch-img \
reporter-multiarch-img
verify-builder:
@./hack/buildx.sh $(PLATFORMS)
local-images:
PLATFORMS=linux/amd64 $(MAKE) all-images
all-images: verify-builder $(FISSION_IMGS)
fission-bundle-multiarch-img: cmd/fission-bundle/Dockerfile.fission-bundle
fetcher-multiarch-img: cmd/fetcher/Dockerfile.fission-fetcher
builder-multiarch-img: cmd/builder/Dockerfile.fission-builder
pre-upgrade-checks-multiarch-img: cmd/preupgradechecks/Dockerfile.fission-preupgradechecks
reporter-multiarch-img: cmd/reporter/Dockerfile.reporter
%-multiarch-img:
@echo === Building image $(REPO)/$(subst -multiarch-img,,$@):$(TAG) using context $(CURDIR) and dockerfile $<
docker buildx build --platform=$(PLATFORMS) -t $(REPO)/$(subst -multiarch-img,,$@):$(TAG) \
--build-arg GITCOMMIT=$(COMMITSHA) \
--build-arg BUILDDATE=$(TIMESTAMP) \
--build-arg BUILDVERSION=$(VERSION) \
$(DOCKER_FLAGS) -f $< .
### CRDs
generate-crds:
controller-gen crd:trivialVersions=false,preserveUnknownFields=false \
paths=./pkg/apis/core/v1 \
output:crd:artifacts:config=crds/v1
create-crds:
@kubectl create -k crds/v1
update-crds:
@kubectl replace -k crds/v1
delete-crds:
@kubectl delete -k crds/v1
### Cleanup
clean:
@rm -f cmd/fission-bundle/fission-bundle
@rm -f cmd/fission-cli/fission
@rm -f cmd/fetcher/fetcher
@rm -f cmd/fetcher/builder
@rm -f cmd/reporter/reporter
@rm -f pkg/apis/core/v1/types_swagger_doc_generated.go
### Misc
generate-swagger-doc:
@cd pkg/apis/core/v1/tool && ./update-generated-swagger-docs.sh
make release:
@./hack/release.sh $(VERSION)
@./hack/releas-tag.sh $(VERSION)
+100 -55
View File
@@ -1,79 +1,124 @@
Fission
=======
<p align="center">
<img src="https://docs.fission.io/images/logo.png" width="300" />
<br>
<h1 align="center">Fission: Serverless Functions for Kubernetes</h1>
</p>
<p align="center">
<a href="https://github.com/fission/fission/actions?query=workflow%3A%22Fission+CI%22">
<img src="https://github.com/fission/fission/workflows/Fission%20CI/badge.svg?branch=master" alt="Build Status" />
</a>
<a href="https://goreportcard.com/report/github.com/fission/fission">
<img src="https://goreportcard.com/badge/github.com/fission/fission" alt="Go Report Card" />
</a>
<a href="https://codecov.io/gh/fission/fission">
<img src="https://codecov.io/gh/fission/fission/branch/master/graph/badge.svg" alt="codecov" />
</a>
<br>
<a href="http://fission.io">fission.io</a> | <a href="http://twitter.com/fissionio">@fissionio</a> | <a href="https://join.slack.com/t/fissionio/shared_invite/enQtOTI3NjgyMjE5NzE3LTllODJiODBmYTBiYWUwMWQxZWRhNDhiZDMyN2EyNjAzMTFiYjE2Nzc1NzE0MTU4ZTg2MzVjMDQ1NWY3MGJhZmE">Slack</a>
</p>
--------------
Fission is a fast serverless framework for Kubernetes with a focus on
developer productivity and high performance.
It's customizable (with sensible defaults), extensible to any
language, and interoperates well with other infrastructure.
Fission operates on _just the code_: Docker and Kubernetes are
abstracted away under normal operation, though you can use both to
extend Fission if you want to.
See https://fission.io for more.
Fission is extensible to any language; the core is written in Go, and
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.
Table of Contents
=================
Running Fission
===============
* [Fission: Serverless Functions for Kubernetes](#fission-serverless-functions-for-kubernetes)
* [Performance: 100msec cold start](#performance-100msec-cold-start)
* [Kubernetes is the right place for Serverless](#kubernetes-is-the-right-place-for-serverless)
* [Getting Started](#getting-started)
* [Learn More](#learn-more)
* [Contributing](#contributing)
* [Get Help &amp; Community Meeting](#get-help--community-meeting)
* [Official Releases](#official-releases)
* [Sponsors](#sponsors)
* [Licensing](#licensing)
On your own Kubernetes cluster
------------------------------
## Performance: 100msec cold start
### Setup Kubernetes
Fission maintains a pool of "warm" containers that each contain a
small dynamic loader. When a function is first called,
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.
On your laptop:
## Kubernetes is the right place for Serverless
https://github.com/kubernetes/minikube
We're built on Kubernetes because we think any non-trivial app will
use a combination of serverless functions and more conventional
microservices, and Kubernetes is a great framework to bring these
together seamlessly.
Or use Google Container Engine.
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.
### Verify access to the cluster
$ kubectl version
### Get and Run Fission
If you're using GKE, use the fission.yaml unmodified. If you're using
minikube, change all instances of LoadBalancer services to NodePort.
$ curl http://fission.io/fission.yaml | kubectl create -f -
$ kubectl --namespace fission get services
Save the external IP addresses of controller and router services in
FISSION_URL and FISSION_ROUTER, respectively.
### Install the client CLI
$ curl http://fission.io/fission > fission
$ chmod +x fission
$ sudo mv fission /usr/local/bin/
### Run an example
## Getting Started
```bash
# Add the stock NodeJS env to your Fission deployment
$ fission env create --name nodejs --image fission/node-env
$ echo 'module.exports = function(context, callback) { callback(200, "Hello, world!\n"); }' > hello.js
$ fission function create --name hello --env nodejs --code hello.js
$ fission route create --method GET --url /hello --function hello
$ curl http://$FISSION_ROUTER/hello
# Create a function with a javascript one-liner that prints "hello world"
$ fission function create --name hello --env nodejs --code https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js
# Run the function. This takes about 100msec the first time.
$ fission function test --name hello
Hello, world!
```
## Learn More
Status
======
* Understand [Fission Concepts](https://docs.fission.io/docs/concepts/).
* See the [installation guide](https://docs.fission.io/docs/installation/) for installing and running Fission.
* You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io/docs).
* See the [troubleshooting guide](https://docs.fission.io/docs/trouble-shooting/) for debugging your functions and Fission installation.
Fission is in early alpha. Watch this space for announcements soon!
## Contributing
Check out the [contributing guide](CONTRIBUTING.md).
Performance
===========
## Get Help & Community Meeting
The alpha release has focussed on cold-start latency performance. For
requests that don't have a running instance, i.e. a "cold start",
fission has a latency overhead of less than 100 msec for the NodeJS
environment.
Fission is a project by [many contributors](https://github.com/fission/fission/graphs/contributors).
Reach us on [slack](https://join.slack.com/t/fissionio/shared_invite/enQtOTI3NjgyMjE5NzE3LTllODJiODBmYTBiYWUwMWQxZWRhNDhiZDMyN2EyNjAzMTFiYjE2Nzc1NzE0MTU4ZTg2MzVjMDQ1NWY3MGJhZmE) or [twitter](https://twitter.com/fissionio).
A regular community meeting takes place every other Thursday at 09:00 AM PT (Pacific Time). [Convert to your local timezone](http://www.thetimezoneconverter.com/?t=09:00&tz=PT%20%28Pacific%20Time%29).
Meeting Link: https://zoom.us/j/413921817
The meeting agenda for next meeting and notes from past meetings are maintained in [this document](https://docs.google.com/document/d/1E-xw4KJgka4sUpETHxr9BJBYntzrtxlAN_CE3Wt8kws). You are welcome to join to discuss direction of project, design and implementation reviews and general questions about project etc.
## 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
the master branch are subject to changes and incompatibilities that will not be supported in the official releases.
## Sponsors
The following companies, organizations, and individuals support Fission's ongoing maintenance and development. If you are using/contributing to Fission, we would be happy to list you here, please raise a Pull request.
<p>
<a href="https://infracloud.io/"><img src="https://fission.io/sponsors/infracloud.png" alt="InfraCloud" height="70"></a>
<a href="https://srcmesh.com/"><img src="https://fission.io/sponsors/srcmesh.png" alt="Srcmesh" height="70"></a>
<a href="https://www.digitalocean.com/?utm_medium=opensource&utm_source=fissionio">
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/PoweredByDO/DO_Powered_by_Badge_blue.svg" width="201px">
</a>
</p>
# Licensing
Fission is under the Apache 2.0 license.
+127
View File
@@ -0,0 +1,127 @@
# Fission
[Fission](http://fission.io/) is a framework for serverless functions on Kubernetes.
## Prerequisites
- Kubernetes 1.9 or later
## Helm charts
The following table lists two helm charts for Fission.
| Parameter | Description |
| ---------------| ---------------------------------------------------------------------------------------|
| `fission-core` | FaaS essentials, and triggers for HTTP, Timers and Kubernetes Watches |
| `fission-all` | Log aggregation with fluentd and InfluxDB; NATS for message queue triggers; Fission-UI |
## Installing the chart
To install the chart with the release name `my-release`,
```bash
$ helm install --name my-release fission-all
```
## Uninstalling the chart
To uninstall/delete chart,
```bash
$ helm delete my-release
```
## Configuration
The following table lists the configurable parameters of the Fission chart and their default values.
Parameter | Description | Default
--------- | ----------- | -------
`serviceType` | Type of Fission Controller service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `ClusterIP`
`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.13.1`
`pullPolicy` | Image pull policy | `IfNotPresent`
`fetcher.image` | Fission fetcher repository | `fission/fetcher`
`fetcher.imageTag` | Fission fetcher image tag | `1.13.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`
`builderNamespace` | Namespace in which to run fission builders (this is different from the release namespace) | `fission-builder`
`enableIstio` | Enable istio integration | `false`
`persistence.enabled` | If true, persist data to a persistent volume | `true`
`persistence.existingClaim` | Provide an existing PersistentVolumeClaim instead of creating a new one | `nil`
`persistence.storageClass` | PersistentVolumeClaim storage class | `nil`
`persistence.accessMode` | PersistentVolumeClaim access mode | `ReadWriteOnce`
`persistence.size` | PersistentVolumeClaim size | `8Gi`
`analytics` | Analytics let us count how many people installed fission. Set to false to disable analytics | `true`
`analyticsNonHelmInstall` | Internally used for generating an analytics job for non-helm installs | `false`
`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`
`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.extraCoreComponentPodConfig` | Extend the container specs for the router fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. Overrides the generic `extraCoreComponentPodConfig`| None
`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`
`router.roundTrip.timeoutExponent` | The length of request timeout will multiply with timeoutExponent after each retry | `2`
`router.roundTrip.maxRetries` | Max retries times of a failed request | `10`
### Extra configuration for `fission-all`
Parameter | Description | Default
--------- | ----------- | -------
`createNamespace` | If true, create `fission-function` and `fission-builder` namespaces | ` true`
`logger.influxdbAdmin` | Log database admin username | `admin`
`logger.fluentdImageRepository` | Logger fluentbit image repository | `index.docker.io`
`logger.fluentdImage` | Logger fluentbit image | `fluent/fluent-bit`
`logger.fluentdImageTag` | Logger fluentbit image tag | `1.0.4`
`nats.enabled` | Nats streaming enabled | `true`
`nats.external` | Use external Nats installation | `false`
`nats.hostaddress` | Address of NATS cluster | `nats-streaming:4222`
`nats.authToken` | Nats streaming auth token | `defaultFissionAuthToken`
`nats.clusterID` | Nats streaming clusterID | `fissionMQTrigger`
`nats.clientID` | Client name registered with nats streaming | `fission`
`nats.queueGroup` | Queue group registered with nats streaming | `fission-messageQueueNatsTrigger`
`natsStreamingPort` | Nats streaming service port | `31316`
`azureStorageQueue.enabled` | Azure storage account name | `false`
`azureStorageQueue.key` | Azure storage account name | `""`
`azureStorageQueue.accountName` | Azure storage access key | `""`
`kafka.enabled` | Kafka trigger enabled | `false`
`kafka.brokers` | Kafka brokers uri | `broker.kafka:9092`
`kafka.version` | Kafka broker version | `nil`
`heapster` | Enable Heapster (only enable this in clusters where heapster does not exist already) | `false`
Please note that deploying of Azure Storage Queue or Kafka is not done by Fission chart and you will have to explicitly deploy them.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release --set image=custom/fission-bundle,imageTag=v1 fission-all
```
If you're using minikube, set serviceType and routerServiceType to NodePort:
```bash
$ helm install --name my-release --set serviceType=NodePort,routerServiceType=NodePort fission-all
```
You can also set parameters with a yaml file (see [values.yaml](fission-all/values.yaml) for
what it should look like):
```bash
$ helm install --name my-release -f values.yaml fission-all
```
+21
View File
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: prometheus
repository: https://prometheus-community.github.io/helm-charts
version: 13.2.1
digest: sha256:136360a97bdc11f1933d75bab77728acc75dd9583257b973cb3336b6d136c9b6
generated: "2021-05-27T18:51:04.509283+05:30"
+21
View File
@@ -0,0 +1,21 @@
apiVersion: v2
name: fission-all
version: 1.13.1
description: Fission is a fast serverless framework for Kubernetes.
keywords:
- fission
- serverless
home: https://fission.io/
maintainers:
- name: Vishal Biyani
email: vishal@infracloud.io
- name: Sanket Sudake
email: sanket@infracloud.io
engine: gotpl
appVersion: 1.13.1
type: application
dependencies:
- name: prometheus
version: 13.2.1
repository: https://prometheus-community.github.io/helm-charts
condition: prometheus.enabled
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
+56
View File
@@ -0,0 +1,56 @@
# Some stuff in this file is copied out of https://github.com/fluent/fluent-bit-kubernetes-logging/blob/master/output/kafka/fluent-bit-configmap.yaml
[SERVICE]
Flush 5
Log_Level info
Parsers_File parsers.conf
[INPUT]
Name tail
Tag log.*
Path ${LOG_PATH}
Mem_Buf_Limit 5MB
Parser docker
DB /var/log/fission/flb_kube.db
Skip_Long_Lines On
Refresh_Interval 10
[FILTER]
Name kubernetes
Match *
Kube_Tag_Prefix log.var.log.fission.
Kube_URL https://kubernetes.default.svc.cluster.local:443
#
# Flatten kubernetes labels so we can tag and query functionuid with influxdb
#
[FILTER]
Name nest
Match log.*
Operation lift
Nested_under kubernetes
Prefix_with kubernetes_
[FILTER]
Name nest
Match log.*
Operation lift
Nested_under kubernetes_labels
Prefix_with kubernetes_labels_
[OUTPUT]
Name influxdb
Match log.*
Host ${INFLUXDB_ADDRESS}
Port ${INFLUXDB_PORT}
Database ${INFLUXDB_DBNAME}
HTTP_User ${INFLUXDB_USERNAME}
HTTP_Passwd ${INFLUXDB_PASSWD}
Tag_Keys kubernetes_labels_functionUid
Sequence_Tag _seq
# Useful for testing config changes
#[OUTPUT]
# Name file
# Match log.*
# Path /flbout.txt
+12
View File
@@ -0,0 +1,12 @@
[PARSER]
Name docker
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
Time_Keep On
# next bit is useful when the logs from the function itself are in json
# Command | Decoder | Field | Optional Action
# =============|==================|=================
#Decode_Field_As escaped log
+25
View File
@@ -0,0 +1,25 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-darwin-amd64 && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-linux-amd64 && 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/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-windows-amd64.exe
2. You're ready to use Fission!
# Create an environment
$ fission env create --name nodejs --image fission/node-env
# Get a hello world
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
# Register this function with Fission
$ fission function create --name hello --env nodejs --code hello.js
# Run this function
$ fission function test --name hello
Hello, world!
+53
View File
@@ -0,0 +1,53 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
This is a template with config parameters for optional features in fission. This gets mounted on to the controller pod
as a config map.
To add new features with config parameters, create a yaml block below with the feature name and define a corresponding struct in
controller/config.go
*/}}
{{- define "config" -}}
canary:
enabled: {{ .Values.canaryDeployment.enabled }}
{{- if .Values.prometheus.enabled }}
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
{{- else }}
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
{{- end }}
{{- printf "\n" -}}
{{- end -}}
{{/*
This template generates the image name for the deployment depending on the value of "repository" field in values.yaml file.
*/}}
{{- define "fission-bundleImage" -}}
{{- if .Values.repository -}}
{{- if eq .Values.imageTag "" -}}
{{ .Values.repository }}/{{ .Values.image }}
{{- else -}}
{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}
{{- end }}
{{- else -}}
{{- if eq .Values.imageTag "" -}}
{{ .Values.image }}
{{- else -}}
{{ .Values.image }}:{{ .Values.imageTag }}
{{- end }}
{{- end }}
{{- end -}}
File diff suppressed because it is too large Load Diff
+188
View File
@@ -0,0 +1,188 @@
# Fluentbit deployment for Fission
#
# Requires:
# - service account: fission-svc
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-fission-fluentbit
data:
{{- if .Files.Get "config/fluentbit.conf" }}
fluentbit.conf: |
{{ .Files.Get "config/fluentbit.conf" | indent 3 }}
{{ else }}
{{ fail "invalid chart" }}
{{- end }}
{{- if .Files.Get "config/parsers.conf" }}
parsers.conf: |
{{ .Files.Get "config/parsers.conf" | indent 3 }}
{{ else }}
{{ fail "invalid chart" }}
{{- end }}
{{- if .Values.logger.podSecurityPolicy.enabled }}
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ .Release.Name }}-fission-logger-privileged
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: logger
spec:
privileged: true
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
volumes:
- '*'
{{- if .Values.logger.podSecurityPolicy.additionalCapabilities }}
allowedCapabilities:
{{- range .Values.logger.podSecurityPolicy.additionalCapabilities }}
- {{ . }}
{{- end }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: psp:{{ .Release.Name }}-fission-logger-privileged
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: logger
rules:
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- {{ .Release.Name }}-fission-logger-privileged
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: psp:{{ .Release.Name }}-fission-logger-privileged
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: logger
roleRef:
kind: Role
name: psp:{{ .Release.Name }}-fission-logger-privileged
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: default
namespace: {{ .Release.Namespace }}
{{- end }}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: logger
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: logger
spec:
selector:
matchLabels:
svc: logger
template:
metadata:
labels:
svc: logger
spec:
initContainers:
- name: init
image: {{ .Values.busyboxImage | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ['mkdir', '-p', '/var/log/fission']
volumeMounts:
- name: container-log
mountPath: /var/log/
readOnly: false
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
containers:
- name: logger
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
command: ["/fission-bundle"]
args: ["--logger"]
volumeMounts:
- name: container-log
mountPath: /var/log/
readOnly: false
- 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 }}"
{{ else }}
image: "{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
# CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
command: ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluentbit.conf"]
env:
- name: INFLUXDB_ADDRESS
value: influxdb
- name: INFLUXDB_PORT
value: "8086"
- name: INFLUXDB_DBNAME
value: "fissionFunctionLog"
- name: INFLUXDB_USERNAME
valueFrom:
secretKeyRef:
name: influxdb
key: username
- name: INFLUXDB_PASSWD
valueFrom:
secretKeyRef:
name: influxdb
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/
readOnly: false
- name: docker-log
mountPath: /var/lib/docker/containers
readOnly: true
- name: fluentbit-config
mountPath: /fluent-bit/etc/
readOnly: true
serviceAccountName: fission-svc
volumes:
- name: container-log
hostPath:
path: /var/log/
- name: docker-log
hostPath:
path: /var/lib/docker/containers
# Fluentbit config location: /fluent-bit/etc/*.conf
- name: fluentbit-config
configMap:
name: {{ .Release.Name }}-fission-fluentbit
updateStrategy:
type: RollingUpdate
@@ -0,0 +1,41 @@
{{- if .Values.analyticsNonHelmInstall }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}-{{ randNumeric 3 }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
spec:
#ttlSecondsAfterFinished: 120
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-install-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "yaml-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,45 @@
{{- if .Values.analytics }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-install-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "helm-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,45 @@
{{- if .Values.analytics }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-upgrade-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "helm-post-upgrade", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,37 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}-{{ randNumeric 3 }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: "{{ .Release.Name }}"
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
spec:
backoffLimit: 0
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: "{{ .Release.Name }}"
app: {{ template "name" . }}
spec:
restartPolicy: Never
containers:
- name: pre-upgrade-job
{{- if .Values.imageTag }}
image: {{ .Values.preUpgradeChecksImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.preUpgradeChecksImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/pre-upgrade-checks" ]
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
serviceAccountName: fission-svc
+23
View File
@@ -0,0 +1,23 @@
{{- if and (.Values.persistence.enabled) (not .Values.persistence.existingClaim) (eq (.Values.persistence.storageType | default "local") "local") }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: fission-storage-pvc
labels:
app: fission-storage
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}
{{- end }}
+95
View File
@@ -0,0 +1,95 @@
apiVersion: apps/v1
{{- if not .Values.router.deployAsDaemonSet }}
kind: Deployment
{{- else }}
kind: DaemonSet
{{- end }}
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: router
application: fission-router
spec:
{{- if not .Values.router.deployAsDaemonSet }}
replicas: 1
{{- end }}
selector:
matchLabels:
application: fission-router
svc: router
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.router.roundTrip.timeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.router.roundTrip.timeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.router.roundTrip.keepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_DISABLE_KEEP_ALIVE
value: {{ .Values.router.roundTrip.disableKeepAlive | default true | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.router.roundTrip.maxRetries | default 10 | quote }}
- name: ROUTER_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: ROUTER_UNTAP_SERVICE_TIMEOUT
value: {{ .Values.router.unTapServiceTimeout | default "3600s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
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 }}
resources:
{{- toYaml .Values.router.resources | indent 10 }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.router.extraCoreComponentPodConfig }}
{{ toYaml .Values.router.extraCoreComponentPodConfig | indent 6 -}}
{{- else }}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
+23
View File
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Secret
metadata:
name: influxdb
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
type: Opaque
data:
username: {{ .Values.logger.influxdbAdmin | b64enc | quote }}
password: {{ randAlphaNum 20 | b64enc | quote }}
{{- if .Values.azureStorageQueue.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
name: azure-storage-account-key
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
type: Opaque
data:
key: {{ required "An Azure storage access key is required." .Values.azureStorageQueue.key | b64enc | quote }}
{{- end }}
+95
View File
@@ -0,0 +1,95 @@
apiVersion: v1
kind: Service
metadata:
name: router
labels:
svc: router
application: fission-router
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.router.svcAnnotations }}
annotations:
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.routerServiceType }}
ports:
- port: 80
targetPort: 8888
{{- if eq .Values.routerServiceType "NodePort" }}
nodePort: {{ .Values.routerPort }}
{{- end }}
selector:
svc: router
---
apiVersion: v1
kind: Service
metadata:
name: controller
labels:
svc: controller
application: fission-api
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: {{ .Values.serviceType }}
ports:
- port: 80
targetPort: 8888
{{- if eq .Values.serviceType "NodePort" }}
nodePort: {{ .Values.controllerPort }}
{{- end }}
selector:
svc: controller
{{- if and .Values.nats.enabled (not .Values.nats.external) }}
---
apiVersion: v1
kind: Service
metadata:
name: nats-streaming
labels:
svc: nats-streaming
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: {{ .Values.serviceType }}
ports:
- port: 4222
targetPort: 4222
{{- if eq .Values.serviceType "NodePort" }}
nodePort: {{ .Values.natsStreamingPort }}
{{- end }}
selector:
svc: nats-streaming
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: storagesvc
labels:
svc: storagesvc
application: fission-storage
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8000
selector:
svc: storagesvc
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
svc: executor
+368
View File
@@ -0,0 +1,368 @@
#
# Fission chart configuration
#
## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
serviceType: ClusterIP
## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
routerServiceType: LoadBalancer
## Image base repository
## Leave it empty for using existing local image
repository: index.docker.io
## Fission image repository
image: fission/fission-bundle
## Image pull policy
pullPolicy: IfNotPresent
## Fission image version
imageTag: 1.13.1
## Port at which Fission controller service should be exposed
controllerPort: 31313
## Port at which Fission router service should be exposed
routerPort: 31314
## Port at which NATS streaming service should be exposed
## (only if nats enabled and not external)
natsStreamingPort: 31316
## Set to false if you create the namespaces manually
createNamespace: true
## Namespace in which to run fission functions (this is different from
## the release namespace)
functionNamespace: fission-function
## Namespace in which to run fission builders (this is different from
## the release namespace)
builderNamespace: fission-builder
## Enable istio integration
enableIstio: false
fetcher:
## Fetcher repository
image: fission/fetcher
## Fetcher image version
imageTag: 1.13.1
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
resource:
cpu:
requests: "10m"
## Low CPU limits will increases the function specialization time.
limits: ""
mem:
requests: "16Mi"
limits: ""
## Logger config
logger:
influxdbAdmin: "admin"
fluentdImageRepository: index.docker.io
fluentdImage: fluent/fluent-bit
fluentdImageTag: 1.5.1
## 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
## Enable PodSecurityPolicies to allow privileged container
## Only required in some clusters and when enableSecurityContext is true
podSecurityPolicy:
enabled: false
## Configure additional capabilities
additionalCapabilities:
# example values for linkerd
#- NET_RAW
#- NET_ADMIN
executor:
adoptExistingResources: false
podReadyTimeout: 300s
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
unTapServiceTimeout: 3600s
## 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
## For router to match encoded path.
## If true, "/foo%2Fbar" will match the path "/{var}";
## Otherwise, it will match the path "/foo/bar".
useEncodedPath: false
roundTrip:
## If true, router will disable the HTTP keep-alive which result in performance degradation.
## But it ensures that router can redirect new coming requests to new function pods.
##
## If false, router will enable transport keep-alive feature for better performance.
## However, the drawback is it takes longer to switch to newly created function pods
## if using newdeploy as executor type for function. If you want to preserve the
## performance while keeping the short switching time to new function, you can create
## an environment with short grace period by setting flag "--graceperiod" (default 360s),
## so that kubernetes will be able to reap old function pod quickly.
##
## For details, see https://github.com/fission/fission/issues/723
disableKeepAlive: false
## The keep-alive period for an active network connection to function pod.
keepAliveTime: 30s
## HTTP transport request timeout
timeout: 50ms
## The length of request timeout will multiply with timeoutExponent after each retry
timeoutExponent: 2
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Extend the container specs for the core fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
## nodeSelectorTerms:
## - matchExpressions:
## - key: capability
## operator: In
## values:
## - app
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
# Pod resources as:
# resources:
# limits:
# cpu: <tbd>
# memory: <tbd>
# requests:
# cpu: <tbd>
# memory: <tbd>
resources: {}
## Message queue trigger config
### NATS Streaming, enabled by default
nats:
# whether or not to use NATS
enabled: true
# if true, don't install NATS, but
external: false
# Address of NATS server (domain:port)
# change from default for external NATS
hostaddress: "nats-streaming:4222"
# Authorization token to use with NATS
authToken: "defaultFissionAuthToken"
# NATS streaming clusterID
clusterID: "fissionMQTrigger"
# Client name registered with NATS streaming
clientID: "fission"
# Queue group registered with NATS streaming
queueGroup: "fission-messageQueueNatsTrigger"
# The image to use for NATS streaming server
streamingserver:
image: nats-streaming
## Azure-storage-queue: enable and configure the details
azureStorageQueue:
enabled: false
key: ""
accountName: ""
## Kafka: enable and configure the details
kafka:
enabled: false
# note: below link is only for reference.
# Please use the brokers link for your kafka here.
brokers: "broker.kafka:9092" # or your-bootstrap-server.kafka:9092/9093
authentication:
tls:
enabled: false
# InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name.
insecureSkipVerify: false # Warning: Setting this to true, makes TLS susceptible to man-in-the-middle attacks
caCert: "" # path to certificate containing public key of CA authority
userCert: "" # path to certificate containing public key of the user signed by CA authority
userKey: "" # path to private key of the user
# brokers: 'my-broker.kafka:9092' # or my-bootstrap-server.kafka:9092/9093
# Sample config for authentication
# authentication:
# tls:
# enabled: true
# caCert: 'auth/kafka/ca.crt'
# userCert: 'auth/kafka/user.crt'
# userKey: 'auth/kafka/user.key'
## version of Kafka broker
## For 0.x it must be a string in the format
## "major.minor.veryMinor.patch" example: 0.8.2.0
## For 1.x it must be a string in the format
## "major.major.veryMinor" example: 2.0.1
## Should be >= 0.11.2.0 to enable Kafka record headers support
# version: "0.11.2.0"
## Persist data to a persistent volume.
persistence:
## If true, fission will create/use a Persistent Volume Claim unless storageType is set to s3
## If false, use emptyDir
##
enabled: true
## Must be set to either local or S3.
## If storateType is set(other than local), one of its backend configuration must be set as below.
#storageType: local | s3
## Sample configruation for AWS s3 storage backend
#s3:
# bucketName: <awsBucketName>
# subDir: <sub directory within a bucket>
# accessKeyId: <awsAccessKeyId>
# secretAccessKey: <awsSecretAccessKey>
# region: <awsRegion>
## A manually managed Persistent Volume Claim name
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
##
# existingClaim:
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
accessMode: ReadWriteOnce
size: 8Gi
## Extend the container specs for the core fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
## nodeSelectorTerms:
## - matchExpressions:
## - key: capability
## operator: In
## values:
## - app
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
## Analytics let us count how many people installed fission. Set to
## false to disable analytics.
analytics: true
## Internally used for generating an analytics job for non-helm installs
analyticsNonHelmInstall: false
## Google Analytics Tracking ID
gaTrackingID: UA-196546703-1
## Enable Heapster only in clusters where heapster does not exist already
heapster: false
## Enable InfluxDB
influxdb:
enabled: true
image: influxdb:1.7
# Allow user to override busybox image used in fluent-bit init container
busyboxImage: busybox
## Archive pruner is a garbage collector for archives on the fission storage service.
## This interval configures the frequency at which it runs inside the storagesvc pod.
## The value is in minutes.
pruneInterval: 60
## Fission pre-install/pre-upgrade checks live in this image
preUpgradeChecksImage: fission/pre-upgrade-checks
## Fission ppost-install/post-upgrade reporting live in this image
postInstallReportImage: fission/reporter
## 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
debugEnv: 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:
enabled: true
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
#traceSamplingRate: 0.75
## Message Queue Trigger Kind, KEDA: enable and configuration
mqt_keda:
enabled: true
connector_images:
kafka:
image: fission/keda-kafka-http-connector
tag: v0.6
rabbitmq:
image: fission/keda-rabbitmq-http-connector
tag: v0.6
awskinesis:
image: fission/keda-aws-kinesis-http-connector
tag: v0.6
aws_sqs:
image: fission/keda-aws-sqs-http-connector
tag: v0.6
nats_steaming:
image: fission/keda-nats-streaming-http-connector
tag: v0.6
gcp_pub_sub:
image: fission/keda-gcp-pubsub-http-connector
tag: v0.1
+21
View File
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: prometheus
repository: https://prometheus-community.github.io/helm-charts
version: 13.2.1
digest: sha256:136360a97bdc11f1933d75bab77728acc75dd9583257b973cb3336b6d136c9b6
generated: "2021-05-31T21:04:26.076006+05:30"
+21
View File
@@ -0,0 +1,21 @@
apiVersion: v2
name: fission-core
version: 1.13.1
description: Fission is a fast serverless framework for Kubernetes.
keywords:
- fission
- serverless
home: https://fission.io/
maintainers:
- name: Vishal Biyani
email: vishal@infracloud.io
- name: Sanket Sudake
email: sanket@infracloud.io
engine: gotpl
appVersion: 1.13.1
type: application
dependencies:
- name: prometheus
version: 13.2.1
repository: https://prometheus-community.github.io/helm-charts
condition: prometheus.enabled
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
+25
View File
@@ -0,0 +1,25 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-darwin-amd64 && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-linux-amd64 && 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/{{ .Chart.Version }}/fission-{{ .Chart.Version }}-windows-amd64.exe
2. You're ready to use Fission!
# Create an environment
$ fission env create --name nodejs --image fission/node-env
# Get a hello world
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
# Register this function with Fission
$ fission function create --name hello --env nodejs --code hello.js
# Run this function
$ fission function test --name hello
Hello, world!
@@ -0,0 +1,44 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
{{/*
This is a template with config parameters for optional features in fission. This gets mounted on to the controller pod
as a config map.
To add new features with config parameters, create a yaml block below with the feature name and define a corresponding struct in
controller/config.go
*/}}
{{- define "config" -}}
canary:
enabled: {{ .Values.canaryDeployment.enabled }}
{{- if .Values.prometheus.enabled }}
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
{{- else }}
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
{{- end }}
{{- printf "\n" -}}
{{- end -}}
{{/*
This template generates the image name for the deployment depending on the value of "repository" field in values.yaml file.
*/}}
{{- define "fission-bundleImage" -}}
{{- if .Values.repository -}}
{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}
{{- else -}}
{{ .Values.image }}:{{ .Values.imageTag }}
{{- end }}
{{- end -}}
@@ -0,0 +1,533 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.functionNamespace }}
labels:
name: fission-function
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.enableIstio }}
istio-injection: enabled
{{- end }}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.builderNamespace }}
labels:
name: fission-builder
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.enableIstio }}
istio-injection: enabled
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: secret-configmap-getter
rules:
- apiGroups:
- '*'
resources:
- secrets
- configmaps
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: package-getter
rules:
- apiGroups:
- '*'
resources:
- packages
verbs:
- get
- watch
- list
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-svc
namespace: {{ .Release.Namespace }}
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fission-admin
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: fission-svc
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: admin
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fission-crd
subjects:
- kind: ServiceAccount
name: fission-svc
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-fetcher
namespace: {{ .Values.functionNamespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-builder
namespace: {{ .Values.builderNamespace }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: feature-config
namespace: {{ .Release.Namespace }}
data:
"config.yaml": {{ include "config" . | b64enc }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: controller
application: fission-api
spec:
replicas: 1
selector:
matchLabels:
svc: controller
application: fission-api
template:
metadata:
labels:
svc: controller
application: fission-api
spec:
containers:
- name: controller
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
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
value: "{{ .Values.functionNamespace }}"
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
readinessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
volumeMounts:
- name: config-volume
mountPath: /etc/config/config.yaml
subPath: config.yaml
ports:
- containerPort: 8888
name: http
serviceAccountName: fission-svc
volumes:
- name: config-volume
configMap:
name: feature-config
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: executor
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: executor
spec:
replicas: 1
selector:
matchLabels:
svc: executor
template:
metadata:
labels:
svc: executor
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: executor
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- 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: POD_READY_TIMEOUT
value: {{ .Values.executor.podReadyTimeout | default false | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcher.resource.mem.limits | quote }}
readinessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: buildermgr
spec:
replicas: 1
selector:
matchLabels:
svc: buildermgr
template:
metadata:
labels:
svc: buildermgr
spec:
containers:
- name: buildermgr
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: BUILDER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcher.resource.mem.limits | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubewatcher
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: kubewatcher
spec:
replicas: 1
selector:
matchLabels:
svc: kubewatcher
template:
metadata:
labels:
svc: kubewatcher
spec:
containers:
- name: kubewatcher
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
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 }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: timer
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: timer
spec:
replicas: 1
selector:
matchLabels:
svc: timer
template:
metadata:
labels:
svc: timer
spec:
containers:
- name: timer
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
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 }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: storagesvc
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: storagesvc
application: fission-storage
spec:
replicas: 1
selector:
matchLabels:
svc: storagesvc
application: fission-storage
template:
metadata:
labels:
svc: storagesvc
application: fission-storage
spec:
containers:
- name: storagesvc
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
{{- if and (.Values.persistence.enabled) (eq (.Values.persistence.storageType | default "local") "s3") }}
args: ["--storageServicePort", "8000", "--storageType", "s3"]
{{- else }}
args: ["--storageServicePort", "8000", "--storageType", "local"]
{{- end }}
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 }}
{{- if and (.Values.persistence.enabled) (eq (.Values.persistence.storageType | default "local") "s3") }}
- name: STORAGE_S3_ENDPOINT
value: {{ .Values.persistence.s3.endPoint }}
- name: STORAGE_S3_BUCKET_NAME
value: {{ .Values.persistence.s3.bucketName }}
- name: STORAGE_S3_SUB_DIR
value: {{ .Values.persistence.s3.subDir }}
- name: STORAGE_S3_ACCESS_KEY_ID
value: {{ .Values.persistence.s3.accessKeyId }}
- name: STORAGE_S3_SECRET_ACCESS_KEY
value: {{ .Values.persistence.s3.secretAccessKey }}
- name: STORAGE_S3_REGION
value: {{ .Values.persistence.s3.region }}
{{- end }}
{{- if ne (.Values.persistence.storageType | default "local") "s3" }}
volumeMounts:
- name: fission-storage
mountPath: /fission
{{- end }}
ports:
- containerPort: 8000
name: http
serviceAccountName: fission-svc
{{- if and (.Values.persistence.enabled) (ne (.Values.persistence.storageType | default "local") "s3") }}
volumes:
- name: fission-storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default "fission-storage-pvc" }}
{{- else }}
volumes:
- name: fission-storage
emptyDir: {}
{{- end }}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- if .Values.mqt_keda.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtrigger-keda
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: mqtrigger-keda
messagequeue: keda
spec:
replicas: 1
selector:
matchLabels:
svc: mqtrigger-keda
messagequeue: keda
template:
metadata:
labels:
svc: mqtrigger-keda
messagequeue: keda
spec:
containers:
- name: mqtrigger-keda
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt_keda", "--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 }}
- name: CONNECTOR_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: KAFKA_IMAGE
value: "{{ .Values.mqt_keda.connector_images.kafka.image }}:{{ .Values.mqt_keda.connector_images.kafka.tag }}"
- name: RABBITMQ_IMAGE
value: "{{ .Values.mqt_keda.connector_images.rabbitmq.image }}:{{ .Values.mqt_keda.connector_images.rabbitmq.tag }}"
- name: AWS-KINESIS-STREAM_IMAGE
value: "{{ .Values.mqt_keda.connector_images.awskinesis.image }}:{{ .Values.mqt_keda.connector_images.awskinesis.tag }}"
- name: AWS-SQS-QUEUE_IMAGE
value: "{{ .Values.mqt_keda.connector_images.aws_sqs.image }}:{{ .Values.mqt_keda.connector_images.aws_sqs.tag }}"
- name: STAN_IMAGE
value: "{{ .Values.mqt_keda.connector_images.nats_steaming.image }}:{{ .Values.mqt_keda.connector_images.nats_steaming.tag }}"
- name: GCP-PUB-SUB_IMAGE
value: "{{ .Values.mqt_keda.connector_images.gcp_pub_sub.image }}:{{ .Values.mqt_keda.connector_images.gcp_pub_sub.tag }}"
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: {{ .Values.functionNamespace }}
name: event-fetcher
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["get", "watch", "list"]
- apiGroups: [""] # "" indicates the core API group
resources: ["events"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: fission-fetcher-pod-reader
namespace: {{ .Values.functionNamespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: event-fetcher
subjects:
- kind: ServiceAccount
name: fission-fetcher
namespace: {{ .Values.functionNamespace }}
@@ -0,0 +1,41 @@
{{- if .Values.analyticsNonHelmInstall }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}-{{ randNumeric 3 }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
spec:
#ttlSecondsAfterFinished: 120
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-install-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "yaml-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,45 @@
{{- if .Values.analytics }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-install-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "helm-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,45 @@
{{- if .Values.analytics }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "name" . }}
annotations:
{{- if .Values.enableIstio }}
"sidecar.istio.io/inject": "false"
{{- end }}
spec:
restartPolicy: Never
containers:
- name: post-upgrade-job
{{- if .Values.imageTag }}
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
{{- else }}
image: {{ .Values.postInstallReportImage }}
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/reporter" ]
args: ["event", "-c", "fission-use", "-a", "helm-post-upgrade", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
env:
- name: GA_TRACKING_ID
value: "{{ .Values.gaTrackingID }}"
serviceAccountName: fission-svc
{{- end }}
@@ -0,0 +1,33 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "fullname" . }}-{{ .Chart.Version }}-{{ randNumeric 3 }}
labels:
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: "{{ .Release.Name }}"
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
spec:
backoffLimit: 0
template:
metadata:
name: {{ template "fullname" . }}
labels:
release: "{{ .Release.Name }}"
app: {{ template "name" . }}
spec:
restartPolicy: Never
containers:
- name: pre-upgrade-job
image: {{ .Values.preUpgradeChecksImage }}:{{ .Values.imageTag }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/pre-upgrade-checks" ]
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
serviceAccountName: fission-svc
+23
View File
@@ -0,0 +1,23 @@
{{- if and (.Values.persistence.enabled) (not .Values.persistence.existingClaim) (eq (.Values.persistence.storageType | default "local") "local") }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: fission-storage-pvc
labels:
app: fission-storage
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}
{{- end }}
+95
View File
@@ -0,0 +1,95 @@
apiVersion: apps/v1
{{- if not .Values.router.deployAsDaemonSet }}
kind: Deployment
{{- else }}
kind: DaemonSet
{{- end }}
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: router
application: fission-router
spec:
{{- if not .Values.router.deployAsDaemonSet }}
replicas: 1
{{- end }}
selector:
matchLabels:
application: fission-router
svc: router
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.router.roundTrip.timeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.router.roundTrip.timeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.router.roundTrip.keepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_DISABLE_KEEP_ALIVE
value: {{ .Values.router.roundTrip.disableKeepAlive | default true | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.router.roundTrip.maxRetries | default 10 | quote }}
- name: ROUTER_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: ROUTER_UNTAP_SERVICE_TIMEOUT
value: {{ .Values.router.unTapServiceTimeout | default "3600s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
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 }}
resources:
{{- toYaml .Values.router.resources | indent 10 }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.router.extraCoreComponentPodConfig }}
{{ toYaml .Values.router.extraCoreComponentPodConfig | indent 6 -}}
{{- else }}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
+75
View File
@@ -0,0 +1,75 @@
apiVersion: v1
kind: Service
metadata:
name: router
labels:
svc: router
application: fission-router
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.router.svcAnnotations }}
annotations:
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.routerServiceType }}
ports:
- port: 80
targetPort: 8888
{{- if eq .Values.routerServiceType "NodePort" }}
nodePort: {{ .Values.routerPort }}
{{- end }}
selector:
svc: router
---
apiVersion: v1
kind: Service
metadata:
name: controller
labels:
svc: controller
application: fission-api
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: {{ .Values.serviceType }}
ports:
- port: 80
targetPort: 8888
{{- if eq .Values.serviceType "NodePort" }}
nodePort: {{ .Values.controllerPort }}
{{- end }}
selector:
svc: controller
---
apiVersion: v1
kind: Service
metadata:
name: storagesvc
labels:
svc: storagesvc
application: fission-storage
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8000
selector:
svc: storagesvc
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
svc: executor
+257
View File
@@ -0,0 +1,257 @@
#
# Fission chart configuration
#
## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
serviceType: ClusterIP
## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
routerServiceType: LoadBalancer
## Image base repository
## Leave it empty for using existing local image
repository: index.docker.io
## Fission image repository
image: fission/fission-bundle
## Fission image version
imageTag: 1.13.1
## Image pull policy
pullPolicy: IfNotPresent
## Port at which Fission controller service should be exposed
controllerPort: 31313
## Port at which Fission router service should be exposed
routerPort: 31314
## Namespace in which to run fission functions (this is different from
## the release namespace)
functionNamespace: fission-function
## Namespace in which to run fission builders (this is different from
## the release namespace)
builderNamespace: fission-builder
## Enable istio integration
enableIstio: false
fetcher:
## Fetcher repository
image: fission/fetcher
## Fetcher image version
imageTag: 1.13.1
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
resource:
cpu:
requests: "10m"
## Low CPU limits will increases the function specialization time.
limits: ""
mem:
requests: "16Mi"
limits: ""
executor:
adoptExistingResources: false
podReadyTimeout: 300s
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
unTapServiceTimeout: 3600s
## 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
## For router to match encoded path.
## If true, "/foo%2Fbar" will match the path "/{var}";
## Otherwise, it will match the path "/foo/bar".
useEncodedPath: false
roundTrip:
## If true, router will disable the HTTP keep-alive which result in performance degradation.
## But it ensures that router can redirect new coming requests to new function pods.
##
## If false, router will enable transport keep-alive feature for better performance.
## However, the drawback is it takes longer to switch to newly created function pods
## if using newdeploy as executor type for function. If you want to preserve the
## performance while keeping the short switching time to new function, you can create
## an environment with short grace period by setting flag "--graceperiod" (default 360s),
## so that kubernetes will be able to reap old function pod quickly.
##
## For details, see https://github.com/fission/fission/issues/723
disableKeepAlive: true
## The keep-alive period for an active network connection to function pod.
keepAliveTime: 30s
## HTTP transport request timeout
timeout: 50ms
## The length of request timeout will multiply with timeoutExponent after each retry
timeoutExponent: 2
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Extend the container specs for the router fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
## nodeSelectorTerms:
## - matchExpressions:
## - key: capability
## operator: In
## values:
## - app
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
# Pod resources as:
# resources:
# limits:
# cpu: <tbd>
# memory: <tbd>
# requests:
# cpu: <tbd>
# memory: <tbd>
resources: {}
## Persist data to a persistent volume.
persistence:
## If true, fission will create/use a Persistent Volume Claim unless storageType is set to s3
## If false, use emptyDir
##
enabled: true
## Must be set to either local or S3.
## If storateType is set(other than local), one of its backend configuration must be set as below.
#storageType: local | s3
## Sample configruation for AWS s3 storage backend
#s3:
# bucketName: <awsBucketName>
# subDir: <sub directory within a bucket>
# accessKeyId: <awsAccessKeyId>
# secretAccessKey: <awsSecretAccessKey>
# region: <awsRegion>
## A manually managed Persistent Volume Claim name
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
##
# existingClaim:
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
accessMode: ReadWriteOnce
size: 8Gi
## Extend the container specs for the core fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
## nodeSelectorTerms:
## - matchExpressions:
## - key: capability
## operator: In
## values:
## - app
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
## Analytics let us count how many people installed fission. Set to
## false to disable analytics.
analytics: true
## Internally used for generating an analytics job for non-helm installs
analyticsNonHelmInstall: false
## Google Analytics Tracking ID
gaTrackingID: UA-196546703-1
## Archive pruner is a garbage collector for archives on the fission storage service.
## This interval configures the frequency at which it runs inside the storagesvc pod.
## The value is in minutes.
pruneInterval: 60
## Fission pre-install/pre-upgrade checks live in this image
preUpgradeChecksImage: fission/pre-upgrade-checks
## Fission ppost-install/post-upgrade reporting live in this image
postInstallReportImage: fission/reporter
## 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
debugEnv: false
## Prometheus for scrapping service metrics
prometheus:
## set this flag to true if prometheus needs to be deployed along with fission
enabled: false
## 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:
enabled: false
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
#traceSamplingRate: 0.75
## Message Queue Trigger Kind, KEDA: enable and configuration
mqt_keda:
enabled: true
connector_images:
kafka:
image: fission/keda-kafka-http-connector
tag: v0.6
rabbitmq:
image: fission/keda-rabbitmq-http-connector
tag: v0.6
awskinesis:
image: fission/keda-aws-kinesis-http-connector
tag: v0.6
aws_sqs:
image: fission/keda-aws-sqs-http-connector
tag: v0.6
nats_steaming:
image: fission/keda-nats-streaming-http-connector
tag: v0.6
gcp_pub_sub:
image: fission/keda-gcp-pubsub-http-connector
tag: v0.1
+45
View File
@@ -0,0 +1,45 @@
FROM golang:1.15-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
FROM godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/builder
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
RUN CGO_ENABLED=0 go build \
-o /go/bin/builder \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.13 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/builder /
EXPOSE 8001
ENTRYPOINT ["/builder"]
+37
View File
@@ -0,0 +1,37 @@
/*
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 app
import (
"net/http"
"go.uber.org/zap"
builder "github.com/fission/fission/pkg/builder"
)
// Usage: builder <shared volume path>
func Run(logger *zap.Logger, shareVolume string) error {
builder := builder.MakeBuilder(logger, shareVolume)
mux := http.NewServeMux()
mux.HandleFunc("/", builder.Handler)
mux.HandleFunc("/version", builder.VersionHandler)
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
return http.ListenAndServe(":8001", mux)
}
+51
View File
@@ -0,0 +1,51 @@
/*
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 main
import (
"log"
"os"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/cmd/builder/app"
)
// Usage: builder <shared volume path>
func main() {
config := zap.NewProductionConfig()
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
defer logger.Sync()
shareVolume := os.Args[1]
if _, err := os.Stat(shareVolume); err != nil {
if os.IsNotExist(err) {
err = os.MkdirAll(shareVolume, os.ModeDir|0700)
if err != nil {
logger.Fatal("error creating directory: %v", zap.Error(err), zap.String("directory", shareVolume))
}
}
}
err = app.Run(logger, shareVolume)
logger.Error("error running builder", zap.Error(err))
}
+45
View File
@@ -0,0 +1,45 @@
FROM golang:1.15-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
FROM godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/fetcher
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
RUN CGO_ENABLED=0 go build \
-o /go/bin/fetcher \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.13 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/fetcher /
EXPOSE 8000
ENTRYPOINT ["/fetcher"]
+150
View File
@@ -0,0 +1,150 @@
/*
Copyright 2019 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 app
import (
"context"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"os"
"contrib.go.opencensus.io/exporter/jaeger"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/trace"
"go.uber.org/zap"
"github.com/fission/fission/pkg/fetcher"
)
func registerTraceExporter(collectorEndpoint string) error {
if collectorEndpoint == "" {
return nil
}
serviceName := "Fission-Fetcher"
exporter, err := jaeger.NewExporter(jaeger.Options{
CollectorEndpoint: collectorEndpoint,
Process: jaeger.Process{
ServiceName: serviceName,
Tags: []jaeger.Tag{
jaeger.BoolTag("fission", true),
},
},
})
if err != nil {
return err
}
trace.RegisterExporter(exporter)
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
return nil
}
func Run(logger *zap.Logger) {
flag.Usage = fetcherUsage
collectorEndpoint := flag.String("jaeger-collector-endpoint", "", "")
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup")
specializePayload := flag.String("specialize-request", "", "JSON payload for specialize request")
secretDir := flag.String("secret-dir", "", "Path to shared secrets directory")
configDir := flag.String("cfgmap-dir", "", "Path to shared configmap directory")
flag.Parse()
if flag.NArg() == 0 {
flag.Usage()
os.Exit(1)
}
dir := flag.Arg(0)
if _, err := os.Stat(dir); err != nil {
if os.IsNotExist(err) {
err = os.MkdirAll(dir, os.ModeDir|0700)
if err != nil {
logger.Fatal("error creating directory", zap.Error(err), zap.String("directory", dir))
}
}
}
if err := registerTraceExporter(*collectorEndpoint); err != nil {
logger.Fatal("could not register trace exporter", zap.Error(err), zap.String("collector_endpoint", *collectorEndpoint))
}
f, err := fetcher.MakeFetcher(logger, dir, *secretDir, *configDir)
if err != nil {
logger.Fatal("error making fetcher", zap.Error(err))
}
readyToServe := false
// do specialization in other goroutine to prevent blocking in newdeploy
go func() {
if *specializeOnStart {
var specializeReq fetcher.FunctionSpecializeRequest
err := json.Unmarshal([]byte(*specializePayload), &specializeReq)
if err != nil {
logger.Fatal("error decoding specialize request", zap.Error(err))
}
ctx := context.Background()
err = f.SpecializePod(ctx, specializeReq.FetchReq, specializeReq.LoadReq)
if err != nil {
logger.Fatal("error specializing function pod", zap.Error(err))
}
readyToServe = true
}
}()
mux := http.NewServeMux()
mux.HandleFunc("/fetch", f.FetchHandler)
mux.HandleFunc("/specialize", f.SpecializeHandler)
mux.HandleFunc("/upload", f.UploadHandler)
mux.HandleFunc("/version", f.VersionHandler)
mux.HandleFunc("/wsevent/start", f.WsStartHandler)
mux.HandleFunc("/wsevent/end", f.WsEndHandler)
readinessHandler := func(w http.ResponseWriter, r *http.Request) {
if !*specializeOnStart || readyToServe {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusServiceUnavailable)
}
}
mux.HandleFunc("/readiness-healthz", readinessHandler)
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
// For backward compatibility
// TODO: remove this path in future
mux.HandleFunc("/readniess-healthz", readinessHandler)
logger.Info("fetcher ready to receive requests")
err = http.ListenAndServe(":8000", &ochttp.Handler{
Handler: mux,
})
if err != nil {
log.Fatal(err)
}
}
func fetcherUsage() {
fmt.Println("Usage: fetcher [-specialize-on-startup] [-specialize-request <json>] [-secret-dir <string>] [-cfgmap-dir <string>] <shared volume path>")
}
+38
View File
@@ -0,0 +1,38 @@
/*
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 main
import (
"log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/cmd/fetcher/app"
)
// Usage: fetcher <shared volume path>
func main() {
config := zap.NewProductionConfig()
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
defer logger.Sync()
app.Run(logger)
}
@@ -0,0 +1,44 @@
FROM golang:1.15-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
FROM godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/fission-bundle
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
RUN CGO_ENABLED=0 go build \
-o /go/bin/fission-bundle \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.13 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/fission-bundle /
ENTRYPOINT ["/fission-bundle"]
+330
View File
@@ -0,0 +1,330 @@
/*
Copyright 2019 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 main
import (
"flag"
"fmt"
"log"
"os"
"strconv"
"contrib.go.opencensus.io/exporter/jaeger"
docopt "github.com/docopt/docopt-go"
"go.opencensus.io/trace"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/cmd/fission-bundle/mqtrigger"
"github.com/fission/fission/pkg/buildermgr"
"github.com/fission/fission/pkg/controller"
"github.com/fission/fission/pkg/executor"
"github.com/fission/fission/pkg/info"
"github.com/fission/fission/pkg/kubewatcher"
functionLogger "github.com/fission/fission/pkg/logger"
mqt "github.com/fission/fission/pkg/mqtrigger"
"github.com/fission/fission/pkg/router"
"github.com/fission/fission/pkg/storagesvc"
"github.com/fission/fission/pkg/timer"
)
func runController(logger *zap.Logger, port int) {
controller.Start(logger, port, false)
logger.Fatal("controller exited")
}
func runRouter(logger *zap.Logger, port int, executorUrl string) {
router.Start(logger, port, executorUrl)
logger.Fatal("router exited")
}
func runExecutor(logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string) {
err := executor.StartExecutor(logger, functionNamespace, envBuilderNamespace, port)
if err != nil {
logger.Fatal("error starting executor", zap.Error(err))
}
}
func runKubeWatcher(logger *zap.Logger, routerUrl string) {
err := kubewatcher.Start(logger, routerUrl)
if err != nil {
logger.Fatal("error starting kubewatcher", zap.Error(err))
}
}
func runTimer(logger *zap.Logger, routerUrl string) {
err := timer.Start(logger, routerUrl)
if err != nil {
logger.Fatal("error starting timer", zap.Error(err))
}
}
func runMessageQueueMgr(logger *zap.Logger, routerUrl string) {
err := mqtrigger.Start(logger, routerUrl)
if err != nil {
logger.Fatal("error starting message queue manager", zap.Error(err))
}
}
// KEDA based MessageQueue Trigger Manager
func runMQManager(logger *zap.Logger, routerURL string) {
err := mqt.StartScalerManager(logger, routerURL)
if err != nil {
logger.Fatal("error starting mqt scaler manager", zap.Error(err))
}
}
func runStorageSvc(logger *zap.Logger, port int, storage storagesvc.Storage) {
err := storagesvc.Start(logger, storage, port)
if err != nil {
logger.Fatal("error starting storage service", zap.Error(err))
}
}
func runBuilderMgr(logger *zap.Logger, storageSvcUrl string, envBuilderNamespace string) {
err := buildermgr.Start(logger, storageSvcUrl, envBuilderNamespace)
if err != nil {
logger.Fatal("error starting builder manager", zap.Error(err))
}
}
func runLogger() {
functionLogger.Start()
log.Fatalf("Error: Logger exited.")
}
func getPort(logger *zap.Logger, portArg interface{}) int {
portArgStr := portArg.(string)
port, err := strconv.Atoi(portArgStr)
if err != nil {
logger.Fatal("invalid port number", zap.Error(err), zap.String("port", portArgStr))
}
return port
}
func getStringArgWithDefault(arg interface{}, defaultValue string) string {
if arg != nil {
return arg.(string)
} else {
return defaultValue
}
}
func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{}) error {
collectorEndpoint := os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT")
if len(collectorEndpoint) == 0 {
logger.Info("skipping trace exporter registration")
return nil
}
serviceName := "Fission-Unknown"
if arguments["--controllerPort"] != nil {
serviceName = "Fission-Controller"
} else if arguments["--routerPort"] != nil {
serviceName = "Fission-Router"
} else if arguments["--executorPort"] != nil {
serviceName = "Fission-Executor"
} else if arguments["--kubewatcher"] == true {
serviceName = "Fission-KubeWatcher"
} else if arguments["--timer"] == true {
serviceName = "Fission-Timer"
} else if arguments["--mqt"] == true {
serviceName = "Fission-MessageQueueTrigger"
} else if arguments["--builderMgr"] == true {
serviceName = "Fission-BuilderMgr"
} else if arguments["--storageServicePort"] != nil {
serviceName = "Fission-StorageSvc"
} else if arguments["--mqt_keda"] == true {
serviceName = "Fission-Keda-MQTrigger"
}
exporter, err := jaeger.NewExporter(jaeger.Options{
CollectorEndpoint: collectorEndpoint,
Process: jaeger.Process{
ServiceName: serviceName,
Tags: []jaeger.Tag{
jaeger.BoolTag("fission", true),
},
},
})
if err != nil {
return err
}
samplingRate, err := strconv.ParseFloat(os.Getenv("TRACING_SAMPLING_RATE"), 32)
if err != nil {
return err
}
trace.RegisterExporter(exporter)
trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(samplingRate)})
return nil
}
func main() {
var err error
// From https://github.com/containous/traefik/pull/1817/files
// Tell glog to log into STDERR. Otherwise, we risk
// certain kinds of API errors getting logged into a directory not
// available in a `FROM scratch` Docker container, causing glog to abort
// hard with an exit code > 0.
// TODO: fix the lint error. Error checking here is causing all components to crash with error "logtostderr not found"
flag.Set("logtostderr", "true") //nolint: errcheck
usage := `fission-bundle: Package of all fission microservices: controller, router, executor.
Use it to start one or more of the fission servers:
Controller is a stateless API frontend for fission resources.
Pool manager maintains a pool of generalized function containers, and
specializes them on-demand. Executor must be run from a pod in a
Kubernetes cluster.
Router implements HTTP triggers: it routes to running instances,
working with the controller and executor.
Kubewatcher implements Kubernetes Watch triggers: it watches
Kubernetes resources and invokes functions described in the
KubernetesWatchTrigger.
The storage service implements storage for functions too large to fit
in the Kubernetes API resource object. It supports various storage
backends.
Usage:
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> --storageType=<storateType>
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
fission-bundle --timer [--routerUrl=<url>]
fission-bundle --mqt [--routerUrl=<url>]
fission-bundle --mqt_keda [--routerUrl=<url>]
fission-bundle --logger
fission-bundle --version
Options:
--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.
--storageServicePort=<port> Port that the storage service should listen on.
--executorUrl=<url> Executor URL. Not required if --executorPort is specified.
--routerUrl=<url> Router URL.
--etcdUrl=<etcdUrl> Etcd URL.
--storageSvcUrl=<url> StorageService URL.
--filePath=<filePath> Directory to store functions in.
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
--kubewatcher Start Kubernetes events watcher.
--timer Start Timer.
--mqt Start message queue trigger.
--mqt_keda Start message queue trigger of kind KEDA
--builderMgr Start builder manager.
--version Print version information
`
var logger *zap.Logger
var config zap.Config
isDebugEnv, _ := strconv.ParseBool(os.Getenv("DEBUG_ENV"))
if isDebugEnv {
config = zap.NewDevelopmentConfig()
config.DisableStacktrace = true
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
} else {
config = zap.NewProductionConfig()
config.DisableStacktrace = true
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
}
logger, err = config.Build()
if err != nil {
log.Fatalf("I can't initialize zap logger: %v", err)
}
defer logger.Sync()
version := fmt.Sprintf("Fission Bundle Version: %v", info.BuildInfo().String())
arguments, err := docopt.ParseArgs(usage, nil, version)
if err != nil {
logger.Fatal("Could not parse command line arguments", zap.Error(err))
}
err = registerTraceExporter(logger, arguments)
if err != nil {
logger.Fatal("Could not register trace exporter", zap.Error(err), zap.Any("argument", arguments))
}
functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function")
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
if arguments["--controllerPort"] != nil {
port := getPort(logger, arguments["--controllerPort"])
runController(logger, port)
}
if arguments["--routerPort"] != nil {
port := getPort(logger, arguments["--routerPort"])
runRouter(logger, port, executorUrl)
}
if arguments["--executorPort"] != nil {
port := getPort(logger, arguments["--executorPort"])
runExecutor(logger, port, functionNs, envBuilderNs)
}
if arguments["--kubewatcher"] == true {
runKubeWatcher(logger, routerUrl)
}
if arguments["--timer"] == true {
runTimer(logger, routerUrl)
}
if arguments["--mqt"] == true {
runMessageQueueMgr(logger, routerUrl)
}
if arguments["--mqt_keda"] == true {
runMQManager(logger, routerUrl)
}
if arguments["--builderMgr"] == true {
runBuilderMgr(logger, storageSvcUrl, envBuilderNs)
}
if arguments["--logger"] == true {
runLogger()
}
if arguments["--storageServicePort"] != nil {
port := getPort(logger, arguments["--storageServicePort"])
var storage storagesvc.Storage
if arguments["--storageType"] != nil && arguments["--storageType"] == string(storagesvc.StorageTypeS3) {
storage = storagesvc.NewS3Storage()
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
storage = storagesvc.NewLocalStorage("/fission")
}
runStorageSvc(logger, port, storage)
}
select {}
}
+115
View File
@@ -0,0 +1,115 @@
/*
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 mqtrigger
import (
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"github.com/pkg/errors"
"go.uber.org/zap"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/mqtrigger"
"github.com/fission/fission/pkg/mqtrigger/factory"
"github.com/fission/fission/pkg/mqtrigger/messageQueue"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/azurequeuestorage"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/kafka"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/nats"
)
func Start(logger *zap.Logger, routerUrl string) error {
fissionClient, _, _, _, err := crd.MakeFissionClient()
if err != nil {
return errors.Wrap(err, "failed to get fission or kubernetes client")
}
err = fissionClient.WaitForCRDs()
if err != nil {
return errors.Wrap(err, "error waiting for CRDs")
}
mqType := (fv1.MessageQueueType)(os.Getenv("MESSAGE_QUEUE_TYPE"))
mqUrl := os.Getenv("MESSAGE_QUEUE_URL")
secretsPath := strings.TrimSpace(os.Getenv("MESSAGE_QUEUE_SECRETS"))
var secrets map[string][]byte
if len(secretsPath) > 0 {
// For authentication with message queue
secrets, err = readSecrets(logger, secretsPath)
if err != nil {
return err
}
}
mq, err := factory.Create(
logger,
mqType,
messageQueue.Config{
MQType: (string)(mqType),
Url: mqUrl,
Secrets: secrets,
},
routerUrl,
)
if err != nil {
logger.Fatal("failed to connect to remote message queue server", zap.Error(err))
}
mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, mq).Run()
return nil
}
func readSecrets(logger *zap.Logger, secretsPath string) (map[string][]byte, error) {
// return if no secrets exist
if _, err := os.Stat(secretsPath); os.IsNotExist(err) {
return nil, err
}
secretFiles, err := ioutil.ReadDir(secretsPath)
if err != nil {
return nil, err
}
secrets := make(map[string][]byte)
for _, secretFile := range secretFiles {
fileName := secretFile.Name()
// /etc/secrets contain some hidden directories (like .data)
// ignore them
if !secretFile.IsDir() && !strings.HasPrefix(fileName, ".") {
logger.Info(fmt.Sprintf("Reading secret from %s", fileName))
filePath := path.Join(secretsPath, fileName)
secret, fileReadErr := ioutil.ReadFile(filePath)
if fileReadErr != nil {
return nil, fileReadErr
}
secrets[fileName] = secret
}
}
return secrets, nil
}
+92
View File
@@ -0,0 +1,92 @@
package app
import (
"github.com/spf13/cobra"
"github.com/fission/fission/pkg/controller/client"
"github.com/fission/fission/pkg/controller/client/rest"
"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"
"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"
"github.com/fission/fission/pkg/fission-cli/util"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/azurequeuestorage"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/kafka"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/nats"
)
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)
if input.IsSet(flagkey.ClientOnly) {
// TODO: use fake rest client for offline spec generation
cmd.SetClientset(client.MakeFakeClientset(nil))
} else {
serverUrl, err := util.GetServerURL(input)
if err != nil {
return err
}
restClient := rest.NewRESTClient(serverUrl)
cmd.SetClientset(client.MakeClientset(restClient))
}
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, flag.KubeContext},
})
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, flagkey.KubeContext)
return rootCmd
}
+36
View File
@@ -0,0 +1,36 @@
/*
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 main
import (
"os"
"github.com/fission/fission/cmd/fission-cli/app"
"github.com/fission/fission/pkg/fission-cli/console"
)
func main() {
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)
}
}
@@ -0,0 +1,45 @@
FROM golang:1.15-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
FROM godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/preupgradechecks
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
RUN CGO_ENABLED=0 go build \
-o /go/bin/pre-upgrade-checks \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.13 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/pre-upgrade-checks /
ENTRYPOINT ["/pre-upgrade-checks"]
EXPOSE 8001
+79
View File
@@ -0,0 +1,79 @@
/*
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 main
import (
"log"
"github.com/docopt/docopt-go"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/fission/fission/pkg/info"
)
func getStringArgWithDefault(arg interface{}, defaultValue string) string {
if arg != nil {
return arg.(string)
} else {
return defaultValue
}
}
func main() {
config := zap.NewProductionConfig()
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
defer logger.Sync()
usage := `Package to perform operations needed prior to fission installation
Usage:
pre-upgrade-checks --fn-pod-namespace=<podNamespace> --envbuilder-namespace=<envBuilderNamespace>
Options:
--fn-pod-namespace=<podNamespace> Namespace where function pods get deployed.
--envbuilder-namespace=<envBuilderNamespace> Namespace where builder env pods are deployed.`
arguments, err := docopt.ParseArgs(usage, nil, info.BuildInfo().String())
if err != nil {
logger.Fatal("Could not parse command line arguments", zap.Error(err))
}
functionPodNs := getStringArgWithDefault(arguments["--fn-pod-namespace"], "fission-function")
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
crdBackedClient, err := makePreUpgradeTaskClient(logger, functionPodNs, envBuilderNs)
if err != nil {
logger.Fatal("error creating a crd client, please retry helm upgrade",
zap.Error(err))
}
crd := crdBackedClient.GetFunctionCRD()
if crd == nil {
logger.Info("nothing to do since CRDs are not present on the cluster")
return
}
err = crdBackedClient.LatestSchemaApplied()
if err != nil {
logger.Fatal("New CRDs are not applied")
}
crdBackedClient.VerifyFunctionSpecReferences()
}
+169
View File
@@ -0,0 +1,169 @@
/*
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 main
import (
"context"
"fmt"
"strings"
multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"go.uber.org/zap"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd"
)
type (
PreUpgradeTaskClient struct {
logger *zap.Logger
fissionClient *crd.FissionClient
k8sClient *kubernetes.Clientset
apiExtClient *apiextensionsclient.Clientset
fnPodNs string
envBuilderNs string
}
)
const (
maxRetries = 5
FunctionCRD = "functions.fission.io"
MqtCRD = "messagequeuetriggers.fission.io"
)
func makePreUpgradeTaskClient(logger *zap.Logger, fnPodNs, envBuilderNs string) (*PreUpgradeTaskClient, error) {
fissionClient, k8sClient, apiExtClient, _, err := crd.MakeFissionClient()
if err != nil {
return nil, errors.Wrap(err, "error making fission client")
}
return &PreUpgradeTaskClient{
logger: logger.Named("pre_upgrade_task_client"),
fissionClient: fissionClient,
k8sClient: k8sClient,
fnPodNs: fnPodNs,
envBuilderNs: envBuilderNs,
apiExtClient: apiExtClient,
}, nil
}
// GetFunctionCRD checks if function CRD is present on the cluster and returns it. It returns nil if not found
// We can use this to find out if fission had been previously installed on this cluster too.
func (client *PreUpgradeTaskClient) GetFunctionCRD() *v1.CustomResourceDefinition {
for i := 0; i < maxRetries; i++ {
crd, err := client.apiExtClient.ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), FunctionCRD, metav1.GetOptions{})
if err != nil && k8serrors.IsNotFound(err) {
continue
}
return crd
}
return nil
}
// GetMqtCRD checks if MQT CRD is present on the cluster and returns it. It returns nil if not found
func (client *PreUpgradeTaskClient) GetMqtCRD() *v1.CustomResourceDefinition {
crd, err := client.apiExtClient.ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), MqtCRD, metav1.GetOptions{})
if err != nil {
client.logger.Error("Could not find MQT CRD", zap.Error(err))
return nil
}
return crd
}
// LatestSchemaApplied ensures that the end user has applied the latest CRDs generated to the cluster.
// For future reference: whenever a new field is added, we need to check for that field's existence in this function
func (client *PreUpgradeTaskClient) LatestSchemaApplied() error {
client.logger.Info("Checking if user has applied the latest CRDs")
funcCRD := client.GetFunctionCRD()
if funcCRD == nil {
return errors.New("Could not get the Function CRD")
}
// Any new field added in Function spec can be checked here provided the substring matches the description in CRD Validation of the field
if !strings.Contains(funcCRD.Spec.String(), "RequestsPerPod") || !strings.Contains(funcCRD.Spec.String(), "OnceOnly") {
return errors.New("Apply the newer CRDs before upgrading")
}
mqtCRD := client.GetMqtCRD()
if mqtCRD == nil {
return errors.New("Could not get the MQT CRD")
}
// Any new field added in MQT spec can be checked here provided the substring matches the description in CRD Validation of the field
if !strings.Contains(mqtCRD.Spec.String(), "PodSpec") {
return errors.New("Apply the newer CRDs before upgrading")
}
return nil
}
// VerifyFunctionSpecReferences verifies that a function references secrets, configmaps, pkgs in its own namespace and
// outputs a list of functions that don't adhere to this requirement.
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
client.logger.Info("verifying function spec references for all functions in the cluster")
var err error
var fList *fv1.FunctionList
for i := 0; i < maxRetries; i++ {
fList, err = client.fissionClient.CoreV1().Functions(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
if err == nil {
break
}
}
if err != nil {
client.logger.Fatal("error listing functions after max retries",
zap.Error(err),
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.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, secret.Name, secret.Namespace))
}
}
configmaps := fn.Spec.ConfigMaps
for _, configmap := range configmaps {
if configmap.Namespace != fn.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, configmap.Name, configmap.Namespace))
}
}
if fn.Spec.Package.PackageRef.Namespace != fn.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
}
}
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"))
}
client.logger.Info("function spec references verified")
}
+43
View File
@@ -0,0 +1,43 @@
FROM golang:1.15-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
FROM godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/reporter
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
ARG BUILDVERSION=unknown
# E.g. BUILDVERSION=$(git rev-parse HEAD)
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
RUN CGO_ENABLED=0 go build \
-o /go/bin/reporter \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.13 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/reporter /
ENTRYPOINT ["/reporter"]
+33
View File
@@ -0,0 +1,33 @@
/*
Copyright 2021 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 app
import (
"github.com/spf13/cobra"
)
func App() *cobra.Command {
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
Use: "reporter",
Short: "Report fission events to analytics service",
ValidArgs: []string{"event"},
Args: cobra.OnlyValidArgs,
}
rootCmd.AddCommand(EventCommand())
return rootCmd
}
+76
View File
@@ -0,0 +1,76 @@
/*
Copyright 2021 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 app
import (
"log"
"github.com/fission/fission/pkg/tracker"
"github.com/spf13/cobra"
)
func eventCommandHandler(cmd *cobra.Command, args []string) error {
var err error
flags := cmd.PersistentFlags()
event := tracker.Event{}
event.Category, err = flags.GetString("category")
if err != nil {
return err
}
event.Action, err = flags.GetString("action")
if err != nil {
return err
}
event.Label, err = flags.GetString("label")
if err != nil {
return err
}
event.Value, err = flags.GetString("value")
if err != nil {
return err
}
return tracker.Tracker.SendEvent(event)
}
//EventCommand reports an event to analytics
func EventCommand() *cobra.Command {
eventCmd := &cobra.Command{
Use: "event",
Short: "Report event to analytics",
RunE: eventCommandHandler,
Args: cobra.NoArgs,
}
persistentFlags := eventCmd.PersistentFlags()
persistentFlags.StringP("category", "c", "", "event category")
persistentFlags.StringP("action", "a", "", "event action")
persistentFlags.StringP("label", "l", "", "event label")
persistentFlags.StringP("value", "v", "", "event value")
err := eventCmd.MarkPersistentFlagRequired("category")
if err != nil {
log.Fatal(err)
}
err = eventCmd.MarkPersistentFlagRequired("action")
if err != nil {
log.Fatal(err)
}
return eventCmd
}
@@ -1,5 +1,5 @@
/*
Copyright 2016 The Fission Authors.
Copyright 2021 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.
@@ -14,19 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
package main
import (
"encoding/json"
"log"
"github.com/fission/fission/cmd/reporter/app"
)
type JsonSerializer struct {
}
func (j JsonSerializer) serialize(r resource) ([]byte, error) {
return json.Marshal(r)
}
func (j JsonSerializer) deserialize(buf []byte, r resource) error {
return json.Unmarshal(buf, r)
func main() {
err := app.App().Execute()
if err != nil {
log.Fatal(err)
}
}
-83
View File
@@ -1,83 +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 controller
import (
"fmt"
"net/http"
"os"
"runtime/debug"
log "github.com/Sirupsen/logrus"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/platform9/fission"
)
type API struct {
FunctionStore
HTTPTriggerStore
EnvironmentStore
}
func (api *API) respondWithSuccess(w http.ResponseWriter, resp []byte) {
_, err := w.Write(resp)
if err != nil {
// this will probably fail too, but try anyway
api.respondWithError(w, err)
}
}
func (api *API) respondWithError(w http.ResponseWriter, err error) {
debug.PrintStack()
code, msg := fission.GetHTTPError(err)
log.Errorf("Error: %v: %v", code, msg)
http.Error(w, msg, code)
}
func (api *API) HomeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "{message: \"Fission API\", version: \"0.1.0\"}\n")
}
func (api *API) Serve(port int) {
r := mux.NewRouter()
r.HandleFunc("/", api.HomeHandler)
r.HandleFunc("/v1/functions", api.FunctionApiList).Methods("GET")
r.HandleFunc("/v1/functions", api.FunctionApiCreate).Methods("POST")
r.HandleFunc("/v1/functions/{function}", api.FunctionApiGet).Methods("GET")
r.HandleFunc("/v1/functions/{function}", api.FunctionApiUpdate).Methods("PUT")
r.HandleFunc("/v1/functions/{function}", api.FunctionApiDelete).Methods("DELETE")
r.HandleFunc("/v1/triggers/http", api.HTTPTriggerApiList).Methods("GET")
r.HandleFunc("/v1/triggers/http", api.HTTPTriggerApiCreate).Methods("POST")
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiGet).Methods("GET")
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiUpdate).Methods("PUT")
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/v1/environments", api.EnvironmentApiList).Methods("GET")
r.HandleFunc("/v1/environments", api.EnvironmentApiCreate).Methods("POST")
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiGet).Methods("GET")
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiUpdate).Methods("PUT")
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiDelete).Methods("DELETE")
address := fmt.Sprintf(":%v", port)
log.WithFields(log.Fields{"port": port}).Info("Server started")
log.Fatal(http.ListenAndServe(address, handlers.LoggingHandler(os.Stdout, r)))
}
-215
View File
@@ -1,215 +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 controller
import (
"flag"
"io/ioutil"
"net/http"
"os"
"testing"
"time"
log "github.com/Sirupsen/logrus"
etcdClient "github.com/coreos/etcd/client"
"golang.org/x/net/context"
"github.com/platform9/fission"
"github.com/platform9/fission/controller/client"
)
var g struct {
client *client.Client
}
func TestFunctionApi(t *testing.T) {
log.SetFormatter(&log.TextFormatter{DisableColors: true})
testFunc := &fission.Function{
Metadata: fission.Metadata{
Name: "foo",
Uid: "",
},
Environment: fission.Metadata{
Name: "nodejs",
Uid: "xxx",
},
Code: "code1",
}
m, err := g.client.FunctionCreate(testFunc)
panicIf(err)
uid1 := m.Uid
//log.Printf("Created function %v: %v", m.Name, m.Uid)
code, err := g.client.FunctionGetRaw(m)
panicIf(err)
assert(string(code) == testFunc.Code, "code from FunctionGetRaw must match created function")
testFunc.Code = "code2"
m, err = g.client.FunctionUpdate(testFunc)
panicIf(err)
uid2 := m.Uid
//log.Printf("Updated function %v: %v", m.Name, m.Uid)
m.Uid = uid1
testFunc.Code = "code1"
f, err := g.client.FunctionGet(m)
panicIf(err)
testFunc.Metadata.Uid = m.Uid
//log.Printf("f = %#v", f)
//log.Printf("testFunc = %#v", testFunc)
assert(*f == *testFunc, "first version should match when read by uid")
m.Uid = uid2
testFunc.Metadata.Uid = m.Uid
testFunc.Code = "code2"
f, err = g.client.FunctionGet(m)
panicIf(err)
assert(*f == *testFunc, "second version should match when read by uid")
m.Uid = ""
testFunc.Metadata.Uid = uid2
testFunc.Code = "code2"
f, err = g.client.FunctionGet(m)
panicIf(err)
assert(*f == *testFunc, "second version should match when read as latest")
testFunc.Metadata.Name = "bar"
m, err = g.client.FunctionCreate(testFunc)
panicIf(err)
funcs, err := g.client.FunctionList()
panicIf(err)
assert(len(funcs) == 2,
"created two functions, but didn't find them")
err = g.client.FunctionDelete(&fission.Metadata{Name: "foo"})
panicIf(err)
err = g.client.FunctionDelete(&fission.Metadata{Name: "bar"})
panicIf(err)
}
func TestHTTPTriggerApi(t *testing.T) {
testTrigger := &fission.HTTPTrigger{
Metadata: fission.Metadata{
Name: "xxx",
Uid: "yyy",
},
UrlPattern: "/hello",
Function: fission.Metadata{
Name: "foo",
Uid: "",
},
}
m, err := g.client.HTTPTriggerCreate(testTrigger)
panicIf(err)
defer g.client.HTTPTriggerDelete(m)
tr, err := g.client.HTTPTriggerGet(m)
panicIf(err)
testTrigger.Metadata.Uid = m.Uid
assert(*testTrigger == *tr, "trigger should match after reading")
testTrigger.UrlPattern = "/hi"
m2, err := g.client.HTTPTriggerUpdate(testTrigger)
panicIf(err)
m.Uid = m2.Uid
tr, err = g.client.HTTPTriggerGet(m)
panicIf(err)
testTrigger.Metadata.Uid = m.Uid
assert(*testTrigger == *tr, "trigger should match after reading")
testTrigger.Metadata.Name = "yyy"
m, err = g.client.HTTPTriggerCreate(testTrigger)
panicIf(err)
defer g.client.HTTPTriggerDelete(m)
ts, err := g.client.HTTPTriggerList()
panicIf(err)
assert(len(ts) == 2, "created two triggers, but didn't find them")
}
func TestEnvironmentApi(t *testing.T) {
testEnv := &fission.Environment{
Metadata: fission.Metadata{
Name: "xxx",
Uid: "yyy",
},
RunContainerImageUrl: "gcr.io/xyz",
}
m, err := g.client.EnvironmentCreate(testEnv)
panicIf(err)
defer g.client.EnvironmentDelete(m)
tr, err := g.client.EnvironmentGet(m)
panicIf(err)
testEnv.Metadata.Uid = m.Uid
assert(*testEnv == *tr, "env should match after reading")
testEnv.RunContainerImageUrl = "/hi"
m2, err := g.client.EnvironmentUpdate(testEnv)
panicIf(err)
m.Uid = m2.Uid
tr, err = g.client.EnvironmentGet(m)
panicIf(err)
testEnv.Metadata.Uid = m.Uid
assert(*testEnv == *tr, "env should match after reading")
testEnv.Metadata.Name = "yyy"
m, err = g.client.EnvironmentCreate(testEnv)
panicIf(err)
defer g.client.EnvironmentDelete(m)
ts, err := g.client.EnvironmentList()
panicIf(err)
assert(len(ts) == 2, "created two envs, but didn't find them")
}
func TestMain(m *testing.M) {
flag.Parse()
fileStore, ks, rs := getTestResourceStore()
defer os.RemoveAll(fileStore.root)
api := &API{
FunctionStore: FunctionStore{ResourceStore: *rs},
HTTPTriggerStore: HTTPTriggerStore{ResourceStore: *rs},
EnvironmentStore: EnvironmentStore{ResourceStore: *rs},
}
g.client = client.MakeClient("http://localhost:8888")
ks.Delete(context.Background(), "Function", &etcdClient.DeleteOptions{Recursive: true})
ks.Delete(context.Background(), "HTTPTrigger", &etcdClient.DeleteOptions{Recursive: true})
ks.Delete(context.Background(), "Environment", &etcdClient.DeleteOptions{Recursive: true})
go api.Serve(8888)
time.Sleep(500 * time.Millisecond)
resp, err := http.Get("http://localhost:8888/")
panicIf(err)
assert(resp.StatusCode == 200, "http get status code on root")
_, err = ioutil.ReadAll(resp.Body)
panicIf(err)
os.Exit(m.Run())
}
-461
View File
@@ -1,461 +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 client
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/platform9/fission"
)
type (
Client struct {
Url string
}
)
func MakeClient(serverUrl string) *Client {
return &Client{Url: strings.TrimSuffix(serverUrl, "/")}
}
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)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return errors.New("Delete failed")
} else {
return errors.New("Delete failed: " + 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))
if err != nil {
return nil, err
}
req.Header.Set("Content-type", contentType)
return http.DefaultClient.Do(req)
}
func (c *Client) url(relativeUrl string) string {
return c.Url + "/v1/" + relativeUrl
}
func (c *Client) handleResponse(resp *http.Response) ([]byte, error) {
if resp.StatusCode != 200 {
var errCode int
switch resp.StatusCode {
case 403:
errCode = fission.ErrorNotAuthorized
case 404:
errCode = fission.ErrorNotFound
case 400:
errCode = fission.ErrorInvalidArgument
default:
errCode = fission.ErrorInternal
}
return nil, fission.MakeError(errCode,
fmt.Sprintf("HTTP error %v", resp.StatusCode))
}
body, err := ioutil.ReadAll(resp.Body)
return body, err
}
func (c *Client) FunctionCreate(f *fission.Function) (*fission.Metadata, error) {
orig := f.Code
f.Code = base64.StdEncoding.EncodeToString([]byte(f.Code))
defer func() { f.Code = orig }()
reqbody, err := json.Marshal(f)
if err != nil {
return nil, err
}
resp, err := http.Post(c.url("functions"), "application/json", bytes.NewReader(reqbody))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
log.WithFields(log.Fields{
"name": f.Metadata.Name,
"err": err,
}).Error("Failed to create function")
return nil, err
}
var m fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) FunctionGet(m *fission.Metadata) (*fission.Function, error) {
relativeUrl := fmt.Sprintf("functions/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
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 f fission.Function
err = json.Unmarshal(body, &f)
if err != nil {
return nil, err
}
dec, err := base64.StdEncoding.DecodeString(f.Code)
if err != nil {
return nil, err
}
f.Code = string(dec)
return &f, nil
}
func (c *Client) FunctionGetRaw(m *fission.Metadata) ([]byte, error) {
relativeUrl := fmt.Sprintf("functions/%v?raw=1", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("&uid=%v", m.Uid)
}
resp, err := http.Get(c.url(relativeUrl))
if err != nil {
return nil, err
}
defer resp.Body.Close()
return c.handleResponse(resp)
}
func (c *Client) FunctionUpdate(f *fission.Function) (*fission.Metadata, error) {
orig := f.Code
f.Code = base64.StdEncoding.EncodeToString([]byte(f.Code))
defer func() { f.Code = orig }()
reqbody, err := json.Marshal(f)
if err != nil {
return nil, err
}
relativeUrl := fmt.Sprintf("functions/%v", f.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 fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) FunctionDelete(m *fission.Metadata) error {
relativeUrl := fmt.Sprintf("functions/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
err := c.delete(relativeUrl)
return err
}
func (c *Client) FunctionList() ([]fission.Function, error) {
resp, err := http.Get(c.url("functions"))
if err != nil {
return nil, err
}
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
funcs := make([]fission.Function, 0)
err = json.Unmarshal(body, &funcs)
if err != nil {
return nil, err
}
return funcs, nil
}
func (c *Client) HTTPTriggerCreate(t *fission.HTTPTrigger) (*fission.Metadata, error) {
reqbody, err := json.Marshal(t)
if err != nil {
return nil, err
}
resp, err := http.Post(c.url("triggers/http"), "application/json", bytes.NewReader(reqbody))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
log.WithFields(log.Fields{
"name": t.Metadata.Name,
"err": err,
}).Error("Failed to create http trigger")
return nil, err
}
var m fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) HTTPTriggerGet(m *fission.Metadata) (*fission.HTTPTrigger, error) {
relativeUrl := fmt.Sprintf("triggers/http/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
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 t fission.HTTPTrigger
err = json.Unmarshal(body, &t)
if err != nil {
return nil, err
}
return &t, nil
}
func (c *Client) HTTPTriggerUpdate(t *fission.HTTPTrigger) (*fission.Metadata, error) {
reqbody, err := json.Marshal(t)
if err != nil {
return nil, err
}
relativeUrl := fmt.Sprintf("triggers/http/%v", t.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 fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) HTTPTriggerDelete(m *fission.Metadata) error {
relativeUrl := fmt.Sprintf("triggers/http/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
err := c.delete(relativeUrl)
return err
}
func (c *Client) HTTPTriggerList() ([]fission.HTTPTrigger, error) {
resp, err := http.Get(c.url("triggers/http"))
if err != nil {
return nil, err
}
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
triggers := make([]fission.HTTPTrigger, 0)
err = json.Unmarshal(body, &triggers)
if err != nil {
return nil, err
}
return triggers, nil
}
func (c *Client) EnvironmentCreate(env *fission.Environment) (*fission.Metadata, error) {
reqbody, err := json.Marshal(env)
if err != nil {
return nil, err
}
resp, err := http.Post(c.url("environments"), "application/json", bytes.NewReader(reqbody))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := c.handleResponse(resp)
if err != nil {
log.WithFields(log.Fields{
"name": env.Metadata.Name,
"err": err,
}).Error("Failed to create environment")
return nil, err
}
var m fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) EnvironmentGet(m *fission.Metadata) (*fission.Environment, error) {
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
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 env fission.Environment
err = json.Unmarshal(body, &env)
if err != nil {
return nil, err
}
return &env, nil
}
func (c *Client) EnvironmentUpdate(env *fission.Environment) (*fission.Metadata, error) {
reqbody, err := json.Marshal(env)
if err != nil {
return nil, err
}
relativeUrl := fmt.Sprintf("environments/%v", env.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 fission.Metadata
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *Client) EnvironmentDelete(m *fission.Metadata) error {
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
if len(m.Uid) > 0 {
relativeUrl += fmt.Sprintf("?uid=%v", m.Uid)
}
err := c.delete(relativeUrl)
return err
}
func (c *Client) EnvironmentList() ([]fission.Environment, error) {
resp, err := http.Get(c.url("environments"))
if err != nil {
return nil, err
}
body, err := c.handleResponse(resp)
if err != nil {
return nil, err
}
envs := make([]fission.Environment, 0)
err = json.Unmarshal(body, &envs)
if err != nil {
return nil, err
}
return envs, nil
}
-153
View File
@@ -1,153 +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 controller
import (
"encoding/json"
"io/ioutil"
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/gorilla/mux"
"github.com/platform9/fission"
)
func (api *API) EnvironmentApiList(w http.ResponseWriter, r *http.Request) {
envs, err := api.EnvironmentStore.List()
if err != nil {
api.respondWithError(w, err)
return
}
resp, err := json.Marshal(envs)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) EnvironmentApiCreate(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
defer r.Body.Close()
var env fission.Environment
err = json.Unmarshal(body, &env)
if err != nil {
log.Printf("Failed to unmarshal request body: [%v]", body)
api.respondWithError(w, err)
return
}
uid, err := api.EnvironmentStore.Create(&env)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: env.Metadata.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) EnvironmentApiGet(w http.ResponseWriter, r *http.Request) {
var m fission.Metadata
vars := mux.Vars(r)
m.Name = vars["environment"]
m.Uid = r.FormValue("uid") // empty if uid is absent
env, err := api.EnvironmentStore.Get(&m)
if err != nil {
api.respondWithError(w, err)
return
}
resp, err := json.Marshal(env)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) EnvironmentApiUpdate(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["environment"]
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
var env fission.Environment
err = json.Unmarshal(body, &env)
if err != nil {
api.respondWithError(w, err)
return
}
if name != env.Metadata.Name {
err = fission.MakeError(fission.ErrorInvalidArgument, "Environment name doesn't match URL")
api.respondWithError(w, err)
return
}
uid, err := api.EnvironmentStore.Update(&env)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: env.Metadata.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) EnvironmentApiDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var m fission.Metadata
m.Name = vars["environment"]
m.Uid = r.FormValue("uid") // empty if uid is absent
if len(m.Uid) == 0 {
log.WithFields(log.Fields{"httpTrigger": m.Name}).Info("Deleting all versions")
}
err := api.EnvironmentStore.Delete(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, []byte(""))
}
-79
View File
@@ -1,79 +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 controller
import (
"github.com/satori/go.uuid"
"github.com/platform9/fission"
)
type EnvironmentStore struct {
ResourceStore
}
func (es *EnvironmentStore) Create(e *fission.Environment) (string, error) {
e.Metadata.Uid = uuid.NewV4().String()
return e.Metadata.Uid, es.ResourceStore.create(e)
}
func (es *EnvironmentStore) Get(m *fission.Metadata) (*fission.Environment, error) {
var e fission.Environment
err := es.ResourceStore.read(m.Name, &e)
if err != nil {
return nil, err
}
return &e, nil
}
func (es *EnvironmentStore) Update(e *fission.Environment) (string, error) {
e.Metadata.Uid = uuid.NewV4().String()
return e.Metadata.Uid, es.ResourceStore.update(e)
}
func (es *EnvironmentStore) Delete(m fission.Metadata) error {
typeName, err := getTypeName(fission.Environment{})
if err != nil {
return err
}
return es.ResourceStore.delete(typeName, m.Name)
}
func (es *EnvironmentStore) List() ([]fission.Environment, error) {
typeName, err := getTypeName(fission.Environment{})
if err != nil {
return nil, err
}
bufs, err := es.ResourceStore.getAll(typeName)
if err != nil {
return nil, err
}
envs := make([]fission.Environment, 0, len(bufs))
js := JsonSerializer{}
for _, buf := range bufs {
var e fission.Environment
err = js.deserialize([]byte(buf), &e)
if err != nil {
return nil, err
}
envs = append(envs, e)
}
return envs, nil
}
-128
View File
@@ -1,128 +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 controller
import (
"io/ioutil"
"os"
"path"
log "github.com/Sirupsen/logrus"
)
type requestType int
const (
READ requestType = iota
WRITE
DELETE
)
type (
FileStore struct {
root string // abs path of root of filestore
requestChannel chan fileStoreRequest
}
fileStoreRequest struct {
requestType
fileName string // relative path
fileContents []byte
responseChannel chan fileStoreResponse
}
fileStoreResponse struct {
error
fileContents []byte
}
)
func MakeFileStore(path string) *FileStore {
// create directory if necessary
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
err = os.MkdirAll(path, os.ModeDir|0700)
if err != nil {
log.Printf("Failed to create directory %v", path)
return nil
}
log.Printf("Created directory %v", path)
}
}
fileStore := &FileStore{
root: path,
requestChannel: make(chan fileStoreRequest),
}
go fileStore.fileStoreService()
return fileStore
}
func (fs *FileStore) fileStoreService() {
for {
req := <-fs.requestChannel
response := &fileStoreResponse{}
log.WithFields(log.Fields{"file": req.fileName, "type": req.requestType}).Debug("fileStore request")
switch req.requestType {
case READ:
response.fileContents, response.error = ioutil.ReadFile(path.Join(fs.root, req.fileName))
case WRITE:
response.error = ioutil.WriteFile(path.Join(fs.root, req.fileName), req.fileContents, 0600)
case DELETE:
response.error = os.Remove(path.Join(fs.root, req.fileName))
default:
log.Panic("bad request")
}
req.responseChannel <- *response
}
}
func (fs *FileStore) read(fileName string) ([]byte, error) {
req := fileStoreRequest{
requestType: READ,
fileName: fileName,
responseChannel: make(chan fileStoreResponse),
}
fs.requestChannel <- req
response := <-req.responseChannel
return response.fileContents, response.error
}
func (fs *FileStore) write(fileName string, contents []byte) error {
req := fileStoreRequest{
requestType: WRITE,
fileName: fileName,
fileContents: contents,
responseChannel: make(chan fileStoreResponse),
}
fs.requestChannel <- req
response := <-req.responseChannel
return response.error
}
func (fs *FileStore) delete(fileName string) error {
req := fileStoreRequest{
requestType: DELETE,
fileName: fileName,
responseChannel: make(chan fileStoreResponse),
}
fs.requestChannel <- req
response := <-req.responseChannel
return response.error
}
-63
View File
@@ -1,63 +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 controller
import (
"io/ioutil"
"log"
"os"
"testing"
)
func TestFileStore(t *testing.T) {
// tmp dir
dir, err := ioutil.TempDir("", "testFileStore")
if err != nil {
t.Fatalf("error creating temp dir: %v", err)
}
defer os.RemoveAll(dir)
log.Printf("temp dir at %v", dir)
// file store
fs := MakeFileStore(dir)
_, err = fs.read("nonexistent")
if err == nil {
t.Fatalf("expected an error")
}
path := "fileStoreTest"
contents := []byte("bar")
err = fs.write(path, contents)
if err != nil {
t.Fatalf("error: %v", err)
}
observedContents, err := fs.read(path)
if err != nil {
t.Fatalf("error: %v", err)
}
if string(observedContents) != string(contents) {
t.Fatalf("contents don't match")
}
err = fs.delete(path)
if err != nil {
t.Fatalf("error: %v", err)
}
}
-172
View File
@@ -1,172 +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 controller
import (
"io/ioutil"
"net/http"
"encoding/json"
log "github.com/Sirupsen/logrus"
"github.com/gorilla/mux"
"encoding/base64"
"github.com/platform9/fission"
)
func (api *API) FunctionApiList(w http.ResponseWriter, r *http.Request) {
funcs, err := api.FunctionStore.List()
if err != nil {
api.respondWithError(w, err)
return
}
resp, err := json.Marshal(funcs)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) FunctionApiCreate(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
var f fission.Function
err = json.Unmarshal(body, &f)
if err != nil {
api.respondWithError(w, err)
return
}
dec, err := base64.StdEncoding.DecodeString(f.Code)
if err != nil {
api.respondWithError(w, err)
return
}
f.Code = string(dec)
uid, err := api.FunctionStore.Create(&f)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: f.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) FunctionApiGet(w http.ResponseWriter, r *http.Request) {
var m fission.Metadata
vars := mux.Vars(r)
m.Name = vars["function"]
m.Uid = r.FormValue("uid") // empty if uid is absent
raw := r.FormValue("raw") // just the code
f, err := api.FunctionStore.Get(&m)
if err != nil {
api.respondWithError(w, err)
return
}
var resp []byte
if raw != "" {
resp = []byte(f.Code)
} else {
f.Code = base64.StdEncoding.EncodeToString([]byte(f.Code))
resp, err = json.Marshal(f)
if err != nil {
api.respondWithError(w, err)
return
}
}
api.respondWithSuccess(w, resp)
}
func (api *API) FunctionApiUpdate(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
funcName := vars["function"]
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
var f fission.Function
err = json.Unmarshal(body, &f)
if err != nil {
api.respondWithError(w, err)
return
}
if funcName != f.Metadata.Name {
err = fission.MakeError(fission.ErrorInvalidArgument, "Function name doesn't match URL")
api.respondWithError(w, err)
return
}
dec, err := base64.StdEncoding.DecodeString(f.Code)
if err != nil {
api.respondWithError(w, err)
return
}
f.Code = string(dec)
uid, err := api.FunctionStore.Update(&f)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: f.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) FunctionApiDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var m fission.Metadata
m.Name = vars["function"]
m.Uid = r.FormValue("uid") // empty if uid is absent
if len(m.Uid) == 0 {
log.WithFields(log.Fields{"function": m.Name}).Info("Deleting all versions")
}
err := api.FunctionStore.Delete(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, []byte(""))
}
-137
View File
@@ -1,137 +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 controller
import (
log "github.com/Sirupsen/logrus"
"github.com/platform9/fission"
)
type FunctionStore struct {
ResourceStore
}
func (fs *FunctionStore) Create(f *fission.Function) (string, error) {
code := []byte(f.Code)
_, uid, err := fs.ResourceStore.writeFile(f.Key(), code)
if err != nil {
return "", err
}
f.Metadata.Uid = uid
f.Code = ""
err = fs.ResourceStore.create(f)
if err != nil {
fs.ResourceStore.deleteFile(f.Key(), uid) // ignore errors
return "", err
}
return f.Metadata.Uid, nil
}
func (fs *FunctionStore) Get(m *fission.Metadata) (*fission.Function, error) {
var f fission.Function
err := fs.ResourceStore.read(m.Name, &f)
if err != nil {
return nil, err
}
var code []byte
if len(m.Uid) > 0 {
log.WithFields(log.Fields{"Uid": m.Uid}).Info("fetching by uid")
code, err = fs.ResourceStore.readFile(m.Name, &m.Uid)
f.Metadata = *m
} else {
code, err = fs.ResourceStore.readFile(m.Name, nil)
}
if err != nil {
return nil, err
}
f.Code = string(code)
return &f, nil
}
func (fs *FunctionStore) Update(f *fission.Function) (string, error) {
code := []byte(f.Code)
_, uid, err := fs.ResourceStore.writeFile(f.Key(), code)
if err != nil {
return "", err
}
var fnew fission.Function
err = fs.ResourceStore.read(f.Metadata.Name, &fnew)
if err != nil {
fs.ResourceStore.deleteFile(f.Key(), uid) // ignore err
return "", err
}
fnew.Metadata.Uid = uid
fnew.Environment = f.Environment
err = fs.ResourceStore.update(fnew)
if err != nil {
fs.ResourceStore.deleteFile(f.Key(), uid) // ignore err
return "", err
}
return uid, err
}
func (fs *FunctionStore) Delete(m fission.Metadata) error {
if len(m.Uid) == 0 {
err := fs.ResourceStore.deleteAllFiles(m.Name)
if err != nil {
return err
}
} else {
err := fs.ResourceStore.deleteFile(m.Name, m.Uid)
if err != nil {
return err
}
}
typeName, err := getTypeName(fission.Function{})
if err != nil {
return err
}
return fs.ResourceStore.delete(typeName, m.Name)
}
func (fs *FunctionStore) List() ([]fission.Function, error) {
typeName, err := getTypeName(fission.Function{})
if err != nil {
return nil, err
}
bufs, err := fs.ResourceStore.getAll(typeName)
if err != nil {
return nil, err
}
js := JsonSerializer{}
functions := make([]fission.Function, 0, len(bufs))
for _, buf := range bufs {
var f fission.Function
err = js.deserialize([]byte(buf), &f)
if err != nil {
return nil, err
}
functions = append(functions, f)
}
return functions, nil
}
-151
View File
@@ -1,151 +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 controller
import (
"encoding/json"
"io/ioutil"
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/gorilla/mux"
"github.com/platform9/fission"
)
func (api *API) HTTPTriggerApiList(w http.ResponseWriter, r *http.Request) {
triggers, err := api.HTTPTriggerStore.List()
if err != nil {
api.respondWithError(w, err)
return
}
resp, err := json.Marshal(triggers)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) HTTPTriggerApiCreate(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
var t fission.HTTPTrigger
err = json.Unmarshal(body, &t)
if err != nil {
api.respondWithError(w, err)
return
}
uid, err := api.HTTPTriggerStore.Create(&t)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: t.Metadata.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) HTTPTriggerApiGet(w http.ResponseWriter, r *http.Request) {
var m fission.Metadata
vars := mux.Vars(r)
m.Name = vars["httpTrigger"]
m.Uid = r.FormValue("uid") // empty if uid is absent
t, err := api.HTTPTriggerStore.Get(&m)
if err != nil {
api.respondWithError(w, err)
return
}
resp, err := json.Marshal(t)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) HTTPTriggerApiUpdate(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["httpTrigger"]
body, err := ioutil.ReadAll(r.Body)
if err != nil {
api.respondWithError(w, err)
}
var t fission.HTTPTrigger
err = json.Unmarshal(body, &t)
if err != nil {
api.respondWithError(w, err)
return
}
if name != t.Metadata.Name {
err = fission.MakeError(fission.ErrorInvalidArgument, "HTTPTrigger name doesn't match URL")
api.respondWithError(w, err)
return
}
uid, err := api.HTTPTriggerStore.Update(&t)
if err != nil {
api.respondWithError(w, err)
return
}
m := &fission.Metadata{Name: t.Metadata.Name, Uid: uid}
resp, err := json.Marshal(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, resp)
}
func (api *API) HTTPTriggerApiDelete(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var m fission.Metadata
m.Name = vars["httpTrigger"]
m.Uid = r.FormValue("uid") // empty if uid is absent
if len(m.Uid) == 0 {
log.WithFields(log.Fields{"httpTrigger": m.Name}).Info("Deleting all versions")
}
err := api.HTTPTriggerStore.Delete(m)
if err != nil {
api.respondWithError(w, err)
return
}
api.respondWithSuccess(w, []byte(""))
}
-79
View File
@@ -1,79 +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 controller
import (
"github.com/satori/go.uuid"
"github.com/platform9/fission"
)
type HTTPTriggerStore struct {
ResourceStore
}
func (hts *HTTPTriggerStore) Create(ht *fission.HTTPTrigger) (string, error) {
ht.Metadata.Uid = uuid.NewV4().String()
return ht.Metadata.Uid, hts.ResourceStore.create(ht)
}
func (hts *HTTPTriggerStore) Get(m *fission.Metadata) (*fission.HTTPTrigger, error) {
var ht fission.HTTPTrigger
err := hts.ResourceStore.read(m.Name, &ht)
if err != nil {
return nil, err
}
return &ht, nil
}
func (hts *HTTPTriggerStore) Update(ht *fission.HTTPTrigger) (string, error) {
ht.Metadata.Uid = uuid.NewV4().String()
return ht.Metadata.Uid, hts.ResourceStore.update(ht)
}
func (hts *HTTPTriggerStore) Delete(m fission.Metadata) error {
typeName, err := getTypeName(fission.HTTPTrigger{})
if err != nil {
return err
}
return hts.ResourceStore.delete(typeName, m.Name)
}
func (hts *HTTPTriggerStore) List() ([]fission.HTTPTrigger, error) {
typeName, err := getTypeName(fission.HTTPTrigger{})
if err != nil {
return nil, err
}
bufs, err := hts.ResourceStore.getAll(typeName)
if err != nil {
return nil, err
}
triggers := make([]fission.HTTPTrigger, 0, len(bufs))
js := JsonSerializer{}
for _, buf := range bufs {
var ht fission.HTTPTrigger
err = js.deserialize([]byte(buf), &ht)
if err != nil {
return nil, err
}
triggers = append(triggers, ht)
}
return triggers, nil
}
-254
View File
@@ -1,254 +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 controller
import (
"errors"
"reflect"
"time"
log "github.com/Sirupsen/logrus"
"github.com/coreos/etcd/client"
"github.com/satori/go.uuid"
"golang.org/x/net/context"
)
type (
ResourceStore struct {
*FileStore
client.KeysAPI
serializer
}
)
func MakeResourceStore(fs *FileStore, etcdUrls []string) (*ResourceStore, error) {
ks, err := getEtcdKeyAPI(etcdUrls)
if err != nil {
return nil, err
}
s := JsonSerializer{}
return &ResourceStore{FileStore: fs, KeysAPI: ks, serializer: s}, nil
}
func getEtcdKeyAPI(etcdUrls []string) (client.KeysAPI, error) {
cfg := client.Config{
Endpoints: etcdUrls,
Transport: client.DefaultTransport,
// set timeout per request to fail fast when the target endpoint is unavailable
HeaderTimeoutPerRequest: time.Second,
}
c, err := client.New(cfg)
if err != nil {
log.Printf("failed to connect to etcd: %v", err)
return nil, err
}
return client.NewKeysAPI(c), nil
}
func getTypeName(r resource) (string, error) {
typ := reflect.TypeOf(r)
if typ.Kind().String() == "ptr" {
typ = typ.Elem()
}
typName := typ.Name()
if len(typName) == 0 {
return "", errors.New("Failed to get type")
}
return typName, nil
}
func getKey(r resource) (string, error) {
typName, err := getTypeName(r)
if err != nil {
return "", err
}
rkey := r.Key()
return (typName + "/" + rkey), nil
}
func (rs *ResourceStore) create(r resource) error {
key, err := getKey(r)
if err != nil {
return err
}
serialized, err := rs.serializer.serialize(r)
if err != nil {
return err
}
_, err = rs.KeysAPI.Set(context.Background(), key, string(serialized),
&client.SetOptions{PrevExist: client.PrevNoExist})
return err
}
func (rs *ResourceStore) read(rkey string, res resource) error {
typName, err := getTypeName(res)
if err != nil {
return err
}
key := typName + "/" + rkey
resp, err := rs.KeysAPI.Get(context.Background(), key, nil)
if err != nil {
return err
}
return rs.serializer.deserialize([]byte(resp.Node.Value), res)
}
func (rs *ResourceStore) update(r resource) error {
key, err := getKey(r)
if err != nil {
return err
}
serialized, err := rs.serializer.serialize(r)
if err != nil {
return err
}
_, err = rs.KeysAPI.Set(context.Background(), key, string(serialized),
&client.SetOptions{PrevExist: client.PrevExist})
return err
}
func (rs *ResourceStore) delete(typename, rkey string) error {
key := typename + "/" + rkey
_, err := rs.KeysAPI.Delete(context.Background(), key, nil) // ignore response
return err
}
// getAll finds all entries under key. If none or found or key
// doesn't exist, returns an empty slice.
func (rs *ResourceStore) getAll(key string) ([]string, error) {
resp, err := rs.KeysAPI.Get(context.Background(), key, &client.GetOptions{Recursive: true})
if err != nil {
if client.IsKeyNotFound(err) {
return []string{}, nil
}
return nil, err
}
res := make([]string, 0, len(resp.Node.Nodes))
for _, n := range resp.Node.Nodes {
res = append(res, n.Value)
}
return res, nil
}
func (rs *ResourceStore) writeFile(parentKey string, contents []byte) (string, string, error) {
uid := uuid.NewV4().String()
err := rs.FileStore.write(uid, contents)
if err != nil {
return "", "", err
}
parentKey = "file/" + parentKey
resp, err := rs.KeysAPI.CreateInOrder(context.Background(), parentKey, uid, nil)
if err != nil {
_ = rs.FileStore.delete(uid)
return "", "", err
}
return resp.Node.Key, uid, nil
}
func (rs *ResourceStore) readFile(key string, uid *string) ([]byte, error) {
key = "file/" + key
resp, err := rs.KeysAPI.Get(context.Background(), key, &client.GetOptions{Sort: true})
if err != nil {
return nil, err
}
if uid == nil {
// get latest
n := resp.Node.Nodes
uid = &n[len(n)-1].Value
} else {
// validate uid is in the list
found := false
for _, u := range resp.Node.Nodes {
if *uid == u.Value {
found = true
break
}
}
if !found {
return nil, errors.New("Invalid UID " + *uid)
}
}
contents, err := rs.FileStore.read(*uid)
return contents, err
}
func (rs *ResourceStore) deleteFile(key string, uid string) error {
key = "file/" + key
resp, err := rs.KeysAPI.Get(context.Background(), key, &client.GetOptions{Sort: true})
if err != nil {
return err
}
var node *client.Node
for _, u := range resp.Node.Nodes {
if u.Value == uid {
node = u
}
}
if node == nil {
log.WithFields(log.Fields{"key": key, "uid": uid}).Error("unreferenced file")
return errors.New("won't delete unreferenced file")
}
err = rs.FileStore.delete(node.Value)
if err != nil {
return err
}
_, err = rs.KeysAPI.Delete(context.Background(), node.Key, nil)
if err != nil {
return err
}
if len(resp.Node.Nodes) == 1 {
_, err = rs.KeysAPI.Delete(context.Background(), key, &client.DeleteOptions{Dir: true})
return err
}
return nil
}
func (rs *ResourceStore) deleteAllFiles(key string) error {
key = "file/" + key
resp, err := rs.KeysAPI.Get(context.Background(), key, &client.GetOptions{Sort: true})
if err != nil {
return err
}
for _, u := range resp.Node.Nodes {
err = rs.FileStore.delete(u.Value)
if err != nil {
return err
}
_, err = rs.KeysAPI.Delete(context.Background(), u.Key, nil)
if err != nil {
return err
}
}
_, err = rs.KeysAPI.Delete(context.Background(), key, &client.DeleteOptions{Dir: true})
return err
}
-152
View File
@@ -1,152 +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 controller
import (
"io/ioutil"
"log"
"os"
"testing"
"github.com/coreos/etcd/client"
"golang.org/x/net/context"
)
type TestResource struct {
A string
B int
}
func (tr TestResource) Key() string {
return tr.A
}
func panicIf(err error) {
if err != nil {
log.Panicf("err: %v", err)
}
}
func assert(b bool, msg string) {
if !b {
log.Panic("assertion failed: " + msg)
}
}
func getTestResourceStore() (*FileStore, client.KeysAPI, *ResourceStore) {
// make a tmp dir
dir, err := ioutil.TempDir("", "testFileStore")
panicIf(err)
fs := MakeFileStore(dir)
rs, err := MakeResourceStore(fs, []string{"http://localhost:2379"})
panicIf(err)
return fs, rs.KeysAPI, rs
}
func TestResourceStore(t *testing.T) {
fs, ks, rs := getTestResourceStore()
defer os.RemoveAll(fs.root)
s := JsonSerializer{}
tr := TestResource{A: "hello", B: 1}
// Delete the key first, in case of a panic'd previous test run; ignore errors
_ = rs.delete("TestResource", tr.Key())
ks.Delete(context.Background(), "/TestResource", &client.DeleteOptions{Dir: true})
// Verify getAll for empty db
trs, err := rs.getAll("TestResource")
panicIf(err)
if len(trs) != 0 {
log.Fatalf("Expected zero length slice, got %v", trs)
}
// Create
err = rs.create(tr)
panicIf(err)
defer ks.Delete(context.Background(), "/TestResource", &client.DeleteOptions{Dir: true})
defer rs.delete("TestResource", tr.Key())
// Etcd key /TestResource/hello should exist
_, err = ks.Get(context.Background(), "TestResource/hello", nil)
panicIf(err)
// Read
tr1 := TestResource{}
err = rs.read(tr.Key(), &tr1)
panicIf(err)
assert(tr1 == tr, "retrieved value must equal created value")
// Update and Read
tr.B += 1
err = rs.update(tr)
panicIf(err)
err = rs.read(tr.Key(), &tr1)
panicIf(err)
assert(tr1 == tr, "retrieved value must equal updated value")
// Get list
results, err := rs.getAll("TestResource")
panicIf(err)
res := make([]TestResource, 0, 0)
for _, r := range results {
tmp := TestResource{}
err = s.deserialize([]byte(r), &tmp)
panicIf(err)
res = append(res, tmp)
}
assert(res[0] == tr, "value from retrieved list must equal updated value")
// file tests
fileKey := "ResourceStoreTest"
fileContents1 := []byte("hello")
fileContents2 := []byte("world")
key, uid1, err := rs.writeFile(fileKey, fileContents1)
panicIf(err)
defer rs.deleteFile(fileKey, uid1)
log.Printf("key = %v, uid = %v", key, uid1)
// read latest
contents, err := rs.readFile(fileKey, nil)
panicIf(err)
assert(string(contents) == string(fileContents1), "retrieved file contents must match written value")
// update-- same key new contents
_, uid2, err := rs.writeFile(fileKey, fileContents2)
panicIf(err)
defer rs.deleteFile(fileKey, uid2)
// read latest
contents, err = rs.readFile(fileKey, nil)
panicIf(err)
assert(string(contents) == string(fileContents2), "retrieved file contents must match updated value")
// read by uid
// 1
contents, err = rs.readFile(fileKey, &uid1)
panicIf(err)
assert(string(contents) == string(fileContents1), "retrieved file contents must match updated value")
// 2
contents, err = rs.readFile(fileKey, &uid2)
panicIf(err)
assert(string(contents) == string(fileContents2), "retrieved file contents must match updated value")
}

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