Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6a8734aae | ||
|
|
3ee98cd13a | ||
|
|
275da18cf6 | ||
|
|
3f3b11ffbf | ||
|
|
7f8cb69326 | ||
|
|
003c304105 | ||
|
|
763ab475f2 | ||
|
|
4b3f48b537 | ||
|
|
6301a78814 | ||
|
|
506b427124 | ||
|
|
19ae7d5ac6 | ||
|
|
47aaa85108 | ||
|
|
3067ecdee3 | ||
|
|
d9a0ee1e33 | ||
|
|
5cfc8dee5e | ||
|
|
1ad7ac2dcf | ||
|
|
86446c8879 | ||
|
|
df857e3194 | ||
|
|
ad7a3951c5 | ||
|
|
7e8e968013 | ||
|
|
e38baeec36 | ||
|
|
ca28f962d4 | ||
|
|
dfb2c073d2 | ||
|
|
51b264e8ca | ||
|
|
6d2fe08973 | ||
|
|
ccc551112b | ||
|
|
1a5537f4ba | ||
|
|
5c2f0c5f4a | ||
|
|
a66de4c601 | ||
|
|
af73d0ce1a | ||
|
|
04654ca465 | ||
|
|
af10579be9 | ||
|
|
30d24a85b5 | ||
|
|
d8b386a812 | ||
|
|
48e7a13c0f | ||
|
|
70803e37fa | ||
|
|
7a770b8627 | ||
|
|
8b0d99d65d | ||
|
|
3aca0edfcc | ||
|
|
81ece23bfe | ||
|
|
66b9dfa8e9 | ||
|
|
f8e98f9f14 | ||
|
|
b97a3c4b0a | ||
|
|
b5c8ea0e13 | ||
|
|
cf2d35291e | ||
|
|
1cda7e051b | ||
|
|
a645a1e197 | ||
|
|
d0276f1d52 | ||
|
|
4474f5f813 | ||
|
|
19e693bf52 | ||
|
|
825939c820 | ||
|
|
5a9138711b | ||
|
|
7640f1199d | ||
|
|
7b6e4318d4 | ||
|
|
fcd1bc0356 | ||
|
|
d443eb1c96 | ||
|
|
c7d0c09f01 | ||
|
|
d3d8ff6c1b | ||
|
|
6f5f6900b6 | ||
|
|
19753e07e0 | ||
|
|
1888cd2ac7 | ||
|
|
4b456db517 | ||
|
|
9272f0cb2c | ||
|
|
b9a5588ca9 | ||
|
|
93d4b88d84 | ||
|
|
b0d27ee5d2 | ||
|
|
c33f1e112e | ||
|
|
f288f0f258 | ||
|
|
e4f44ffa63 | ||
|
|
d1ed089c3e | ||
|
|
e1a64dd0c1 | ||
|
|
3b6749dce9 | ||
|
|
8f6887280c | ||
|
|
ef0a2fa340 | ||
|
|
2b616ec4e2 | ||
|
|
fe02bb1678 | ||
|
|
fc1aab2472 | ||
|
|
e22cdee5f5 | ||
|
|
698d591788 | ||
|
|
3b11ca87f1 | ||
|
|
bbaf1b0c2d | ||
|
|
a151f89eec | ||
|
|
d20dc9aa64 | ||
|
|
52b5cb0902 | ||
|
|
bc5c181fc2 | ||
|
|
fed30e1b24 | ||
|
|
22de11190c | ||
|
|
e42f81a7a1 | ||
|
|
f30e7df43d | ||
|
|
c930c69629 | ||
|
|
08b6d43ac1 | ||
|
|
53b075a315 | ||
|
|
b8311d43ce | ||
|
|
1075c5da13 | ||
|
|
59c8569190 | ||
|
|
395a8adf37 | ||
|
|
d358a29b17 | ||
|
|
e253d2a376 | ||
|
|
bfd005a295 | ||
|
|
c1a3bdd895 | ||
|
|
b18462b10b | ||
|
|
30dba5dae9 | ||
|
|
f12880fb5c | ||
|
|
c61442ee76 | ||
|
|
96ae708163 | ||
|
|
b47b3ecb70 | ||
|
|
7cdc146515 | ||
|
|
e734fa3554 | ||
|
|
71b587b58e | ||
|
|
81ae6f38fc | ||
|
|
7fbb4098a4 | ||
|
|
f8af8b91f5 | ||
|
|
b5341edec0 | ||
|
|
49d60b19f3 | ||
|
|
82a7acf408 | ||
|
|
7bd57c208a | ||
|
|
27ec605955 | ||
|
|
c94e02b302 | ||
|
|
5d2d65f05c | ||
|
|
6d3d277cb9 | ||
|
|
4d654c6fe7 | ||
|
|
ecb97db913 | ||
|
|
082c244b0b | ||
|
|
678a2c7ad8 | ||
|
|
78026ac573 | ||
|
|
4cfd459317 | ||
|
|
e481c234ee | ||
|
|
0d872020e3 | ||
|
|
62016b2f83 | ||
|
|
58811ab522 | ||
|
|
19c60d1592 | ||
|
|
cd36047660 | ||
|
|
ef8289ff73 | ||
|
|
ff47a8c1ed | ||
|
|
86b506c9b6 | ||
|
|
e762471d78 | ||
|
|
1040a0d7e9 | ||
|
|
c49377569e | ||
|
|
560aa34ce2 | ||
|
|
ee18a88664 | ||
|
|
31b8c1ee3b | ||
|
|
97b9350651 | ||
|
|
b9997b2ece | ||
|
|
9c63975497 | ||
|
|
8cafe1ebf3 | ||
|
|
4dccfcc156 | ||
|
|
7af711a48b | ||
|
|
80910562b3 | ||
|
|
88b5343775 | ||
|
|
a6e75b4da6 | ||
|
|
8fb0e9e10c | ||
|
|
747d774a3c | ||
|
|
7bbcaf2174 | ||
|
|
ac21c037d6 | ||
|
|
3b47daa8fc | ||
|
|
dff08a0a8e | ||
|
|
74ad096158 | ||
|
|
be84f9ec93 | ||
|
|
6e440f11cd | ||
|
|
655a76447e | ||
|
|
dc0fc839ed | ||
|
|
efe1209550 | ||
|
|
93c5b53b77 | ||
|
|
1beaa9ec13 | ||
|
|
6e00733f68 | ||
|
|
3bffd27c74 | ||
|
|
971a314d63 | ||
|
|
40e1689e49 | ||
|
|
fe8fa94c77 | ||
|
|
a9dd4bf81a | ||
|
|
56beac6508 | ||
|
|
b0b29da388 | ||
|
|
c1cb9603a5 | ||
|
|
58722f849a | ||
|
|
9e7dd5aa27 | ||
|
|
9d13081803 | ||
|
|
78a774cfd9 | ||
|
|
9f51f9064d | ||
|
|
b229d6e1b0 | ||
|
|
2ba66afb9f | ||
|
|
36e544b537 | ||
|
|
5ec841cf2e | ||
|
|
981bb21756 | ||
|
|
a297a67385 | ||
|
|
5445b75af9 | ||
|
|
e189ac4fc2 | ||
|
|
4bc5d49792 | ||
|
|
3860039f9a | ||
|
|
cb8605cf60 |
@@ -0,0 +1,14 @@
|
|||||||
|
ignore:
|
||||||
|
- "charts"
|
||||||
|
- "demos"
|
||||||
|
- "Documentation"
|
||||||
|
- "examples"
|
||||||
|
- "test"
|
||||||
|
- "tools"
|
||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project:
|
||||||
|
default:
|
||||||
|
threshold: 2
|
||||||
|
# Disable patch coverage check since we focus on project coverage.
|
||||||
|
patch: off
|
||||||
@@ -8,7 +8,9 @@ assignees: ''
|
|||||||
---
|
---
|
||||||
|
|
||||||
<!-- Please answer these questions before submitting your issue. Thanks! -->
|
<!-- Please answer these questions before submitting your issue. Thanks! -->
|
||||||
|
|
||||||
<!-- Documentation URL: https://docs.fission.io/ -->
|
<!-- Documentation URL: https://docs.fission.io/ -->
|
||||||
|
<!-- Troubleshooting guide: https://docs.fission.io/trouble-shooting/ -->
|
||||||
|
|
||||||
**Fission/Kubernetes version**
|
**Fission/Kubernetes version**
|
||||||
|
|
||||||
|
|||||||
+14
-8
@@ -4,49 +4,55 @@ dist: trusty
|
|||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.11.6
|
- 1.12.x
|
||||||
|
|
||||||
|
env:
|
||||||
|
- KUBECONFIG=${HOME}/.kube/config PATH=$HOME/k8scli:$HOME/tool:$HOME/google-cloud-sdk/bin:${PATH} GO111MODULE=on DOCKER_CACHE_DIR=${HOME}/docker/
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/google-cloud-sdk/
|
- $HOME/google-cloud-sdk/
|
||||||
- $HOME/k8scli
|
- $HOME/k8scli
|
||||||
- $HOME/tool
|
- $HOME/tool
|
||||||
|
- $HOME/.cache/go-build
|
||||||
|
- $HOME/gopath/pkg/mod
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
# - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
- sudo apt-get -y install apache2-utils parallel realpath
|
- sudo apt-get -y install apache2-utils parallel realpath
|
||||||
- sudo sysctl net.ipv6.conf.all.disable_ipv6=0
|
- sudo sysctl net.ipv6.conf.all.disable_ipv6=0
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- hack/travis-kube-setup.sh
|
- hack/travis-kube-setup.sh
|
||||||
|
|
||||||
env:
|
|
||||||
- KUBECONFIG=${HOME}/.kube/config PATH=$HOME/k8scli:$HOME/tool:$HOME/google-cloud-sdk/bin:${PATH} GO111MODULE=on
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
- go mod download
|
- go mod download
|
||||||
- go mod vendor
|
|
||||||
- hack/verify-staticcheck.sh
|
- hack/verify-staticcheck.sh
|
||||||
- hack/verify-gofmt.sh
|
- hack/verify-gofmt.sh
|
||||||
- hack/verify-govet.sh
|
- hack/verify-govet.sh
|
||||||
- helm lint charts/fission-all/ charts/fission-core/
|
- helm lint charts/fission-all/ charts/fission-core/
|
||||||
- hack/runtests.sh
|
- hack/runtests.sh
|
||||||
|
- test/build.sh
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
- test/build_and_test.sh
|
- test/test.sh
|
||||||
- test/upgrade/fission_upgrade_test.sh
|
- test/upgrade/fission_upgrade_test.sh
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
- kubectl --namespace default delete configmap -l travisID=${TRAVIS_BUILD_ID} # remove in-test configmap to indicate this CI build finished
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack:
|
slack:
|
||||||
rooms:
|
rooms:
|
||||||
|
|||||||
+256
-14
@@ -1,22 +1,265 @@
|
|||||||
# 1.2.1
|
# 1.7.0-rc.2
|
||||||
[Documentation](https://docs.fission.io/)
|
[Documentation](https://docs.fission.io/)
|
||||||
## Downloads for 1.2.1
|
## Downloads for 1.7.0-rc.2
|
||||||
|
|
||||||
|
|
||||||
filename | sha256 hash
|
filename | sha256 hash
|
||||||
-------- | -----------
|
-------- | -----------
|
||||||
[fission-all-1.2.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1-minikube.yaml) | `f645d4741c6396d71addcd1af0cdbf6791bb7b9f6dda3f0b3fea0359f70fe233`
|
[fission-all-1.7.0-rc.2-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-all-1.7.0-rc.2-openshift.yaml) | `67c0ffcb0e156b87237cd3a712a1435f09365701f4c516d5e9a83cb3f1c73041`
|
||||||
[fission-core-1.2.1.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1.yaml) | `aa0c50cd38cdde805c7fac62d18875ca72b0f420ccc17b179c067561eaa7249a`
|
[fission-core-1.7.0-rc.2.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-core-1.7.0-rc.2.yaml) | `79e620b73b6a6b9f3f0290aa5b8b6daf7f77e938e34e839fc8b84cee00351b49`
|
||||||
[fission-all-1.2.1.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1.yaml) | `f814b0e194b137235d8860336f488f51c93dea59cf3f8a15ff3e740a6c2972c1`
|
[fission-core-1.7.0-rc.2-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-core-1.7.0-rc.2-openshift.yaml) | `a180331a308500cc6bc936b6c6f262bef69e6d75d5d0a1a54e5912845822ff51`
|
||||||
[fission-core-1.2.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1-minikube.yaml) | `a12cc0037916c9ea5afb894d666533eaf66a543efb11f1bf4e0492e320039890`
|
[fission-all-1.7.0-rc.2-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-all-1.7.0-rc.2-minikube.yaml) | `7c43a8acc3125e4a25444cedda15e045c90d911689cb18042ce7c4a0f7b6cc73`
|
||||||
[fission-core-1.2.1.tgz](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1.tgz) | `09f573bd2cefa5106b0f67bc741ffa8440d9d65c9d87a27cde9a00513dd503d6`
|
[fission-core-1.7.0-rc.2-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-core-1.7.0-rc.2-minikube.yaml) | `9c052808104ae833e7d2ed23403f2c84a595f525ef7b9e53dee6b70a810cf032`
|
||||||
[fission-all-1.2.1.tgz](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1.tgz) | `9dce2e7bc1e59e4ef2746046751389ebcf8919cbe49829d614cad38449fbf7e1`
|
[fission-all-1.7.0-rc.2.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-all-1.7.0-rc.2.yaml) | `594ebff290c13ad590a0fa44bbbd45a5b5e0ee6fac853d197e7bc756773c5089`
|
||||||
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx) | `b171448a109ea8e3813a60068579d601da5b85584e106f52e790d3220a104bda`
|
[fission-core-1.7.0-rc.2.tgz](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-core-1.7.0-rc.2.tgz) | `8ba194e2bf9cf5ea95b851093675268d1bcb713bdf2f9f8ed0fae26fe7731718`
|
||||||
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux) | `29de834928464a4389decaaffa89854aa4533d2a914adfcf8844a8a2356e9cf0`
|
[fission-all-1.7.0-rc.2.tgz](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-all-1.7.0-rc.2.tgz) | `76359916272b408ee21e18a74e230d5f344bea5d95a050fc931547760a8b52b1`
|
||||||
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe) | `279a732cbeadd6eadbdce096d54f0ba242738ab2b5f0e710fc04bc2eb3459878`
|
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-cli-osx) | `0b79ba3bd1d74e3fdac12f966753c5268df3f32f7fdab3d11431fdfbd8d3e5d2`
|
||||||
|
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-cli-windows.exe) | `9f94e3ad7248b7f5883e78a8a7c0fb41ec7467680be445582e7e5fb1f6a62a50`
|
||||||
|
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.7.0-rc.2/fission-cli-linux) | `0f37a1164df007c540e36dead66226fc9919ad5182aa479baabc46da2e9ee72f`
|
||||||
|
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [1.7.0-rc.2](https://github.com/fission/fission/tree/1.7.0-rc.2) (2019-11-27)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.2...1.7.0-rc.2)
|
||||||
|
|
||||||
|
## [v1.7.0-rc.2](https://github.com/fission/fission/tree/v1.7.0-rc.2) (2019-11-27)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.7.0-rc.1...v1.7.0-rc.2)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Push extra tag to fit go module semver tag format [\#1444](https://github.com/fission/fission/pull/1444) ([life1347](https://github.com/life1347))
|
||||||
|
- Adopt existing orphan kubernetes resources when executor starts up [\#1443](https://github.com/fission/fission/pull/1443) ([life1347](https://github.com/life1347))
|
||||||
|
- Revert "Try to fix flaky canary test" [\#1442](https://github.com/fission/fission/pull/1442) ([life1347](https://github.com/life1347))
|
||||||
|
- Try to fix flaky canary test [\#1441](https://github.com/fission/fission/pull/1441) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix router tries to update ingress when createIngress is false [\#1440](https://github.com/fission/fission/pull/1440) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix poolmanager sets 0 timeout for function specialization [\#1439](https://github.com/fission/fission/pull/1439) ([life1347](https://github.com/life1347))
|
||||||
|
- Add huge response body test [\#1437](https://github.com/fission/fission/pull/1437) ([life1347](https://github.com/life1347))
|
||||||
|
- Return error when specialization failed [\#1436](https://github.com/fission/fission/pull/1436) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix poolmanager terminates running function pod periodically [\#1435](https://github.com/fission/fission/pull/1435) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow to tap multiple function services at one time [\#1434](https://github.com/fission/fission/pull/1434) ([life1347](https://github.com/life1347))
|
||||||
|
- Collect function metrics after finishing request [\#1433](https://github.com/fission/fission/pull/1433) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix poolmanager crashes when failed to list environment [\#1432](https://github.com/fission/fission/pull/1432) ([life1347](https://github.com/life1347))
|
||||||
|
- Ability to pull builder image from private registry [\#1431](https://github.com/fission/fission/pull/1431) ([life1347](https://github.com/life1347))
|
||||||
|
- Add checksum and insecure flag for user to skip checksum generation [\#1430](https://github.com/fission/fission/pull/1430) ([life1347](https://github.com/life1347))
|
||||||
|
- Support to set imagePullSecret when creating environment [\#1429](https://github.com/fission/fission/pull/1429) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix no kubeobjs get created if fn created before env creation [\#1428](https://github.com/fission/fission/pull/1428) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix verbosity flag not found in subcommand [\#1425](https://github.com/fission/fission/pull/1425) ([life1347](https://github.com/life1347))
|
||||||
|
- Improve compatibility with Openshift [\#1424](https://github.com/fission/fission/pull/1424) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix truncated body returned from router [\#1420](https://github.com/fission/fission/pull/1420) ([life1347](https://github.com/life1347))
|
||||||
|
- Fission 1.7.0-rc.1 [\#1419](https://github.com/fission/fission/pull/1419) ([life1347](https://github.com/life1347))
|
||||||
|
|
||||||
|
## [1.7.0-rc.1](https://github.com/fission/fission/tree/1.7.0-rc.1) (2019-11-18)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.1...1.7.0-rc.1)
|
||||||
|
|
||||||
|
## [v1.7.0-rc.1](https://github.com/fission/fission/tree/v1.7.0-rc.1) (2019-11-18)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.6.0...v1.7.0-rc.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update release-builder go and helm version [\#1418](https://github.com/fission/fission/pull/1418) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix failed to find init\_tools.sh [\#1417](https://github.com/fission/fission/pull/1417) ([life1347](https://github.com/life1347))
|
||||||
|
- Support semantic version tags [\#1416](https://github.com/fission/fission/pull/1416) ([life1347](https://github.com/life1347))
|
||||||
|
- Show warning when referencing nonexistent resources in spec [\#1415](https://github.com/fission/fission/pull/1415) ([life1347](https://github.com/life1347))
|
||||||
|
- Add resource info to output message when saving spec file [\#1414](https://github.com/fission/fission/pull/1414) ([life1347](https://github.com/life1347))
|
||||||
|
- Always embed given URL in the archive [\#1413](https://github.com/fission/fission/pull/1413) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix wrong command and flag usage description [\#1412](https://github.com/fission/fission/pull/1412) ([life1347](https://github.com/life1347))
|
||||||
|
- Add --spec to package command [\#1411](https://github.com/fission/fission/pull/1411) ([life1347](https://github.com/life1347))
|
||||||
|
- Drop unreleased features \(record & replay\) [\#1406](https://github.com/fission/fission/pull/1406) ([life1347](https://github.com/life1347))
|
||||||
|
- Build error formatting on fission spec apply --wait [\#1403](https://github.com/fission/fission/pull/1403) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor controller client package [\#1402](https://github.com/fission/fission/pull/1402) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix fn test failed to query logs from log database [\#1401](https://github.com/fission/fission/pull/1401) ([life1347](https://github.com/life1347))
|
||||||
|
- Skip trace for router healthz endpoint [\#1400](https://github.com/fission/fission/pull/1400) ([life1347](https://github.com/life1347))
|
||||||
|
- Set jaeger collector endpoint as an environment variable [\#1399](https://github.com/fission/fission/pull/1399) ([life1347](https://github.com/life1347))
|
||||||
|
- Replace deprecated serviceAccount with serviceAccountName [\#1398](https://github.com/fission/fission/pull/1398) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix helm pre-upgrade check failure problem [\#1397](https://github.com/fission/fission/pull/1397) ([life1347](https://github.com/life1347))
|
||||||
|
- Prettify console output message [\#1396](https://github.com/fission/fission/pull/1396) ([life1347](https://github.com/life1347))
|
||||||
|
- fix typo [\#1395](https://github.com/fission/fission/pull/1395) ([jjmengze](https://github.com/jjmengze))
|
||||||
|
- Reorder command flags and add missing flags [\#1394](https://github.com/fission/fission/pull/1394) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix CLI exits with status 0 when error occurs [\#1393](https://github.com/fission/fission/pull/1393) ([life1347](https://github.com/life1347))
|
||||||
|
- Poolmanager wait for function pod till specialization timeout [\#1392](https://github.com/fission/fission/pull/1392) ([life1347](https://github.com/life1347))
|
||||||
|
- Replace flag text with const [\#1391](https://github.com/fission/fission/pull/1391) ([life1347](https://github.com/life1347))
|
||||||
|
- Update prometheus version and disable it from the default installation [\#1389](https://github.com/fission/fission/pull/1389) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix helm shows "Not a table" issue when install Fission [\#1387](https://github.com/fission/fission/pull/1387) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix githook not aborting push if error occurs [\#1386](https://github.com/fission/fission/pull/1386) ([life1347](https://github.com/life1347))
|
||||||
|
- Migrate from urfave/cli to cobra [\#1385](https://github.com/fission/fission/pull/1385) ([life1347](https://github.com/life1347))
|
||||||
|
- Update maintainer info [\#1383](https://github.com/fission/fission/pull/1383) ([life1347](https://github.com/life1347))
|
||||||
|
- Update Makefile and add git pre-push hook [\#1382](https://github.com/fission/fission/pull/1382) ([life1347](https://github.com/life1347))
|
||||||
|
- Update staticcheck version and fix all warnings [\#1381](https://github.com/fission/fission/pull/1381) ([life1347](https://github.com/life1347))
|
||||||
|
- Make CLI functions return error instead of fatal out [\#1379](https://github.com/fission/fission/pull/1379) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor record command [\#1378](https://github.com/fission/fission/pull/1378) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix reverse proxy shows 404 not found when Istio enabled [\#1377](https://github.com/fission/fission/pull/1377) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor time trigger command [\#1376](https://github.com/fission/fission/pull/1376) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor mqtrigger command [\#1375](https://github.com/fission/fission/pull/1375) ([life1347](https://github.com/life1347))
|
||||||
|
- added example for builder podspec [\#1374](https://github.com/fission/fission/pull/1374) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Refactor function command [\#1372](https://github.com/fission/fission/pull/1372) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow to set API type for tensorflow serving environment [\#1371](https://github.com/fission/fission/pull/1371) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor canary config command [\#1370](https://github.com/fission/fission/pull/1370) ([life1347](https://github.com/life1347))
|
||||||
|
- PodSpec support in environment builder [\#1369](https://github.com/fission/fission/pull/1369) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Fix utility function uses the wrong flag text to get value [\#1368](https://github.com/fission/fission/pull/1368) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor HTTP trigger command [\#1367](https://github.com/fission/fission/pull/1367) ([life1347](https://github.com/life1347))
|
||||||
|
- Update READEME link and add back the basic usage [\#1366](https://github.com/fission/fission/pull/1366) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor kubewatch command [\#1365](https://github.com/fission/fission/pull/1365) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix accidentally removed timestamp when listing package [\#1364](https://github.com/fission/fission/pull/1364) ([life1347](https://github.com/life1347))
|
||||||
|
- Move route creation to function [\#1362](https://github.com/fission/fission/pull/1362) ([life1347](https://github.com/life1347))
|
||||||
|
- Remove UID from CLI output [\#1361](https://github.com/fission/fission/pull/1361) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow using URL as archive source when creating functions [\#1360](https://github.com/fission/fission/pull/1360) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor plugin & version subcommands [\#1359](https://github.com/fission/fission/pull/1359) ([life1347](https://github.com/life1347))
|
||||||
|
- Provide secrets and configmaps while updating the functions [\#1358](https://github.com/fission/fission/pull/1358) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Update fission architecture doc [\#1356](https://github.com/fission/fission/pull/1356) ([life1347](https://github.com/life1347))
|
||||||
|
- calling the function that handles kafka messages, asynchronously [\#1355](https://github.com/fission/fission/pull/1355) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Fix release script tags wrong image name & sed problem on Linux [\#1353](https://github.com/fission/fission/pull/1353) ([life1347](https://github.com/life1347))
|
||||||
|
- Update CHANGELOG for 1.6.0 [\#1352](https://github.com/fission/fission/pull/1352) ([life1347](https://github.com/life1347))
|
||||||
|
- Replace `AlwaysSample` with `ProbabilitySampler` in router \(\#1215\) [\#1348](https://github.com/fission/fission/pull/1348) ([ccamel](https://github.com/ccamel))
|
||||||
|
- Refactor package CLI command [\#1345](https://github.com/fission/fission/pull/1345) ([life1347](https://github.com/life1347))
|
||||||
|
|
||||||
|
## [1.6.0](https://github.com/fission/fission/tree/1.6.0) (2019-10-10)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/v1.6.0...1.6.0)
|
||||||
|
|
||||||
|
## [v1.6.0](https://github.com/fission/fission/tree/v1.6.0) (2019-10-10)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.5.0...v1.6.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Fission 1.6.0 [\#1351](https://github.com/fission/fission/pull/1351) ([life1347](https://github.com/life1347))
|
||||||
|
- Move statefulset to apps/v1 [\#1350](https://github.com/fission/fission/pull/1350) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix newdeploy failed to find serviceEntry in cache [\#1349](https://github.com/fission/fission/pull/1349) ([life1347](https://github.com/life1347))
|
||||||
|
- Support encoded path in router [\#1347](https://github.com/fission/fission/pull/1347) ([life1347](https://github.com/life1347))
|
||||||
|
- Support custom private go vendor [\#1346](https://github.com/fission/fission/pull/1346) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix the namespace mismatch problem when deploying with a single YAML file [\#1344](https://github.com/fission/fission/pull/1344) ([life1347](https://github.com/life1347))
|
||||||
|
- Move charts executor service to the right place [\#1343](https://github.com/fission/fission/pull/1343) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow to deploy router as DaemonSet [\#1342](https://github.com/fission/fission/pull/1342) ([life1347](https://github.com/life1347))
|
||||||
|
- add package filter feature [\#1341](https://github.com/fission/fission/pull/1341) ([jjmengze](https://github.com/jjmengze))
|
||||||
|
- Bump jvm builder JDK version [\#1340](https://github.com/fission/fission/pull/1340) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix executor doesn't apply user-configured container spec correctly [\#1339](https://github.com/fission/fission/pull/1339) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow to add annotations to router service in helm chart [\#1338](https://github.com/fission/fission/pull/1338) ([prabhu43](https://github.com/prabhu43))
|
||||||
|
- Remove too verbose and unhelpful debug log [\#1336](https://github.com/fission/fission/pull/1336) ([life1347](https://github.com/life1347))
|
||||||
|
- package will now be listed, sorted by lastupdatedtime [\#1334](https://github.com/fission/fission/pull/1334) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Fix router health route not found if no HTTP triggers created [\#1333](https://github.com/fission/fission/pull/1333) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix spec doesn't update status of failed package when applying spec files [\#1332](https://github.com/fission/fission/pull/1332) ([life1347](https://github.com/life1347))
|
||||||
|
- Move Deployment API group from extensions/v1beta1 to apps/v1 [\#1331](https://github.com/fission/fission/pull/1331) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix empty host value when list http triggers [\#1328](https://github.com/fission/fission/pull/1328) ([life1347](https://github.com/life1347))
|
||||||
|
- List/Delete HTTP triggers by function [\#1327](https://github.com/fission/fission/pull/1327) ([life1347](https://github.com/life1347))
|
||||||
|
- Add Ingress TLS support [\#1326](https://github.com/fission/fission/pull/1326) ([life1347](https://github.com/life1347))
|
||||||
|
- Add Ingress host, path and annotations support [\#1325](https://github.com/fission/fission/pull/1325) ([life1347](https://github.com/life1347))
|
||||||
|
- Set maxSurge to 20% for safe rolling upgrade [\#1321](https://github.com/fission/fission/pull/1321) ([life1347](https://github.com/life1347))
|
||||||
|
- Disable revision history for newdeploy [\#1319](https://github.com/fission/fission/pull/1319) ([life1347](https://github.com/life1347))
|
||||||
|
- Pre-built docker go module dependency cache image [\#1318](https://github.com/fission/fission/pull/1318) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix newdeploy doesn't handle error properly [\#1316](https://github.com/fission/fission/pull/1316) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix failed to update specialization timeout [\#1315](https://github.com/fission/fission/pull/1315) ([life1347](https://github.com/life1347))
|
||||||
|
- Add codecov config file [\#1314](https://github.com/fission/fission/pull/1314) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix potential nil pointer problem when using multierror pkg [\#1311](https://github.com/fission/fission/pull/1311) ([life1347](https://github.com/life1347))
|
||||||
|
- Use ErrorHandler to handle proxy error [\#1310](https://github.com/fission/fission/pull/1310) ([life1347](https://github.com/life1347))
|
||||||
|
- Integrate with Codecov [\#1308](https://github.com/fission/fission/pull/1308) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix executor unable to list secrets/configmaps [\#1307](https://github.com/fission/fission/pull/1307) ([life1347](https://github.com/life1347))
|
||||||
|
- Add specialization timeout default value to CLI [\#1305](https://github.com/fission/fission/pull/1305) ([life1347](https://github.com/life1347))
|
||||||
|
- Update CHANGELOG for 1.5.0 [\#1304](https://github.com/fission/fission/pull/1304) ([life1347](https://github.com/life1347))
|
||||||
|
- Fission 1.5.0 [\#1303](https://github.com/fission/fission/pull/1303) ([life1347](https://github.com/life1347))
|
||||||
|
- Implement TLS authentication for kafka mqt [\#1300](https://github.com/fission/fission/pull/1300) ([vadasambar](https://github.com/vadasambar))
|
||||||
|
- Issue 1229: Function level timeout [\#1284](https://github.com/fission/fission/pull/1284) ([parauliya](https://github.com/parauliya))
|
||||||
|
- Fix kafka producer and consumer logs show empty objects [\#1281](https://github.com/fission/fission/pull/1281) ([vadasambar](https://github.com/vadasambar))
|
||||||
|
|
||||||
|
## [1.5.0](https://github.com/fission/fission/tree/1.5.0) (2019-09-09)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.4.1...1.5.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Refactor support dump CLI [\#1301](https://github.com/fission/fission/pull/1301) ([life1347](https://github.com/life1347))
|
||||||
|
- \[fission-cli\]\[feature\] support reverse query function for query log [\#1298](https://github.com/fission/fission/pull/1298) ([moluzhang](https://github.com/moluzhang))
|
||||||
|
- Fix unit tests failure [\#1297](https://github.com/fission/fission/pull/1297) ([life1347](https://github.com/life1347))
|
||||||
|
- Support nodejs function with 0 argument [\#1295](https://github.com/fission/fission/pull/1295) ([life1347](https://github.com/life1347))
|
||||||
|
- Update go environment errors for specializeHandlerV2 [\#1294](https://github.com/fission/fission/pull/1294) ([e-nikolov](https://github.com/e-nikolov))
|
||||||
|
- Add troubleshooting guide link [\#1292](https://github.com/fission/fission/pull/1292) ([life1347](https://github.com/life1347))
|
||||||
|
- Bump nokogiri from 1.10.1 to 1.10.4 in /examples/ruby/parse [\#1291](https://github.com/fission/fission/pull/1291) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Bump Go version to 1.12 [\#1290](https://github.com/fission/fission/pull/1290) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix typo extraCoreComponmentPodConfig -\> extraCoreComponentPodConfig [\#1287](https://github.com/fission/fission/pull/1287) ([life1347](https://github.com/life1347))
|
||||||
|
- Improve CI integration test script [\#1285](https://github.com/fission/fission/pull/1285) ([life1347](https://github.com/life1347))
|
||||||
|
- support for providing multiple CMs and secrets in fn create [\#1282](https://github.com/fission/fission/pull/1282) ([viveksinghggits](https://github.com/viveksinghggits))
|
||||||
|
- Fix typo "consumer" =\> "producer" [\#1278](https://github.com/fission/fission/pull/1278) ([vadasambar](https://github.com/vadasambar))
|
||||||
|
- Fix go 1.9.2 & 1.11.4 shows "go mod not found" [\#1276](https://github.com/fission/fission/pull/1276) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix typo "specialing" -\> "specializing" [\#1275](https://github.com/fission/fission/pull/1275) ([vadasambar](https://github.com/vadasambar))
|
||||||
|
- Added community meetings and some other changes [\#1273](https://github.com/fission/fission/pull/1273) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- fix a panic bug caused by err.Error\(\) [\#1271](https://github.com/fission/fission/pull/1271) ([cocoifly10](https://github.com/cocoifly10))
|
||||||
|
- Use fuzzy version for openJDK dependency [\#1269](https://github.com/fission/fission/pull/1269) ([life1347](https://github.com/life1347))
|
||||||
|
- Set full URL path to request header [\#1266](https://github.com/fission/fission/pull/1266) ([life1347](https://github.com/life1347))
|
||||||
|
- Refactor environment CLI command [\#1265](https://github.com/fission/fission/pull/1265) ([life1347](https://github.com/life1347))
|
||||||
|
- Added correct imagePullPolicy [\#1263](https://github.com/fission/fission/pull/1263) ([msshroff](https://github.com/msshroff))
|
||||||
|
- Make NewDeployment wait timeout configurable [\#1260](https://github.com/fission/fission/pull/1260) ([vadasambar](https://github.com/vadasambar))
|
||||||
|
- Issue \#1258: Allow empty repository tag in chart values.yaml [\#1259](https://github.com/fission/fission/pull/1259) ([parauliya](https://github.com/parauliya))
|
||||||
|
- Fix release script tags wrong image name [\#1257](https://github.com/fission/fission/pull/1257) ([life1347](https://github.com/life1347))
|
||||||
|
- Update tensorflow serving image name in env README [\#1256](https://github.com/fission/fission/pull/1256) ([life1347](https://github.com/life1347))
|
||||||
|
- V1.4.1 [\#1255](https://github.com/fission/fission/pull/1255) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Fix environment version validation [\#1253](https://github.com/fission/fission/pull/1253) ([davidsmf](https://github.com/davidsmf))
|
||||||
|
- Allow to set deployment config uid during initialization [\#1249](https://github.com/fission/fission/pull/1249) ([life1347](https://github.com/life1347))
|
||||||
|
- Add swagger \(OpenAPI 2.0\) support [\#1245](https://github.com/fission/fission/pull/1245) ([life1347](https://github.com/life1347))
|
||||||
|
- Update go dependencies [\#1240](https://github.com/fission/fission/pull/1240) ([life1347](https://github.com/life1347))
|
||||||
|
|
||||||
|
## [1.4.1](https://github.com/fission/fission/tree/1.4.1) (2019-07-29)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.4.0...1.4.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Fix wrongly replace spec api version [\#1254](https://github.com/fission/fission/pull/1254) ([life1347](https://github.com/life1347))
|
||||||
|
- Revert change of product name in README [\#1250](https://github.com/fission/fission/pull/1250) ([davidsmf](https://github.com/davidsmf))
|
||||||
|
- Analytics env fix in chart [\#1247](https://github.com/fission/fission/pull/1247) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Fix CI unable to start test due to the same travis build ID [\#1246](https://github.com/fission/fission/pull/1246) ([life1347](https://github.com/life1347))
|
||||||
|
- V1.4.0 [\#1244](https://github.com/fission/fission/pull/1244) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
|
||||||
|
## [1.4.0](https://github.com/fission/fission/tree/1.4.0) (2019-07-24)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.3.0...1.4.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update flask version to resolve CVE alert [\#1243](https://github.com/fission/fission/pull/1243) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix typo where "spec" is spelt "sepc" in some dump directories. [\#1239](https://github.com/fission/fission/pull/1239) ([davidsmf](https://github.com/davidsmf))
|
||||||
|
- Fix fetcher client doesn't handle error properly [\#1238](https://github.com/fission/fission/pull/1238) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix build failed due to script unable to find configmap [\#1237](https://github.com/fission/fission/pull/1237) ([life1347](https://github.com/life1347))
|
||||||
|
- Enable concurrent CI builds [\#1236](https://github.com/fission/fission/pull/1236) ([life1347](https://github.com/life1347))
|
||||||
|
- Change log-level for better performance and less annoying logs [\#1231](https://github.com/fission/fission/pull/1231) ([life1347](https://github.com/life1347))
|
||||||
|
- Replace localhost with 127.0.0.1 to prevent DNS resolving problem [\#1227](https://github.com/fission/fission/pull/1227) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix release script wrongly tags builder as env image [\#1226](https://github.com/fission/fission/pull/1226) ([life1347](https://github.com/life1347))
|
||||||
|
- Make router keep-alive setting configurable [\#1225](https://github.com/fission/fission/pull/1225) ([life1347](https://github.com/life1347))
|
||||||
|
- Function Update if config/secret changes [\#1224](https://github.com/fission/fission/pull/1224) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Fix nil pointer when CLI unable to get server version [\#1223](https://github.com/fission/fission/pull/1223) ([life1347](https://github.com/life1347))
|
||||||
|
- Reuse go docker build cache [\#1218](https://github.com/fission/fission/pull/1218) ([life1347](https://github.com/life1347))
|
||||||
|
- Allow to set log level through environment variable [\#1217](https://github.com/fission/fission/pull/1217) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix roundtripper doesn't increase request timeout setting after each retry [\#1216](https://github.com/fission/fission/pull/1216) ([life1347](https://github.com/life1347))
|
||||||
|
- Configmaps/secrets in function exist check [\#1214](https://github.com/fission/fission/pull/1214) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Add experimental environment: tensorflow-serving [\#1212](https://github.com/fission/fission/pull/1212) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix executor panic problem when specialization timeout [\#1211](https://github.com/fission/fission/pull/1211) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix fetcher of newdeploy pod error out when starting up. [\#1210](https://github.com/fission/fission/pull/1210) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix Istio-proxy cannot collect HTTP-level information [\#1209](https://github.com/fission/fission/pull/1209) ([life1347](https://github.com/life1347))
|
||||||
|
- Fix poolmanager specializes a function pod repeatedly if istio is enabled [\#1208](https://github.com/fission/fission/pull/1208) ([life1347](https://github.com/life1347))
|
||||||
|
- Reuse docker maven build cache in JVM environment build process [\#1207](https://github.com/fission/fission/pull/1207) ([life1347](https://github.com/life1347))
|
||||||
|
- modify code to make log collection comprehensive [\#1206](https://github.com/fission/fission/pull/1206) ([cocoifly10](https://github.com/cocoifly10))
|
||||||
|
- Fallback to get user home directory from env [\#1203](https://github.com/fission/fission/pull/1203) ([life1347](https://github.com/life1347))
|
||||||
|
- Fission v1.3.0 [\#1202](https://github.com/fission/fission/pull/1202) ([life1347](https://github.com/life1347))
|
||||||
|
- \[bugfix\] Fix CLI drops controller URL path when querying logs [\#1201](https://github.com/fission/fission/pull/1201) ([moluzhang](https://github.com/moluzhang))
|
||||||
|
- Enable go module support for go environment [\#1152](https://github.com/fission/fission/pull/1152) ([life1347](https://github.com/life1347))
|
||||||
|
|
||||||
|
## [1.3.0](https://github.com/fission/fission/tree/1.3.0) (2019-06-03)
|
||||||
|
[Full Changelog](https://github.com/fission/fission/compare/1.2.1...1.3.0)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Check fission CLI & server git commit SHA before test [\#1200](https://github.com/fission/fission/pull/1200) ([life1347](https://github.com/life1347))
|
||||||
|
- Add readiness/liveness probes to nat-streaming [\#1199](https://github.com/fission/fission/pull/1199) ([life1347](https://github.com/life1347))
|
||||||
|
- Update bug issue templates [\#1198](https://github.com/fission/fission/pull/1198) ([life1347](https://github.com/life1347))
|
||||||
|
- Add static code analysis to CI test [\#1197](https://github.com/fission/fission/pull/1197) ([life1347](https://github.com/life1347))
|
||||||
|
- Analytics bugfix [\#1195](https://github.com/fission/fission/pull/1195) ([soamvasani](https://github.com/soamvasani))
|
||||||
|
- Add Terraform configuration and upgrade helm version [\#1194](https://github.com/fission/fission/pull/1194) ([darkgerm](https://github.com/darkgerm))
|
||||||
|
- Show warning message if spec alters poolsize while env version \< 3 [\#1193](https://github.com/fission/fission/pull/1193) ([life1347](https://github.com/life1347))
|
||||||
|
- Move packages to proejct/pkg to follow go project folder structure convention [\#1190](https://github.com/fission/fission/pull/1190) ([life1347](https://github.com/life1347))
|
||||||
|
- router analytics -- close http response body [\#1180](https://github.com/fission/fission/pull/1180) ([soamvasani](https://github.com/soamvasani))
|
||||||
|
- Remove prometheus server connectivity test during controller initialization [\#1179](https://github.com/fission/fission/pull/1179) ([life1347](https://github.com/life1347))
|
||||||
|
- V1.2.1 [\#1178](https://github.com/fission/fission/pull/1178) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Skaffold for Fission [\#1172](https://github.com/fission/fission/pull/1172) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Add affinity support [\#1170](https://github.com/fission/fission/pull/1170) ([laurence-hudson-mindfoundry](https://github.com/laurence-hudson-mindfoundry))
|
||||||
|
- Using templated imagePullPolicy for containers in deployment.yaml [\#1137](https://github.com/fission/fission/pull/1137) ([msshroff](https://github.com/msshroff))
|
||||||
|
- Refactor test framework [\#1128](https://github.com/fission/fission/pull/1128) ([darkgerm](https://github.com/darkgerm))
|
||||||
|
- Pod specs [\#1106](https://github.com/fission/fission/pull/1106) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
|
- Allow non-toplevel modules in python environment [\#1042](https://github.com/fission/fission/pull/1042) ([soamvasani](https://github.com/soamvasani))
|
||||||
|
- Created dotnet2.0 Builder Image and Added /v2/specialized Endpoint to dotnet2.0 Envrionment [\#1001](https://github.com/fission/fission/pull/1001) ([paraspatidar](https://github.com/paraspatidar))
|
||||||
|
|
||||||
## [1.2.1](https://github.com/fission/fission/tree/1.2.1) (2019-05-09)
|
## [1.2.1](https://github.com/fission/fission/tree/1.2.1) (2019-05-09)
|
||||||
[Full Changelog](https://github.com/fission/fission/compare/1.2.0...1.2.1)
|
[Full Changelog](https://github.com/fission/fission/compare/1.2.0...1.2.1)
|
||||||
|
|
||||||
@@ -38,7 +281,6 @@ filename | sha256 hash
|
|||||||
- Fix TravisCI go environment version to avoid go bugs [\#1154](https://github.com/fission/fission/pull/1154) ([life1347](https://github.com/life1347))
|
- Fix TravisCI go environment version to avoid go bugs [\#1154](https://github.com/fission/fission/pull/1154) ([life1347](https://github.com/life1347))
|
||||||
- \#1132 nodejs environment, increase body size [\#1149](https://github.com/fission/fission/pull/1149) ([JannikZed](https://github.com/JannikZed))
|
- \#1132 nodejs environment, increase body size [\#1149](https://github.com/fission/fission/pull/1149) ([JannikZed](https://github.com/JannikZed))
|
||||||
- Added php builder to release script fixes \#1140 [\#1145](https://github.com/fission/fission/pull/1145) ([vishal-biyani](https://github.com/vishal-biyani))
|
- Added php builder to release script fixes \#1140 [\#1145](https://github.com/fission/fission/pull/1145) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
- Using templated imagePullPolicy for containers in deployment.yaml [\#1137](https://github.com/fission/fission/pull/1137) ([msshroff](https://github.com/msshroff))
|
|
||||||
- Migrate from glide to official dependencies management tool: Go Module [\#1136](https://github.com/fission/fission/pull/1136) ([life1347](https://github.com/life1347))
|
- Migrate from glide to official dependencies management tool: Go Module [\#1136](https://github.com/fission/fission/pull/1136) ([life1347](https://github.com/life1347))
|
||||||
- Fix misleading log when setup portforward [\#1134](https://github.com/fission/fission/pull/1134) ([life1347](https://github.com/life1347))
|
- Fix misleading log when setup portforward [\#1134](https://github.com/fission/fission/pull/1134) ([life1347](https://github.com/life1347))
|
||||||
- V1.1.0 [\#1129](https://github.com/fission/fission/pull/1129) ([vishal-biyani](https://github.com/vishal-biyani))
|
- V1.1.0 [\#1129](https://github.com/fission/fission/pull/1129) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||||
@@ -657,7 +899,7 @@ filename | sha256 hash
|
|||||||
- Fix Markdown table [\#136](https://github.com/fission/fission/pull/136) ([RobertHerhold](https://github.com/RobertHerhold))
|
- Fix Markdown table [\#136](https://github.com/fission/fission/pull/136) ([RobertHerhold](https://github.com/RobertHerhold))
|
||||||
- Symlink user function's node\_modules to server's node\_modules [\#133](https://github.com/fission/fission/pull/133) ([soamvasani](https://github.com/soamvasani))
|
- Symlink user function's node\_modules to server's node\_modules [\#133](https://github.com/fission/fission/pull/133) ([soamvasani](https://github.com/soamvasani))
|
||||||
- Add function logs support \(\#53\) [\#131](https://github.com/fission/fission/pull/131) ([life1347](https://github.com/life1347))
|
- Add function logs support \(\#53\) [\#131](https://github.com/fission/fission/pull/131) ([life1347](https://github.com/life1347))
|
||||||
- Remove redundant hello.js from charts directory [\#130](https://github.com/fission/fission/pull/130) ([ssudake21](https://github.com/ssudake21))
|
- Remove redundant hello.js from charts directory [\#130](https://github.com/fission/fission/pull/130) ([sanketsudake](https://github.com/sanketsudake))
|
||||||
- Handle errors in filestore init \(\#108\) [\#127](https://github.com/fission/fission/pull/127) ([soamvasani](https://github.com/soamvasani))
|
- Handle errors in filestore init \(\#108\) [\#127](https://github.com/fission/fission/pull/127) ([soamvasani](https://github.com/soamvasani))
|
||||||
- \[WIP\] Golang runtime [\#125](https://github.com/fission/fission/pull/125) ([nouney](https://github.com/nouney))
|
- \[WIP\] Golang runtime [\#125](https://github.com/fission/fission/pull/125) ([nouney](https://github.com/nouney))
|
||||||
- Modify the stock example to show how to change the Content-Type [\#124](https://github.com/fission/fission/pull/124) ([gonrial](https://github.com/gonrial))
|
- Modify the stock example to show how to change the Content-Type [\#124](https://github.com/fission/fission/pull/124) ([gonrial](https://github.com/gonrial))
|
||||||
@@ -678,7 +920,7 @@ filename | sha256 hash
|
|||||||
- Add initial support for PHP7 [\#97](https://github.com/fission/fission/pull/97) ([dgoujard](https://github.com/dgoujard))
|
- Add initial support for PHP7 [\#97](https://github.com/fission/fission/pull/97) ([dgoujard](https://github.com/dgoujard))
|
||||||
- kubewatcher example: send watch updates to slack [\#96](https://github.com/fission/fission/pull/96) ([soamvasani](https://github.com/soamvasani))
|
- kubewatcher example: send watch updates to slack [\#96](https://github.com/fission/fission/pull/96) ([soamvasani](https://github.com/soamvasani))
|
||||||
- bugfix \(cli\) Update the URL check to work with https [\#94](https://github.com/fission/fission/pull/94) ([andrewstuart](https://github.com/andrewstuart))
|
- bugfix \(cli\) Update the URL check to work with https [\#94](https://github.com/fission/fission/pull/94) ([andrewstuart](https://github.com/andrewstuart))
|
||||||
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([ssudake21](https://github.com/ssudake21))
|
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([sanketsudake](https://github.com/sanketsudake))
|
||||||
- Wait for Pod IP while waiting for pod ready [\#89](https://github.com/fission/fission/pull/89) ([soamvasani](https://github.com/soamvasani))
|
- Wait for Pod IP while waiting for pod ready [\#89](https://github.com/fission/fission/pull/89) ([soamvasani](https://github.com/soamvasani))
|
||||||
- Added support for running C\# code in a dotnet core environment [\#84](https://github.com/fission/fission/pull/84) ([ktrance](https://github.com/ktrance))
|
- Added support for running C\# code in a dotnet core environment [\#84](https://github.com/fission/fission/pull/84) ([ktrance](https://github.com/ktrance))
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting the project team at codeofconduct@platform9.com. All
|
reported by contacting the project team at slack channel. All
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
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
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
|||||||
+1
-2
@@ -34,9 +34,8 @@ If you choose a big chunk of work that involves design changes to
|
|||||||
Fission, please talk to us while planning the change; that way we can
|
Fission, please talk to us while planning the change; that way we can
|
||||||
all be on the same page before you invest too much work into it.
|
all be on the same page before you invest too much work into it.
|
||||||
|
|
||||||
* Drop by the [slack channel](http://slack.fission.io)
|
* Drop by the [slack channel](http://slack.fission.io).
|
||||||
* Say hi on [twitter](https://twitter.com/fissionio).
|
* Say hi on [twitter](https://twitter.com/fissionio).
|
||||||
* Email soamvasani@platform9.com
|
|
||||||
|
|
||||||
### Contribution Howto
|
### Contribution Howto
|
||||||
|
|
||||||
|
|||||||
+150
-94
@@ -1,105 +1,186 @@
|
|||||||
|
# A high-level view of the internals of Fission.
|
||||||
|
|
||||||
A high level view of the internals of Fission.
|
## How it works
|
||||||
|
|
||||||
How it works
|
|
||||||
============
|
|
||||||
|
|
||||||
Fission is a FaaS -- users create functions (source level), register
|
Fission is a FaaS -- users create functions (source level), register
|
||||||
them with fission using a CLI, and associate functions with triggers.
|
them with Fission using a CLI, and associate functions with triggers.
|
||||||
|
|
||||||
Fission wraps those functions into a service, and runs them on
|
Fission wraps those functions into a service and runs them on
|
||||||
Kubernetes on demand.
|
Kubernetes on demand.
|
||||||
|
|
||||||
Here's an overview of the services that make up fission.
|
Here's an overview of the services that make up Fission.
|
||||||
|
|
||||||
Components
|
## Components
|
||||||
==========
|
|
||||||
|
|
||||||
Language-neutral components:
|
Core Components:
|
||||||
|
* Controller
|
||||||
|
* Executor
|
||||||
|
* Environment Container (language-specific)
|
||||||
|
* Router
|
||||||
|
* Builder Manager
|
||||||
|
* Storage Service
|
||||||
|
|
||||||
* controller
|
Optional Components:
|
||||||
* poolmgr
|
* Logger
|
||||||
* router
|
* Kubewatcher
|
||||||
* kubewatcher
|
* Message Queue Trigger
|
||||||
|
* Timer
|
||||||
|
|
||||||
Language-specific components:
|
Third-party components:
|
||||||
|
* InfluxDB: To store function logs.
|
||||||
|
* Prometheus: For metric collection and canary deployment.
|
||||||
|
* NATS Streaming: For message queue trigger. (Kafka, Azure are not included in charts deployment.)
|
||||||
|
|
||||||
* Environment container(s)
|
## Core Components
|
||||||
|
|
||||||
|
### Controller
|
||||||
|
|
||||||
Controller
|
The controller contains CRUD APIs for functions, triggers, environments,
|
||||||
----------
|
Kubernetes event watches, etc. This is the component that the client talks to.
|
||||||
|
|
||||||
The controller contains CRUD APIs for functions, http triggers,
|
All fission resources are stored in kubernetes CRDs. It needs to be able to
|
||||||
environments, Kubernetes event watches. This is the component that
|
talk to kubernetes API service.
|
||||||
the client talks to.
|
|
||||||
|
|
||||||
This is the only stateful component. It needs to be configured with a
|
### Executor
|
||||||
URL to an etcd cluster and a path to a persistent volume. The volume
|
|
||||||
is used to store the functions' source code. Etcd is used as the DB.
|
|
||||||
|
|
||||||
[Work to extend to other storage backends is planned, see issue #83.]
|
The executor has two simple APIs; the router calls both these endpoints.
|
||||||
|
|
||||||
Pool Manager
|
* GetFunctionService takes function metadata and dispatches the corresponding executor
|
||||||
------------
|
type to get the address of a service/pod and returns it to the router.
|
||||||
|
|
||||||
|
* TapService lets executor know a service/pod is being used; if it's not
|
||||||
|
called for a few minutes the pod(s) backing the service are killed.
|
||||||
|
|
||||||
Poolmgr manages pools of generic containers and function containers.
|
It now supports two different executor types:
|
||||||
|
|
||||||
It has a simple API; both these endpoints are called by the router.
|
* PoolManager
|
||||||
|
* NewDeploy
|
||||||
|
|
||||||
* GetFunctionService takes function metadata and returns the address
|
These two executor types have different strategies to launch, specialize, and manage pod(s).
|
||||||
of a service.
|
You should choose one of the executor types wisely based on the scenario.
|
||||||
|
|
||||||
* TapService lets poolmgr know a service is being used; if it's not
|
|
||||||
called for a few minutes the pod(s) backing the service are killed.
|
|
||||||
|
|
||||||
Poolmgr watches the controller API and eagerly creates generic pools
|
#### PoolManager
|
||||||
for environments. It uses Kubernetes deployments to do that. The
|
|
||||||
environment container runs in a pod with the 'fetcher' container.
|
|
||||||
Fetcher is a very simple utility that downloads a URL sent to it and
|
|
||||||
saves it at a configured location.
|
|
||||||
|
|
||||||
GetFunctionService "specializes" a pod. The implementation chooses a
|
PoolManager manages pools of generic containers and function containers.
|
||||||
pod from the pool, relabels it to "orphan" the pod from the
|
|
||||||
deployment, invokes fetcher to copy the function into the pod, and
|
|
||||||
hits the the specialize endpoint on the environment container. This
|
|
||||||
causes the function to be loaded. The pod is now specific to that
|
|
||||||
function.
|
|
||||||
|
|
||||||
This function pod is cached; it's cleaned up if it's unused for a few
|
PoolManager watches the environment CRD changes and eagerly creates generic pools
|
||||||
minutes.
|
for environments. It uses Kubernetes deployments to do that. The
|
||||||
|
environment container runs in a pod with the 'fetcher' container.
|
||||||
|
Fetcher is a straightforward utility that downloads a URL sent to it
|
||||||
|
and saves it at a configured location (shared volume).
|
||||||
|
|
||||||
Router
|
The implementation chooses a generic pod from the pool, relabels it to
|
||||||
------
|
"orphan". The pod from the deployment invokes fetcher to copy the function
|
||||||
|
into the pod and hits the specialize endpoint on the environment container.
|
||||||
|
This causes the function to be loaded. The pod is now specific to that
|
||||||
|
function. This function pod is cached; it's cleaned up if it's unused for a few minutes.
|
||||||
|
|
||||||
The router forwards HTTP requests to function pods. If there's no
|
PoolManager selects a generic pod from the warm pool, specializes it,
|
||||||
running service for a function, it requests one from poolmgr, while
|
and recycles the pod if there are no further requests to the function after a few minutes.
|
||||||
holding on to the request; when the function's service is ready it
|
It makes PoolManager suitable for functions that are short-living
|
||||||
forwards the request.
|
and requires a short cold start time [1].
|
||||||
|
|
||||||
The router is stateless and can be scaled up if needed, according to
|
However, PoolManager only selects one pod per function, which is not
|
||||||
|
suitable for serving massive traffic. In such cases, you should consider
|
||||||
|
using NewDeploy as executor type of function.
|
||||||
|
|
||||||
|
[1] The cold start time depends on the package size of the function. If it's
|
||||||
|
a snippet of code, the cold start time usually is less then 100ms.
|
||||||
|
|
||||||
|
#### NewDeploy
|
||||||
|
|
||||||
|
NewDeploy creates deployment, service, and HPA for functions in order to handle
|
||||||
|
massive traffic.
|
||||||
|
|
||||||
|
NewDeploy watches the function CRD changes and creates a Kubernetes deployment,
|
||||||
|
service, and HPA for a function. NewDeploy will scale the replicas of a function
|
||||||
|
deployment to the minimum feasible scale setting, if the minimum scale setting of
|
||||||
|
a function is greater than 0. The 'fetcher' inside the pod uses a URL in the
|
||||||
|
JSON payload, which is attached as a parameter to start fetcher, to download the
|
||||||
|
function package instead of waiting for calls from NewDeploy.
|
||||||
|
|
||||||
|
When a function experiences a traffic spike, the service helps to distribute the requests to
|
||||||
|
pods belonging to the function for better workload distribution and lower latency. Also,
|
||||||
|
the HPA scales the replicas of the deployment based on the conditions set by the user.
|
||||||
|
|
||||||
|
This approach though increases the cold time of a function, but also makes NewDeploy
|
||||||
|
suitable for functions designed to serve massive traffic.
|
||||||
|
|
||||||
|
### Environment Container
|
||||||
|
|
||||||
|
Environment containers run user-defined functions and are language-specific.
|
||||||
|
Each environment container must contain an HTTP server and a loader for functions.
|
||||||
|
|
||||||
|
The pool manager deploys the environment container into a pod with fetcher
|
||||||
|
(fetcher is a simple utility that can fetch an HTTP URL to a file at a
|
||||||
|
configured location). This pod forms a "generic pod" because it can
|
||||||
|
be loaded with any function in that coding language.
|
||||||
|
|
||||||
|
When the pool manager needs to create a service for a function, it calls
|
||||||
|
fetcher to fetch the function. Fetcher downloads the function into a
|
||||||
|
volume shared between fetcher and this environment container. Poolmgr
|
||||||
|
then requests the container to load the function.
|
||||||
|
|
||||||
|
### Router
|
||||||
|
|
||||||
|
The router forwards HTTP requests to function pods. If there's no
|
||||||
|
running service for a function, it requests one from executor, while
|
||||||
|
holding on to the request; the router will forward the request to
|
||||||
|
the pod once the function service is ready.
|
||||||
|
|
||||||
|
The router is the only stateless component and can be scaled up if needed, according to
|
||||||
load.
|
load.
|
||||||
|
|
||||||
Kubewatcher
|
### Builder Manager
|
||||||
-----------
|
|
||||||
|
The builder manager watches the package & environments CRD changes and manages
|
||||||
|
the builds of function source code. Once an environment that contains a builder
|
||||||
|
image is created, the builder manager will then creates the Kubernetes service
|
||||||
|
and deployment under the fission-builder namespace to start the environment
|
||||||
|
builder. And once a package that contains a source archive is created, the
|
||||||
|
builder manager talks to the environment builder to build the function's source
|
||||||
|
archive into a deploy archive for function deployment.
|
||||||
|
|
||||||
|
After the build, the builder manager asks Builder to upload the deploy archive to the
|
||||||
|
Storage Service once the build succeeded, and updates the package status attached with build logs.
|
||||||
|
|
||||||
|
### Storage Service
|
||||||
|
|
||||||
|
The storage service is the home for all archives of packages with sizes larger than 256KB.
|
||||||
|
The Builder pulls the source archive from the storage service and uploads deploy archive to it.
|
||||||
|
The fetcher inside the function pod also pulls the deploy archive for function specialization.
|
||||||
|
|
||||||
|
## Optional Components
|
||||||
|
|
||||||
|
### Logger
|
||||||
|
|
||||||
|
Logger is deployed as DaemonSet to help to forward function logs to a centralized
|
||||||
|
database service for log persistence. Currently, only InfluxDB is supported to store logs.
|
||||||
|
|
||||||
|
Following is a diagram describe how log service works:
|
||||||
|
1. Logger watches pod changes and creates a symlink to the container log if the pod runs on the same node.
|
||||||
|
2. Fluentd reads logs from symlink and pipes them to InfluxDB
|
||||||
|
3. `fission function logs ...` retrieve event logs from InfluxDB with optional log filter
|
||||||
|
4. Logger removes the symlink if the pod no longer exists.
|
||||||
|
|
||||||
|
### Kubewatcher
|
||||||
|
|
||||||
Kubewatcher watches the Kubernetes API and invokes functions
|
Kubewatcher watches the Kubernetes API and invokes functions
|
||||||
associated with watches, sending the watch event to the function.
|
associated with watches, sending the watch event to the function.
|
||||||
|
|
||||||
The controller keeps track of user's requested watches and associated
|
The controller keeps track of the user's requested watches and associated
|
||||||
functions. Kubewatcher watches the API based on these requests; when
|
functions. Kubewatcher watches the API based on these requests; when
|
||||||
a watch event occurs, it serializes the object and calls the function
|
a watch event occurs, it serializes the object and calls the function
|
||||||
via the router.
|
via the router.
|
||||||
|
|
||||||
While a few simple retries are done, there isn't yet a reliable
|
While a few simple retries are done, there isn't yet a reliable
|
||||||
message bus between Kubewatcher and the function. Work for this is
|
message bus between Kubewatcher and the function. Work for this is
|
||||||
tracked in issue #64.
|
tracked in issue #64.
|
||||||
|
|
||||||
Message Queue Trigger
|
### Message Queue Trigger
|
||||||
---------------------
|
|
||||||
|
|
||||||
A message queue trigger binds a message queue topic to a function:
|
A message queue trigger binds a message queue topic to a function:
|
||||||
events from that topic cause the function to be invoked with the
|
Events from that topic cause the function to be invoked with the
|
||||||
message as the body of the request. The trigger may also contain a
|
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 topic: if specified, the function's output is sent to this
|
||||||
response.
|
response.
|
||||||
@@ -108,37 +189,12 @@ Here's a diagram of the components:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Environment Container
|
### Timer
|
||||||
---------------------
|
|
||||||
|
|
||||||
Environment containers run user-defined functions. Environment
|
The timer works like kubernetes CronJob but instead of creating a pod to do the task,
|
||||||
containers are language specific. Each environment container must
|
it sends a request to router to invoke the function. It's suitable for the background tasks that
|
||||||
contain an HTTP server and a loader for functions.
|
need to executor periodically.
|
||||||
|
|
||||||
Poolmgr deploys the environment container into a pod with fetcher
|
The timer works like a Kubernetes CronJob, but instead of creating a
|
||||||
(fetcher is a simple utility that can fetch an HTTP url to a file at a
|
pod to do the task, it sends a request to the router to invoke the
|
||||||
configured location). This pod forms a "generic pod", because it can
|
function. It is suitable for background tasks that need to execute periodically.
|
||||||
be loaded with any function in that language.
|
|
||||||
|
|
||||||
When poolmgr needs to create a service for a function, it calls
|
|
||||||
fetcher to fetch the function. Fetcher downloads the function into a
|
|
||||||
volume shared between fetcher and this environment container. Poolmgr
|
|
||||||
then requests the container to load the function.
|
|
||||||
|
|
||||||
Logger
|
|
||||||
------
|
|
||||||
|
|
||||||
Logger helps to forward function logs to centralized db service for log
|
|
||||||
persistence. Currently only influxdb is supported to store logs.
|
|
||||||
Following is a diagram describe how log service works:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
1. Pool manager chooses a pod from the pool to execute user function
|
|
||||||
2. Pool manager makes a HTTP POST to logger helper, once helper receives
|
|
||||||
the request it creates a symlink to container log for fluentd.
|
|
||||||
3. Fluentd reads log from symlink and pipes to influxdb
|
|
||||||
4. `fission function logs ...` retrieve event logs from influxdb with
|
|
||||||
optional log filter
|
|
||||||
5. Pool manager removes function pod from pool
|
|
||||||
6. Pool manager asks logger helper to stop piping logs, logger removes symlink.
|
|
||||||
|
|||||||
@@ -11,36 +11,38 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
.PHONY: test
|
|
||||||
.DEFAULT_GOAL := build
|
|
||||||
|
|
||||||
IMAGE ?= fission/fission-bundle
|
.DEFAULT_GOAL := check
|
||||||
VERSION ?= latest
|
|
||||||
ARCH ?= amd64
|
|
||||||
OS ?= linux
|
|
||||||
|
|
||||||
test:
|
check: test-run build clean
|
||||||
go test -v $(go list ./... | grep -v /examples/ | grep -v /environments/)
|
|
||||||
|
|
||||||
build: build-bundle build-client
|
# run basic check scripts
|
||||||
|
test-run:
|
||||||
|
hack/verify-gofmt.sh
|
||||||
|
hack/verify-govet.sh
|
||||||
|
hack/verify-staticcheck.sh
|
||||||
|
hack/runtests.sh
|
||||||
|
@rm -f coverage.txt
|
||||||
|
|
||||||
build-client:
|
# ensure the changes are buildable
|
||||||
|
build:
|
||||||
|
go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
||||||
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
|
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
|
||||||
|
go build -o cmd/fetcher/fetcher ./cmd/fetcher/
|
||||||
|
go build -o cmd/fetcher/builder ./cmd/builder/
|
||||||
|
|
||||||
build-bundle:
|
# install CLI binary to $PATH
|
||||||
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
install: build
|
||||||
|
mv cmd/fission-cli/fission $(GOPATH)/bin
|
||||||
|
|
||||||
build-image:
|
# build images (environment images are not included)
|
||||||
docker build --rm --tag "$(IMAGE):$(VERSION)" cmd/fission-bundle/
|
image:
|
||||||
|
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
|
||||||
install:
|
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
|
||||||
go install ./cmd/fission-cli/
|
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
|
||||||
|
|
||||||
image: build-bundle build-image
|
|
||||||
|
|
||||||
image-push: image
|
|
||||||
docker push "$(IMAGE):$(VERSION)"
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f fission-bundle/fission-bundle
|
@rm -f cmd/fission-bundle/fission-bundle
|
||||||
@rm -f fission/fission
|
@rm -f cmd/fission-cli/fission
|
||||||
|
@rm -f cmd/fetcher/fetcher
|
||||||
|
@rm -f cmd/fetcher/builder
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
Fission: Serverless Functions for Kubernetes
|
# Fission: Serverless Functions for Kubernetes
|
||||||
============================================
|
|
||||||
[](https://travis-ci.org/fission/fission)
|
[](https://travis-ci.org/fission/fission)
|
||||||
[](https://goreportcard.com/report/github.com/fission/fission)
|
[](https://goreportcard.com/report/github.com/fission/fission)
|
||||||
[](http://slack.fission.io)
|
[](http://slack.fission.io)
|
||||||
|
|
||||||
[fission.io](http://fission.io) [@fissionio](http://twitter.com/fissionio)
|
[fission.io](http://fission.io) [@fissionio](http://twitter.com/fissionio)
|
||||||
|
|
||||||
Fission is a fast serverless framework for Kubernetes with a focus on
|
Fission is a fast serverless framework for Kubernetes with a focus on
|
||||||
developer productivity and high performance.
|
developer productivity and high performance.
|
||||||
@@ -18,7 +18,7 @@ language-specific parts are isolated in something called
|
|||||||
_environments_ (more below). Fission currently supports NodeJS, Python, Ruby, Go,
|
_environments_ (more below). Fission currently supports NodeJS, Python, Ruby, Go,
|
||||||
PHP, Bash, and any Linux executable, with more languages coming soon.
|
PHP, Bash, and any Linux executable, with more languages coming soon.
|
||||||
|
|
||||||
### Performance: 100msec cold start
|
# Performance: 100msec cold start
|
||||||
|
|
||||||
Fission maintains a pool of "warm" containers that each contain a
|
Fission maintains a pool of "warm" containers that each contain a
|
||||||
small dynamic loader. When a function is first called,
|
small dynamic loader. When a function is first called,
|
||||||
@@ -26,7 +26,7 @@ i.e. "cold-started", a running container is chosen and the function is
|
|||||||
loaded. This pool is what makes Fission fast: cold-start latencies
|
loaded. This pool is what makes Fission fast: cold-start latencies
|
||||||
are typically about 100msec.
|
are typically about 100msec.
|
||||||
|
|
||||||
### Kubernetes is the right place for Serverless
|
# Kubernetes is the right place for Serverless
|
||||||
|
|
||||||
We're built on Kubernetes because we think any non-trivial app will
|
We're built on Kubernetes because we think any non-trivial app will
|
||||||
use a combination of serverless functions and more conventional
|
use a combination of serverless functions and more conventional
|
||||||
@@ -37,44 +37,21 @@ Building on Kubernetes also means that anything you do for operations
|
|||||||
on your Kubernetes cluster — such as monitoring or log
|
on your Kubernetes cluster — such as monitoring or log
|
||||||
aggregation — also helps with ops on your Fission deployment.
|
aggregation — also helps with ops on your Fission deployment.
|
||||||
|
|
||||||
|
# Getting started and documentation
|
||||||
|
|
||||||
Fission Concepts
|
## Fission Concepts
|
||||||
----------------
|
|
||||||
|
|
||||||
A _function_ is a piece of code that follows the fission function
|
Visit [concepts](https://docs.fission.io/docs/concepts/) for more details.
|
||||||
interface.
|
|
||||||
|
|
||||||
An _environment_ contains the language- and runtime-specific parts of
|
## Documentations
|
||||||
running a function.
|
|
||||||
|
|
||||||
The following environments are currently available:
|
You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io/docs).
|
||||||
|
* See the [installation guide](https://docs.fission.io/docs/installation/) for installing and running Fission.
|
||||||
| Environment | Image |
|
* See the [troubleshooting guide](https://docs.fission.io/docs/trouble-shooting/) for debugging your functions and Fission installation.
|
||||||
| ------------------------------------ | ------------------------- |
|
|
||||||
| Binary (for executables or scripts) | `fission/binary-env` |
|
|
||||||
| Go | `fission/go-env` |
|
|
||||||
| JVM | `fission/jvm-env` |
|
|
||||||
| .NET | `fission/dotnet-env` |
|
|
||||||
| .NET 2.0 | `fission/dotnet20-env` |
|
|
||||||
| NodeJS (Alpine) | `fission/node-env` |
|
|
||||||
| NodeJS (Debian) | `fission/node-env-debian` |
|
|
||||||
| Perl | `fission/perl-env` |
|
|
||||||
| PHP 7 | `fission/php-env` |
|
|
||||||
| Python 3 | `fission/python-env` |
|
|
||||||
| Ruby | `fission/ruby-env` |
|
|
||||||
|
|
||||||
You can also extend environments or create entirely new
|
## Usage
|
||||||
ones if you want. (An environment is essentially just a container
|
|
||||||
with a webserver and dynamic loader.)
|
|
||||||
|
|
||||||
A _trigger_ is something that maps an event to a function; Fission
|
|
||||||
as of today supports [HTTP request](https://docs.fission.io/usage/trigger/#create-a-http-trigger), [timed](https://docs.fission.io/usage/trigger/#create-a-time-trigger), and [message queue](https://docs.fission.io/usage/trigger/#create-a-message-queue-trigger) triggers.
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
# Add the stock NodeJS env to your Fission deployment
|
# Add the stock NodeJS env to your Fission deployment
|
||||||
$ fission env create --name nodejs --image fission/node-env
|
$ fission env create --name nodejs --image fission/node-env
|
||||||
|
|
||||||
@@ -92,20 +69,28 @@ Usage
|
|||||||
Hello, world!
|
Hello, world!
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [examples](examples) directory for more.
|
# Contributing
|
||||||
|
|
||||||
Running Fission on your Cluster
|
## Building Fission
|
||||||
===============================
|
See the [compilation guide](https://docs.fission.io/docs/contributing/).
|
||||||
|
|
||||||
See the [installation guide](https://docs.fission.io/installation/).
|
## Contact
|
||||||
|
Reach us on [slack](http://slack.fission.io) or [twitter](https://twitter.com/fissionio).
|
||||||
|
|
||||||
Compiling Fission
|
Fission is a project by [many contributors](https://github.com/fission/fission/graphs/contributors).
|
||||||
=================
|
|
||||||
|
|
||||||
See the [compilation guide](https://docs.fission.io/contributing/).
|
## Community meeting
|
||||||
|
|
||||||
Reach us on [slack](http://slack.fission.io) or
|
A regular community meeting takes place every other Thursday at 08:30 AM PT (Pacific Time). [Convert to your local timezone](http://www.thetimezoneconverter.com/?t=08:30&tz=PT%20%28Pacific%20Time%29).
|
||||||
[twitter](https://twitter.com/fissionio).
|
|
||||||
|
|
||||||
Fission is a project by [Platform9 Systems](https://platform9.com/fission/)
|
# Official Releases
|
||||||
and [many contributors](https://github.com/fission/fission/graphs/contributors).
|
|
||||||
|
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.
|
||||||
|
Builds from the master branch can have functionality changed and even removed at any time without compatibility support
|
||||||
|
and without prior notice.
|
||||||
|
|
||||||
|
# Licensing
|
||||||
|
|
||||||
|
Fission is under the Apache 2.0 license.
|
||||||
|
|||||||
+18
-5
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Kubernetes 1.6 or later
|
- Kubernetes 1.9 or later
|
||||||
|
|
||||||
|
|
||||||
## Helm charts
|
## Helm charts
|
||||||
@@ -43,10 +43,10 @@ Parameter | Description | Default
|
|||||||
`routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer`
|
`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`
|
`repository` | Image base repository | `index.docker.io`
|
||||||
`image` | Fission image repository | `fission/fission-bundle`
|
`image` | Fission image repository | `fission/fission-bundle`
|
||||||
`imageTag` | Fission image tag | `1.2.1`
|
`imageTag` | Fission image tag | `1.7.0`
|
||||||
`pullPolicy` | Image pull policy | `IfNotPresent`
|
`pullPolicy` | Image pull policy | `IfNotPresent`
|
||||||
`fetcherImage` | Fission fetcher repository | `fission/fetcher`
|
`fetcherImage` | Fission fetcher repository | `fission/fetcher`
|
||||||
`fetcherImageTag` | Fission fetcher image tag | `1.2.1`
|
`fetcherImageTag` | Fission fetcher image tag | `1.7.0`
|
||||||
`controllerPort` | Fission Controller service port | `31313`
|
`controllerPort` | Fission Controller service port | `31313`
|
||||||
`routerPort` | Fission Router service port | ` 31314`
|
`routerPort` | Fission Router service port | ` 31314`
|
||||||
`functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function`
|
`functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function`
|
||||||
@@ -62,9 +62,22 @@ Parameter | Description | Default
|
|||||||
`pruneInterval` | The frequency of archive pruner (in minutes) | `60`
|
`pruneInterval` | The frequency of archive pruner (in minutes) | `60`
|
||||||
`preUpgradeChecksImage` | Fission pre-install/pre-upgrade checks live in this image | `fission/pre-upgrade-checks`
|
`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`
|
`debugEnv` | If there are any pod specialization errors when a function is triggered and this flag is set to true, the error summary is returned as part of http response | `true`
|
||||||
`prometheusDeploy` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
|
`prometheus.enabled` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
|
||||||
|
`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil`
|
||||||
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
|
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
|
||||||
`extraCoreComponmentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
|
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
|
||||||
|
`executor.adoptExistingResources` | If true, executor will try to adopt existing resources created by the old executor instance. | `false`
|
||||||
|
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
|
||||||
|
`router.svcAddressMaxRetries` | Max retries times for router to retry on a certain service URL returns from cache/executor | `5`
|
||||||
|
`router.svcAddressUpdateTimeout` | The length of update lock expiry time for router to get a service URL returns from executor | `30`
|
||||||
|
`router.svcAnnotations` | Annotations for router service | None
|
||||||
|
`router.useEncodedPath` | For router to match encoded path. If true, "/foo%2Fbar" will match the path "/{var}"; Otherwise, it will match the path "/foo/bar". | `false`
|
||||||
|
`router.traceSamplingRate` | Uniformly sample traces with the given probabilistic sampling rate | `0.5`
|
||||||
|
`router.roundTrip.disableKeepAlive` | Disable transport keep-alive for fast switching function version | `true`
|
||||||
|
`router.roundTrip.keepAliveTime` | The keep-alive period for an active network connection to function pod | `30s`
|
||||||
|
`router.roundTrip.timeout` | HTTP transport request timeout | `50ms`
|
||||||
|
`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`
|
### Extra configuration for `fission-all`
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
name: fission-all
|
name: fission-all
|
||||||
version: 1.2.1
|
version: 1.7.0
|
||||||
description: Fission is a fast serverless framework for Kubernetes.
|
description: Fission is a fast serverless framework for Kubernetes.
|
||||||
keywords:
|
keywords:
|
||||||
- fission
|
- fission
|
||||||
@@ -8,8 +8,8 @@ keywords:
|
|||||||
home: http://fission.io/
|
home: http://fission.io/
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: Soam Vasani
|
- name: Soam Vasani
|
||||||
email: soamvasani@platform9.com
|
email: soamvasani+1@gmail.com
|
||||||
- name: Ta Ching Chen
|
- name: Ta Ching Chen
|
||||||
email: contact@tachingchen.com
|
email: hello@tachingchen.com
|
||||||
engine: gotpl
|
engine: gotpl
|
||||||
appVersion: 1.2.1
|
appVersion: 1.7.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: prometheus
|
- name: prometheus
|
||||||
repository: https://kubernetes-charts.storage.googleapis.com
|
repository: https://kubernetes-charts.storage.googleapis.com
|
||||||
version: 7.1.0
|
version: 9.3.1
|
||||||
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
|
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
|
||||||
generated: 2019-01-03T16:29:53.158684+01:00
|
generated: "2019-11-18T10:16:20.334338911Z"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: prometheus
|
- name: prometheus
|
||||||
version: 7.1.0
|
version: 9.3.1
|
||||||
repository: https://kubernetes-charts.storage.googleapis.com
|
repository: https://kubernetes-charts.storage.googleapis.com
|
||||||
condition: prometheusDeploy
|
condition: prometheus.enabled
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
1. Install the client CLI.
|
1. Install the client CLI.
|
||||||
|
|
||||||
Mac:
|
Mac:
|
||||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||||
|
|
||||||
Linux:
|
Linux:
|
||||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe
|
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
|
||||||
|
|
||||||
2. You're ready to use Fission!
|
2. You're ready to use Fission!
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,21 @@ controller/config.go
|
|||||||
{{- define "config" -}}
|
{{- define "config" -}}
|
||||||
canary:
|
canary:
|
||||||
enabled: {{ .Values.canaryDeployment.enabled }}
|
enabled: {{ .Values.canaryDeployment.enabled }}
|
||||||
{{- if .Values.prometheusDeploy }}
|
{{- if .Values.prometheus.enabled }}
|
||||||
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
||||||
|
{{- else }}
|
||||||
|
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- printf "\n" -}}
|
{{- printf "\n" -}}
|
||||||
{{- end -}}
|
{{- 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 -}}
|
||||||
|
|||||||
@@ -112,14 +112,20 @@ data:
|
|||||||
"config.yaml": {{ include "config" . | b64enc }}
|
"config.yaml": {{ include "config" . | b64enc }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: controller
|
name: controller
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: controller
|
||||||
|
application: fission-api
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: controller
|
||||||
|
application: fission-api
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -128,19 +134,23 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: controller
|
- name: controller
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--controllerPort", "8888"]
|
||||||
env:
|
env:
|
||||||
- name: FISSION_FUNCTION_NAMESPACE
|
- name: FISSION_FUNCTION_NAMESPACE
|
||||||
value: "{{ .Values.functionNamespace }}"
|
value: "{{ .Values.functionNamespace }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: POD_NAMESPACE
|
- name: TRACING_SAMPLING_RATE
|
||||||
valueFrom:
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
fieldRef:
|
- name: DEBUG_ENV
|
||||||
fieldPath: metadata.namespace
|
value: {{ .Values.debugEnv | quote }}
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: "/healthz"
|
path: "/healthz"
|
||||||
@@ -158,115 +168,31 @@ spec:
|
|||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /etc/config/config.yaml
|
mountPath: /etc/config/config.yaml
|
||||||
subPath: config.yaml
|
subPath: config.yaml
|
||||||
serviceAccount: fission-svc
|
ports:
|
||||||
|
- containerPort: 8888
|
||||||
|
name: http
|
||||||
|
serviceAccountName: fission-svc
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: feature-config
|
name: feature-config
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
|
||||||
---
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: router
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
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: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
|
||||||
command: ["/fission-bundle"]
|
|
||||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
|
||||||
env:
|
|
||||||
- name: POD_NAMESPACE
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
fieldPath: metadata.namespace
|
|
||||||
- name: ROUTER_ROUND_TRIP_TIMEOUT
|
|
||||||
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
|
|
||||||
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
|
|
||||||
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
|
|
||||||
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
|
|
||||||
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
|
|
||||||
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
|
|
||||||
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
|
|
||||||
- name: DEBUG_ENV
|
|
||||||
value: {{ .Values.debugEnv | quote }}
|
|
||||||
- name: TRACING_SAMPLING_RATE
|
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
|
||||||
{{ if .Values.analytics }}
|
|
||||||
- name: ANALYTICS_URL
|
|
||||||
value: "https://g.fission.sh/metrics"
|
|
||||||
{{ else if .Values.analyticsNonHelmInstall }}
|
|
||||||
- name: ANALYTICS_URL
|
|
||||||
value: "https://g.fission.sh/metrics"
|
|
||||||
{{ end }}
|
|
||||||
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
|
|
||||||
serviceAccount: fission-svc
|
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: apps/v1
|
||||||
kind: Service
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: executor
|
name: executor
|
||||||
labels:
|
labels:
|
||||||
svc: executor
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: executor
|
||||||
spec:
|
spec:
|
||||||
type: ClusterIP
|
replicas: 1
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
targetPort: 8888
|
|
||||||
selector:
|
selector:
|
||||||
svc: executor
|
matchLabels:
|
||||||
|
svc: executor
|
||||||
---
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: executor
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -278,10 +204,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: executor
|
- name: executor
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--fission-namespace", "{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: FETCHER_IMAGE
|
- name: FETCHER_IMAGE
|
||||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||||
@@ -289,10 +215,14 @@ spec:
|
|||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: RUNTIME_IMAGE_PULL_POLICY
|
- name: RUNTIME_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
- name: ADOPT_EXISTING_RESOURCES
|
||||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
|
||||||
- name: ENABLE_ISTIO
|
- name: ENABLE_ISTIO
|
||||||
value: "{{ .Values.enableIstio }}"
|
value: "{{ .Values.enableIstio }}"
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
|
- name: TRACING_SAMPLING_RATE
|
||||||
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
- name: FETCHER_MINCPU
|
- name: FETCHER_MINCPU
|
||||||
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
||||||
- name: FETCHER_MINMEM
|
- name: FETCHER_MINMEM
|
||||||
@@ -301,8 +231,8 @@ spec:
|
|||||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||||
- name: FETCHER_MAXMEM
|
- name: FETCHER_MAXMEM
|
||||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: DEBUG_ENV
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: "/healthz"
|
path: "/healthz"
|
||||||
@@ -321,20 +251,24 @@ spec:
|
|||||||
name: metrics
|
name: metrics
|
||||||
- containerPort: 8888
|
- containerPort: 8888
|
||||||
name: http
|
name: http
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: buildermgr
|
name: buildermgr
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: buildermgr
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: buildermgr
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -342,10 +276,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: buildermgr
|
- name: buildermgr
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: FETCHER_IMAGE
|
- name: FETCHER_IMAGE
|
||||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||||
@@ -353,10 +287,10 @@ spec:
|
|||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: BUILDER_IMAGE_PULL_POLICY
|
- name: BUILDER_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
|
||||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
|
||||||
- name: ENABLE_ISTIO
|
- name: ENABLE_ISTIO
|
||||||
value: "{{ .Values.enableIstio }}"
|
value: "{{ .Values.enableIstio }}"
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
- name: FETCHER_MINCPU
|
- name: FETCHER_MINCPU
|
||||||
@@ -366,21 +300,27 @@ spec:
|
|||||||
- name: FETCHER_MAXCPU
|
- name: FETCHER_MAXCPU
|
||||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||||
- name: FETCHER_MAXMEM
|
- name: FETCHER_MAXMEM
|
||||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||||
serviceAccount: fission-svc
|
- name: DEBUG_ENV
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: kubewatcher
|
name: kubewatcher
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: kubewatcher
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: kubewatcher
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -388,16 +328,20 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: kubewatcher
|
- name: kubewatcher
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
serviceAccount: fission-svc
|
- name: DEBUG_ENV
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -417,14 +361,18 @@ spec:
|
|||||||
svc: influxdb
|
svc: influxdb
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: influxdb
|
name: influxdb
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: influxdb
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: influxdb
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -435,20 +383,20 @@ spec:
|
|||||||
image: fission/influxdb
|
image: fission/influxdb
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
env:
|
env:
|
||||||
- name: PRE_CREATE_DB
|
- name: PRE_CREATE_DB
|
||||||
value: fissionFunctionLog
|
value: fissionFunctionLog
|
||||||
- name: ADMIN_USER
|
- name: ADMIN_USER
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: influxdb
|
name: influxdb
|
||||||
key: username
|
key: username
|
||||||
- name: INFLUXDB_INIT_PWD
|
- name: INFLUXDB_INIT_PWD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: influxdb
|
name: influxdb
|
||||||
key: password
|
key: password
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if .Values.heapster }}
|
{{- if .Values.heapster }}
|
||||||
@@ -471,15 +419,19 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
svc: heapster
|
svc: heapster
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: heapster
|
name: heapster
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: heapster
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: heapster
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -492,17 +444,21 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /heapster
|
- /heapster
|
||||||
- --source=kubernetes:https://kubernetes.default
|
- --source=kubernetes:https://kubernetes.default
|
||||||
serviceAccount: {{ .Release.Namespace }}/fission-svc
|
serviceAccountName: {{ .Release.Namespace }}/fission-svc
|
||||||
{{- end }}
|
{{- end }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: timer
|
name: timer
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: timer
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: timer
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -510,13 +466,16 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: timer
|
- name: timer
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
serviceAccount: fission-svc
|
env:
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
- name: DEBUG_ENV
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -525,7 +484,7 @@ spec:
|
|||||||
# "fission".
|
# "fission".
|
||||||
#
|
#
|
||||||
#---
|
#---
|
||||||
#apiVersion: extensions/v1beta1
|
#apiVersion: apps/v1
|
||||||
#kind: Deployment
|
#kind: Deployment
|
||||||
#metadata:
|
#metadata:
|
||||||
# name: fission-ui
|
# name: fission-ui
|
||||||
@@ -545,11 +504,11 @@ spec:
|
|||||||
# - name: kubectl-proxy
|
# - name: kubectl-proxy
|
||||||
# image: {{ .Values.repository }}/lachlanevenson/k8s-kubectl
|
# image: {{ .Values.repository }}/lachlanevenson/k8s-kubectl
|
||||||
# args: ["proxy", "--port", "8001", "--address", "127.0.0.1"]
|
# args: ["proxy", "--port", "8001", "--address", "127.0.0.1"]
|
||||||
# serviceAccount: fission-svc
|
# serviceAccountName: fission-svc
|
||||||
|
|
||||||
{{- if .Values.nats.enabled }}
|
{{- if .Values.nats.enabled }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -557,6 +516,9 @@ metadata:
|
|||||||
name: nats-streaming
|
name: nats-streaming
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: nats-streaming
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -574,10 +536,8 @@ spec:
|
|||||||
]
|
]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4222
|
- containerPort: 4222
|
||||||
hostPort: 4222
|
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- containerPort: 4223
|
- containerPort: 4223
|
||||||
hostPort: 4223
|
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
@@ -592,18 +552,24 @@ spec:
|
|||||||
port: 4223
|
port: 4223
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: mqtrigger-nats-streaming
|
name: mqtrigger-nats-streaming
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: nats-streaming
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: nats-streaming
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -612,33 +578,43 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: mqtrigger
|
- name: mqtrigger
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: MESSAGE_QUEUE_TYPE
|
- name: MESSAGE_QUEUE_TYPE
|
||||||
value: nats-streaming
|
value: nats-streaming
|
||||||
- name: MESSAGE_QUEUE_URL
|
- name: MESSAGE_QUEUE_URL
|
||||||
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
|
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
serviceAccount: fission-svc
|
- name: DEBUG_ENV
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if .Values.kafka.enabled }}
|
{{- if .Values.kafka.enabled }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: mqtrigger-kafka
|
name: mqtrigger-kafka
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: kafka
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: kafka
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -650,7 +626,7 @@ spec:
|
|||||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: MESSAGE_QUEUE_TYPE
|
- name: MESSAGE_QUEUE_TYPE
|
||||||
value: kafka
|
value: kafka
|
||||||
@@ -658,24 +634,77 @@ spec:
|
|||||||
value: "{{.Values.kafka.brokers}}"
|
value: "{{.Values.kafka.brokers}}"
|
||||||
- name: MESSAGE_QUEUE_KAFKA_VERSION
|
- name: MESSAGE_QUEUE_KAFKA_VERSION
|
||||||
value: "{{.Values.kafka.version}}"
|
value: "{{.Values.kafka.version}}"
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
serviceAccount: fission-svc
|
- name: DEBUG_ENV
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
# TLS authentication is TLS with authentication (2 way)
|
||||||
|
# More info: https://docs.confluent.io/current/kafka/authentication_ssl.html#ssl-overview
|
||||||
|
{{- if .Values.kafka.authentication.tls.enabled }}
|
||||||
|
- name: TLS_ENABLED
|
||||||
|
value: "true"
|
||||||
|
- name: MESSAGE_QUEUE_SECRETS
|
||||||
|
value: /etc/fission/secrets
|
||||||
|
volumeMounts:
|
||||||
|
- name: kafka-secrets
|
||||||
|
mountPath: /etc/fission/secrets
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.kafka.authentication.tls.enabled }}
|
||||||
|
volumes:
|
||||||
|
- name: kafka-secrets
|
||||||
|
secret:
|
||||||
|
secretName: mqtrigger-kafka-secrets
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
---
|
||||||
|
{{- if .Values.kafka.authentication.tls.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: mqtrigger-kafka-secrets
|
||||||
|
labels:
|
||||||
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
data:
|
||||||
|
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) }}
|
||||||
|
caCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) | b64enc }}
|
||||||
|
{{- else }}
|
||||||
|
{{ fail "Invalid chart. CA Certificate not found." }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) }}
|
||||||
|
userCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) | b64enc }}
|
||||||
|
{{- else }}
|
||||||
|
{{ fail "Invalid chart. User Certificate not found." }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) }}
|
||||||
|
userKey: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) | b64enc }}
|
||||||
|
{{- else }}
|
||||||
|
{{ fail "Invalid chart. User Key not found." }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if .Values.azureStorageQueue.enabled }}
|
{{- if .Values.azureStorageQueue.enabled }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: mqtrigger-azure-storage-queue
|
name: mqtrigger-azure-storage-queue
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: azure-storage-queue
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: mqtrigger
|
||||||
|
messagequeue: azure-storage-queue
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -687,8 +716,10 @@ spec:
|
|||||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
- name: MESSAGE_QUEUE_TYPE
|
- name: MESSAGE_QUEUE_TYPE
|
||||||
@@ -700,20 +731,28 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: azure-storage-account-key
|
name: azure-storage-account-key
|
||||||
key: key
|
key: key
|
||||||
serviceAccount: fission-svc
|
- name: DEBUG_ENV
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
value: {{ .Values.debugEnv | quote }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: storagesvc
|
name: storagesvc
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: storagesvc
|
||||||
|
application: fission-storage
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: storagesvc
|
||||||
|
application: fission-storage
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -722,15 +761,19 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: storagesvc
|
- name: storagesvc
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
- name: PRUNE_INTERVAL
|
- name: PRUNE_INTERVAL
|
||||||
value: "{{.Values.pruneInterval}}"
|
value: "{{.Values.pruneInterval}}"
|
||||||
|
- name: DEBUG_ENV
|
||||||
|
value: {{ .Values.debugEnv | quote }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: fission-storage
|
- name: fission-storage
|
||||||
mountPath: /fission
|
mountPath: /fission
|
||||||
@@ -747,7 +790,10 @@ spec:
|
|||||||
port: 8000
|
port: 8000
|
||||||
initialDelaySeconds: 35
|
initialDelaySeconds: 35
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
serviceAccount: fission-svc
|
ports:
|
||||||
|
- containerPort: 8000
|
||||||
|
name: http
|
||||||
|
serviceAccountName: fission-svc
|
||||||
volumes:
|
volumes:
|
||||||
- name: fission-storage
|
- name: fission-storage
|
||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
@@ -756,6 +802,6 @@ spec:
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -20,13 +20,17 @@ data:
|
|||||||
{{ fail "invalid chart" }}
|
{{ fail "invalid chart" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: DaemonSet
|
kind: DaemonSet
|
||||||
metadata:
|
metadata:
|
||||||
name: logger
|
name: logger
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: logger
|
||||||
spec:
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: logger
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -35,15 +39,24 @@ spec:
|
|||||||
initContainers:
|
initContainers:
|
||||||
- name: init
|
- name: init
|
||||||
image: busybox
|
image: busybox
|
||||||
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ['mkdir', '-p', '/var/log/fission']
|
command: ['mkdir', '-p', '/var/log/fission']
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: container-log
|
- name: container-log
|
||||||
mountPath: /var/log/
|
mountPath: /var/log/
|
||||||
readOnly: false
|
readOnly: false
|
||||||
|
{{- if .Values.logger.enableSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: logger
|
- name: logger
|
||||||
|
{{ if .Values.repository }}
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||||
imagePullPolicy: IfNotPresent
|
{{ else }}
|
||||||
|
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||||
|
{{ end }}
|
||||||
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
env:
|
env:
|
||||||
- name: NODE_NAME
|
- name: NODE_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@@ -59,8 +72,16 @@ spec:
|
|||||||
- name: docker-log
|
- name: docker-log
|
||||||
mountPath: /var/lib/docker/containers
|
mountPath: /var/lib/docker/containers
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
{{- if .Values.logger.enableSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
{{- end }}
|
||||||
- name: fluentbit
|
- name: fluentbit
|
||||||
|
{{- if .Values.repository }}
|
||||||
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
|
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
|
||||||
|
{{ else }}
|
||||||
|
image: "{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
|
||||||
|
{{- end }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
# CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
|
# 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"]
|
command: ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluentbit.conf"]
|
||||||
@@ -83,6 +104,10 @@ spec:
|
|||||||
key: password
|
key: password
|
||||||
- name: LOG_PATH
|
- name: LOG_PATH
|
||||||
value: /var/log/fission/*.log
|
value: /var/log/fission/*.log
|
||||||
|
{{- if .Values.logger.enableSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: container-log
|
- name: container-log
|
||||||
mountPath: /var/log/
|
mountPath: /var/log/
|
||||||
@@ -93,7 +118,7 @@ spec:
|
|||||||
- name: fluentbit-config
|
- name: fluentbit-config
|
||||||
mountPath: /fluent-bit/etc/
|
mountPath: /fluent-bit/etc/
|
||||||
readOnly: true
|
readOnly: true
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
volumes:
|
volumes:
|
||||||
- name: container-log
|
- name: container-log
|
||||||
hostPath:
|
hostPath:
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ spec:
|
|||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: [ "/pre-upgrade-checks" ]
|
command: [ "/pre-upgrade-checks" ]
|
||||||
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: redis
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 6379
|
|
||||||
targetPort: 6379
|
|
||||||
protocol: TCP
|
|
||||||
name: redis
|
|
||||||
selector:
|
|
||||||
app: redis
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1beta2
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: redis
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: redis
|
|
||||||
serviceName: redis
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: redis
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: redis
|
|
||||||
image: redis:3.2-alpine
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: 6379
|
|
||||||
name: redis
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
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: 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 }}
|
||||||
|
{{- if .Values.analytics }}
|
||||||
|
- name: ANALYTICS_URL
|
||||||
|
value: "https://g.fission.sh/metrics"
|
||||||
|
{{- else if .Values.analyticsNonHelmInstall }}
|
||||||
|
- name: ANALYTICS_URL
|
||||||
|
value: "https://g.fission.sh/metrics"
|
||||||
|
{{- end }}
|
||||||
|
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.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
|
{{- end }}
|
||||||
@@ -6,6 +6,10 @@ metadata:
|
|||||||
svc: router
|
svc: router
|
||||||
application: fission-router
|
application: fission-router
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
{{- if .Values.router.svcAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.routerServiceType }}
|
type: {{ .Values.routerServiceType }}
|
||||||
ports:
|
ports:
|
||||||
@@ -73,3 +77,19 @@ spec:
|
|||||||
targetPort: 8000
|
targetPort: 8000
|
||||||
selector:
|
selector:
|
||||||
svc: storagesvc
|
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
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ serviceType: ClusterIP
|
|||||||
routerServiceType: LoadBalancer
|
routerServiceType: LoadBalancer
|
||||||
|
|
||||||
## Image base repository
|
## Image base repository
|
||||||
|
## Leave it empty for using existing local image
|
||||||
repository: index.docker.io
|
repository: index.docker.io
|
||||||
|
|
||||||
## Fission image repository
|
## Fission image repository
|
||||||
@@ -19,13 +20,13 @@ image: fission/fission-bundle
|
|||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
## Fission image version
|
## Fission image version
|
||||||
imageTag: 1.2.1
|
imageTag: 1.7.0
|
||||||
|
|
||||||
## Fission fetcher repository
|
## Fission fetcher repository
|
||||||
fetcherImage: fission/fetcher
|
fetcherImage: fission/fetcher
|
||||||
|
|
||||||
## Fission fetcher image version
|
## Fission fetcher image version
|
||||||
fetcherImageTag: 1.2.1
|
fetcherImageTag: 1.7.0
|
||||||
|
|
||||||
## Port at which Fission controller service should be exposed
|
## Port at which Fission controller service should be exposed
|
||||||
controllerPort: 31313
|
controllerPort: 31313
|
||||||
@@ -56,6 +57,65 @@ logger:
|
|||||||
fluentdImageRepository: index.docker.io
|
fluentdImageRepository: index.docker.io
|
||||||
fluentdImage: fluent/fluent-bit
|
fluentdImage: fluent/fluent-bit
|
||||||
fluentdImageTag: 1.0.4
|
fluentdImageTag: 1.0.4
|
||||||
|
|
||||||
|
## Fluent-bit writes/reads it’s own sqlite database to record a history of tracked
|
||||||
|
## files and a state of offsets, this is very useful to resume a state if the ser-
|
||||||
|
## vice is restarted. For Kubernetes environment with constraints like OpenShift,
|
||||||
|
## the containers are limited to write hostPath volume. Hence, we have to enable
|
||||||
|
## security context and set privileged to true.
|
||||||
|
enableSecurityContext: false
|
||||||
|
|
||||||
|
executor:
|
||||||
|
adoptExistingResources: false
|
||||||
|
|
||||||
|
## Router config
|
||||||
|
router:
|
||||||
|
deployAsDaemonSet: false
|
||||||
|
svcAddressMaxRetries: 5
|
||||||
|
svcAddressUpdateTimeout: 30s
|
||||||
|
|
||||||
|
## Display endpoint access logs
|
||||||
|
## To be aware of enabling logging endpoint access log, it increases
|
||||||
|
## router resource utilization when under heavy workloads.
|
||||||
|
displayAccessLog: false
|
||||||
|
|
||||||
|
## Add annotations for router
|
||||||
|
# svcAnnotations:
|
||||||
|
# cloud.google.com/load-balancer-type: Internal
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
## Message queue trigger config
|
## Message queue trigger config
|
||||||
### NATS Streaming, enabled by default
|
### NATS Streaming, enabled by default
|
||||||
@@ -73,7 +133,25 @@ azureStorageQueue:
|
|||||||
## Kafka: enable and configure the details
|
## Kafka: enable and configure the details
|
||||||
kafka:
|
kafka:
|
||||||
enabled: false
|
enabled: false
|
||||||
brokers: 'broker.kafka:9092'
|
# 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
|
||||||
|
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
|
## version of Kafka broker
|
||||||
## For 0.x it must be a string in the format
|
## For 0.x it must be a string in the format
|
||||||
## "major.minor.veryMinor.patch" example: 0.8.2.0
|
## "major.minor.veryMinor.patch" example: 0.8.2.0
|
||||||
@@ -109,7 +187,7 @@ persistence:
|
|||||||
## Extend the container specs for the core fission pods.
|
## Extend the container specs for the core fission pods.
|
||||||
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
|
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
|
||||||
## For example:
|
## For example:
|
||||||
## extraCoreComponmentPodConfig:
|
## extraCoreComponentPodConfig:
|
||||||
## affinity:
|
## affinity:
|
||||||
## nodeAffinity:
|
## nodeAffinity:
|
||||||
## requiredDuringSchedulingIgnoredDuringExecution:
|
## requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
@@ -119,7 +197,7 @@ persistence:
|
|||||||
## operator: In
|
## operator: In
|
||||||
## values:
|
## values:
|
||||||
## - app
|
## - app
|
||||||
extraCoreComponmentPodConfig:
|
#extraCoreComponentPodConfig:
|
||||||
# affinity:
|
# affinity:
|
||||||
# tolerations:
|
# tolerations:
|
||||||
# nodeSelector:
|
# nodeSelector:
|
||||||
@@ -144,17 +222,21 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
|||||||
|
|
||||||
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
|
## 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
|
## summary is returned as part of http response
|
||||||
debugEnv: true
|
debugEnv: false
|
||||||
|
|
||||||
|
## Prometheus for scrapping service metrics
|
||||||
## set this flag to true if prometheus needs to be deployed along with fission
|
prometheus:
|
||||||
prometheusDeploy: true
|
## 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
|
## set this flag to false if you dont need canary deployment feature
|
||||||
canaryDeployment:
|
canaryDeployment:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
|
||||||
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
|
# 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"
|
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
|
||||||
#traceSamplingRate: 0.75
|
#traceSamplingRate: 0.75
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
name: fission-core
|
name: fission-core
|
||||||
version: 1.2.1
|
version: 1.7.0
|
||||||
description: Fission is a fast serverless framework for Kubernetes.
|
description: Fission is a fast serverless framework for Kubernetes.
|
||||||
keywords:
|
keywords:
|
||||||
- fission
|
- fission
|
||||||
@@ -8,8 +8,8 @@ keywords:
|
|||||||
home: http://fission.io/
|
home: http://fission.io/
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: Soam Vasani
|
- name: Soam Vasani
|
||||||
email: soamvasani@platform9.com
|
email: soamvasani+1@gmail.com
|
||||||
- name: Ta Ching Chen
|
- name: Ta Ching Chen
|
||||||
email: contact@tachingchen.com
|
email: hello@tachingchen.com
|
||||||
engine: gotpl
|
engine: gotpl
|
||||||
appVersion: 1.2.1
|
appVersion: 1.7.0
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
dependencies:
|
||||||
|
- name: prometheus
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com
|
||||||
|
version: 9.3.1
|
||||||
|
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
|
||||||
|
generated: "2019-11-18T10:16:25.945208326Z"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: prometheus
|
- name: prometheus
|
||||||
version: 7.1.0
|
version: 9.3.1
|
||||||
repository: https://kubernetes-charts.storage.googleapis.com
|
repository: https://kubernetes-charts.storage.googleapis.com
|
||||||
condition: prometheusDeploy
|
condition: prometheus.enabled
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
1. Install the client CLI.
|
1. Install the client CLI.
|
||||||
|
|
||||||
Mac:
|
Mac:
|
||||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||||
|
|
||||||
Linux:
|
Linux:
|
||||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe
|
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
|
||||||
|
|
||||||
2. You're ready to use Fission!
|
2. You're ready to use Fission!
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,21 @@ controller/config.go
|
|||||||
{{- define "config" -}}
|
{{- define "config" -}}
|
||||||
canary:
|
canary:
|
||||||
enabled: {{ .Values.canaryDeployment.enabled }}
|
enabled: {{ .Values.canaryDeployment.enabled }}
|
||||||
{{- if .Values.prometheusDeploy }}
|
{{- if .Values.prometheus.enabled }}
|
||||||
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
||||||
|
{{- else }}
|
||||||
|
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- printf "\n" -}}
|
{{- printf "\n" -}}
|
||||||
{{- end -}}
|
{{- 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 -}}
|
||||||
|
|||||||
@@ -113,14 +113,20 @@ data:
|
|||||||
"config.yaml": {{ include "config" . | b64enc }}
|
"config.yaml": {{ include "config" . | b64enc }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: controller
|
name: controller
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: controller
|
||||||
|
application: fission-api
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: controller
|
||||||
|
application: fission-api
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -129,11 +135,13 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: controller
|
- name: controller
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--controllerPort", "8888"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
- name: FISSION_FUNCTION_NAMESPACE
|
- name: FISSION_FUNCTION_NAMESPACE
|
||||||
@@ -159,111 +167,32 @@ spec:
|
|||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /etc/config/config.yaml
|
mountPath: /etc/config/config.yaml
|
||||||
subPath: config.yaml
|
subPath: config.yaml
|
||||||
serviceAccount: fission-svc
|
ports:
|
||||||
|
- containerPort: 8888
|
||||||
|
name: http
|
||||||
|
serviceAccountName: fission-svc
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: feature-config
|
name: feature-config
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
|
||||||
name: router
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
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: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
|
||||||
command: ["/fission-bundle"]
|
|
||||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
|
||||||
env:
|
|
||||||
- name: POD_NAMESPACE
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
fieldPath: metadata.namespace
|
|
||||||
- name: TRACING_SAMPLING_RATE
|
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_TIMEOUT
|
|
||||||
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
|
|
||||||
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
|
|
||||||
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
|
|
||||||
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
|
|
||||||
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
|
|
||||||
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
|
|
||||||
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
|
|
||||||
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
|
|
||||||
- name: DEBUG_ENV
|
|
||||||
value: {{ .Values.debugEnv | quote }}
|
|
||||||
{{ if .Values.analytics }}
|
|
||||||
- name: ANALYTICS_URL
|
|
||||||
value: "https://g.fission.sh/metrics"
|
|
||||||
{{ else if .Values.analyticsNonHelmInstall }}
|
|
||||||
- name: ANALYTICS_URL
|
|
||||||
value: "https://g.fission.sh/metrics"
|
|
||||||
{{ end }}
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: "/router-healthz"
|
|
||||||
port: 8888
|
|
||||||
initialDelaySeconds: 1
|
|
||||||
periodSeconds: 1
|
|
||||||
failureThreshold: 30
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: "/router-healthz"
|
|
||||||
port: 8888
|
|
||||||
initialDelaySeconds: 35
|
|
||||||
periodSeconds: 5
|
|
||||||
serviceAccount: fission-svc
|
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
metadata:
|
||||||
name: executor
|
name: executor
|
||||||
labels:
|
labels:
|
||||||
svc: executor
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: executor
|
||||||
spec:
|
spec:
|
||||||
type: ClusterIP
|
replicas: 1
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
targetPort: 8888
|
|
||||||
selector:
|
selector:
|
||||||
svc: executor
|
matchLabels:
|
||||||
|
svc: executor
|
||||||
---
|
|
||||||
apiVersion: extensions/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: executor
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -275,21 +204,23 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: executor
|
- name: executor
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--fission-namespace", "{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: FETCHER_IMAGE
|
- name: FETCHER_IMAGE
|
||||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||||
- name: FETCHER_IMAGE_PULL_POLICY
|
- name: FETCHER_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
|
||||||
- name: ENABLE_ISTIO
|
|
||||||
value: "{{ .Values.enableIstio }}"
|
|
||||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
|
- name: TRACING_SAMPLING_RATE
|
||||||
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
|
- name: ADOPT_EXISTING_RESOURCES
|
||||||
|
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
|
||||||
|
- name: ENABLE_ISTIO
|
||||||
|
value: "{{ .Values.enableIstio }}"
|
||||||
- name: FETCHER_MINCPU
|
- name: FETCHER_MINCPU
|
||||||
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
||||||
- name: FETCHER_MINMEM
|
- name: FETCHER_MINMEM
|
||||||
@@ -311,20 +242,29 @@ spec:
|
|||||||
port: 8888
|
port: 8888
|
||||||
initialDelaySeconds: 35
|
initialDelaySeconds: 35
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
serviceAccount: fission-svc
|
ports:
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
- containerPort: 8080
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
name: metrics
|
||||||
|
- containerPort: 8888
|
||||||
|
name: http
|
||||||
|
serviceAccountName: fission-svc
|
||||||
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: buildermgr
|
name: buildermgr
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: buildermgr
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: buildermgr
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -332,10 +272,10 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: buildermgr
|
- name: buildermgr
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||||
env:
|
env:
|
||||||
- name: FETCHER_IMAGE
|
- name: FETCHER_IMAGE
|
||||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||||
@@ -357,20 +297,24 @@ spec:
|
|||||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||||
- name: FETCHER_MAXMEM
|
- name: FETCHER_MAXMEM
|
||||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: kubewatcher
|
name: kubewatcher
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: kubewatcher
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: kubewatcher
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -378,27 +322,33 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: kubewatcher
|
- name: kubewatcher
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: timer
|
name: timer
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: timer
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: timer
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -406,27 +356,35 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: timer
|
- name: timer
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||||
env:
|
env:
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: storagesvc
|
name: storagesvc
|
||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
svc: storagesvc
|
||||||
|
application: fission-storage
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
svc: storagesvc
|
||||||
|
application: fission-storage
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -435,19 +393,24 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: storagesvc
|
- name: storagesvc
|
||||||
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
|
image: {{ include "fission-bundleImage" . | quote }}
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: ["/fission-bundle"]
|
command: ["/fission-bundle"]
|
||||||
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
|
||||||
env:
|
env:
|
||||||
- name: PRUNE_INTERVAL
|
- name: PRUNE_INTERVAL
|
||||||
value: "{{.Values.pruneInterval}}"
|
value: "{{.Values.pruneInterval}}"
|
||||||
|
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||||
|
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||||
- name: TRACING_SAMPLING_RATE
|
- name: TRACING_SAMPLING_RATE
|
||||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: fission-storage
|
- name: fission-storage
|
||||||
mountPath: /fission
|
mountPath: /fission
|
||||||
serviceAccount: fission-svc
|
ports:
|
||||||
|
- containerPort: 8000
|
||||||
|
name: http
|
||||||
|
serviceAccountName: fission-svc
|
||||||
volumes:
|
volumes:
|
||||||
- name: fission-storage
|
- name: fission-storage
|
||||||
{{- if .Values.persistence.enabled }}
|
{{- if .Values.persistence.enabled }}
|
||||||
@@ -456,6 +419,6 @@ spec:
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.extraCoreComponmentPodConfig }}
|
{{- if .Values.extraCoreComponentPodConfig }}
|
||||||
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ spec:
|
|||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: [ "/pre-upgrade-checks" ]
|
command: [ "/pre-upgrade-checks" ]
|
||||||
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||||
serviceAccount: fission-svc
|
serviceAccountName: fission-svc
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
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: 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 }}
|
||||||
|
{{- if .Values.analytics }}
|
||||||
|
- name: ANALYTICS_URL
|
||||||
|
value: "https://g.fission.sh/metrics"
|
||||||
|
{{- else if .Values.analyticsNonHelmInstall }}
|
||||||
|
- name: ANALYTICS_URL
|
||||||
|
value: "https://g.fission.sh/metrics"
|
||||||
|
{{- end }}
|
||||||
|
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.extraCoreComponentPodConfig }}
|
||||||
|
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||||
|
{{- end }}
|
||||||
@@ -6,6 +6,10 @@ metadata:
|
|||||||
svc: router
|
svc: router
|
||||||
application: fission-router
|
application: fission-router
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
|
{{- if .Values.router.svcAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.routerServiceType }}
|
type: {{ .Values.routerServiceType }}
|
||||||
ports:
|
ports:
|
||||||
@@ -53,3 +57,19 @@ spec:
|
|||||||
targetPort: 8000
|
targetPort: 8000
|
||||||
selector:
|
selector:
|
||||||
svc: storagesvc
|
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
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ serviceType: ClusterIP
|
|||||||
routerServiceType: LoadBalancer
|
routerServiceType: LoadBalancer
|
||||||
|
|
||||||
## Image base repository
|
## Image base repository
|
||||||
|
## Leave it empty for using existing local image
|
||||||
repository: index.docker.io
|
repository: index.docker.io
|
||||||
|
|
||||||
## Fission image repository
|
## Fission image repository
|
||||||
image: fission/fission-bundle
|
image: fission/fission-bundle
|
||||||
|
|
||||||
## Fission image version
|
## Fission image version
|
||||||
imageTag: 1.2.1
|
imageTag: 1.7.0
|
||||||
|
|
||||||
## Image pull policy
|
## Image pull policy
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
@@ -25,7 +26,7 @@ pullPolicy: IfNotPresent
|
|||||||
fetcherImage: fission/fetcher
|
fetcherImage: fission/fetcher
|
||||||
|
|
||||||
## Fission fetcher image version
|
## Fission fetcher image version
|
||||||
fetcherImageTag: 1.2.1
|
fetcherImageTag: 1.7.0
|
||||||
|
|
||||||
## Port at which Fission controller service should be exposed
|
## Port at which Fission controller service should be exposed
|
||||||
controllerPort: 31313
|
controllerPort: 31313
|
||||||
@@ -44,6 +45,58 @@ builderNamespace: fission-builder
|
|||||||
## Enable istio integration
|
## Enable istio integration
|
||||||
enableIstio: false
|
enableIstio: false
|
||||||
|
|
||||||
|
executor:
|
||||||
|
adoptExistingResources: false
|
||||||
|
|
||||||
|
## Router config
|
||||||
|
router:
|
||||||
|
deployAsDaemonSet: false
|
||||||
|
svcAddressMaxRetries: 5
|
||||||
|
svcAddressUpdateTimeout: 30s
|
||||||
|
|
||||||
|
## Display endpoint access logs
|
||||||
|
## To be aware of enabling logging endpoint access log, it increases
|
||||||
|
## router resource utilization when under heavy workloads.
|
||||||
|
displayAccessLog: false
|
||||||
|
|
||||||
|
## Add annotations for router
|
||||||
|
# svcAnnotations:
|
||||||
|
# cloud.google.com/load-balancer-type: Internal
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
## Persist data to a persistent volume.
|
## Persist data to a persistent volume.
|
||||||
persistence:
|
persistence:
|
||||||
## If true, fission will create/use a Persistent Volume Claim
|
## If true, fission will create/use a Persistent Volume Claim
|
||||||
@@ -71,7 +124,7 @@ persistence:
|
|||||||
## Extend the container specs for the core fission pods.
|
## Extend the container specs for the core fission pods.
|
||||||
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
|
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
|
||||||
## For example:
|
## For example:
|
||||||
## extraCoreComponmentPodConfig:
|
## extraCoreComponentPodConfig:
|
||||||
## affinity:
|
## affinity:
|
||||||
## nodeAffinity:
|
## nodeAffinity:
|
||||||
## requiredDuringSchedulingIgnoredDuringExecution:
|
## requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
@@ -81,7 +134,7 @@ persistence:
|
|||||||
## operator: In
|
## operator: In
|
||||||
## values:
|
## values:
|
||||||
## - app
|
## - app
|
||||||
extraCoreComponmentPodConfig:
|
#extraCoreComponentPodConfig:
|
||||||
# affinity:
|
# affinity:
|
||||||
# tolerations:
|
# tolerations:
|
||||||
# nodeSelector:
|
# nodeSelector:
|
||||||
@@ -103,10 +156,16 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
|||||||
|
|
||||||
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
|
## 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
|
## summary is returned as part of http response
|
||||||
debugEnv: true
|
debugEnv: false
|
||||||
|
|
||||||
## set this flag to true if prometheus needs to be deployed along with fission
|
## Prometheus for scrapping service metrics
|
||||||
prometheusDeploy: false
|
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
|
## set this flag to false if you dont need canary deployment feature
|
||||||
canaryDeployment:
|
canaryDeployment:
|
||||||
@@ -114,4 +173,4 @@ canaryDeployment:
|
|||||||
|
|
||||||
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
|
# 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"
|
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
|
||||||
#traceSamplingRate: 0.75
|
#traceSamplingRate: 0.75
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
FROM golang:1.11-alpine as fission-builder
|
FROM golang:1.12-alpine as godep
|
||||||
RUN apk add bash ca-certificates git gcc g++ libc-dev
|
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
|
ARG GITCOMMIT=unknown
|
||||||
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
@@ -10,17 +31,15 @@ ARG BUILDVERSION=unknown
|
|||||||
ARG BUILDDATE=unknown
|
ARG BUILDDATE=unknown
|
||||||
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
ARG GOPKG=github.com/fission/fission
|
|
||||||
COPY . /go/src/${GOPKG}
|
|
||||||
WORKDIR /go/src/${GOPKG}/cmd/builder
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
-o /go/bin/builder \
|
-o /go/bin/builder \
|
||||||
-gcflags=-trimpath=$GOPATH \
|
-gcflags=-trimpath=$GOPATH \
|
||||||
-asmflags=-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}"
|
-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.5
|
FROM alpine:3.10 as base
|
||||||
COPY --from=fission-builder /go/bin/builder /
|
RUN apk add --update ca-certificates
|
||||||
|
COPY --from=builder /go/bin/builder /
|
||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
|
||||||
ENTRYPOINT ["/builder"]
|
ENTRYPOINT ["/builder"]
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
FROM golang:1.11-alpine as builder
|
FROM golang:1.12-alpine as godep
|
||||||
RUN apk add bash ca-certificates git gcc g++ libc-dev
|
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
|
ARG GITCOMMIT=unknown
|
||||||
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
@@ -10,16 +31,14 @@ ARG BUILDVERSION=unknown
|
|||||||
ARG BUILDDATE=unknown
|
ARG BUILDDATE=unknown
|
||||||
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
ARG GOPKG=github.com/fission/fission
|
|
||||||
COPY . /go/src/${GOPKG}
|
|
||||||
WORKDIR /go/src/${GOPKG}/cmd/fetcher
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
-o /go/bin/fetcher \
|
-o /go/bin/fetcher \
|
||||||
-gcflags=-trimpath=$GOPATH \
|
-gcflags=-trimpath=$GOPATH \
|
||||||
-asmflags=-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}"
|
-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.4
|
FROM alpine:3.10 as base
|
||||||
|
RUN apk add --update ca-certificates
|
||||||
COPY --from=builder /go/bin/fetcher /
|
COPY --from=builder /go/bin/fetcher /
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
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
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -8,7 +24,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"go.opencensus.io/exporter/jaeger"
|
"contrib.go.opencensus.io/exporter/jaeger"
|
||||||
"go.opencensus.io/plugin/ochttp"
|
"go.opencensus.io/plugin/ochttp"
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@@ -100,17 +116,24 @@ func Run(logger *zap.Logger) {
|
|||||||
mux.HandleFunc("/specialize", f.SpecializeHandler)
|
mux.HandleFunc("/specialize", f.SpecializeHandler)
|
||||||
mux.HandleFunc("/upload", f.UploadHandler)
|
mux.HandleFunc("/upload", f.UploadHandler)
|
||||||
mux.HandleFunc("/version", f.VersionHandler)
|
mux.HandleFunc("/version", f.VersionHandler)
|
||||||
mux.HandleFunc("/readniess-healthz", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
|
readinessHandler := func(w http.ResponseWriter, r *http.Request) {
|
||||||
if !*specializeOnStart || readyToServe {
|
if !*specializeOnStart || readyToServe {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
} else {
|
} else {
|
||||||
w.WriteHeader(http.StatusServiceUnavailable)
|
w.WriteHeader(http.StatusServiceUnavailable)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
mux.HandleFunc("/readiness-healthz", readinessHandler)
|
||||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
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")
|
logger.Info("fetcher ready to receive requests")
|
||||||
http.ListenAndServe(":8000", &ochttp.Handler{
|
http.ListenAndServe(":8000", &ochttp.Handler{
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
FROM golang:1.11-alpine as builder
|
FROM golang:1.12-alpine as godep
|
||||||
RUN apk add bash ca-certificates git gcc g++ libc-dev
|
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
|
ARG GITCOMMIT=unknown
|
||||||
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
@@ -10,18 +31,13 @@ ARG BUILDVERSION=unknown
|
|||||||
ARG BUILDDATE=unknown
|
ARG BUILDDATE=unknown
|
||||||
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
ARG GOPKG=github.com/fission/fission
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
COPY . /go/src/${GOPKG}
|
|
||||||
RUN rm -f /go/src/${GOPKG}/Dockerfile*
|
|
||||||
WORKDIR /go/src/${GOPKG}/cmd/fission-bundle
|
|
||||||
ENV GO111MODULE=on
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -mod vendor \
|
|
||||||
-o /go/bin/fission-bundle \
|
-o /go/bin/fission-bundle \
|
||||||
-gcflags=-trimpath=$GOPATH \
|
-gcflags=-trimpath=$GOPATH \
|
||||||
-asmflags=-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}"
|
-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.4
|
FROM alpine:3.10 as base
|
||||||
RUN apk add --update ca-certificates
|
RUN apk add --update ca-certificates
|
||||||
COPY --from=builder /go/bin/fission-bundle /
|
COPY --from=builder /go/bin/fission-bundle /
|
||||||
|
|
||||||
|
|||||||
+42
-17
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -7,8 +23,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"contrib.go.opencensus.io/exporter/jaeger"
|
||||||
docopt "github.com/docopt/docopt-go"
|
docopt "github.com/docopt/docopt-go"
|
||||||
"go.opencensus.io/exporter/jaeger"
|
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
@@ -34,8 +50,8 @@ func runRouter(logger *zap.Logger, port int, executorUrl string) {
|
|||||||
logger.Fatal("router exited")
|
logger.Fatal("router exited")
|
||||||
}
|
}
|
||||||
|
|
||||||
func runExecutor(logger *zap.Logger, port int, fissionNamespace, functionNamespace, envBuilderNamespace string) {
|
func runExecutor(logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string) {
|
||||||
err := executor.StartExecutor(logger, fissionNamespace, functionNamespace, envBuilderNamespace, port)
|
err := executor.StartExecutor(logger, functionNamespace, envBuilderNamespace, port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("error starting executor", zap.Error(err))
|
logger.Fatal("error starting executor", zap.Error(err))
|
||||||
}
|
}
|
||||||
@@ -102,8 +118,8 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{}) error {
|
func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{}) error {
|
||||||
collectorEndpoint := getStringArgWithDefault(arguments["--collectorEndpoint"], "")
|
collectorEndpoint := os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT")
|
||||||
if collectorEndpoint == "" {
|
if len(collectorEndpoint) == 0 {
|
||||||
logger.Info("skipping trace exporter registration")
|
logger.Info("skipping trace exporter registration")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -180,18 +196,17 @@ Use it to start one or more of the fission servers:
|
|||||||
backends.
|
backends.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
fission-bundle --controllerPort=<port> [--collectorEndpoint=<url>]
|
fission-bundle --controllerPort=<port>
|
||||||
fission-bundle --routerPort=<port> [--executorUrl=<url>] [--collectorEndpoint=<url>]
|
fission-bundle --routerPort=<port> [--executorUrl=<url>]
|
||||||
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>] [--collectorEndpoint=<url>]
|
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
|
||||||
fission-bundle --kubewatcher [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
fission-bundle --kubewatcher [--routerUrl=<url>]
|
||||||
fission-bundle --storageServicePort=<port> --filePath=<filePath> [--collectorEndpoint=<url>]
|
fission-bundle --storageServicePort=<port> --filePath=<filePath>
|
||||||
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>] [--collectorEndpoint=<url>]
|
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
|
||||||
fission-bundle --timer [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
fission-bundle --timer [--routerUrl=<url>]
|
||||||
fission-bundle --mqt [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
fission-bundle --mqt [--routerUrl=<url>]
|
||||||
fission-bundle --logger
|
fission-bundle --logger
|
||||||
fission-bundle --version
|
fission-bundle --version
|
||||||
Options:
|
Options:
|
||||||
--collectorEndpoint=<url> Jaeger HTTP Thrift collector URL.
|
|
||||||
--controllerPort=<port> Port that the controller should listen on.
|
--controllerPort=<port> Port that the controller should listen on.
|
||||||
--routerPort=<port> Port that the router should listen on.
|
--routerPort=<port> Port that the router should listen on.
|
||||||
--executorPort=<port> Port that the executor should listen on.
|
--executorPort=<port> Port that the executor should listen on.
|
||||||
@@ -208,7 +223,18 @@ Options:
|
|||||||
--builderMgr Start builder manager.
|
--builderMgr Start builder manager.
|
||||||
--version Print version information
|
--version Print version information
|
||||||
`
|
`
|
||||||
logger, err := zap.NewProduction()
|
|
||||||
|
var logger *zap.Logger
|
||||||
|
var err error
|
||||||
|
|
||||||
|
isDebugEnv, _ := strconv.ParseBool(os.Getenv("DEBUG_ENV"))
|
||||||
|
if isDebugEnv {
|
||||||
|
logger, err = zap.NewDevelopment()
|
||||||
|
} else {
|
||||||
|
config := zap.NewProductionConfig()
|
||||||
|
config.DisableStacktrace = true
|
||||||
|
logger, err = config.Build()
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("can't initialize zap logger: %v", err)
|
log.Fatalf("can't initialize zap logger: %v", err)
|
||||||
}
|
}
|
||||||
@@ -226,7 +252,6 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function")
|
functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function")
|
||||||
fissionNs := getStringArgWithDefault(arguments["--fission-namespace"], "fission")
|
|
||||||
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
|
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
|
||||||
|
|
||||||
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
|
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
|
||||||
@@ -245,7 +270,7 @@ Options:
|
|||||||
|
|
||||||
if arguments["--executorPort"] != nil {
|
if arguments["--executorPort"] != nil {
|
||||||
port := getPort(logger, arguments["--executorPort"])
|
port := getPort(logger, arguments["--executorPort"])
|
||||||
runExecutor(logger, port, fissionNs, functionNs, envBuilderNs)
|
runExecutor(logger, port, functionNs, envBuilderNs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--kubewatcher"] == true {
|
if arguments["--kubewatcher"] == true {
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||||
|
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/canaryconfig"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/environment"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/function"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/httptrigger"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/kubewatch"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/mqtrigger"
|
||||||
|
_package "github.com/fission/fission/pkg/fission-cli/cmd/package"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/spec"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/support"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/timetrigger"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd/version"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/flag"
|
||||||
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
usage = `Fission: Fast and Simple Serverless Functions for Kubernetes
|
||||||
|
|
||||||
|
* Github: https://github.com/fission/fission
|
||||||
|
* Documentation: https://docs.fission.io/docs
|
||||||
|
`
|
||||||
|
)
|
||||||
|
|
||||||
|
func App() *cobra.Command {
|
||||||
|
cobra.EnableCommandSorting = false
|
||||||
|
|
||||||
|
rootCmd := &cobra.Command{
|
||||||
|
Use: "fission",
|
||||||
|
Long: usage,
|
||||||
|
//SilenceUsage: true,
|
||||||
|
PersistentPreRunE: wrapper.Wrapper(
|
||||||
|
func(input cli.Input) error {
|
||||||
|
console.Verbosity = input.Int(flagkey.Verbosity)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workaround fix for not to show help command
|
||||||
|
// https://github.com/spf13/cobra/issues/587
|
||||||
|
rootCmd.SetHelpCommand(&cobra.Command{
|
||||||
|
Use: "no-help",
|
||||||
|
Hidden: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
wrapper.SetFlags(rootCmd, flag.FlagSet{
|
||||||
|
Global: []flag.Flag{flag.GlobalServer, flag.GlobalVerbosity},
|
||||||
|
})
|
||||||
|
|
||||||
|
groups := helptemplate.CommandGroups{}
|
||||||
|
groups = append(groups, helptemplate.CreateCmdGroup("Basic Commands", environment.Commands(), _package.Commands(), function.Commands()))
|
||||||
|
groups = append(groups, helptemplate.CreateCmdGroup("Trigger Commands", httptrigger.Commands(), mqtrigger.Commands(), timetrigger.Commands(), kubewatch.Commands()))
|
||||||
|
groups = append(groups, helptemplate.CreateCmdGroup("Deploy Strategies Commands", canaryconfig.Commands()))
|
||||||
|
groups = append(groups, helptemplate.CreateCmdGroup("Declarative Application Commands", spec.Commands()))
|
||||||
|
groups = append(groups, helptemplate.CreateCmdGroup("Other Commands", support.Commands(), version.Commands()))
|
||||||
|
groups.Add(rootCmd)
|
||||||
|
|
||||||
|
flagExposer := helptemplate.ActsAsRootCommand(rootCmd, nil, groups...)
|
||||||
|
// show global options in usage
|
||||||
|
flagExposer.ExposeFlags(rootCmd, flagkey.Server, flagkey.Verbosity)
|
||||||
|
|
||||||
|
return rootCmd
|
||||||
|
}
|
||||||
+11
-2
@@ -19,9 +19,18 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
fcli "github.com/fission/fission/pkg/fission-cli"
|
"github.com/fission/fission/cmd/fission-cli/app"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fcli.NewCliApp().Run(os.Args)
|
cmd := app.App()
|
||||||
|
cmd.SilenceErrors = true // use our own error message printer
|
||||||
|
|
||||||
|
err := cmd.Execute()
|
||||||
|
if err != nil {
|
||||||
|
// let program exit with non-zero code when error occurs
|
||||||
|
console.Error(err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
FROM golang:1.11-alpine as builder
|
FROM golang:1.12-alpine as godep
|
||||||
RUN apk add bash ca-certificates git gcc g++ libc-dev
|
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
|
ARG GITCOMMIT=unknown
|
||||||
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
# E.g. GITCOMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
@@ -10,17 +31,13 @@ ARG BUILDVERSION=unknown
|
|||||||
ARG BUILDDATE=unknown
|
ARG BUILDDATE=unknown
|
||||||
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
ARG GOPKG=github.com/fission/fission
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
COPY . /go/src/${GOPKG}
|
|
||||||
WORKDIR /go/src/${GOPKG}/cmd/preupgradechecks
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a \
|
|
||||||
-o /go/bin/pre-upgrade-checks \
|
-o /go/bin/pre-upgrade-checks \
|
||||||
-gcflags=-trimpath=$GOPATH \
|
-gcflags=-trimpath=$GOPATH \
|
||||||
-asmflags=-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}"
|
-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.10 as base
|
||||||
FROM alpine:3.4
|
|
||||||
RUN apk add --update ca-certificates
|
RUN apk add --update ca-certificates
|
||||||
COPY --from=builder /go/bin/pre-upgrade-checks /
|
COPY --from=builder /go/bin/pre-upgrade-checks /
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ func (client *PreUpgradeTaskClient) IsFissionReInstall() bool {
|
|||||||
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
|
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
|
||||||
client.logger.Info("verifying function spec references for all functions in the cluster")
|
client.logger.Info("verifying function spec references for all functions in the cluster")
|
||||||
|
|
||||||
var result *multierror.Error
|
|
||||||
var err error
|
var err error
|
||||||
var fList *fv1.FunctionList
|
var fList *fv1.FunctionList
|
||||||
|
|
||||||
@@ -103,28 +102,30 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
|
|||||||
zap.Int("max_retries", maxRetries))
|
zap.Int("max_retries", maxRetries))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errs := &multierror.Error{}
|
||||||
|
|
||||||
// check that all secrets, configmaps, packages are in the same namespace
|
// check that all secrets, configmaps, packages are in the same namespace
|
||||||
for _, fn := range fList.Items {
|
for _, fn := range fList.Items {
|
||||||
secrets := fn.Spec.Secrets
|
secrets := fn.Spec.Secrets
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
if secret.Namespace != fn.Metadata.Namespace {
|
if secret.Namespace != fn.Metadata.Namespace {
|
||||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
|
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configmaps := fn.Spec.ConfigMaps
|
configmaps := fn.Spec.ConfigMaps
|
||||||
for _, configmap := range configmaps {
|
for _, configmap := range configmaps {
|
||||||
if configmap.Namespace != fn.Metadata.Namespace {
|
if configmap.Namespace != fn.Metadata.Namespace {
|
||||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
|
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fn.Spec.Package.PackageRef.Namespace != fn.Metadata.Namespace {
|
if fn.Spec.Package.PackageRef.Namespace != fn.Metadata.Namespace {
|
||||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if result != nil {
|
if errs.ErrorOrNil() != nil {
|
||||||
client.logger.Fatal("installation failed",
|
client.logger.Fatal("installation failed",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
|
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
|
||||||
@@ -218,5 +219,4 @@ func (client *PreUpgradeTaskClient) SetupRoleBindings() {
|
|||||||
|
|
||||||
client.logger.Info("created rolebindings in default namespace",
|
client.logger.Info("created rolebindings in default namespace",
|
||||||
zap.Strings("role_bindings", []string{types.PackageGetterRB, types.SecretConfigMapGetterRB}))
|
zap.Strings("role_bindings", []string{types.PackageGetterRB, types.SecretConfigMapGetterRB}))
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,11 +81,6 @@ clear
|
|||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#
|
|
||||||
# Record replay
|
|
||||||
#
|
|
||||||
clear
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Canary Deployments
|
# Canary Deployments
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ metadata:
|
|||||||
name: guestbook
|
name: guestbook
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
fission fn delete --name hi-py
|
|
||||||
fission route delete --name $(fission route list|grep hi|cut -f1 -d' ')
|
|
||||||
fission recorder delete --name my-recorder
|
|
||||||
kubectl -n fission delete pod redis-0
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from flask import current_app
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
name=request.args["name"]
|
|
||||||
return "Hello, %s" % name
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DEMO_RUN_FAST=1
|
|
||||||
ROOT_DIR=$(dirname $0)/..
|
|
||||||
. $ROOT_DIR/util.sh
|
|
||||||
|
|
||||||
desc "A simple function that takes inputs"
|
|
||||||
run "cat hi.py"
|
|
||||||
|
|
||||||
desc "Set up function"
|
|
||||||
run "fission function create --name hi-py --env python --code hi.py --entrypoint hi.main"
|
|
||||||
|
|
||||||
desc "Set up route"
|
|
||||||
run "fission route create --function hi-py --url /hi --method GET"
|
|
||||||
|
|
||||||
desc "Set up recorder"
|
|
||||||
run "fission recorder create --name my-recorder --function hi-py"
|
|
||||||
|
|
||||||
desc "Run function"
|
|
||||||
run "curl http://$FISSION_ROUTER/hi?name=world"
|
|
||||||
|
|
||||||
desc "View recording"
|
|
||||||
run "fission records view -v"
|
|
||||||
|
|
||||||
requid=$(fission records view -v|tail -1|cut -f1 -d' ')
|
|
||||||
|
|
||||||
desc "Replay recording"
|
|
||||||
run "fission replay --reqUID $requid"
|
|
||||||
@@ -38,10 +38,8 @@ func (e *Env) ToStringEnv() []string {
|
|||||||
|
|
||||||
func NewEnv(stringEnv []string) *Env {
|
func NewEnv(stringEnv []string) *Env {
|
||||||
env := &Env{}
|
env := &Env{}
|
||||||
if stringEnv != nil {
|
for _, rawEnvVar := range stringEnv {
|
||||||
for _, rawEnvVar := range stringEnv {
|
env.SetEnv(FromString(rawEnvVar))
|
||||||
env.SetEnv(FromString(rawEnvVar))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
ARG GO_VERSION=1.9.2
|
ARG GO_VERSION=1.9.2
|
||||||
|
|
||||||
|
FROM ubuntu:18.04 AS base
|
||||||
|
WORKDIR /
|
||||||
|
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS builder
|
FROM golang:${GO_VERSION} AS builder
|
||||||
|
|
||||||
ENV GOPATH /usr
|
ENV GOPATH /usr
|
||||||
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
||||||
|
|
||||||
|
WORKDIR ${APP}
|
||||||
|
|
||||||
ADD context ${APP}/context
|
ADD context ${APP}/context
|
||||||
ADD server.go ${APP}
|
ADD server.go ${APP}
|
||||||
|
|
||||||
WORKDIR ${APP}
|
|
||||||
RUN go get
|
RUN go get
|
||||||
RUN go build -a -o /server server.go
|
RUN go build -a -o /server server.go
|
||||||
|
|
||||||
FROM ubuntu:18.04
|
FROM base
|
||||||
WORKDIR /
|
|
||||||
COPY --from=builder /server /
|
COPY --from=builder /server /
|
||||||
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENTRYPOINT ["/server"]
|
ENTRYPOINT ["/server"]
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
ARG GO_VERSION=1.11.4
|
ARG GO_VERSION=1.11.4
|
||||||
|
|
||||||
|
FROM ubuntu:18.04 AS base
|
||||||
|
WORKDIR /
|
||||||
|
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS builder
|
FROM golang:${GO_VERSION} AS builder
|
||||||
|
|
||||||
ENV GOPATH /usr
|
ENV GOPATH /usr
|
||||||
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
||||||
|
|
||||||
|
WORKDIR ${APP}
|
||||||
|
|
||||||
ADD context ${APP}/context
|
ADD context ${APP}/context
|
||||||
ADD server.go ${APP}
|
ADD server.go ${APP}
|
||||||
|
|
||||||
WORKDIR ${APP}
|
|
||||||
RUN go get
|
RUN go get
|
||||||
RUN go build -a -o /server server.go
|
RUN go build -a -o /server server.go
|
||||||
|
|
||||||
FROM ubuntu:18.04
|
FROM base
|
||||||
WORKDIR /
|
|
||||||
COPY --from=builder /server /
|
COPY --from=builder /server /
|
||||||
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENTRYPOINT ["/server"]
|
ENTRYPOINT ["/server"]
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
ARG GO_VERSION=1.12.7
|
||||||
|
|
||||||
|
FROM ubuntu:18.04 AS base
|
||||||
|
WORKDIR /
|
||||||
|
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION} AS builder
|
||||||
|
|
||||||
|
ENV GOPATH /usr
|
||||||
|
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
|
||||||
|
|
||||||
|
WORKDIR ${APP}
|
||||||
|
|
||||||
|
ADD context ${APP}/context
|
||||||
|
ADD server.go ${APP}
|
||||||
|
|
||||||
|
RUN go get
|
||||||
|
RUN go build -a -o /server server.go
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
COPY --from=builder /server /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/server"]
|
||||||
|
EXPOSE 8888
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
ARG BUILDER_IMAGE=fission/builder
|
||||||
|
ARG GO_VERSION=1.12.7
|
||||||
|
|
||||||
|
FROM ${BUILDER_IMAGE}
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION}
|
||||||
|
|
||||||
|
ENV GOPATH /usr
|
||||||
|
ENV GO111MODULE on
|
||||||
|
WORKDIR ${GOPATH}
|
||||||
|
|
||||||
|
COPY --from=0 /builder /builder
|
||||||
|
ADD build.sh /usr/local/bin/build
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
@@ -6,6 +6,9 @@ srcDir=${GOPATH}/src/$(basename ${SRC_PKG})
|
|||||||
|
|
||||||
trap "rm -rf ${srcDir}" EXIT
|
trap "rm -rf ${srcDir}" EXIT
|
||||||
|
|
||||||
|
# http://ask.xmodulo.com/compare-two-version-numbers.html
|
||||||
|
version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||||
|
|
||||||
if [ -d ${SRC_PKG} ]
|
if [ -d ${SRC_PKG} ]
|
||||||
then
|
then
|
||||||
echo "Building in directory ${srcDir}"
|
echo "Building in directory ${srcDir}"
|
||||||
@@ -18,4 +21,25 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${srcDir}
|
cd ${srcDir}
|
||||||
go build -buildmode=plugin -i -o ${DEPLOY_PKG} .
|
|
||||||
|
if [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
|
||||||
|
if [ -f "go.mod" ]; then
|
||||||
|
go mod download
|
||||||
|
else
|
||||||
|
# still need to do this; otherwise, go will complain "cannot find main module".
|
||||||
|
go mod init
|
||||||
|
fi
|
||||||
|
else # go version lower than go 1.12
|
||||||
|
if [ -f "go.mod" ]; then
|
||||||
|
echo "Please update fission/go-builder and fission/go-env image to the latest version to support go module"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use vendor mode if the vendor dir exists when go version is greater
|
||||||
|
# than 1.12 (the version that fission started to support go module).
|
||||||
|
if [ -d "vendor" ] && [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
|
||||||
|
go build -mod=vendor -buildmode=plugin -i -o ${DEPLOY_PKG} .
|
||||||
|
else
|
||||||
|
go build -buildmode=plugin -i -o ${DEPLOY_PKG} .
|
||||||
|
fi
|
||||||
|
|||||||
@@ -153,14 +153,14 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
|
|||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
logger.Error("code path does not exist",
|
logger.Error("code path does not exist",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("code_path", CODE_PATH))
|
zap.String("code_path", loadreq.FilePath))
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
w.Write([]byte(CODE_PATH + ": not found"))
|
w.Write([]byte(loadreq.FilePath + ": not found"))
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
logger.Error("unknown error looking for code path",
|
logger.Error("unknown error looking for code path",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("code_path", CODE_PATH))
|
zap.String("code_path", loadreq.FilePath))
|
||||||
err = errors.Wrap(err, "unknown error")
|
err = errors.Wrap(err, "unknown error")
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
FROM maven:3.5-jdk-8 as BUILD
|
FROM maven:3.5-jdk-8 as BUILD
|
||||||
COPY src /usr/src/myapp/src
|
WORKDIR /usr/src/myapp/
|
||||||
COPY pom.xml /usr/src/myapp
|
|
||||||
RUN mvn -f /usr/src/myapp/pom.xml clean package
|
# To reuse the build cache, here we split maven dependency
|
||||||
|
# download and package into two RUN commands to avoid cache invalidation.
|
||||||
|
COPY pom.xml .
|
||||||
|
RUN mvn dependency:go-offline
|
||||||
|
|
||||||
|
COPY src /usr/src/myapp/src/
|
||||||
|
RUN mvn package
|
||||||
|
|
||||||
FROM openjdk:8-jdk-alpine
|
FROM openjdk:8-jdk-alpine
|
||||||
VOLUME /tmp
|
VOLUME /tmp
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
|
|||||||
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
|
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
|
||||||
|
|
||||||
ENV JAVA_VERSION 8u181
|
ENV JAVA_VERSION 8u181
|
||||||
ENV JAVA_ALPINE_VERSION 8.181.13-r0
|
## Use "fuzzy" version matching to pin the version to a major/minor release
|
||||||
|
ENV JAVA_ALPINE_VERSION "~8"
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apk add --no-cache \
|
&& apk add --no-cache \
|
||||||
@@ -44,4 +45,4 @@ ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
|
|||||||
|
|
||||||
## Fission builder specific section
|
## Fission builder specific section
|
||||||
ADD build.sh /usr/local/bin/build
|
ADD build.sh /usr/local/bin/build
|
||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "Soam Vasani",
|
"name": "Soam Vasani",
|
||||||
"email": "soamvasani@platform9.com"
|
"email": "soamvasani+1@gmail.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Gary Yeap",
|
"name": "Gary Yeap",
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ if (!argv.port) {
|
|||||||
argv.port = 8888;
|
argv.port = 8888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To catch unhandled exceptions thrown by user code async callbacks,
|
||||||
|
// these exceptions cannot be catched by try-catch in user function invocation code below
|
||||||
|
process.on('uncaughtException', (err) => {
|
||||||
|
console.error(`Caught exception: ${err}`);
|
||||||
|
});
|
||||||
|
|
||||||
// User function. Starts out undefined.
|
// User function. Starts out undefined.
|
||||||
let userFunction;
|
let userFunction;
|
||||||
|
|
||||||
@@ -91,7 +97,7 @@ function specialize(req, res) {
|
|||||||
|
|
||||||
|
|
||||||
// Request logger
|
// Request logger
|
||||||
app.use(morgan('combined'))
|
app.use(morgan('combined'));
|
||||||
|
|
||||||
app.use(bodyParser.urlencoded({ extended: false, limit: '1mb' }));
|
app.use(bodyParser.urlencoded({ extended: false, limit: '1mb' }));
|
||||||
app.use(bodyParser.json({limit: '1mb'}));
|
app.use(bodyParser.json({limit: '1mb'}));
|
||||||
@@ -132,10 +138,15 @@ app.all('/', function (req, res) {
|
|||||||
// you can do that here by adding properties to the context.
|
// you can do that here by adding properties to the context.
|
||||||
//
|
//
|
||||||
|
|
||||||
let functionProm;
|
if (userFunction.length <= 1) { // One or zero argument (context)
|
||||||
if (userFunction.length === 1) { // One argument (context)
|
let result;
|
||||||
// Make sure their function returns a promise
|
// Make sure their function returns a promise
|
||||||
Promise.resolve(userFunction(context)).then(function({ status, body, headers }) {
|
if (userFunction.length === 0) {
|
||||||
|
result = Promise.resolve(userFunction())
|
||||||
|
} else {
|
||||||
|
result = Promise.resolve(userFunction(context))
|
||||||
|
}
|
||||||
|
result.then(function({status, body, headers}) {
|
||||||
callback(status, body, headers);
|
callback(status, body, headers);
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(`Function error: ${err}`);
|
console.log(`Function error: ${err}`);
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
FROM alpine:3.5
|
FROM alpine:3.5
|
||||||
|
|
||||||
RUN apk update
|
WORKDIR /app
|
||||||
RUN apk add --no-cache python3 python3-dev build-base libev-dev
|
|
||||||
RUN pip3 install --upgrade pip
|
RUN apk add --no-cache python3 python3-dev build-base libev-dev && \
|
||||||
RUN rm -r /root/.cache
|
pip3 install --upgrade pip && \
|
||||||
|
rm -r /root/.cache
|
||||||
|
|
||||||
|
COPY requirements.txt /app
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
|
||||||
RUN pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
ENTRYPOINT ["python3"]
|
ENTRYPOINT ["python3"]
|
||||||
CMD ["server.py"]
|
CMD ["server.py"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
FROM alpine:3.5
|
FROM alpine:3.5
|
||||||
|
|
||||||
RUN apk update
|
WORKDIR /app
|
||||||
RUN apk add --no-cache python python-dev build-base py-pip libev-dev
|
|
||||||
RUN pip install --upgrade pip
|
RUN apk add --no-cache python python-dev build-base py-pip libev-dev && \
|
||||||
RUN rm -r /root/.cache
|
pip install --upgrade pip && \
|
||||||
|
rm -r /root/.cache
|
||||||
|
|
||||||
|
COPY requirements.txt /app
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
ENTRYPOINT ["python"]
|
ENTRYPOINT ["python"]
|
||||||
CMD ["server.py"]
|
CMD ["server.py"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
flask ~= 0.12.3
|
flask ~= 1.0.4
|
||||||
bjoern
|
bjoern
|
||||||
httplib2
|
httplib2
|
||||||
python-dateutil
|
python-dateutil
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
ARG GO_VERSION=1.9.2
|
||||||
|
|
||||||
|
FROM tensorflow/serving as serving
|
||||||
|
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION} AS builder
|
||||||
|
|
||||||
|
ENV GOPATH /usr
|
||||||
|
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/tensorflow-serving
|
||||||
|
|
||||||
|
WORKDIR ${APP}
|
||||||
|
|
||||||
|
ADD server.go ${APP}
|
||||||
|
|
||||||
|
RUN go get
|
||||||
|
RUN go build -a -o /server server.go
|
||||||
|
|
||||||
|
FROM serving
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=builder /server /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/server"]
|
||||||
|
EXPOSE 8888
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Fission: Tensorflow Serving Environment
|
||||||
|
|
||||||
|
This is the Tensorflow Serving environment for Fission.
|
||||||
|
|
||||||
|
It's a Docker image containing a Go runtime, along with a tensorflow serving service.
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
|
||||||
|
Tensorflow Serving is an serving service that supports both RESTful API and gRPC endpoints. In current implementation,
|
||||||
|
Go server launches `tensorflow_model_server` to load in model during specialization. As long as the Go server receives
|
||||||
|
requests from router it creates a reverse proxy that connects to RESTful API endpoint exposed by tensorflow_model_server
|
||||||
|
and get response from the upstream server for user.
|
||||||
|
|
||||||
|
## Build this image
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t USER/tensorflow-serving . && docker push USER/tensorflow-serving
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using the image in fission
|
||||||
|
|
||||||
|
You can add this customized image to fission with "fission env create":
|
||||||
|
|
||||||
|
```
|
||||||
|
fission env create --name tensorflow --image USER/tensorflow-serving --version 2
|
||||||
|
```
|
||||||
|
|
||||||
|
After this, fission functions that have the env parameter set to the
|
||||||
|
same environment name as this command will use this environment.
|
||||||
@@ -0,0 +1,226 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PortgRPC = 8500
|
||||||
|
PortRestAPI = 8501
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
specialized = false
|
||||||
|
|
||||||
|
// for tensorflow serving to use
|
||||||
|
MODEL_NAME = ""
|
||||||
|
API_TYPE = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
FunctionLoadRequest struct {
|
||||||
|
// FilePath is an absolute filesystem path to the
|
||||||
|
// function. What exactly is stored here is
|
||||||
|
// env-specific. Optional.
|
||||||
|
FilePath string `json:"filepath"`
|
||||||
|
|
||||||
|
// FunctionName has an environment-specific meaning;
|
||||||
|
// usually, it defines a function within a module
|
||||||
|
// containing multiple functions. Optional; default is
|
||||||
|
// environment-specific.
|
||||||
|
FunctionName string `json:"functionName"`
|
||||||
|
|
||||||
|
// URL to expose this function at. Optional; defaults
|
||||||
|
// to "/".
|
||||||
|
URL string `json:"url"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func specializeHandler(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
logger.Error("v1 interface is not implemented")
|
||||||
|
w.WriteHeader(http.StatusNotImplemented)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if specialized {
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
w.Write([]byte("Not a generic container"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
body, err := ioutil.ReadAll(r.Body)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("error reading request body", zap.Error(err))
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var loadreq FunctionLoadRequest
|
||||||
|
err = json.Unmarshal(body, &loadreq)
|
||||||
|
if err != nil {
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tensorflow-serving supports three types of API: classify, regress, predict
|
||||||
|
// To get the API type, we need to split the entry point with separator ":"
|
||||||
|
// POST http://host:port/v1/models/${MODEL_NAME}:(classify|regress:predict)
|
||||||
|
entrypoint := strings.Split(loadreq.FunctionName, ":")
|
||||||
|
modelDir, apiType := "", ""
|
||||||
|
|
||||||
|
if len(entrypoint) == 0 {
|
||||||
|
logger.Error("unable to load model due to empty entrypoint")
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
} else if len(entrypoint) == 1 {
|
||||||
|
modelDir = entrypoint[0]
|
||||||
|
apiType = "predict" // assign default API type
|
||||||
|
} else {
|
||||||
|
modelDir = entrypoint[0]
|
||||||
|
apiType = entrypoint[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// To ensure we load model from the expected path
|
||||||
|
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, modelDir)
|
||||||
|
basePath, err = filepath.Abs(basePath)
|
||||||
|
if err != nil {
|
||||||
|
msg := "error getting absolute path of model"
|
||||||
|
logger.Error(msg, zap.Error(err))
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
w.Write([]byte(err.Error()))
|
||||||
|
return
|
||||||
|
} else if !strings.HasPrefix(basePath, loadreq.FilePath) {
|
||||||
|
msg := "incorrect model base path"
|
||||||
|
logger.Error(msg, zap.String("model_base_path", basePath))
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
w.Write([]byte(msg))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = os.Stat(basePath)
|
||||||
|
if err != nil {
|
||||||
|
msg := "error checking model status"
|
||||||
|
logger.Error(msg, zap.Error(err))
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// get directory name that holds model
|
||||||
|
MODEL_NAME = filepath.Base(basePath)
|
||||||
|
API_TYPE = apiType
|
||||||
|
|
||||||
|
argModelBasePath := fmt.Sprintf("--model_base_path=%v", basePath)
|
||||||
|
argModelName := fmt.Sprintf("--model_name=%v", MODEL_NAME)
|
||||||
|
argPortgRPC := fmt.Sprintf("--port=%v", PortgRPC)
|
||||||
|
argPortREST := fmt.Sprintf("--rest_api_port=%v", PortRestAPI)
|
||||||
|
|
||||||
|
logger.Info(fmt.Sprintf("specializing: %v %v", loadreq.FunctionName, loadreq.FilePath))
|
||||||
|
|
||||||
|
// Future: could be improved by keeping subprocess open while environment is specialized
|
||||||
|
cmd := exec.Command("tensorflow_model_server",
|
||||||
|
argPortgRPC, argPortREST, argModelName, argModelBasePath)
|
||||||
|
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
|
err = cmd.Start()
|
||||||
|
if err != nil {
|
||||||
|
msg := "error starting tensorflow serving"
|
||||||
|
logger.Error(msg, zap.Error(err))
|
||||||
|
err = errors.Wrap(err, msg)
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
w.Write([]byte(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
err = cmd.Wait()
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatal("error running tensorflow serving", zap.Error(err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
t := time.Now()
|
||||||
|
retryInterval := 50 * time.Millisecond
|
||||||
|
|
||||||
|
// tensorflow serving takes some time to load model
|
||||||
|
// into memory, keep retrying until it starts REST api server.
|
||||||
|
for {
|
||||||
|
if time.Since(t) > 30*time.Second {
|
||||||
|
w.WriteHeader(http.StatusGatewayTimeout)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
conn, err := net.Dial("tcp", "localhost:8501")
|
||||||
|
if err == nil {
|
||||||
|
conn.Close()
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
logger.Info(fmt.Sprintf("waiting for tensorflow serving to be ready: %v", err.Error()))
|
||||||
|
time.Sleep(retryInterval)
|
||||||
|
retryInterval = retryInterval * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
specialized = true
|
||||||
|
|
||||||
|
logger.Info("done")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func readinessProbeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
logger, err := zap.NewProduction()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("can't initialize zap logger: %v", err)
|
||||||
|
}
|
||||||
|
defer logger.Sync()
|
||||||
|
|
||||||
|
http.HandleFunc("/healthz", readinessProbeHandler)
|
||||||
|
http.HandleFunc("/specialize", specializeHandler(logger.Named("specialize_handler")))
|
||||||
|
http.HandleFunc("/v2/specialize", specializeHandlerV2(logger.Named("specialize_v2_handler")))
|
||||||
|
|
||||||
|
// Generic route -- all http requests go to the user function.
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if !specialized {
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
w.Write([]byte("Generic container: no requests supported"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: replace it with gRPC (https://gist.github.com/mauri870/1f953a183ee6c186e70a0a72e78b088c)
|
||||||
|
// set up proxy server director
|
||||||
|
director := func(req *http.Request) {
|
||||||
|
req.URL.Scheme = "http"
|
||||||
|
req.URL.Host = "localhost:8501"
|
||||||
|
req.URL.Path = fmt.Sprintf("/v1/models/%v:%v", MODEL_NAME, API_TYPE)
|
||||||
|
req.Host = "localhost:8501"
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy := &httputil.ReverseProxy{
|
||||||
|
Director: director,
|
||||||
|
}
|
||||||
|
proxy.ServeHTTP(w, r)
|
||||||
|
})
|
||||||
|
|
||||||
|
logger.Info("listening on 8888 ...")
|
||||||
|
http.ListenAndServe(":8888", nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Go module usage
|
||||||
|
|
||||||
|
1. Initialize your project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go mod init "<module>"
|
||||||
|
```
|
||||||
|
|
||||||
|
For example,
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go mod init "github.com/fission/fission/examples/go/go-module-example"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add dependencies
|
||||||
|
|
||||||
|
* See [here](https://github.com/golang/go/wiki/Modules#daily-workflow)
|
||||||
|
|
||||||
|
3. Verify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go mod verify
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Archive and create package as usual
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ zip -r go.zip .
|
||||||
|
adding: go.mod (deflated 26%)
|
||||||
|
adding: go.sum (deflated 1%)
|
||||||
|
adding: README.md (deflated 37%)
|
||||||
|
adding: main.go (deflated 30%)
|
||||||
|
|
||||||
|
$ fission pkg create --env go --src go.zip
|
||||||
|
```
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
module github.com/fission/fission/examples/go/go-module-example
|
||||||
|
|
||||||
|
require github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
github.com/golang/example v0.0.0-20170904185048-46695d81d1fa/go.mod h1:tO/5UvQ/uKigUjQBPqzstj6uxd3fUIjddi19DxGJeWg=
|
||||||
@@ -7,7 +7,6 @@ spec:
|
|||||||
version: 2
|
version: 2
|
||||||
builder:
|
builder:
|
||||||
command: build
|
command: build
|
||||||
image: fission/go-builder:0.6.0
|
image: fission/go-builder-1.12:1.5.0
|
||||||
runtime:
|
runtime:
|
||||||
image: fission/go-env:0.6.0
|
image: fission/go-env-1.12:1.5.0
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ spec:
|
|||||||
environment:
|
environment:
|
||||||
name: go
|
name: go
|
||||||
namespace: default
|
namespace: default
|
||||||
|
functionTimeout: 60
|
||||||
package:
|
package:
|
||||||
functionName: Handler
|
functionName: Handler
|
||||||
packageref:
|
packageref:
|
||||||
|
|||||||
-202
@@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
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.
|
|
||||||
-65
@@ -1,65 +0,0 @@
|
|||||||
# Go example projects
|
|
||||||
|
|
||||||
This repository contains a collection of Go programs and libraries that
|
|
||||||
demonstrate the language, standard libraries, and tools.
|
|
||||||
|
|
||||||
## The examples
|
|
||||||
|
|
||||||
### [hello](hello/) ([godoc](//godoc.org/github.com/golang/example/hello)) and [stringutil](stringutil/) ([godoc](//godoc.org/github.com/golang/example/stringutil))
|
|
||||||
|
|
||||||
go get github.com/golang/example/hello
|
|
||||||
|
|
||||||
A trivial "Hello, world" program that uses a stringutil package.
|
|
||||||
|
|
||||||
Command [hello](hello/) covers:
|
|
||||||
|
|
||||||
* The basic form of an executable command
|
|
||||||
* Importing packages (from the standard library and the local repository)
|
|
||||||
* Printing strings ([fmt](//golang.org/pkg/fmt/))
|
|
||||||
|
|
||||||
Library [stringutil](stringutil/) covers:
|
|
||||||
|
|
||||||
* The basic form of a library
|
|
||||||
* Conversion between string and []rune
|
|
||||||
* Table-driven unit tests ([testing](//golang.org/pkg/testing/))
|
|
||||||
|
|
||||||
### [outyet](outyet/) ([godoc](//godoc.org/github.com/golang/example/outyet))
|
|
||||||
|
|
||||||
go get github.com/golang/example/outyet
|
|
||||||
|
|
||||||
A web server that answers the question: "Is Go 1.x out yet?"
|
|
||||||
|
|
||||||
Topics covered:
|
|
||||||
|
|
||||||
* Command-line flags ([flag](//golang.org/pkg/flag/))
|
|
||||||
* Web servers ([net/http](//golang.org/pkg/net/http/))
|
|
||||||
* HTML Templates ([html/template](//golang.org/pkg/html/template/))
|
|
||||||
* Logging ([log](//golang.org/pkg/log/))
|
|
||||||
* Long-running background processes
|
|
||||||
* Synchronizing data access between goroutines ([sync](//golang.org/pkg/sync/))
|
|
||||||
* Exporting server state for monitoring ([expvar](//golang.org/pkg/expvar/))
|
|
||||||
* Unit and integration tests ([testing](//golang.org/pkg/testing/))
|
|
||||||
* Dependency injection
|
|
||||||
* Time ([time](//golang.org/pkg/time/))
|
|
||||||
|
|
||||||
### [appengine-hello](appengine-hello/) ([godoc](//godoc.org/github.com/golang/example/appengine-hello))
|
|
||||||
|
|
||||||
goapp get github.com/golang/example/appengine-hello
|
|
||||||
|
|
||||||
A trivial "Hello, world" App Engine application intended to be used as the
|
|
||||||
starting point for your own code.
|
|
||||||
|
|
||||||
_Note_: The `goapp` tool is part of the [Google App Engine SDK for Go](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go).
|
|
||||||
|
|
||||||
### [gotypes](gotypes/) ([godoc](//godoc.org/github.com/golang/example/gotypes))
|
|
||||||
|
|
||||||
The `go/types` package is a type-checker for Go programs. It is one of the most
|
|
||||||
complex packages in Go's standard library, so we have provided this tutorial to
|
|
||||||
help you find your bearings. It comes with several example programs that you
|
|
||||||
can obtain using `go get` and play with as you learn to build tools that analyze
|
|
||||||
or manipulate Go programs.
|
|
||||||
|
|
||||||
### [template](template/) ([godoc](//godoc.org/github.com/golang/example/template))
|
|
||||||
|
|
||||||
A trivial web server that demonstrates the use of the
|
|
||||||
[`template` package](https://golang.org/pkg/text/template/)'s `block` feature.
|
|
||||||
Generated
Vendored
-11
@@ -1,11 +0,0 @@
|
|||||||
This code is a starting point for your Google App Engine application in
|
|
||||||
Go.
|
|
||||||
|
|
||||||
To run the application locally you need the install the [Go Cloud
|
|
||||||
SDK](https://cloud.google.com/appengine/docs/go/#Go_tools) and execute the next
|
|
||||||
command from the directory containing this file:
|
|
||||||
|
|
||||||
$ goapp serve app.yaml
|
|
||||||
|
|
||||||
To deploy the application you have to first create an App Engine project
|
|
||||||
and use it as the application file in all the yaml files.
|
|
||||||
Generated
Vendored
-32
@@ -1,32 +0,0 @@
|
|||||||
// Copyright 2015 Google Inc.
|
|
||||||
//
|
|
||||||
// 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 hello is a simple App Engine application that replies to requests
|
|
||||||
// on /hello with a welcoming message.
|
|
||||||
package hello
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// init is run before the application starts serving.
|
|
||||||
func init() {
|
|
||||||
// Handle all requests with path /hello with the helloHandler function.
|
|
||||||
http.HandleFunc("/hello", helloHandler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func helloHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
fmt.Fprintln(w, "Hello from the Go app")
|
|
||||||
}
|
|
||||||
Generated
Vendored
-32
@@ -1,32 +0,0 @@
|
|||||||
# Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
# 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 writing, software distributed
|
|
||||||
# under the License is distributed on a "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.
|
|
||||||
|
|
||||||
application: you-application-id
|
|
||||||
version: 1
|
|
||||||
runtime: go
|
|
||||||
api_version: go1
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- url: /hello
|
|
||||||
script: _go_app
|
|
||||||
|
|
||||||
- url: /favicon.ico
|
|
||||||
static_files: static/favicon.ico
|
|
||||||
upload: static/favicon.ico
|
|
||||||
|
|
||||||
- url: /
|
|
||||||
static_files: static/index.html
|
|
||||||
upload: static/index.html
|
|
||||||
|
|
||||||
- url: /
|
|
||||||
static_dir: static
|
|
||||||
Generated
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Generated
Vendored
-34
@@ -1,34 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright 2015 Google Inc.
|
|
||||||
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Hello, world</title>
|
|
||||||
<link rel="stylesheet" href="/style.css">
|
|
||||||
<script src="/script.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Hello, world</h1>
|
|
||||||
|
|
||||||
<button onclick="fetchMessage()">Fetch Message</button>
|
|
||||||
<p id="message">Click on the button to fetch the message.</p>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
all: README.md
|
|
||||||
go build ./...
|
|
||||||
|
|
||||||
README.md: go-types.md weave.go $(wildcard */*.go)
|
|
||||||
go run weave.go go-types.md >README.md
|
|
||||||
|
|
||||||
# This is for previewing using github.
|
|
||||||
# $HOME/markdown must be a github client.
|
|
||||||
test: README.md
|
|
||||||
cp README.md $$HOME/markdown/
|
|
||||||
(cd $$HOME/markdown/ && git commit -m . README.md && git push)
|
|
||||||
|
|
||||||
-2554
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-68
@@ -1,68 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
const hello = `package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello, world")
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
//!+
|
|
||||||
func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
info := &types.Info{
|
|
||||||
Defs: make(map[*ast.Ident]types.Object),
|
|
||||||
Uses: make(map[*ast.Ident]types.Object),
|
|
||||||
}
|
|
||||||
_, err := conf.Check("hello", fset, files, info)
|
|
||||||
if err != nil {
|
|
||||||
return err // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
for id, obj := range info.Defs {
|
|
||||||
fmt.Printf("%s: %q defines %v\n",
|
|
||||||
fset.Position(id.Pos()), id.Name, obj)
|
|
||||||
}
|
|
||||||
for id, obj := range info.Uses {
|
|
||||||
fmt.Printf("%s: %q uses %v\n",
|
|
||||||
fset.Position(id.Pos()), id.Name, obj)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Parse one file.
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
f, err := parser.ParseFile(fset, "hello.go", hello, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
if err := PrintDefsUses(fset, f); err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/defsuses
|
|
||||||
$ ./defsuses
|
|
||||||
hello.go:1:9: "main" defines <nil>
|
|
||||||
hello.go:5:6: "main" defines func hello.main()
|
|
||||||
hello.go:6:9: "fmt" uses package fmt
|
|
||||||
hello.go:6:13: "Println" uses func fmt.Println(a ...interface{}) (n int, err error)
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
-77
@@ -1,77 +0,0 @@
|
|||||||
// The doc command prints the doc comment of a package-level object.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/parser"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
// TODO: these will use std go/types after Feb 2016
|
|
||||||
"golang.org/x/tools/go/loader"
|
|
||||||
"golang.org/x/tools/go/types/typeutil"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if len(os.Args) != 3 {
|
|
||||||
log.Fatal("Usage: doc <package> <object>")
|
|
||||||
}
|
|
||||||
//!+part1
|
|
||||||
pkgpath, name := os.Args[1], os.Args[2]
|
|
||||||
|
|
||||||
// The loader loads a complete Go program from source code.
|
|
||||||
conf := loader.Config{ParserMode: parser.ParseComments}
|
|
||||||
conf.Import(pkgpath)
|
|
||||||
lprog, err := conf.Load()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // load error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the package and package-level object.
|
|
||||||
pkg := lprog.Package(pkgpath).Pkg
|
|
||||||
obj := pkg.Scope().Lookup(name)
|
|
||||||
if obj == nil {
|
|
||||||
log.Fatalf("%s.%s not found", pkg.Path(), name)
|
|
||||||
}
|
|
||||||
//!-part1
|
|
||||||
//!+part2
|
|
||||||
|
|
||||||
// Print the object and its methods (incl. location of definition).
|
|
||||||
fmt.Println(obj)
|
|
||||||
for _, sel := range typeutil.IntuitiveMethodSet(obj.Type(), nil) {
|
|
||||||
fmt.Printf("%s: %s\n", lprog.Fset.Position(sel.Obj().Pos()), sel)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the path from the root of the AST to the object's position.
|
|
||||||
// Walk up to the enclosing ast.Decl for the doc comment.
|
|
||||||
_, path, _ := lprog.PathEnclosingInterval(obj.Pos(), obj.Pos())
|
|
||||||
for _, n := range path {
|
|
||||||
switch n := n.(type) {
|
|
||||||
case *ast.GenDecl:
|
|
||||||
fmt.Println("\n", n.Doc.Text())
|
|
||||||
return
|
|
||||||
case *ast.FuncDecl:
|
|
||||||
fmt.Println("\n", n.Doc.Text())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//!-part2
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ ./doc net/http File
|
|
||||||
type net/http.File interface{Readdir(count int) ([]os.FileInfo, error); Seek(offset int64, whence int) (int64, error); Stat() (os.FileInfo, error); io.Closer; io.Reader}
|
|
||||||
/go/src/io/io.go:92:2: method (net/http.File) Close() error
|
|
||||||
/go/src/io/io.go:71:2: method (net/http.File) Read(p []byte) (n int, err error)
|
|
||||||
/go/src/net/http/fs.go:65:2: method (net/http.File) Readdir(count int) ([]os.FileInfo, error)
|
|
||||||
/go/src/net/http/fs.go:66:2: method (net/http.File) Seek(offset int64, whence int) (int64, error)
|
|
||||||
/go/src/net/http/fs.go:67:2: method (net/http.File) Stat() (os.FileInfo, error)
|
|
||||||
|
|
||||||
A File is returned by a FileSystem's Open method and can be
|
|
||||||
served by the FileServer implementation.
|
|
||||||
|
|
||||||
The methods should behave the same as those on an *os.File.
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
-2055
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-10
@@ -1,10 +0,0 @@
|
|||||||
//!+
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello, 世界")
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
Generated
Vendored
-81
@@ -1,81 +0,0 @@
|
|||||||
// The hugeparam command identifies by-value parameters that are larger than n bytes.
|
|
||||||
//
|
|
||||||
// Example:
|
|
||||||
// $ ./hugeparams encoding/xml
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"golang.org/x/tools/go/loader"
|
|
||||||
)
|
|
||||||
|
|
||||||
//!+
|
|
||||||
var bytesFlag = flag.Int("bytes", 48, "maximum parameter size in bytes")
|
|
||||||
|
|
||||||
var sizeof = (&types.StdSizes{8, 8}).Sizeof // the sizeof function
|
|
||||||
|
|
||||||
func PrintHugeParams(fset *token.FileSet, info *types.Info, files []*ast.File) {
|
|
||||||
checkTuple := func(descr string, tuple *types.Tuple) {
|
|
||||||
for i := 0; i < tuple.Len(); i++ {
|
|
||||||
v := tuple.At(i)
|
|
||||||
if sz := sizeof(v.Type()); sz > int64(*bytesFlag) {
|
|
||||||
fmt.Printf("%s: %q %s: %s = %d bytes\n",
|
|
||||||
fset.Position(v.Pos()),
|
|
||||||
v.Name(), descr, v.Type(), sz)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSig := func(sig *types.Signature) {
|
|
||||||
checkTuple("parameter", sig.Params())
|
|
||||||
checkTuple("result", sig.Results())
|
|
||||||
}
|
|
||||||
for _, file := range files {
|
|
||||||
ast.Inspect(file, func(n ast.Node) bool {
|
|
||||||
switch n := n.(type) {
|
|
||||||
case *ast.FuncDecl:
|
|
||||||
checkSig(info.Defs[n.Name].Type().(*types.Signature))
|
|
||||||
case *ast.FuncLit:
|
|
||||||
checkSig(info.Types[n.Type].Type.(*types.Signature))
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
// The loader loads a complete Go program from source code.
|
|
||||||
var conf loader.Config
|
|
||||||
_, err := conf.FromArgs(flag.Args(), false)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // command syntax error
|
|
||||||
}
|
|
||||||
lprog, err := conf.Load()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // load error
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, info := range lprog.InitialPackages() {
|
|
||||||
PrintHugeParams(lprog.Fset, &info.Info, info.Files)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
% ./hugeparam encoding/xml
|
|
||||||
/go/src/encoding/xml/marshal.go:167:50: "start" parameter: encoding/xml.StartElement = 56 bytes
|
|
||||||
/go/src/encoding/xml/marshal.go:734:97: "" result: encoding/xml.StartElement = 56 bytes
|
|
||||||
/go/src/encoding/xml/marshal.go:761:51: "start" parameter: encoding/xml.StartElement = 56 bytes
|
|
||||||
/go/src/encoding/xml/marshal.go:781:68: "start" parameter: encoding/xml.StartElement = 56 bytes
|
|
||||||
/go/src/encoding/xml/xml.go:72:30: "" result: encoding/xml.StartElement = 56 bytes
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-77
@@ -1,77 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
//!+input
|
|
||||||
const input = `package main
|
|
||||||
|
|
||||||
type A struct{}
|
|
||||||
func (*A) f()
|
|
||||||
|
|
||||||
type B int
|
|
||||||
func (B) f()
|
|
||||||
func (*B) g()
|
|
||||||
|
|
||||||
type I interface { f() }
|
|
||||||
type J interface { g() }
|
|
||||||
`
|
|
||||||
|
|
||||||
//!-input
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Parse one file.
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
f, err := parser.ParseFile(fset, "input.go", input, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
pkg, err := conf.Check("hello", fset, []*ast.File{f}, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
//!+implements
|
|
||||||
// Find all named types at package level.
|
|
||||||
var allNamed []*types.Named
|
|
||||||
for _, name := range pkg.Scope().Names() {
|
|
||||||
if obj, ok := pkg.Scope().Lookup(name).(*types.TypeName); ok {
|
|
||||||
allNamed = append(allNamed, obj.Type().(*types.Named))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test assignability of all distinct pairs of
|
|
||||||
// named types (T, U) where U is an interface.
|
|
||||||
for _, T := range allNamed {
|
|
||||||
for _, U := range allNamed {
|
|
||||||
if T == U || !types.IsInterface(U) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if types.AssignableTo(T, U) {
|
|
||||||
fmt.Printf("%s satisfies %s\n", T, U)
|
|
||||||
} else if !types.IsInterface(T) &&
|
|
||||||
types.AssignableTo(types.NewPointer(T), U) {
|
|
||||||
fmt.Printf("%s satisfies %s\n", types.NewPointer(T), U)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//!-implements
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/implements
|
|
||||||
$ ./implements
|
|
||||||
*hello.A satisfies hello.I
|
|
||||||
hello.B satisfies hello.I
|
|
||||||
*hello.B satisfies hello.J
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-77
@@ -1,77 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
//!+input
|
|
||||||
const hello = `
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
// append
|
|
||||||
func main() {
|
|
||||||
// fmt
|
|
||||||
fmt.Println("Hello, world")
|
|
||||||
// main
|
|
||||||
main, x := 1, 2
|
|
||||||
// main
|
|
||||||
print(main, x)
|
|
||||||
// x
|
|
||||||
}
|
|
||||||
// x
|
|
||||||
`
|
|
||||||
|
|
||||||
//!-input
|
|
||||||
|
|
||||||
//!+main
|
|
||||||
func main() {
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each comment contains a name.
|
|
||||||
// Look up that name in the innermost scope enclosing the comment.
|
|
||||||
for _, comment := range f.Comments {
|
|
||||||
pos := comment.Pos()
|
|
||||||
name := strings.TrimSpace(comment.Text())
|
|
||||||
fmt.Printf("At %s,\t%q = ", fset.Position(pos), name)
|
|
||||||
inner := pkg.Scope().Innermost(pos)
|
|
||||||
if _, obj := inner.LookupParent(name, pos); obj != nil {
|
|
||||||
fmt.Println(obj)
|
|
||||||
} else {
|
|
||||||
fmt.Println("not found")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-main
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/lookup
|
|
||||||
$ ./lookup
|
|
||||||
At hello.go:6:1, "append" = builtin append
|
|
||||||
At hello.go:8:9, "fmt" = package fmt
|
|
||||||
At hello.go:10:9, "main" = func cmd/hello.main()
|
|
||||||
At hello.go:12:9, "main" = var main int
|
|
||||||
At hello.go:14:9, "x" = var x int
|
|
||||||
At hello.go:16:1, "x" = not found
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-104
@@ -1,104 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
//!+input
|
|
||||||
const input = `package main
|
|
||||||
|
|
||||||
import "bytes"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
var buf bytes.Buffer
|
|
||||||
if buf.Bytes == nil && bytes.Repeat != nil && main == nil {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
//!-input
|
|
||||||
|
|
||||||
var fset = token.NewFileSet()
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
f, err := parser.ParseFile(fset, "input.go", input, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
info := &types.Info{
|
|
||||||
Defs: make(map[*ast.Ident]types.Object),
|
|
||||||
Uses: make(map[*ast.Ident]types.Object),
|
|
||||||
Types: make(map[ast.Expr]types.TypeAndValue),
|
|
||||||
}
|
|
||||||
if _, err = conf.Check("cmd/hello", fset, []*ast.File{f}, info); err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
ast.Inspect(f, func(n ast.Node) bool {
|
|
||||||
if n != nil {
|
|
||||||
CheckNilFuncComparison(info, n)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//!+
|
|
||||||
// CheckNilFuncComparison reports unintended comparisons
|
|
||||||
// of functions against nil, e.g., "if x.Method == nil {".
|
|
||||||
func CheckNilFuncComparison(info *types.Info, n ast.Node) {
|
|
||||||
e, ok := n.(*ast.BinaryExpr)
|
|
||||||
if !ok {
|
|
||||||
return // not a binary operation
|
|
||||||
}
|
|
||||||
if e.Op != token.EQL && e.Op != token.NEQ {
|
|
||||||
return // not a comparison
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this is a comparison against nil, find the other operand.
|
|
||||||
var other ast.Expr
|
|
||||||
if info.Types[e.X].IsNil() {
|
|
||||||
other = e.Y
|
|
||||||
} else if info.Types[e.Y].IsNil() {
|
|
||||||
other = e.X
|
|
||||||
} else {
|
|
||||||
return // not a comparison against nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the object.
|
|
||||||
var obj types.Object
|
|
||||||
switch v := other.(type) {
|
|
||||||
case *ast.Ident:
|
|
||||||
obj = info.Uses[v]
|
|
||||||
case *ast.SelectorExpr:
|
|
||||||
obj = info.Uses[v.Sel]
|
|
||||||
default:
|
|
||||||
return // not an identifier or selection
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, ok := obj.(*types.Func); !ok {
|
|
||||||
return // not a function or method
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("%s: comparison of function %v %v nil is always %v\n",
|
|
||||||
fset.Position(e.Pos()), obj.Name(), e.Op, e.Op == token.NEQ)
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/nilfunc
|
|
||||||
$ ./nilfunc
|
|
||||||
input.go:7:5: comparison of function Bytes == nil is always false
|
|
||||||
input.go:7:25: comparison of function Repeat != nil is always true
|
|
||||||
input.go:7:48: comparison of function main == nil is always false
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-64
@@ -1,64 +0,0 @@
|
|||||||
//!+
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
const hello = `package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello, world")
|
|
||||||
}`
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fset := token.NewFileSet()
|
|
||||||
|
|
||||||
// Parse the input string, []byte, or io.Reader,
|
|
||||||
// recording position information in fset.
|
|
||||||
// ParseFile returns an *ast.File, a syntax tree.
|
|
||||||
f, err := parser.ParseFile(fset, "hello.go", hello, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
|
|
||||||
// A Config controls various options of the type checker.
|
|
||||||
// The defaults work fine except for one setting:
|
|
||||||
// we must specify how to deal with imports.
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
|
|
||||||
// Type-check the package containing only file f.
|
|
||||||
// Check returns a *types.Package.
|
|
||||||
pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("Package %q\n", pkg.Path())
|
|
||||||
fmt.Printf("Name: %s\n", pkg.Name())
|
|
||||||
fmt.Printf("Imports: %s\n", pkg.Imports())
|
|
||||||
fmt.Printf("Scope: %s\n", pkg.Scope())
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/pkginfo
|
|
||||||
$ ./pkginfo
|
|
||||||
Package "cmd/hello"
|
|
||||||
Name: main
|
|
||||||
Imports: [package fmt ("fmt")]
|
|
||||||
Scope: package "cmd/hello" scope 0x820533590 {
|
|
||||||
. func cmd/hello.main()
|
|
||||||
}
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-115
@@ -1,115 +0,0 @@
|
|||||||
// The skeleton command prints the boilerplate for a concrete type
|
|
||||||
// that implements the specified interface type.
|
|
||||||
//
|
|
||||||
// Example:
|
|
||||||
// $ ./skeleton io ReadWriteCloser buffer
|
|
||||||
// // *buffer implements io.ReadWriteCloser.
|
|
||||||
// type buffer struct{ /* ... */ }
|
|
||||||
// func (b *buffer) Close() error { panic("unimplemented") }
|
|
||||||
// func (b *buffer) Read(p []byte) (n int, err error) { panic("unimplemented") }
|
|
||||||
// func (b *buffer) Write(p []byte) (n int, err error) { panic("unimplemented") }
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"unicode"
|
|
||||||
"unicode/utf8"
|
|
||||||
|
|
||||||
"golang.org/x/tools/go/loader"
|
|
||||||
)
|
|
||||||
|
|
||||||
const usage = "Usage: skeleton <package> <interface> <concrete>"
|
|
||||||
|
|
||||||
//!+
|
|
||||||
func PrintSkeleton(pkg *types.Package, ifacename, concname string) error {
|
|
||||||
obj := pkg.Scope().Lookup(ifacename)
|
|
||||||
if obj == nil {
|
|
||||||
return fmt.Errorf("%s.%s not found", pkg.Path(), ifacename)
|
|
||||||
}
|
|
||||||
if _, ok := obj.(*types.TypeName); !ok {
|
|
||||||
return fmt.Errorf("%v is not a named type", obj)
|
|
||||||
}
|
|
||||||
iface, ok := obj.Type().Underlying().(*types.Interface)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("type %v is a %T, not an interface",
|
|
||||||
obj, obj.Type().Underlying())
|
|
||||||
}
|
|
||||||
// Use first letter of type name as receiver parameter.
|
|
||||||
if !isValidIdentifier(concname) {
|
|
||||||
return fmt.Errorf("invalid concrete type name: %q", concname)
|
|
||||||
}
|
|
||||||
r, _ := utf8.DecodeRuneInString(concname)
|
|
||||||
|
|
||||||
fmt.Printf("// *%s implements %s.%s.\n", concname, pkg.Path(), ifacename)
|
|
||||||
fmt.Printf("type %s struct{}\n", concname)
|
|
||||||
mset := types.NewMethodSet(iface)
|
|
||||||
for i := 0; i < mset.Len(); i++ {
|
|
||||||
meth := mset.At(i).Obj()
|
|
||||||
sig := types.TypeString(meth.Type(), (*types.Package).Name)
|
|
||||||
fmt.Printf("func (%c *%s) %s%s {\n\tpanic(\"unimplemented\")\n}\n",
|
|
||||||
r, concname, meth.Name(),
|
|
||||||
strings.TrimPrefix(sig, "func"))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//!-
|
|
||||||
|
|
||||||
func isValidIdentifier(id string) bool {
|
|
||||||
for i, r := range id {
|
|
||||||
if !unicode.IsLetter(r) &&
|
|
||||||
!(i > 0 && unicode.IsDigit(r)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id != ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if len(os.Args) != 4 {
|
|
||||||
log.Fatal(usage)
|
|
||||||
}
|
|
||||||
pkgpath, ifacename, concname := os.Args[1], os.Args[2], os.Args[3]
|
|
||||||
|
|
||||||
// The loader loads a complete Go program from source code.
|
|
||||||
var conf loader.Config
|
|
||||||
conf.Import(pkgpath)
|
|
||||||
lprog, err := conf.Load()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // load error
|
|
||||||
}
|
|
||||||
pkg := lprog.Package(pkgpath).Pkg
|
|
||||||
if err := PrintSkeleton(pkg, ifacename, concname); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output1
|
|
||||||
$ ./skeleton io ReadWriteCloser buffer
|
|
||||||
// *buffer implements io.ReadWriteCloser.
|
|
||||||
type buffer struct{}
|
|
||||||
func (b *buffer) Close() error {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
func (b *buffer) Read(p []byte) (n int, err error) {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
func (b *buffer) Write(p []byte) (n int, err error) {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
//!-output1
|
|
||||||
|
|
||||||
//!+output2
|
|
||||||
$ ./skeleton net/http Handler myHandler
|
|
||||||
// *myHandler implements net/http.Handler.
|
|
||||||
type myHandler struct{}
|
|
||||||
func (m *myHandler) ServeHTTP(http.ResponseWriter, *http.Request) {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
//!-output2
|
|
||||||
*/
|
|
||||||
Generated
Vendored
-134
@@ -1,134 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
|
||||||
"go/format"
|
|
||||||
"go/importer"
|
|
||||||
"go/parser"
|
|
||||||
"go/token"
|
|
||||||
"go/types"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
//!+input
|
|
||||||
const input = `
|
|
||||||
package main
|
|
||||||
|
|
||||||
var m = make(map[string]int)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
v, ok := m["hello, " + "world"]
|
|
||||||
print(rune(v), ok)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
//!-input
|
|
||||||
|
|
||||||
var fset = token.NewFileSet()
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
f, err := parser.ParseFile(fset, "hello.go", input, 0)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err) // parse error
|
|
||||||
}
|
|
||||||
|
|
||||||
conf := types.Config{Importer: importer.Default()}
|
|
||||||
info := &types.Info{Types: make(map[ast.Expr]types.TypeAndValue)}
|
|
||||||
if _, err := conf.Check("cmd/hello", fset, []*ast.File{f}, info); err != nil {
|
|
||||||
log.Fatal(err) // type error
|
|
||||||
}
|
|
||||||
|
|
||||||
//!+inspect
|
|
||||||
// f is a parsed, type-checked *ast.File.
|
|
||||||
ast.Inspect(f, func(n ast.Node) bool {
|
|
||||||
if expr, ok := n.(ast.Expr); ok {
|
|
||||||
if tv, ok := info.Types[expr]; ok {
|
|
||||||
fmt.Printf("%-24s\tmode: %s\n", nodeString(expr), mode(tv))
|
|
||||||
fmt.Printf("\t\t\t\ttype: %v\n", tv.Type)
|
|
||||||
if tv.Value != nil {
|
|
||||||
fmt.Printf("\t\t\t\tvalue: %v\n", tv.Value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
//!-inspect
|
|
||||||
}
|
|
||||||
|
|
||||||
// nodeString formats a syntax tree in the style of gofmt.
|
|
||||||
func nodeString(n ast.Node) string {
|
|
||||||
var buf bytes.Buffer
|
|
||||||
format.Node(&buf, fset, n)
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// mode returns a string describing the mode of an expression.
|
|
||||||
func mode(tv types.TypeAndValue) string {
|
|
||||||
s := ""
|
|
||||||
if tv.IsVoid() {
|
|
||||||
s += ",void"
|
|
||||||
}
|
|
||||||
if tv.IsType() {
|
|
||||||
s += ",type"
|
|
||||||
}
|
|
||||||
if tv.IsBuiltin() {
|
|
||||||
s += ",builtin"
|
|
||||||
}
|
|
||||||
if tv.IsValue() {
|
|
||||||
s += ",value"
|
|
||||||
}
|
|
||||||
if tv.IsNil() {
|
|
||||||
s += ",nil"
|
|
||||||
}
|
|
||||||
if tv.Addressable() {
|
|
||||||
s += ",addressable"
|
|
||||||
}
|
|
||||||
if tv.Assignable() {
|
|
||||||
s += ",assignable"
|
|
||||||
}
|
|
||||||
if tv.HasOk() {
|
|
||||||
s += ",ok"
|
|
||||||
}
|
|
||||||
return s[1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//!+output
|
|
||||||
$ go build github.com/golang/example/gotypes/typeandvalue
|
|
||||||
$ ./typeandvalue
|
|
||||||
make(map[string]int) mode: value
|
|
||||||
type: map[string]int
|
|
||||||
make mode: builtin
|
|
||||||
type: func(map[string]int) map[string]int
|
|
||||||
map[string]int mode: type
|
|
||||||
type: map[string]int
|
|
||||||
string mode: type
|
|
||||||
type: string
|
|
||||||
int mode: type
|
|
||||||
type: int
|
|
||||||
m["hello, "+"world"] mode: value,assignable,ok
|
|
||||||
type: (int, bool)
|
|
||||||
m mode: value,addressable,assignable
|
|
||||||
type: map[string]int
|
|
||||||
"hello, " + "world" mode: value
|
|
||||||
type: string
|
|
||||||
value: "hello, world"
|
|
||||||
"hello, " mode: value
|
|
||||||
type: untyped string
|
|
||||||
value: "hello, "
|
|
||||||
"world" mode: value
|
|
||||||
type: untyped string
|
|
||||||
value: "world"
|
|
||||||
print(rune(v), ok) mode: void
|
|
||||||
type: ()
|
|
||||||
print mode: builtin
|
|
||||||
type: func(rune, bool)
|
|
||||||
rune(v) mode: value
|
|
||||||
type: rune
|
|
||||||
rune mode: type
|
|
||||||
type: rune
|
|
||||||
...more not shown...
|
|
||||||
//!-output
|
|
||||||
*/
|
|
||||||
-191
@@ -1,191 +0,0 @@
|
|||||||
// The weave command is a simple preprocessor for markdown files.
|
|
||||||
// It builds a table of contents and processes %include directives.
|
|
||||||
//
|
|
||||||
// Example usage:
|
|
||||||
// $ go run weave.go go-types.md > README.md
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
log.SetFlags(0)
|
|
||||||
log.SetPrefix("weave: ")
|
|
||||||
if len(os.Args) != 2 {
|
|
||||||
log.Fatal("usage: weave input.md\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
f, err := os.Open(os.Args[1])
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
fmt.Println("<!-- Autogenerated by weave; DO NOT EDIT -->")
|
|
||||||
|
|
||||||
// Pass 1.
|
|
||||||
var toc []string
|
|
||||||
in := bufio.NewScanner(f)
|
|
||||||
for in.Scan() {
|
|
||||||
line := in.Text()
|
|
||||||
if line == "" || (line[0] != '#' && line[0] != '%') {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
line = strings.TrimSpace(line)
|
|
||||||
if line == "%toc" {
|
|
||||||
toc = nil
|
|
||||||
} else if strings.HasPrefix(line, "# ") || strings.HasPrefix(line, "## ") {
|
|
||||||
words := strings.Fields(line)
|
|
||||||
depth := len(words[0])
|
|
||||||
words = words[1:]
|
|
||||||
text := strings.Join(words, " ")
|
|
||||||
for i := range words {
|
|
||||||
words[i] = strings.ToLower(words[i])
|
|
||||||
}
|
|
||||||
line = fmt.Sprintf("%s1. [%s](#%s)",
|
|
||||||
strings.Repeat("\t", depth-1), text, strings.Join(words, "-"))
|
|
||||||
toc = append(toc, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass 2.
|
|
||||||
if _, err := f.Seek(0, os.SEEK_SET); err != nil {
|
|
||||||
log.Fatalf("can't rewind input: %v", err)
|
|
||||||
}
|
|
||||||
in = bufio.NewScanner(f)
|
|
||||||
for in.Scan() {
|
|
||||||
line := in.Text()
|
|
||||||
switch {
|
|
||||||
case strings.HasPrefix(line, "%toc"): // ToC
|
|
||||||
for _, h := range toc {
|
|
||||||
fmt.Println(h)
|
|
||||||
}
|
|
||||||
case strings.HasPrefix(line, "%include"):
|
|
||||||
words := strings.Fields(line)
|
|
||||||
if len(words) < 2 {
|
|
||||||
log.Fatal(line)
|
|
||||||
}
|
|
||||||
filename := words[1]
|
|
||||||
|
|
||||||
// Show caption unless '-' follows.
|
|
||||||
if len(words) < 4 || words[3] != "-" {
|
|
||||||
fmt.Printf(" // go get github.com/golang/example/gotypes/%s\n\n",
|
|
||||||
filepath.Dir(filename))
|
|
||||||
}
|
|
||||||
|
|
||||||
section := ""
|
|
||||||
if len(words) > 2 {
|
|
||||||
section = words[2]
|
|
||||||
}
|
|
||||||
s, err := include(filename, section)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
fmt.Println("```")
|
|
||||||
fmt.Println(cleanListing(s)) // TODO(adonovan): escape /^```/ in s
|
|
||||||
fmt.Println("```")
|
|
||||||
default:
|
|
||||||
fmt.Println(line)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// include processes an included file, and returns the included text.
|
|
||||||
// Only lines between those matching !+tag and !-tag will be returned.
|
|
||||||
// This is true even if tag=="".
|
|
||||||
func include(file, tag string) (string, error) {
|
|
||||||
f, err := os.Open(file)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
startre, err := regexp.Compile("!\\+" + tag + "$")
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
endre, err := regexp.Compile("!\\-" + tag + "$")
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
var text bytes.Buffer
|
|
||||||
in := bufio.NewScanner(f)
|
|
||||||
var on bool
|
|
||||||
for in.Scan() {
|
|
||||||
line := in.Text()
|
|
||||||
switch {
|
|
||||||
case startre.MatchString(line):
|
|
||||||
on = true
|
|
||||||
case endre.MatchString(line):
|
|
||||||
on = false
|
|
||||||
case on:
|
|
||||||
text.WriteByte('\t')
|
|
||||||
text.WriteString(line)
|
|
||||||
text.WriteByte('\n')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if text.Len() == 0 {
|
|
||||||
return "", fmt.Errorf("no lines of %s matched tag %q", file, tag)
|
|
||||||
}
|
|
||||||
return text.String(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func isBlank(line string) bool { return strings.TrimSpace(line) == "" }
|
|
||||||
|
|
||||||
func indented(line string) bool {
|
|
||||||
return strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t")
|
|
||||||
}
|
|
||||||
|
|
||||||
// cleanListing removes entirely blank leading and trailing lines from
|
|
||||||
// text, and removes n leading tabs.
|
|
||||||
func cleanListing(text string) string {
|
|
||||||
lines := strings.Split(text, "\n")
|
|
||||||
|
|
||||||
// remove minimum number of leading tabs from all non-blank lines
|
|
||||||
tabs := 999
|
|
||||||
for i, line := range lines {
|
|
||||||
if strings.TrimSpace(line) == "" {
|
|
||||||
lines[i] = ""
|
|
||||||
} else {
|
|
||||||
if n := leadingTabs(line); n < tabs {
|
|
||||||
tabs = n
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for i, line := range lines {
|
|
||||||
if line != "" {
|
|
||||||
line := line[tabs:]
|
|
||||||
lines[i] = line // remove leading tabs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove leading blank lines
|
|
||||||
for len(lines) > 0 && lines[0] == "" {
|
|
||||||
lines = lines[1:]
|
|
||||||
}
|
|
||||||
// remove trailing blank lines
|
|
||||||
for len(lines) > 0 && lines[len(lines)-1] == "" {
|
|
||||||
lines = lines[:len(lines)-1]
|
|
||||||
}
|
|
||||||
return strings.Join(lines, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func leadingTabs(s string) int {
|
|
||||||
var i int
|
|
||||||
for i = 0; i < len(s); i++ {
|
|
||||||
if s[i] != '\t' {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
FROM golang:onbuild
|
|
||||||
EXPOSE 8080
|
|
||||||
Generated
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
version: v1beta2
|
|
||||||
containers:
|
|
||||||
- name: outyet
|
|
||||||
image: adg1/outyet
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
hostPort: 80
|
|
||||||
containerPort: 8080
|
|
||||||
-140
@@ -1,140 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Google Inc.
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// outyet is a web server that announces whether or not a particular Go version
|
|
||||||
// has been tagged.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"expvar"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Command-line flags.
|
|
||||||
var (
|
|
||||||
httpAddr = flag.String("http", ":8080", "Listen address")
|
|
||||||
pollPeriod = flag.Duration("poll", 5*time.Second, "Poll period")
|
|
||||||
version = flag.String("version", "1.4", "Go version")
|
|
||||||
)
|
|
||||||
|
|
||||||
const baseChangeURL = "https://go.googlesource.com/go/+/"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
changeURL := fmt.Sprintf("%sgo%s", baseChangeURL, *version)
|
|
||||||
http.Handle("/", NewServer(*version, changeURL, *pollPeriod))
|
|
||||||
log.Fatal(http.ListenAndServe(*httpAddr, nil))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exported variables for monitoring the server.
|
|
||||||
// These are exported via HTTP as a JSON object at /debug/vars.
|
|
||||||
var (
|
|
||||||
hitCount = expvar.NewInt("hitCount")
|
|
||||||
pollCount = expvar.NewInt("pollCount")
|
|
||||||
pollError = expvar.NewString("pollError")
|
|
||||||
pollErrorCount = expvar.NewInt("pollErrorCount")
|
|
||||||
)
|
|
||||||
|
|
||||||
// Server implements the outyet server.
|
|
||||||
// It serves the user interface (it's an http.Handler)
|
|
||||||
// and polls the remote repository for changes.
|
|
||||||
type Server struct {
|
|
||||||
version string
|
|
||||||
url string
|
|
||||||
period time.Duration
|
|
||||||
|
|
||||||
mu sync.RWMutex // protects the yes variable
|
|
||||||
yes bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewServer returns an initialized outyet server.
|
|
||||||
func NewServer(version, url string, period time.Duration) *Server {
|
|
||||||
s := &Server{version: version, url: url, period: period}
|
|
||||||
go s.poll()
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// poll polls the change URL for the specified period until the tag exists.
|
|
||||||
// Then it sets the Server's yes field true and exits.
|
|
||||||
func (s *Server) poll() {
|
|
||||||
for !isTagged(s.url) {
|
|
||||||
pollSleep(s.period)
|
|
||||||
}
|
|
||||||
s.mu.Lock()
|
|
||||||
s.yes = true
|
|
||||||
s.mu.Unlock()
|
|
||||||
pollDone()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hooks that may be overridden for integration tests.
|
|
||||||
var (
|
|
||||||
pollSleep = time.Sleep
|
|
||||||
pollDone = func() {}
|
|
||||||
)
|
|
||||||
|
|
||||||
// isTagged makes an HTTP HEAD request to the given URL and reports whether it
|
|
||||||
// returned a 200 OK response.
|
|
||||||
func isTagged(url string) bool {
|
|
||||||
pollCount.Add(1)
|
|
||||||
r, err := http.Head(url)
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
pollError.Set(err.Error())
|
|
||||||
pollErrorCount.Add(1)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return r.StatusCode == http.StatusOK
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServeHTTP implements the HTTP user interface.
|
|
||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
||||||
hitCount.Add(1)
|
|
||||||
s.mu.RLock()
|
|
||||||
data := struct {
|
|
||||||
URL string
|
|
||||||
Version string
|
|
||||||
Yes bool
|
|
||||||
}{
|
|
||||||
s.url,
|
|
||||||
s.version,
|
|
||||||
s.yes,
|
|
||||||
}
|
|
||||||
s.mu.RUnlock()
|
|
||||||
err := tmpl.Execute(w, data)
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// tmpl is the HTML template that drives the user interface.
|
|
||||||
var tmpl = template.Must(template.New("tmpl").Parse(`
|
|
||||||
<!DOCTYPE html><html><body><center>
|
|
||||||
<h2>Is Go {{.Version}} out yet?</h2>
|
|
||||||
<h1>
|
|
||||||
{{if .Yes}}
|
|
||||||
<a href="{{.URL}}">YES!</a>
|
|
||||||
{{else}}
|
|
||||||
No. :-(
|
|
||||||
{{end}}
|
|
||||||
</h1>
|
|
||||||
</center></body></html>
|
|
||||||
`))
|
|
||||||
-99
@@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Google Inc.
|
|
||||||
|
|
||||||
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 (
|
|
||||||
"net/http"
|
|
||||||
"net/http/httptest"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// statusHandler is an http.Handler that writes an empty response using itself
|
|
||||||
// as the response status code.
|
|
||||||
type statusHandler int
|
|
||||||
|
|
||||||
func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.WriteHeader(int(*h))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIsTagged(t *testing.T) {
|
|
||||||
// Set up a fake "Google Code" web server reporting 404 not found.
|
|
||||||
status := statusHandler(http.StatusNotFound)
|
|
||||||
s := httptest.NewServer(&status)
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
if isTagged(s.URL) {
|
|
||||||
t.Fatal("isTagged == true, want false")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change fake server status to 200 OK and try again.
|
|
||||||
status = http.StatusOK
|
|
||||||
|
|
||||||
if !isTagged(s.URL) {
|
|
||||||
t.Fatal("isTagged == false, want true")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIntegration(t *testing.T) {
|
|
||||||
status := statusHandler(http.StatusNotFound)
|
|
||||||
ts := httptest.NewServer(&status)
|
|
||||||
defer ts.Close()
|
|
||||||
|
|
||||||
// Replace the pollSleep with a closure that we can block and unblock.
|
|
||||||
sleep := make(chan bool)
|
|
||||||
pollSleep = func(time.Duration) {
|
|
||||||
sleep <- true
|
|
||||||
sleep <- true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace pollDone with a closure that will tell us when the poller is
|
|
||||||
// exiting.
|
|
||||||
done := make(chan bool)
|
|
||||||
pollDone = func() { done <- true }
|
|
||||||
|
|
||||||
// Put things as they were when the test finishes.
|
|
||||||
defer func() {
|
|
||||||
pollSleep = time.Sleep
|
|
||||||
pollDone = func() {}
|
|
||||||
}()
|
|
||||||
|
|
||||||
s := NewServer("1.x", ts.URL, 1*time.Millisecond)
|
|
||||||
|
|
||||||
<-sleep // Wait for poll loop to start sleeping.
|
|
||||||
|
|
||||||
// Make first request to the server.
|
|
||||||
r, _ := http.NewRequest("GET", "/", nil)
|
|
||||||
w := httptest.NewRecorder()
|
|
||||||
s.ServeHTTP(w, r)
|
|
||||||
if b := w.Body.String(); !strings.Contains(b, "No.") {
|
|
||||||
t.Fatalf("body = %s, want no", b)
|
|
||||||
}
|
|
||||||
|
|
||||||
status = http.StatusOK
|
|
||||||
|
|
||||||
<-sleep // Permit poll loop to stop sleeping.
|
|
||||||
<-done // Wait for poller to see the "OK" status and exit.
|
|
||||||
|
|
||||||
// Make second request to the server.
|
|
||||||
w = httptest.NewRecorder()
|
|
||||||
s.ServeHTTP(w, r)
|
|
||||||
if b := w.Body.String(); !strings.Contains(b, "YES!") {
|
|
||||||
t.Fatalf("body = %q, want yes", b)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
Vendored
-34
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Google Inc.
|
|
||||||
|
|
||||||
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 stringutil
|
|
||||||
|
|
||||||
import "testing"
|
|
||||||
|
|
||||||
func TestReverse(t *testing.T) {
|
|
||||||
for _, c := range []struct {
|
|
||||||
in, want string
|
|
||||||
}{
|
|
||||||
{"Hello, world", "dlrow ,olleH"},
|
|
||||||
{"Hello, 世界", "界世 ,olleH"},
|
|
||||||
{"", ""},
|
|
||||||
} {
|
|
||||||
got := Reverse(c.in)
|
|
||||||
if got != c.want {
|
|
||||||
t.Errorf("Reverse(%q) == %q, want %q", c.in, got, c.want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
{{define "content"}}
|
|
||||||
<div id="image">
|
|
||||||
<img src="{{.URL}}" title="{{.Title}}" alt="{{.Title}}">
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "sidebar"}}
|
|
||||||
<a href="/">Back</a>
|
|
||||||
{{end}}
|
|
||||||
-41
@@ -1,41 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>{{.Title}}</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
background: #ddd;
|
|
||||||
}
|
|
||||||
#sidebar {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>{{.Title}}</h1>
|
|
||||||
|
|
||||||
<div id="sidebar">
|
|
||||||
{{block "sidebar" .}}
|
|
||||||
<h2>Links</h2>
|
|
||||||
{{/* The dashes in the following template directives
|
|
||||||
ensure the generated HTML of this list contains no
|
|
||||||
extraneous spaces or line breaks. */}}
|
|
||||||
<ul>
|
|
||||||
{{- range .Links}}
|
|
||||||
<li><a href="{{.URL}}">{{.Title}}</a></li>
|
|
||||||
{{- end}}
|
|
||||||
</ul>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{block "content" .}}
|
|
||||||
<div id="content">
|
|
||||||
{{.Body}}
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
-97
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Google Inc.
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Command template is a trivial web server that uses the text/template (and
|
|
||||||
// html/template) package's "block" feature to implement a kind of template
|
|
||||||
// inheritance.
|
|
||||||
//
|
|
||||||
// It should be executed from the directory in which the source resides,
|
|
||||||
// as it will look for its template files in the current directory.
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"html/template"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
http.HandleFunc("/", indexHandler)
|
|
||||||
http.HandleFunc("/image/", imageHandler)
|
|
||||||
log.Fatal(http.ListenAndServe("localhost:8080", nil))
|
|
||||||
}
|
|
||||||
|
|
||||||
// indexTemplate is the main site template.
|
|
||||||
// The default template includes two template blocks ("sidebar" and "content")
|
|
||||||
// that may be replaced in templates derived from this one.
|
|
||||||
var indexTemplate = template.Must(template.ParseFiles("index.tmpl"))
|
|
||||||
|
|
||||||
// Index is a data structure used to populate an indexTemplate.
|
|
||||||
type Index struct {
|
|
||||||
Title string
|
|
||||||
Body string
|
|
||||||
Links []Link
|
|
||||||
}
|
|
||||||
|
|
||||||
type Link struct {
|
|
||||||
URL, Title string
|
|
||||||
}
|
|
||||||
|
|
||||||
// indexHandler is an HTTP handler that serves the index page.
|
|
||||||
func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
data := &Index{
|
|
||||||
Title: "Image gallery",
|
|
||||||
Body: "Welcome to the image gallery.",
|
|
||||||
}
|
|
||||||
for name, img := range images {
|
|
||||||
data.Links = append(data.Links, Link{
|
|
||||||
URL: "/image/" + name,
|
|
||||||
Title: img.Title,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := indexTemplate.Execute(w, data); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// imageTemplate is a clone of indexTemplate that provides
|
|
||||||
// alternate "sidebar" and "content" templates.
|
|
||||||
var imageTemplate = template.Must(template.Must(indexTemplate.Clone()).ParseFiles("image.tmpl"))
|
|
||||||
|
|
||||||
// Image is a data structure used to populate an imageTemplate.
|
|
||||||
type Image struct {
|
|
||||||
Title string
|
|
||||||
URL string
|
|
||||||
}
|
|
||||||
|
|
||||||
// imageHandler is an HTTP handler that serves the image pages.
|
|
||||||
func imageHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
data, ok := images[strings.TrimPrefix(r.URL.Path, "/image/")]
|
|
||||||
if !ok {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := imageTemplate.Execute(w, data); err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// images specifies the site content: a collection of images.
|
|
||||||
var images = map[string]*Image{
|
|
||||||
"go": {"The Go Gopher", "https://golang.org/doc/gopher/frontpage.png"},
|
|
||||||
"google": {"The Google Logo", "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"},
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "Soam Vasani",
|
"name": "Soam Vasani",
|
||||||
"email": "soamvasani@platform9.com"
|
"email": "soamvasani+1@gmail.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Gary Yeap",
|
"name": "Gary Yeap",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ metadata:
|
|||||||
name: guestbook
|
name: guestbook
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user