Compare commits
77
Commits
v1.6.0
...
v1.7.0-rc.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
+127
-20
@@ -1,22 +1,129 @@
|
||||
# 1.5.0
|
||||
# 1.7.0-rc.1
|
||||
[Documentation](https://docs.fission.io/)
|
||||
## Downloads for 1.5.0
|
||||
## Downloads for 1.7.0-rc.1
|
||||
|
||||
|
||||
filename | sha256 hash
|
||||
-------- | -----------
|
||||
[fission-core-1.5.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0-minikube.yaml) | `bf804e8106f034b2cb5f7d577ca11a9267db43c4ce9c937af879b8a8f35f422a`
|
||||
[fission-all-1.5.0-minikube.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0-minikube.yaml) | `fc526cde3f18d1cf5a86fa5f3612e0120cb1a0544012ec02292a666d9aed840b`
|
||||
[fission-all-1.5.0.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0.yaml) | `c67b40869823f2ac436a02bb6d15dc68f531c1032c6af3bfdd4cee2a9d43399d`
|
||||
[fission-core-1.5.0.yaml](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0.yaml) | `b15a1771955700c33abf63fe523d2c3393186a4d0f456b5a274aa1434cf7ba3b`
|
||||
[fission-all-1.5.0.tgz](https://github.com/fission/fission/releases/download/1.5.0/fission-all-1.5.0.tgz) | `07e6430f73d1eee0dfb4bd558bc05d51d828332ce2ec7d5b25a0b3722c175bc1`
|
||||
[fission-core-1.5.0.tgz](https://github.com/fission/fission/releases/download/1.5.0/fission-core-1.5.0.tgz) | `d13ac896f0ef480ede0cd505f3dd55370e2f16ed5dc1b5ad3bc67a2e06623aac`
|
||||
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-osx) | `e3415e4c64d404b4065c420d7b62bf1b702e08b40b6018672545f2f2637a2d04`
|
||||
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-windows.exe) | `b539ab484fac6f7a9b513df1f652fc93f5a39cf9a44237c0ba7457b863a05c36`
|
||||
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.5.0/fission-cli-linux) | `d399aa01dac007a69c74be99944767e76321b067d29be64edd73b45d2a23d002`
|
||||
[fission-all-1.7.0-rc.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-all-1.7.0-rc.1-minikube.yaml) | `360645acc1a13dfce5e739ac9cf1abd3cc0aebed612a3a010eb4db668ba9a34b`
|
||||
[fission-core-1.7.0-rc.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-core-1.7.0-rc.1-minikube.yaml) | `8564fe7d7acdcb17baad49f4f3c20b23bb101bd6e550a84a408eeeecceb7d00e`
|
||||
[fission-core-1.7.0-rc.1.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-core-1.7.0-rc.1.yaml) | `1e49e381b08e71454ae330eca958842957d9401a6d26bdfb028ec09338ad68fe`
|
||||
[fission-all-1.7.0-rc.1.yaml](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-all-1.7.0-rc.1.yaml) | `6d12dc90d0a4395eed2397362789843e894534ee446a08f411aa63de92f400fb`
|
||||
[fission-all-1.7.0-rc.1.tgz](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-all-1.7.0-rc.1.tgz) | `be78fd00b1a8df028a41b000838c00e7e16eea25b8a6d0014ee841b8ed73e9c7`
|
||||
[fission-core-1.7.0-rc.1.tgz](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-core-1.7.0-rc.1.tgz) | `07cb5287d0624af5ab025821a1222e764f6e9634b82003b23a46910f9de2f80a`
|
||||
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-cli-osx) | `d68939d54a5e9c9c4bc6bb5477e9e11591514d4c3dcf371bb4272b8f41915d00`
|
||||
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-cli-windows.exe) | `adc30a600a150b78c8defdaae97f8d7aa4d3bc27b0dd71ff1b793e36bfc25437`
|
||||
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.7.0-rc.1/fission-cli-linux) | `5b02b0271568460de8ae7d3090e89cef16031fa8ac9e3e3b179445596bbbeca5`
|
||||
|
||||
# Change Log
|
||||
|
||||
## [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)
|
||||
|
||||
@@ -48,7 +155,6 @@ filename | sha256 hash
|
||||
- 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))
|
||||
|
||||
@@ -59,6 +165,7 @@ filename | sha256 hash
|
||||
|
||||
- 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))
|
||||
- Allow to set deployment config uid during initialization [\#1249](https://github.com/fission/fission/pull/1249) ([life1347](https://github.com/life1347))
|
||||
- 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))
|
||||
@@ -104,9 +211,7 @@ filename | sha256 hash
|
||||
- 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))
|
||||
@@ -116,7 +221,6 @@ filename | sha256 hash
|
||||
- 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)
|
||||
[Full Changelog](https://github.com/fission/fission/compare/1.2.0...1.2.1)
|
||||
@@ -132,6 +236,8 @@ filename | sha256 hash
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Analytics bugfix [\#1195](https://github.com/fission/fission/pull/1195) ([soamvasani](https://github.com/soamvasani))
|
||||
- Show warning message if spec alters poolsize while env version \< 3 [\#1193](https://github.com/fission/fission/pull/1193) ([life1347](https://github.com/life1347))
|
||||
- DRY up fetcher configuration [\#1168](https://github.com/fission/fission/pull/1168) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Add simple anonymous usage metrics [\#1167](https://github.com/fission/fission/pull/1167) ([soamvasani](https://github.com/soamvasani))
|
||||
- Fix the logger not working [\#1166](https://github.com/fission/fission/pull/1166) ([darkgerm](https://github.com/darkgerm))
|
||||
@@ -168,6 +274,7 @@ filename | sha256 hash
|
||||
- Added draft proposal for CI/CD [\#1084](https://github.com/fission/fission/pull/1084) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- \[Kafka MQT\] Add warning about Kafka version [\#1083](https://github.com/fission/fission/pull/1083) ([bhavin192](https://github.com/bhavin192))
|
||||
- Bump base image version of Go environment to 1.11.4 [\#1026](https://github.com/fission/fission/pull/1026) ([life1347](https://github.com/life1347))
|
||||
- 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.0.0](https://github.com/fission/fission/tree/1.0.0) (2019-02-13)
|
||||
[Full Changelog](https://github.com/fission/fission/compare/1.0...1.0.0)
|
||||
@@ -372,6 +479,7 @@ filename | sha256 hash
|
||||
- ArchiveLiteralSizeLimit: Use Constant Instead Hard Code [\#731](https://github.com/fission/fission/pull/731) ([xiekeyang](https://github.com/xiekeyang))
|
||||
- Environment warning message bugfix [\#725](https://github.com/fission/fission/pull/725) ([soamvasani](https://github.com/soamvasani))
|
||||
- V0.8.0 [\#722](https://github.com/fission/fission/pull/722) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Make fetcher resource requests and limits configurable [\#708](https://github.com/fission/fission/pull/708) ([xiekeyang](https://github.com/xiekeyang))
|
||||
- Add steps to render & upload fission installation YAML [\#745](https://github.com/fission/fission/pull/745) ([life1347](https://github.com/life1347))
|
||||
- Fix executor not reaps idle function pods for functions with executortype newdeploy [\#744](https://github.com/fission/fission/pull/744) ([life1347](https://github.com/life1347))
|
||||
- Testing with keep alive settings for connections [\#742](https://github.com/fission/fission/pull/742) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
@@ -396,7 +504,6 @@ filename | sha256 hash
|
||||
- Pre-install/pre-upgrade hooks to verify func references and assign restricted role bindings [\#717](https://github.com/fission/fission/pull/717) ([smruthi2187](https://github.com/smruthi2187))
|
||||
- Logger daemonset's update strategy [\#714](https://github.com/fission/fission/pull/714) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Check spec directory exists before reading spec files [\#709](https://github.com/fission/fission/pull/709) ([life1347](https://github.com/life1347))
|
||||
- Make fetcher resource requests and limits configurable [\#708](https://github.com/fission/fission/pull/708) ([xiekeyang](https://github.com/xiekeyang))
|
||||
- Formatted specifiers are not compatible with variables [\#706](https://github.com/fission/fission/pull/706) ([xiekeyang](https://github.com/xiekeyang))
|
||||
- Indicate HTTP status code by library const [\#703](https://github.com/fission/fission/pull/703) ([xiekeyang](https://github.com/xiekeyang))
|
||||
- docker-distribution version bump for windows compatibility [\#691](https://github.com/fission/fission/pull/691) ([thejosephstevens](https://github.com/thejosephstevens))
|
||||
@@ -582,7 +689,6 @@ filename | sha256 hash
|
||||
- Changed podName to a generic objectReference in cache implementation [\#391](https://github.com/fission/fission/pull/391) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Add package command [\#385](https://github.com/fission/fission/pull/385) ([life1347](https://github.com/life1347))
|
||||
- Executor abstraction [\#384](https://github.com/fission/fission/pull/384) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Fix builder manager issues [\#367](https://github.com/fission/fission/pull/367) ([life1347](https://github.com/life1347))
|
||||
|
||||
## [0.4.0](https://github.com/fission/fission/tree/0.4.0) (2017-11-15)
|
||||
[Full Changelog](https://github.com/fission/fission/compare/0.4.0rc...0.4.0)
|
||||
@@ -601,9 +707,11 @@ filename | sha256 hash
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Use store to sync functions/triggers for fast synchronization [\#382](https://github.com/fission/fission/pull/382) ([life1347](https://github.com/life1347))
|
||||
- Switch from ThirdPartyResources to CustomResourceDefinitions [\#381](https://github.com/fission/fission/pull/381) ([life1347](https://github.com/life1347))
|
||||
- changed helm install pullPolicy from Always to IfNotPresent when building local docker image [\#378](https://github.com/fission/fission/pull/378) ([prithviramesh](https://github.com/prithviramesh))
|
||||
- Reduce function resolving time [\#376](https://github.com/fission/fission/pull/376) ([life1347](https://github.com/life1347))
|
||||
- Fix builder manager issues [\#367](https://github.com/fission/fission/pull/367) ([life1347](https://github.com/life1347))
|
||||
- Test functions 236 [\#355](https://github.com/fission/fission/pull/355) ([vishal-biyani](https://github.com/vishal-biyani))
|
||||
- Make default node-env use alpine. List envs in documentation. [\#354](https://github.com/fission/fission/pull/354) ([rapitable](https://github.com/rapitable))
|
||||
- Update k8s client version to 4.0.0 [\#351](https://github.com/fission/fission/pull/351) ([life1347](https://github.com/life1347))
|
||||
@@ -613,7 +721,6 @@ filename | sha256 hash
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Use store to sync functions/triggers for fast synchronization [\#382](https://github.com/fission/fission/pull/382) ([life1347](https://github.com/life1347))
|
||||
- dotnet20 build fixes [\#365](https://github.com/fission/fission/pull/365) ([soamvasani](https://github.com/soamvasani))
|
||||
- Add experimental deploy script [\#364](https://github.com/fission/fission/pull/364) ([erwinvaneyk](https://github.com/erwinvaneyk))
|
||||
- Fix workflow apiserver proxy [\#363](https://github.com/fission/fission/pull/363) ([erwinvaneyk](https://github.com/erwinvaneyk))
|
||||
@@ -782,7 +889,6 @@ filename | sha256 hash
|
||||
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([sanketsudake](https://github.com/sanketsudake))
|
||||
- Wait for Pod IP while waiting for pod ready [\#89](https://github.com/fission/fission/pull/89) ([soamvasani](https://github.com/soamvasani))
|
||||
- Added support for running C\# code in a dotnet core environment [\#84](https://github.com/fission/fission/pull/84) ([ktrance](https://github.com/ktrance))
|
||||
- Poolmgr: fix pod leak bugs on specializePod failure [\#70](https://github.com/fission/fission/pull/70) ([soamvasani](https://github.com/soamvasani))
|
||||
|
||||
## [alpha20170124](https://github.com/fission/fission/tree/alpha20170124) (2017-01-24)
|
||||
[Full Changelog](https://github.com/fission/fission/compare/kubecon...alpha20170124)
|
||||
@@ -795,6 +901,7 @@ filename | sha256 hash
|
||||
- Bug fix for handling a route's HTTP method in router [\#79](https://github.com/fission/fission/pull/79) ([soamvasani](https://github.com/soamvasani))
|
||||
- fission-bundle: allow setting the namespace [\#77](https://github.com/fission/fission/pull/77) ([frodenas](https://github.com/frodenas))
|
||||
- Delete generic pools when environments are deleted [\#75](https://github.com/fission/fission/pull/75) ([soamvasani](https://github.com/soamvasani))
|
||||
- Poolmgr: fix pod leak bugs on specializePod failure [\#70](https://github.com/fission/fission/pull/70) ([soamvasani](https://github.com/soamvasani))
|
||||
- Poolmgr: ensure orphaned resources are cleaned up [\#69](https://github.com/fission/fission/pull/69) ([soamvasani](https://github.com/soamvasani))
|
||||
- Implement 'fission route update' [\#68](https://github.com/fission/fission/pull/68) ([soamvasani](https://github.com/soamvasani))
|
||||
- Update router cache on new function version [\#67](https://github.com/fission/fission/pull/67) ([soamvasani](https://github.com/soamvasani))
|
||||
@@ -822,6 +929,7 @@ filename | sha256 hash
|
||||
- Readme updates [\#29](https://github.com/fission/fission/pull/29) ([soamvasani](https://github.com/soamvasani))
|
||||
- Add "fission function edit \<function\>" command [\#28](https://github.com/fission/fission/pull/28) ([soamvasani](https://github.com/soamvasani))
|
||||
- Move client-go dependency to 1.5 [\#27](https://github.com/fission/fission/pull/27) ([soamvasani](https://github.com/soamvasani))
|
||||
- fission-bundle: executable package for router, controller, poolmgr [\#17](https://github.com/fission/fission/pull/17) ([soamvasani](https://github.com/soamvasani))
|
||||
|
||||
## [kubecon](https://github.com/fission/fission/tree/kubecon) (2016-11-11)
|
||||
**Merged pull requests:**
|
||||
@@ -829,7 +937,6 @@ filename | sha256 hash
|
||||
- Reap idle pods [\#20](https://github.com/fission/fission/pull/20) ([soamvasani](https://github.com/soamvasani))
|
||||
- Fission CLI [\#19](https://github.com/fission/fission/pull/19) ([soamvasani](https://github.com/soamvasani))
|
||||
- Fix resource store errors on empty db [\#18](https://github.com/fission/fission/pull/18) ([soamvasani](https://github.com/soamvasani))
|
||||
- fission-bundle: executable package for router, controller, poolmgr [\#17](https://github.com/fission/fission/pull/17) ([soamvasani](https://github.com/soamvasani))
|
||||
- Router integration with poolmgr and controller [\#16](https://github.com/fission/fission/pull/16) ([soamvasani](https://github.com/soamvasani))
|
||||
- Poolmgr -- manage generic containers and their specialization [\#15](https://github.com/fission/fission/pull/15) ([soamvasani](https://github.com/soamvasani))
|
||||
- Fetcher is a helper for function run containers [\#14](https://github.com/fission/fission/pull/14) ([soamvasani](https://github.com/soamvasani))
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at codeofconduct@platform9.com. All
|
||||
reported by contacting the project team at slack channel. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
||||
+1
-2
@@ -34,9 +34,8 @@ If you choose a big chunk of work that involves design changes to
|
||||
Fission, please talk to us while planning the change; that way we can
|
||||
all be on the same page before you invest too much work into it.
|
||||
|
||||
* Drop by the [slack channel](http://slack.fission.io)
|
||||
* Drop by the [slack channel](http://slack.fission.io).
|
||||
* Say hi on [twitter](https://twitter.com/fissionio).
|
||||
* Email soamvasani@platform9.com
|
||||
|
||||
### Contribution Howto
|
||||
|
||||
|
||||
+150
-94
@@ -1,105 +1,186 @@
|
||||
# A high-level view of the internals of Fission.
|
||||
|
||||
A high level view of the internals of Fission.
|
||||
|
||||
How it works
|
||||
============
|
||||
## How it works
|
||||
|
||||
Fission is a FaaS -- users create functions (source level), register
|
||||
them with fission using a CLI, and associate functions with triggers.
|
||||
them with Fission using a CLI, and associate functions with triggers.
|
||||
|
||||
Fission wraps those functions into a service, and runs them on
|
||||
Fission wraps those functions into a service and runs them on
|
||||
Kubernetes on demand.
|
||||
|
||||
Here's an overview of the services that make up fission.
|
||||
Here's an overview of the services that make up Fission.
|
||||
|
||||
Components
|
||||
==========
|
||||
## Components
|
||||
|
||||
Language-neutral components:
|
||||
Core Components:
|
||||
* Controller
|
||||
* Executor
|
||||
* Environment Container (language-specific)
|
||||
* Router
|
||||
* Builder Manager
|
||||
* Storage Service
|
||||
|
||||
* controller
|
||||
* poolmgr
|
||||
* router
|
||||
* kubewatcher
|
||||
Optional Components:
|
||||
* Logger
|
||||
* Kubewatcher
|
||||
* Message Queue Trigger
|
||||
* Timer
|
||||
|
||||
Language-specific components:
|
||||
Third-party components:
|
||||
* InfluxDB: To store function logs.
|
||||
* Prometheus: For metric collection and canary deployment.
|
||||
* NATS Streaming: For message queue trigger. (Kafka, Azure are not included in charts deployment.)
|
||||
|
||||
* Environment container(s)
|
||||
## Core Components
|
||||
|
||||
### Controller
|
||||
|
||||
Controller
|
||||
----------
|
||||
The controller contains CRUD APIs for functions, triggers, environments,
|
||||
Kubernetes event watches, etc. This is the component that the client talks to.
|
||||
|
||||
The controller contains CRUD APIs for functions, http triggers,
|
||||
environments, Kubernetes event watches. This is the component that
|
||||
the client talks to.
|
||||
All fission resources are stored in kubernetes CRDs. It needs to be able to
|
||||
talk to kubernetes API service.
|
||||
|
||||
This is the only stateful component. It needs to be configured with a
|
||||
URL to an etcd cluster and a path to a persistent volume. The volume
|
||||
is used to store the functions' source code. Etcd is used as the DB.
|
||||
### Executor
|
||||
|
||||
[Work to extend to other storage backends is planned, see issue #83.]
|
||||
The executor has two simple APIs; the router calls both these endpoints.
|
||||
|
||||
Pool Manager
|
||||
------------
|
||||
* GetFunctionService takes function metadata and dispatches the corresponding executor
|
||||
type to get the address of a service/pod and returns it to the router.
|
||||
|
||||
* TapService lets executor know a service/pod is being used; if it's not
|
||||
called for a few minutes the pod(s) backing the service are killed.
|
||||
|
||||
Poolmgr manages pools of generic containers and function containers.
|
||||
It now supports two different executor types:
|
||||
|
||||
It has a simple API; both these endpoints are called by the router.
|
||||
* PoolManager
|
||||
* NewDeploy
|
||||
|
||||
* GetFunctionService takes function metadata and returns the address
|
||||
of a service.
|
||||
|
||||
* TapService lets poolmgr know a service is being used; if it's not
|
||||
called for a few minutes the pod(s) backing the service are killed.
|
||||
These two executor types have different strategies to launch, specialize, and manage pod(s).
|
||||
You should choose one of the executor types wisely based on the scenario.
|
||||
|
||||
Poolmgr watches the controller API and eagerly creates generic pools
|
||||
for environments. It uses Kubernetes deployments to do that. The
|
||||
environment container runs in a pod with the 'fetcher' container.
|
||||
Fetcher is a very simple utility that downloads a URL sent to it and
|
||||
saves it at a configured location.
|
||||
#### PoolManager
|
||||
|
||||
GetFunctionService "specializes" a pod. The implementation chooses a
|
||||
pod from the pool, relabels it to "orphan" the pod from the
|
||||
deployment, invokes fetcher to copy the function into the pod, and
|
||||
hits the the specialize endpoint on the environment container. This
|
||||
causes the function to be loaded. The pod is now specific to that
|
||||
function.
|
||||
PoolManager manages pools of generic containers and function containers.
|
||||
|
||||
This function pod is cached; it's cleaned up if it's unused for a few
|
||||
minutes.
|
||||
PoolManager watches the environment CRD changes and eagerly creates generic pools
|
||||
for environments. It uses Kubernetes deployments to do that. The
|
||||
environment container runs in a pod with the 'fetcher' container.
|
||||
Fetcher is a straightforward utility that downloads a URL sent to it
|
||||
and saves it at a configured location (shared volume).
|
||||
|
||||
Router
|
||||
------
|
||||
The implementation chooses a generic pod from the pool, relabels it to
|
||||
"orphan". The pod from the deployment invokes fetcher to copy the function
|
||||
into the pod and hits the specialize endpoint on the environment container.
|
||||
This causes the function to be loaded. The pod is now specific to that
|
||||
function. This function pod is cached; it's cleaned up if it's unused for a few minutes.
|
||||
|
||||
The router forwards HTTP requests to function pods. If there's no
|
||||
running service for a function, it requests one from poolmgr, while
|
||||
holding on to the request; when the function's service is ready it
|
||||
forwards the request.
|
||||
PoolManager selects a generic pod from the warm pool, specializes it,
|
||||
and recycles the pod if there are no further requests to the function after a few minutes.
|
||||
It makes PoolManager suitable for functions that are short-living
|
||||
and requires a short cold start time [1].
|
||||
|
||||
The router is stateless and can be scaled up if needed, according to
|
||||
However, PoolManager only selects one pod per function, which is not
|
||||
suitable for serving massive traffic. In such cases, you should consider
|
||||
using NewDeploy as executor type of function.
|
||||
|
||||
[1] The cold start time depends on the package size of the function. If it's
|
||||
a snippet of code, the cold start time usually is less then 100ms.
|
||||
|
||||
#### NewDeploy
|
||||
|
||||
NewDeploy creates deployment, service, and HPA for functions in order to handle
|
||||
massive traffic.
|
||||
|
||||
NewDeploy watches the function CRD changes and creates a Kubernetes deployment,
|
||||
service, and HPA for a function. NewDeploy will scale the replicas of a function
|
||||
deployment to the minimum feasible scale setting, if the minimum scale setting of
|
||||
a function is greater than 0. The 'fetcher' inside the pod uses a URL in the
|
||||
JSON payload, which is attached as a parameter to start fetcher, to download the
|
||||
function package instead of waiting for calls from NewDeploy.
|
||||
|
||||
When a function experiences a traffic spike, the service helps to distribute the requests to
|
||||
pods belonging to the function for better workload distribution and lower latency. Also,
|
||||
the HPA scales the replicas of the deployment based on the conditions set by the user.
|
||||
|
||||
This approach though increases the cold time of a function, but also makes NewDeploy
|
||||
suitable for functions designed to serve massive traffic.
|
||||
|
||||
### Environment Container
|
||||
|
||||
Environment containers run user-defined functions and are language-specific.
|
||||
Each environment container must contain an HTTP server and a loader for functions.
|
||||
|
||||
The pool manager deploys the environment container into a pod with fetcher
|
||||
(fetcher is a simple utility that can fetch an HTTP URL to a file at a
|
||||
configured location). This pod forms a "generic pod" because it can
|
||||
be loaded with any function in that coding language.
|
||||
|
||||
When the pool manager needs to create a service for a function, it calls
|
||||
fetcher to fetch the function. Fetcher downloads the function into a
|
||||
volume shared between fetcher and this environment container. Poolmgr
|
||||
then requests the container to load the function.
|
||||
|
||||
### Router
|
||||
|
||||
The router forwards HTTP requests to function pods. If there's no
|
||||
running service for a function, it requests one from executor, while
|
||||
holding on to the request; the router will forward the request to
|
||||
the pod once the function service is ready.
|
||||
|
||||
The router is the only stateless component and can be scaled up if needed, according to
|
||||
load.
|
||||
|
||||
Kubewatcher
|
||||
-----------
|
||||
### Builder Manager
|
||||
|
||||
The builder manager watches the package & environments CRD changes and manages
|
||||
the builds of function source code. Once an environment that contains a builder
|
||||
image is created, the builder manager will then creates the Kubernetes service
|
||||
and deployment under the fission-builder namespace to start the environment
|
||||
builder. And once a package that contains a source archive is created, the
|
||||
builder manager talks to the environment builder to build the function's source
|
||||
archive into a deploy archive for function deployment.
|
||||
|
||||
After the build, the builder manager asks Builder to upload the deploy archive to the
|
||||
Storage Service once the build succeeded, and updates the package status attached with build logs.
|
||||
|
||||
### Storage Service
|
||||
|
||||
The storage service is the home for all archives of packages with sizes larger than 256KB.
|
||||
The Builder pulls the source archive from the storage service and uploads deploy archive to it.
|
||||
The fetcher inside the function pod also pulls the deploy archive for function specialization.
|
||||
|
||||
## Optional Components
|
||||
|
||||
### Logger
|
||||
|
||||
Logger is deployed as DaemonSet to help to forward function logs to a centralized
|
||||
database service for log persistence. Currently, only InfluxDB is supported to store logs.
|
||||
|
||||
Following is a diagram describe how log service works:
|
||||
1. Logger watches pod changes and creates a symlink to the container log if the pod runs on the same node.
|
||||
2. Fluentd reads logs from symlink and pipes them to InfluxDB
|
||||
3. `fission function logs ...` retrieve event logs from InfluxDB with optional log filter
|
||||
4. Logger removes the symlink if the pod no longer exists.
|
||||
|
||||
### Kubewatcher
|
||||
|
||||
Kubewatcher watches the Kubernetes API and invokes functions
|
||||
associated with watches, sending the watch event to the function.
|
||||
|
||||
The controller keeps track of user's requested watches and associated
|
||||
functions. Kubewatcher watches the API based on these requests; when
|
||||
The controller keeps track of the user's requested watches and associated
|
||||
functions. Kubewatcher watches the API based on these requests; when
|
||||
a watch event occurs, it serializes the object and calls the function
|
||||
via the router.
|
||||
|
||||
While a few simple retries are done, there isn't yet a reliable
|
||||
message bus between Kubewatcher and the function. Work for this is
|
||||
message bus between Kubewatcher and the function. Work for this is
|
||||
tracked in issue #64.
|
||||
|
||||
Message Queue Trigger
|
||||
---------------------
|
||||
### Message Queue Trigger
|
||||
|
||||
A message queue trigger binds a message queue topic to a function:
|
||||
events from that topic cause the function to be invoked with the
|
||||
Events from that topic cause the function to be invoked with the
|
||||
message as the body of the request. The trigger may also contain a
|
||||
response topic: if specified, the function's output is sent to this
|
||||
response.
|
||||
@@ -108,37 +189,12 @@ Here's a diagram of the components:
|
||||
|
||||

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

|
||||
|
||||
1. Pool manager chooses a pod from the pool to execute user function
|
||||
2. Pool manager makes a HTTP POST to logger helper, once helper receives
|
||||
the request it creates a symlink to container log for fluentd.
|
||||
3. Fluentd reads log from symlink and pipes to influxdb
|
||||
4. `fission function logs ...` retrieve event logs from influxdb with
|
||||
optional log filter
|
||||
5. Pool manager removes function pod from pool
|
||||
6. Pool manager asks logger helper to stop piping logs, logger removes symlink.
|
||||
The timer works like a Kubernetes CronJob, but instead of creating a
|
||||
pod to do the task, it sends a request to the router to invoke the
|
||||
function. It is suitable for background tasks that need to execute periodically.
|
||||
|
||||
@@ -11,36 +11,38 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
.PHONY: test
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
IMAGE ?= fission/fission-bundle
|
||||
VERSION ?= latest
|
||||
ARCH ?= amd64
|
||||
OS ?= linux
|
||||
.DEFAULT_GOAL := check
|
||||
|
||||
test:
|
||||
go test -v $(go list ./... | grep -v /examples/ | grep -v /environments/)
|
||||
check: test-run build clean
|
||||
|
||||
build: build-bundle build-client
|
||||
# run basic check scripts
|
||||
test-run:
|
||||
hack/verify-gofmt.sh
|
||||
hack/verify-govet.sh
|
||||
hack/verify-staticcheck.sh
|
||||
hack/runtests.sh
|
||||
@rm -f coverage.txt
|
||||
|
||||
build-client:
|
||||
# ensure the changes are buildable
|
||||
build:
|
||||
go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
||||
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
|
||||
go build -o cmd/fetcher/fetcher ./cmd/fetcher/
|
||||
go build -o cmd/fetcher/builder ./cmd/builder/
|
||||
|
||||
build-bundle:
|
||||
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
||||
# install CLI binary to $PATH
|
||||
install: build
|
||||
mv cmd/fission-cli/fission $(GOPATH)/bin
|
||||
|
||||
build-image:
|
||||
docker build --rm --tag "$(IMAGE):$(VERSION)" cmd/fission-bundle/
|
||||
|
||||
install:
|
||||
go install ./cmd/fission-cli/
|
||||
|
||||
image: build-bundle build-image
|
||||
|
||||
image-push: image
|
||||
docker push "$(IMAGE):$(VERSION)"
|
||||
# build images (environment images are not included)
|
||||
image:
|
||||
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
|
||||
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
|
||||
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
|
||||
|
||||
clean:
|
||||
@rm -f fission-bundle/fission-bundle
|
||||
@rm -f fission/fission
|
||||
@rm -f cmd/fission-bundle/fission-bundle
|
||||
@rm -f cmd/fission-cli/fission
|
||||
@rm -f cmd/fetcher/fetcher
|
||||
@rm -f cmd/fetcher/builder
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Fission: Serverless Functions for Kubernetes
|
||||
============================================
|
||||
# Fission: Serverless Functions for Kubernetes
|
||||
|
||||
[](https://travis-ci.org/fission/fission)
|
||||
[](https://goreportcard.com/report/github.com/fission/fission)
|
||||
[](http://slack.fission.io)
|
||||
@@ -18,7 +18,7 @@ language-specific parts are isolated in something called
|
||||
_environments_ (more below). Fission currently supports NodeJS, Python, Ruby, Go,
|
||||
PHP, Bash, and any Linux executable, with more languages coming soon.
|
||||
|
||||
### Performance: 100msec cold start
|
||||
# Performance: 100msec cold start
|
||||
|
||||
Fission maintains a pool of "warm" containers that each contain a
|
||||
small dynamic loader. When a function is first called,
|
||||
@@ -26,7 +26,7 @@ i.e. "cold-started", a running container is chosen and the function is
|
||||
loaded. This pool is what makes Fission fast: cold-start latencies
|
||||
are typically about 100msec.
|
||||
|
||||
### Kubernetes is the right place for Serverless
|
||||
# Kubernetes is the right place for Serverless
|
||||
|
||||
We're built on Kubernetes because we think any non-trivial app will
|
||||
use a combination of serverless functions and more conventional
|
||||
@@ -37,30 +37,53 @@ Building on Kubernetes also means that anything you do for operations
|
||||
on your Kubernetes cluster — such as monitoring or log
|
||||
aggregation — also helps with ops on your Fission deployment.
|
||||
|
||||
Getting started and documentation
|
||||
===============================
|
||||
# Getting started and documentation
|
||||
|
||||
You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io).
|
||||
* See the [installation guide](https://docs.fission.io/installation/) for installing and running Fission.
|
||||
* See the [troubleshooting guide](https://docs.fission.io/trouble-shooting/) for debugging your functions and Fission installation.
|
||||
## Fission Concepts
|
||||
|
||||
Contributing
|
||||
=================
|
||||
Visit [concepts](https://docs.fission.io/docs/concepts/) for more details.
|
||||
|
||||
### Building Fission
|
||||
See the [compilation guide](https://docs.fission.io/contributing/).
|
||||
## Documentations
|
||||
|
||||
### Contact
|
||||
Reach us on [slack](http://slack.fission.io) or
|
||||
[twitter](https://twitter.com/fissionio).
|
||||
You can learn more about Fission and get started from [Fission Docs](https://docs.fission.io/docs).
|
||||
* See the [installation guide](https://docs.fission.io/docs/installation/) for installing and running Fission.
|
||||
* See the [troubleshooting guide](https://docs.fission.io/docs/trouble-shooting/) for debugging your functions and Fission installation.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Add the stock NodeJS env to your Fission deployment
|
||||
$ fission env create --name nodejs --image fission/node-env
|
||||
|
||||
# A javascript one-liner that prints "hello world"
|
||||
$ curl https://raw.githubusercontent.com/fission/fission/master/examples/nodejs/hello.js > hello.js
|
||||
|
||||
# Upload your function code to fission
|
||||
$ fission function create --name hello --env nodejs --code hello.js
|
||||
|
||||
# Map GET /hello to your new function
|
||||
$ fission route create --method GET --url /hello --function hello
|
||||
|
||||
# Run the function. This takes about 100msec the first time.
|
||||
$ fission function test --name hello
|
||||
Hello, world!
|
||||
```
|
||||
|
||||
# Contributing
|
||||
|
||||
## Building Fission
|
||||
See the [compilation guide](https://docs.fission.io/docs/contributing/).
|
||||
|
||||
## Contact
|
||||
Reach us on [slack](http://slack.fission.io) or [twitter](https://twitter.com/fissionio).
|
||||
|
||||
Fission is a project by [many contributors](https://github.com/fission/fission/graphs/contributors).
|
||||
|
||||
### Community meeting
|
||||
## Community meeting
|
||||
|
||||
A regular community meeting takes place every other Thursday at 08:30 AM PT (Pacific Time). [Convert to your local timezone](http://www.thetimezoneconverter.com/?t=08:30&tz=PT%20%28Pacific%20Time%29).
|
||||
|
||||
## Official Releases
|
||||
# Official Releases
|
||||
|
||||
Official releases of Fission can be found on [the releases page](https://github.com/fission/fission/releases).
|
||||
Please note that it is strongly recommended that you use official releases of Fission, as unreleased versions from
|
||||
@@ -68,6 +91,6 @@ the master branch are subject to changes and incompatibilities that will not be
|
||||
Builds from the master branch can have functionality changed and even removed at any time without compatibility support
|
||||
and without prior notice.
|
||||
|
||||
## Licensing
|
||||
# Licensing
|
||||
|
||||
Fission is under the Apache 2.0 license.
|
||||
|
||||
+5
-3
@@ -43,10 +43,10 @@ Parameter | Description | Default
|
||||
`routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer`
|
||||
`repository` | Image base repository | `index.docker.io`
|
||||
`image` | Fission image repository | `fission/fission-bundle`
|
||||
`imageTag` | Fission image tag | `1.6.0`
|
||||
`imageTag` | Fission image tag | `1.7.0-rc.2`
|
||||
`pullPolicy` | Image pull policy | `IfNotPresent`
|
||||
`fetcherImage` | Fission fetcher repository | `fission/fetcher`
|
||||
`fetcherImageTag` | Fission fetcher image tag | `1.6.0`
|
||||
`fetcherImageTag` | Fission fetcher image tag | `1.7.0-rc.2`
|
||||
`controllerPort` | Fission Controller service port | `31313`
|
||||
`routerPort` | Fission Router service port | ` 31314`
|
||||
`functionNamespace` | Namespace in which to run fission functions (this is different from the release namespace) | `fission-function`
|
||||
@@ -62,7 +62,8 @@ Parameter | Description | Default
|
||||
`pruneInterval` | The frequency of archive pruner (in minutes) | `60`
|
||||
`preUpgradeChecksImage` | Fission pre-install/pre-upgrade checks live in this image | `fission/pre-upgrade-checks`
|
||||
`debugEnv` | If there are any pod specialization errors when a function is triggered and this flag is set to true, the error summary is returned as part of http response | `true`
|
||||
`prometheusDeploy` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
|
||||
`prometheus.enabled` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core`
|
||||
`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil`
|
||||
`canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core`
|
||||
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
|
||||
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
|
||||
@@ -70,6 +71,7 @@ Parameter | Description | Default
|
||||
`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`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: fission-all
|
||||
version: 1.6.0
|
||||
version: 1.7.0-rc.2
|
||||
description: Fission is a fast serverless framework for Kubernetes.
|
||||
keywords:
|
||||
- fission
|
||||
@@ -8,8 +8,8 @@ keywords:
|
||||
home: http://fission.io/
|
||||
maintainers:
|
||||
- name: Soam Vasani
|
||||
email: soamvasani@platform9.com
|
||||
email: soamvasani+1@gmail.com
|
||||
- name: Ta Ching Chen
|
||||
email: contact@tachingchen.com
|
||||
email: hello@tachingchen.com
|
||||
engine: gotpl
|
||||
appVersion: 1.6.0
|
||||
appVersion: 1.7.0-rc.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
dependencies:
|
||||
- name: prometheus
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
version: 7.1.0
|
||||
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
|
||||
generated: 2019-01-03T16:29:53.158684+01:00
|
||||
version: 9.3.1
|
||||
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
|
||||
generated: "2019-11-18T10:16:20.334338911Z"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dependencies:
|
||||
- name: prometheus
|
||||
version: 7.1.0
|
||||
version: 9.3.1
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
condition: prometheusDeploy
|
||||
condition: prometheus.enabled
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
1. Install the client CLI.
|
||||
|
||||
Mac:
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
|
||||
Linux:
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
|
||||
Windows:
|
||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.6.0/fission-cli-windows.exe
|
||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
|
||||
|
||||
2. You're ready to use Fission!
|
||||
|
||||
|
||||
@@ -25,8 +25,10 @@ controller/config.go
|
||||
{{- define "config" -}}
|
||||
canary:
|
||||
enabled: {{ .Values.canaryDeployment.enabled }}
|
||||
{{- if .Values.prometheusDeploy }}
|
||||
{{- if .Values.prometheus.enabled }}
|
||||
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
||||
{{- else }}
|
||||
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
|
||||
{{- end }}
|
||||
{{- printf "\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -137,10 +137,12 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--controllerPort", "8888"]
|
||||
env:
|
||||
- name: FISSION_FUNCTION_NAMESPACE
|
||||
value: "{{ .Values.functionNamespace }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
@@ -169,7 +171,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
@@ -205,7 +207,7 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||
@@ -213,10 +215,12 @@ spec:
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: RUNTIME_IMAGE_PULL_POLICY
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: ENABLE_ISTIO
|
||||
value: "{{ .Values.enableIstio }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: FETCHER_MINCPU
|
||||
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
||||
- name: FETCHER_MINMEM
|
||||
@@ -225,8 +229,6 @@ spec:
|
||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||
- name: FETCHER_MAXMEM
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
readinessProbe:
|
||||
@@ -247,7 +249,7 @@ spec:
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -275,7 +277,7 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||
@@ -283,10 +285,10 @@ spec:
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: BUILDER_IMAGE_PULL_POLICY
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: ENABLE_ISTIO
|
||||
value: "{{ .Values.enableIstio }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: FETCHER_MINCPU
|
||||
@@ -299,7 +301,7 @@ spec:
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -327,13 +329,15 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -438,7 +442,7 @@ spec:
|
||||
command:
|
||||
- /heapster
|
||||
- --source=kubernetes:https://kubernetes.default
|
||||
serviceAccount: {{ .Release.Namespace }}/fission-svc
|
||||
serviceAccountName: {{ .Release.Namespace }}/fission-svc
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
@@ -467,7 +471,7 @@ spec:
|
||||
env:
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -498,7 +502,7 @@ spec:
|
||||
# - name: kubectl-proxy
|
||||
# image: {{ .Values.repository }}/lachlanevenson/k8s-kubectl
|
||||
# args: ["proxy", "--port", "8001", "--address", "127.0.0.1"]
|
||||
# serviceAccount: fission-svc
|
||||
# serviceAccountName: fission-svc
|
||||
|
||||
{{- if .Values.nats.enabled }}
|
||||
---
|
||||
@@ -530,10 +534,8 @@ spec:
|
||||
]
|
||||
ports:
|
||||
- containerPort: 4222
|
||||
hostPort: 4222
|
||||
protocol: TCP
|
||||
- containerPort: 4223
|
||||
hostPort: 4223
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
@@ -577,17 +579,19 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: MESSAGE_QUEUE_TYPE
|
||||
value: nats-streaming
|
||||
- name: MESSAGE_QUEUE_URL
|
||||
value: nats://{{ .Values.nats.authToken }}@nats-streaming:4222
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -620,7 +624,7 @@ spec:
|
||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: MESSAGE_QUEUE_TYPE
|
||||
value: kafka
|
||||
@@ -628,6 +632,8 @@ spec:
|
||||
value: "{{.Values.kafka.brokers}}"
|
||||
- name: MESSAGE_QUEUE_KAFKA_VERSION
|
||||
value: "{{.Values.kafka.version}}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: DEBUG_ENV
|
||||
@@ -643,7 +649,7 @@ spec:
|
||||
- name: kafka-secrets
|
||||
mountPath: /etc/fission/secrets
|
||||
{{- end }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.kafka.authentication.tls.enabled }}
|
||||
volumes:
|
||||
- name: kafka-secrets
|
||||
@@ -708,8 +714,10 @@ spec:
|
||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: MESSAGE_QUEUE_TYPE
|
||||
@@ -723,7 +731,7 @@ spec:
|
||||
key: key
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -754,8 +762,10 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: PRUNE_INTERVAL
|
||||
@@ -781,7 +791,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
volumes:
|
||||
- name: fission-storage
|
||||
{{- if .Values.persistence.enabled }}
|
||||
|
||||
@@ -45,6 +45,10 @@ spec:
|
||||
- name: container-log
|
||||
mountPath: /var/log/
|
||||
readOnly: false
|
||||
{{- if .Values.logger.enableSecurityContext }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: logger
|
||||
{{ if .Values.repository }}
|
||||
@@ -68,6 +72,10 @@ spec:
|
||||
- name: docker-log
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
{{- if .Values.logger.enableSecurityContext }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
- name: fluentbit
|
||||
{{- if .Values.repository }}
|
||||
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
|
||||
@@ -96,6 +104,10 @@ spec:
|
||||
key: password
|
||||
- name: LOG_PATH
|
||||
value: /var/log/fission/*.log
|
||||
{{- if .Values.logger.enableSecurityContext }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: container-log
|
||||
mountPath: /var/log/
|
||||
@@ -106,7 +118,7 @@ spec:
|
||||
- name: fluentbit-config
|
||||
mountPath: /fluent-bit/etc/
|
||||
readOnly: true
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
volumes:
|
||||
- name: container-log
|
||||
hostPath:
|
||||
|
||||
@@ -30,4 +30,4 @@ spec:
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: [ "/pre-upgrade-checks" ]
|
||||
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
spec:
|
||||
ports:
|
||||
- port: 6379
|
||||
targetPort: 6379
|
||||
protocol: TCP
|
||||
name: redis
|
||||
selector:
|
||||
app: redis
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: redis
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: redis
|
||||
serviceName: redis
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: redis
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: redis:3.2-alpine
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
name: redis
|
||||
@@ -33,7 +33,7 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
@@ -53,12 +53,16 @@ spec:
|
||||
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
|
||||
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
|
||||
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: USE_ENCODED_PATH
|
||||
value: {{ .Values.router.useEncodedPath | default false | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: DISPLAY_ACCESS_LOG
|
||||
value: {{ .Values.router.displayAccessLog | default false | quote }}
|
||||
{{- if .Values.analytics }}
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
@@ -84,7 +88,7 @@ spec:
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -20,13 +20,13 @@ image: fission/fission-bundle
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
## Fission image version
|
||||
imageTag: 1.6.0
|
||||
imageTag: 1.7.0-rc.2
|
||||
|
||||
## Fission fetcher repository
|
||||
fetcherImage: fission/fetcher
|
||||
|
||||
## Fission fetcher image version
|
||||
fetcherImageTag: 1.6.0
|
||||
fetcherImageTag: 1.7.0-rc.2
|
||||
|
||||
## Port at which Fission controller service should be exposed
|
||||
controllerPort: 31313
|
||||
@@ -57,12 +57,25 @@ logger:
|
||||
fluentdImageRepository: index.docker.io
|
||||
fluentdImage: fluent/fluent-bit
|
||||
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
|
||||
|
||||
## Router config
|
||||
router:
|
||||
deployAsDaemonSet: false
|
||||
svcAddressMaxRetries: 5
|
||||
svcAddressUpdateTimeout: 30s
|
||||
|
||||
## Display endpoint access logs
|
||||
## To be aware of enabling logging endpoint access log, it increases
|
||||
## router resource utilization when under heavy workloads.
|
||||
displayAccessLog: false
|
||||
|
||||
## Add annotations for router
|
||||
# svcAnnotations:
|
||||
# cloud.google.com/load-balancer-type: Internal
|
||||
@@ -98,6 +111,9 @@ router:
|
||||
## Max retries times of a failed request
|
||||
maxRetries: 10
|
||||
|
||||
## Sample with a rate per time window (traces/second)
|
||||
traceSamplingRate: 0.5
|
||||
|
||||
## Message queue trigger config
|
||||
### NATS Streaming, enabled by default
|
||||
nats:
|
||||
@@ -178,7 +194,7 @@ persistence:
|
||||
## operator: In
|
||||
## values:
|
||||
## - app
|
||||
extraCoreComponentPodConfig:
|
||||
#extraCoreComponentPodConfig:
|
||||
# affinity:
|
||||
# tolerations:
|
||||
# nodeSelector:
|
||||
@@ -205,8 +221,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
||||
## summary is returned as part of http response
|
||||
debugEnv: false
|
||||
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
prometheusDeploy: true
|
||||
## Prometheus for scrapping service metrics
|
||||
prometheus:
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
enabled: true
|
||||
|
||||
## If enabled is false, please assign the prometheus service URL
|
||||
## that is accessible by components.
|
||||
serviceEndpoint: ""
|
||||
|
||||
## set this flag to false if you dont need canary deployment feature
|
||||
canaryDeployment:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: fission-core
|
||||
version: 1.6.0
|
||||
version: 1.7.0-rc.2
|
||||
description: Fission is a fast serverless framework for Kubernetes.
|
||||
keywords:
|
||||
- fission
|
||||
@@ -8,8 +8,8 @@ keywords:
|
||||
home: http://fission.io/
|
||||
maintainers:
|
||||
- name: Soam Vasani
|
||||
email: soamvasani@platform9.com
|
||||
email: soamvasani+1@gmail.com
|
||||
- name: Ta Ching Chen
|
||||
email: contact@tachingchen.com
|
||||
email: hello@tachingchen.com
|
||||
engine: gotpl
|
||||
appVersion: 1.6.0
|
||||
appVersion: 1.7.0-rc.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
dependencies:
|
||||
- name: prometheus
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
version: 7.1.0
|
||||
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
|
||||
generated: 2019-06-03T10:47:50.335101619Z
|
||||
version: 9.3.1
|
||||
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
|
||||
generated: "2019-11-18T10:16:25.945208326Z"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dependencies:
|
||||
- name: prometheus
|
||||
version: 7.1.0
|
||||
version: 9.3.1
|
||||
repository: https://kubernetes-charts.storage.googleapis.com
|
||||
condition: prometheusDeploy
|
||||
condition: prometheus.enabled
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
1. Install the client CLI.
|
||||
|
||||
Mac:
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
|
||||
Linux:
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.6.0/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
|
||||
|
||||
Windows:
|
||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.6.0/fission-cli-windows.exe
|
||||
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
|
||||
|
||||
2. You're ready to use Fission!
|
||||
|
||||
|
||||
@@ -24,8 +24,10 @@ controller/config.go
|
||||
{{- define "config" -}}
|
||||
canary:
|
||||
enabled: {{ .Values.canaryDeployment.enabled }}
|
||||
{{- if .Values.prometheusDeploy }}
|
||||
{{- if .Values.prometheus.enabled }}
|
||||
prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}"
|
||||
{{- else }}
|
||||
prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }}
|
||||
{{- end }}
|
||||
{{- printf "\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -138,8 +138,10 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--controllerPort", "8888", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--controllerPort", "8888"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: FISSION_FUNCTION_NAMESPACE
|
||||
@@ -168,7 +170,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
@@ -205,18 +207,18 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||
- name: FETCHER_IMAGE_PULL_POLICY
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: ENABLE_ISTIO
|
||||
value: "{{ .Values.enableIstio }}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: FETCHER_MINCPU
|
||||
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
|
||||
- name: FETCHER_MINMEM
|
||||
@@ -243,7 +245,7 @@ spec:
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -271,7 +273,7 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
|
||||
@@ -293,7 +295,7 @@ spec:
|
||||
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
|
||||
- name: FETCHER_MAXMEM
|
||||
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -321,11 +323,13 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--kubewatcher", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -353,11 +357,13 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
@@ -388,10 +394,12 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--storageServicePort", "8000", "--filePath", "/fission", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--storageServicePort", "8000", "--filePath", "/fission"]
|
||||
env:
|
||||
- name: PRUNE_INTERVAL
|
||||
value: "{{.Values.pruneInterval}}"
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
volumeMounts:
|
||||
@@ -400,7 +408,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
volumes:
|
||||
- name: fission-storage
|
||||
{{- if .Values.persistence.enabled }}
|
||||
|
||||
@@ -30,4 +30,4 @@ spec:
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: [ "/pre-upgrade-checks" ]
|
||||
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
|
||||
@@ -33,7 +33,7 @@ spec:
|
||||
image: {{ include "fission-bundleImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
|
||||
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
@@ -53,12 +53,16 @@ spec:
|
||||
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
|
||||
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
|
||||
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
|
||||
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
|
||||
value: "{{ .Values.traceCollectorEndpoint }}"
|
||||
- name: TRACING_SAMPLING_RATE
|
||||
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
|
||||
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
|
||||
- name: USE_ENCODED_PATH
|
||||
value: {{ .Values.router.useEncodedPath | default false | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: DISPLAY_ACCESS_LOG
|
||||
value: {{ .Values.router.displayAccessLog | default false | quote }}
|
||||
{{- if .Values.analytics }}
|
||||
- name: ANALYTICS_URL
|
||||
value: "https://g.fission.sh/metrics"
|
||||
@@ -84,7 +88,7 @@ spec:
|
||||
name: metrics
|
||||
- containerPort: 8888
|
||||
name: http
|
||||
serviceAccount: fission-svc
|
||||
serviceAccountName: fission-svc
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -17,7 +17,7 @@ repository: index.docker.io
|
||||
image: fission/fission-bundle
|
||||
|
||||
## Fission image version
|
||||
imageTag: 1.6.0
|
||||
imageTag: 1.7.0-rc.2
|
||||
|
||||
## Image pull policy
|
||||
pullPolicy: IfNotPresent
|
||||
@@ -26,7 +26,7 @@ pullPolicy: IfNotPresent
|
||||
fetcherImage: fission/fetcher
|
||||
|
||||
## Fission fetcher image version
|
||||
fetcherImageTag: 1.6.0
|
||||
fetcherImageTag: 1.7.0-rc.2
|
||||
|
||||
## Port at which Fission controller service should be exposed
|
||||
controllerPort: 31313
|
||||
@@ -50,6 +50,12 @@ router:
|
||||
deployAsDaemonSet: false
|
||||
svcAddressMaxRetries: 5
|
||||
svcAddressUpdateTimeout: 30s
|
||||
|
||||
## Display endpoint access logs
|
||||
## To be aware of enabling logging endpoint access log, it increases
|
||||
## router resource utilization when under heavy workloads.
|
||||
displayAccessLog: false
|
||||
|
||||
## Add annotations for router
|
||||
# svcAnnotations:
|
||||
# cloud.google.com/load-balancer-type: Internal
|
||||
@@ -85,6 +91,9 @@ router:
|
||||
## Max retries times of a failed request
|
||||
maxRetries: 10
|
||||
|
||||
## Sample with a rate per time window (traces/second)
|
||||
traceSamplingRate: 0.5
|
||||
|
||||
## Persist data to a persistent volume.
|
||||
persistence:
|
||||
## If true, fission will create/use a Persistent Volume Claim
|
||||
@@ -122,7 +131,7 @@ persistence:
|
||||
## operator: In
|
||||
## values:
|
||||
## - app
|
||||
extraCoreComponentPodConfig:
|
||||
#extraCoreComponentPodConfig:
|
||||
# affinity:
|
||||
# tolerations:
|
||||
# nodeSelector:
|
||||
@@ -146,8 +155,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
|
||||
## summary is returned as part of http response
|
||||
debugEnv: false
|
||||
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
prometheusDeploy: false
|
||||
## Prometheus for scrapping service metrics
|
||||
prometheus:
|
||||
## set this flag to true if prometheus needs to be deployed along with fission
|
||||
enabled: true
|
||||
|
||||
## If enabled is false, please assign the prometheus service URL
|
||||
## that is accessible by components.
|
||||
serviceEndpoint: ""
|
||||
|
||||
## set this flag to false if you dont need canary deployment feature
|
||||
canaryDeployment:
|
||||
|
||||
+10
-11
@@ -118,8 +118,8 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
|
||||
}
|
||||
|
||||
func registerTraceExporter(logger *zap.Logger, arguments map[string]interface{}) error {
|
||||
collectorEndpoint := getStringArgWithDefault(arguments["--collectorEndpoint"], "")
|
||||
if collectorEndpoint == "" {
|
||||
collectorEndpoint := os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT")
|
||||
if len(collectorEndpoint) == 0 {
|
||||
logger.Info("skipping trace exporter registration")
|
||||
return nil
|
||||
}
|
||||
@@ -196,18 +196,17 @@ Use it to start one or more of the fission servers:
|
||||
backends.
|
||||
|
||||
Usage:
|
||||
fission-bundle --controllerPort=<port> [--collectorEndpoint=<url>]
|
||||
fission-bundle --routerPort=<port> [--executorUrl=<url>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --kubewatcher [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --storageServicePort=<port> --filePath=<filePath> [--collectorEndpoint=<url>]
|
||||
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --timer [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --mqt [--routerUrl=<url>] [--collectorEndpoint=<url>]
|
||||
fission-bundle --controllerPort=<port>
|
||||
fission-bundle --routerPort=<port> [--executorUrl=<url>]
|
||||
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
|
||||
fission-bundle --kubewatcher [--routerUrl=<url>]
|
||||
fission-bundle --storageServicePort=<port> --filePath=<filePath>
|
||||
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
|
||||
fission-bundle --timer [--routerUrl=<url>]
|
||||
fission-bundle --mqt [--routerUrl=<url>]
|
||||
fission-bundle --logger
|
||||
fission-bundle --version
|
||||
Options:
|
||||
--collectorEndpoint=<url> Jaeger HTTP Thrift collector URL.
|
||||
--controllerPort=<port> Port that the controller should listen on.
|
||||
--routerPort=<port> Port that the router should listen on.
|
||||
--executorPort=<port> Port that the executor should listen on.
|
||||
|
||||
@@ -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 (
|
||||
"os"
|
||||
|
||||
fcli "github.com/fission/fission/pkg/fission-cli"
|
||||
"github.com/fission/fission/cmd/fission-cli/app"
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fcli.NewCliApp().Run(os.Args)
|
||||
cmd := app.App()
|
||||
cmd.SilenceErrors = true // use our own error message printer
|
||||
|
||||
err := cmd.Execute()
|
||||
if err != nil {
|
||||
// let program exit with non-zero code when error occurs
|
||||
console.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ func (client *PreUpgradeTaskClient) IsFissionReInstall() bool {
|
||||
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
|
||||
client.logger.Info("verifying function spec references for all functions in the cluster")
|
||||
|
||||
result := &multierror.Error{}
|
||||
var err error
|
||||
var fList *fv1.FunctionList
|
||||
|
||||
@@ -103,28 +102,30 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
|
||||
zap.Int("max_retries", maxRetries))
|
||||
}
|
||||
|
||||
errs := &multierror.Error{}
|
||||
|
||||
// check that all secrets, configmaps, packages are in the same namespace
|
||||
for _, fn := range fList.Items {
|
||||
secrets := fn.Spec.Secrets
|
||||
for _, secret := range secrets {
|
||||
if secret.Namespace != fn.Metadata.Namespace {
|
||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
|
||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, secret.Name, secret.Namespace))
|
||||
}
|
||||
}
|
||||
|
||||
configmaps := fn.Spec.ConfigMaps
|
||||
for _, configmap := range configmaps {
|
||||
if configmap.Namespace != fn.Metadata.Namespace {
|
||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
|
||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, configmap.Name, configmap.Namespace))
|
||||
}
|
||||
}
|
||||
|
||||
if fn.Spec.Package.PackageRef.Namespace != fn.Metadata.Namespace {
|
||||
result = multierror.Append(result, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.Metadata.Name, fn.Metadata.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
||||
}
|
||||
}
|
||||
|
||||
if result != nil {
|
||||
if errs.ErrorOrNil() != nil {
|
||||
client.logger.Fatal("installation failed",
|
||||
zap.Error(err),
|
||||
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
|
||||
@@ -218,5 +219,4 @@ func (client *PreUpgradeTaskClient) SetupRoleBindings() {
|
||||
|
||||
client.logger.Info("created rolebindings in default namespace",
|
||||
zap.Strings("role_bindings", []string{types.PackageGetterRB, types.SecretConfigMapGetterRB}))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,11 +81,6 @@ clear
|
||||
|
||||
popd
|
||||
|
||||
#
|
||||
# Record replay
|
||||
#
|
||||
clear
|
||||
|
||||
#
|
||||
# Canary Deployments
|
||||
#
|
||||
|
||||
@@ -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 {
|
||||
env := &Env{}
|
||||
if stringEnv != nil {
|
||||
for _, rawEnvVar := range stringEnv {
|
||||
env.SetEnv(FromString(rawEnvVar))
|
||||
}
|
||||
for _, rawEnvVar := range stringEnv {
|
||||
env.SetEnv(FromString(rawEnvVar))
|
||||
}
|
||||
return env
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Soam Vasani",
|
||||
"email": "soamvasani@platform9.com"
|
||||
"email": "soamvasani+1@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gary Yeap",
|
||||
|
||||
@@ -28,6 +28,7 @@ var (
|
||||
|
||||
// for tensorflow serving to use
|
||||
MODEL_NAME = ""
|
||||
API_TYPE = ""
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -77,8 +78,26 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
|
||||
return
|
||||
}
|
||||
|
||||
// Tensorflow-serving supports three types of API: classify, regress, predict
|
||||
// To get the API type, we need to split the entry point with separator ":"
|
||||
// POST http://host:port/v1/models/${MODEL_NAME}:(classify|regress:predict)
|
||||
entrypoint := strings.Split(loadreq.FunctionName, ":")
|
||||
modelDir, apiType := "", ""
|
||||
|
||||
if len(entrypoint) == 0 {
|
||||
logger.Error("unable to load model due to empty entrypoint")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
} else if len(entrypoint) == 1 {
|
||||
modelDir = entrypoint[0]
|
||||
apiType = "predict" // assign default API type
|
||||
} else {
|
||||
modelDir = entrypoint[0]
|
||||
apiType = entrypoint[1]
|
||||
}
|
||||
|
||||
// To ensure we load model from the expected path
|
||||
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, loadreq.FunctionName)
|
||||
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, modelDir)
|
||||
basePath, err = filepath.Abs(basePath)
|
||||
if err != nil {
|
||||
msg := "error getting absolute path of model"
|
||||
@@ -104,6 +123,7 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
|
||||
|
||||
// get directory name that holds model
|
||||
MODEL_NAME = filepath.Base(basePath)
|
||||
API_TYPE = apiType
|
||||
|
||||
argModelBasePath := fmt.Sprintf("--model_base_path=%v", basePath)
|
||||
argModelName := fmt.Sprintf("--model_name=%v", MODEL_NAME)
|
||||
@@ -191,7 +211,8 @@ func main() {
|
||||
director := func(req *http.Request) {
|
||||
req.URL.Scheme = "http"
|
||||
req.URL.Host = "localhost:8501"
|
||||
req.URL.Path = fmt.Sprintf("/v1/models/%v:predict", MODEL_NAME)
|
||||
req.URL.Path = fmt.Sprintf("/v1/models/%v:%v", MODEL_NAME, API_TYPE)
|
||||
req.Host = "localhost:8501"
|
||||
}
|
||||
|
||||
proxy := &httputil.ReverseProxy{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Soam Vasani",
|
||||
"email": "soamvasani@platform9.com"
|
||||
"email": "soamvasani+1@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gary Yeap",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Adding podspec for builder of environment
|
||||
|
||||
If you see the files in the `specs` directory you will get to know that we have just generated the
|
||||
environment spec using the command
|
||||
```
|
||||
fission env create --name python --image fission/python-env --builder fission/python-builder --spec
|
||||
```
|
||||
and changed the env-python.yaml file to have below `podspec` for builder for the environment.
|
||||
|
||||
```
|
||||
nodeSelector:
|
||||
machinecap: high
|
||||
tolerations:
|
||||
- key: "env"
|
||||
value: "prod"
|
||||
operator: "Equal"
|
||||
effect: "NoSchedule"
|
||||
|
||||
```
|
||||
|
||||
If we create this environment, the builder pod that will be created will have the `PodSpec` that
|
||||
we have mentioned for builder in the environment spec.
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
Fission Specs
|
||||
=============
|
||||
|
||||
This is a set of specifications for a Fission app. This includes functions,
|
||||
environments, and triggers; we collectively call these things "resources".
|
||||
|
||||
How to use these specs
|
||||
----------------------
|
||||
|
||||
These specs are handled with the 'fission spec' command. See 'fission spec --help'.
|
||||
|
||||
'fission spec apply' will "apply" all resources specified in this directory to your
|
||||
cluster. That means it checks what resources exist on your cluster, what resources are
|
||||
specified in the specs directory, and reconciles the difference by creating, updating or
|
||||
deleting resources on the cluster.
|
||||
|
||||
'fission spec apply' will also package up your source code (or compiled binaries) and
|
||||
upload the archives to the cluster if needed. It uses 'ArchiveUploadSpec' resources in
|
||||
this directory to figure out which files to archive.
|
||||
|
||||
You can use 'fission spec apply --watch' to watch for file changes and continuously keep
|
||||
the cluster updated.
|
||||
|
||||
You can add YAMLs to this directory by writing them manually, but it's easier to generate
|
||||
them. Use 'fission function create --spec' to generate a function spec,
|
||||
'fission environment create --spec' to generate an environment spec, and so on.
|
||||
|
||||
You can edit any of the files in this directory, except 'fission-deployment-config.yaml',
|
||||
which contains a UID that you should never change. To apply your changes simply use
|
||||
'fission spec apply'.
|
||||
|
||||
fission-deployment-config.yaml
|
||||
------------------------------
|
||||
|
||||
fission-deployment-config.yaml contains a UID. This UID is what fission uses to correlate
|
||||
resources on the cluster to resources in this directory.
|
||||
|
||||
All resources created by 'fission spec apply' are annotated with this UID. Resources on
|
||||
the cluster that are _not_ annotated with this UID are never modified or deleted by
|
||||
fission.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
apiVersion: fission.io/v1
|
||||
kind: Environment
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: python
|
||||
namespace: default
|
||||
spec:
|
||||
builder:
|
||||
command: build
|
||||
image: fission/python-builder
|
||||
podspec:
|
||||
nodeSelector:
|
||||
machinecap: high
|
||||
tolerations:
|
||||
- key: "env"
|
||||
value: "prod"
|
||||
operator: "Equal"
|
||||
effect: "NoSchedule"
|
||||
keeparchive: false
|
||||
poolsize: 3
|
||||
resources: {}
|
||||
runtime:
|
||||
image: fission/python-env
|
||||
terminationGracePeriod: 360
|
||||
version: 2
|
||||
@@ -0,0 +1,7 @@
|
||||
# This file is generated by the 'fission spec init' command.
|
||||
# See the README in this directory for background and usage information.
|
||||
# Do not edit the UID below: that will break 'fission spec apply'
|
||||
apiVersion: fission.io/v1
|
||||
kind: DeploymentConfig
|
||||
name: podspec-example
|
||||
uid: c0803d62-03a2-4934-b9b2-82f2a221a333
|
||||
@@ -15,9 +15,10 @@ $ fission pkg create --env tensorflow --deploy half_plus_two.zip
|
||||
|
||||
## Create Function
|
||||
|
||||
Here, the `--entrypoint` represents the name of top directory contains trained model.
|
||||
Here, the `--entrypoint` represents the name of the top directory contains the trained model and what kind of API the model supports.
|
||||
Currently, three API are supported: `predict`, `classify`, `regress`. `predict` API will be used if no API kind was given.
|
||||
|
||||
```bash
|
||||
$ fission fn create --name t1 --pkg <pkg name> --env tensorflow --entrypoint "half_plus_two"
|
||||
$ fission fn create --name t1 --pkg <pkg name> --env tensorflow --entrypoint "half_plus_two:predict"
|
||||
$ fission fn test --name t1 --body '{"instances": [1.0, 2.0, 0.0]}' --method POST
|
||||
```
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Git hooks
|
||||
|
||||
* pre-push: Check, build and test the changes.
|
||||
|
||||
```bash
|
||||
$ cp githooks/* .git/hooks/
|
||||
```
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ROOT=`realpath $(dirname $0)/../..`
|
||||
pushd $ROOT
|
||||
make
|
||||
popd
|
||||
@@ -40,7 +40,10 @@ require (
|
||||
github.com/imdario/mergo v0.3.5
|
||||
github.com/influxdata/influxdb v1.2.0
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/life1347/color v1.7.0
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c // indirect
|
||||
github.com/mattn/go-colorable v0.1.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.10 // indirect
|
||||
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0
|
||||
github.com/nats-io/gnatsd v1.4.1 // indirect
|
||||
github.com/nats-io/go-nats v1.6.0 // indirect
|
||||
@@ -56,7 +59,8 @@ require (
|
||||
github.com/prometheus/common v0.4.1
|
||||
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/spf13/pflag v1.0.3
|
||||
github.com/spf13/cobra v0.0.5
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 // indirect
|
||||
github.com/urfave/cli v1.20.0
|
||||
@@ -69,7 +73,6 @@ require (
|
||||
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 // indirect
|
||||
golang.org/x/image v0.0.0-20190618124811-92942e4437e2 // indirect
|
||||
golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b
|
||||
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4 // indirect
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
|
||||
google.golang.org/appengine v1.6.1 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
|
||||
@@ -31,6 +31,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
@@ -46,11 +47,15 @@ github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyV
|
||||
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||
github.com/coreos/go-oidc v0.0.0-20180117170138-065b426bd416/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
|
||||
github.com/coreos/go-semver v0.0.0-20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -188,12 +193,14 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/raft v1.0.0 h1:htBVktAOtGs4Le5Z7K8SF5H2+oWsQFYVmOgH5loro7Y=
|
||||
github.com/hashicorp/raft v1.0.0/go.mod h1:DVSAWItjLjTOkVbSpWQ0j0kUADIvDaCtBxIcbNAQLkI=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q=
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/influxdb v1.2.0 h1:ZSB1cdZP9/8yyFzZhyaHimPL55Qo2kRDv2VhgnCePJ4=
|
||||
github.com/influxdata/influxdb v1.2.0/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
||||
@@ -214,15 +221,24 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/life1347/color v1.7.0 h1:Csr56ts64td/iG9T9o4p9cXNK46YB1/ZSq3V+qDwD4Y=
|
||||
github.com/life1347/color v1.7.0/go.mod h1:yXW8vSPZhOJLmveaa6cN+24V2xrX2Cuf3X7nVpiRidw=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mailru/easyjson v0.0.0-20180323154445-8b799c424f57/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY=
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
|
||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0 h1:581DnhoG2Q33rqM3X6Is+8agf17B2vlzV/H52/Xvcd0=
|
||||
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
@@ -257,6 +273,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
@@ -288,14 +305,24 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
|
||||
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937 h1:+ryWjMVzFAkEz5zT+Ms49aROZwxlJce3x3zLTFpkz3Y=
|
||||
github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -303,6 +330,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670 h1:HQWT4ta3wW5GZ790GaqLCS+w1dvuA3rMfEQxLi+UOYU=
|
||||
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||
@@ -310,6 +338,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
|
||||
github.com/wcharczuk/go-chart v2.0.1+incompatible h1:0pz39ZAycJFF7ju/1mepnk26RLVLBCWz1STcD3doU0A=
|
||||
github.com/wcharczuk/go-chart v2.0.1+incompatible/go.mod h1:PF5tmL4EIx/7Wf+hEkpCqYi5He4u90sw+0+6FhrryuE=
|
||||
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
@@ -327,6 +356,7 @@ go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=
|
||||
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
@@ -379,15 +409,17 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4 h1:FFQWNXvutleFrNfNdz+TAJiRUdRxjFpjBtDMQ2y3psA=
|
||||
golang.org/x/sys v0.0.0-20190619183051-17bc6164aac4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.11.6
|
||||
FROM golang:1.12.13
|
||||
ENV GO111MODULE on
|
||||
RUN wget -qO- https://download.docker.com/linux/static/stable/x86_64/docker-17.03.0-ce.tgz | tar xvz -C /usr/local/bin/ --strip 1
|
||||
RUN wget -qO- https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz | tar xvz -C /usr/local/bin/ --strip 1
|
||||
RUN wget -qO- https://storage.googleapis.com/kubernetes-helm/helm-v2.16.1-linux-amd64.tar.gz | tar xvz -C /usr/local/bin/ --strip 1
|
||||
|
||||
+10
-8
@@ -44,7 +44,7 @@ Updating Fission Repo (https://github.com/fission/fission)
|
||||
|
||||
1. cd to the top of the fission repo, create a branch:
|
||||
|
||||
git checkout -b vX.Y.Z
|
||||
git checkout -b release-X.Y.Z
|
||||
|
||||
2. Change references of old version to new version in charts directory. You use replace and find all with a quick preview in your IDE.
|
||||
|
||||
@@ -52,7 +52,7 @@ Updating Fission Repo (https://github.com/fission/fission)
|
||||
|
||||
`./hack/release.sh <VERSION>`
|
||||
|
||||
This script checks to make sure you're releasing from the vX.Y.Z
|
||||
This script checks to make sure you're releasing from the release-X.Y.Z
|
||||
branch, and that your repo is clean (no modified/staged files).
|
||||
|
||||
This will take a while as it builds and pushes all images (Approx ~2-3 hours)
|
||||
@@ -61,10 +61,13 @@ Updating Fission Repo (https://github.com/fission/fission)
|
||||
|
||||
5. As part of release script, changelog.md has been modified. Take a look at it, correct it if you want and then commit it, discard other directories etc. produced by builders after inspection.
|
||||
|
||||
6. Now push this vx.y.z branch to remote repo. Create a PR and merge it into master branch.
|
||||
6. Push this release-x.y.z branch to remote repo. Create a PR and wait for CI passed.
|
||||
|
||||
a. Test build from master branch for sanity check
|
||||
b. Make sure the master build is green
|
||||
7. Now manually merge the release-x.y.z branch into master branch with Git command to prevent the commit SHA from being changed.
|
||||
|
||||
`git checkout master && git merge --ff-only release-<VERSION>`
|
||||
|
||||
8. Test build from master branch for sanity check and make sure the master build is green
|
||||
|
||||
Updating Fission Charts (https://github.com/fission/fission-charts)
|
||||
------------------------------
|
||||
@@ -72,8 +75,7 @@ a. Switch to fission/fission-charts repo and run `index.sh` in that repo. (Don'
|
||||
|
||||
b. You should have index.yaml and fission-core-*, fission-all-* charts as change, add, commit and push it to repo.
|
||||
|
||||
|
||||
8. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created.
|
||||
9. Go to Github Web UI --> Releases, here you will notice a pre-release for the version x.y.z you just created.
|
||||
|
||||
Edit it and add links to:
|
||||
|
||||
@@ -85,7 +87,7 @@ Before you save the release - UNCHECK the "This is a pre-release" checkbox. This
|
||||
Updating Fission Docs (https://github.com/fission/docs.fission.io)
|
||||
------------------------------
|
||||
|
||||
9. Documentatin Update
|
||||
10. Documentation Update
|
||||
|
||||
a. Merge documentation PRs that are peer reviewed and get latest master locally.
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ build_env_builder_image() {
|
||||
else
|
||||
# variant specified - append variant to image name and assume dockerfile
|
||||
# exists with same suffix (e.g. image node-env-debian built from Dockerfile-debian)
|
||||
imgname="$imgname-$imgvariant"
|
||||
imgname="$imgnamebase-$imgvariant"
|
||||
dockerfile="Dockerfile-$imgvariant"
|
||||
fi
|
||||
echo "Building $envdir -> $imgname:$version using $dockerfile"
|
||||
@@ -198,8 +198,8 @@ build_charts() {
|
||||
do
|
||||
# https://github.com/kubernetes/helm/issues/1732
|
||||
helm init --client-only
|
||||
helm package -u $c/
|
||||
mv *.tgz $BUILDDIR/charts/
|
||||
helm package -u $c/
|
||||
mv *.tgz $BUILDDIR/charts/
|
||||
done
|
||||
popd
|
||||
}
|
||||
@@ -226,6 +226,8 @@ build_yamls() {
|
||||
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort > ${c}-${version}-minikube.yaml
|
||||
# for environments that support LoadBalancer
|
||||
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true > ${c}-${version}.yaml
|
||||
# for OpenShift
|
||||
helm template ${c} -n ${releaseName} --namespace fission --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true,prometheus.enabled=false > ${c}-${version}-openshift.yaml
|
||||
|
||||
# copy yaml files to build directory
|
||||
mv *.yaml ${BUILDDIR}/yamls/
|
||||
|
||||
+23
-12
@@ -6,14 +6,16 @@ set -e
|
||||
DIR=$(realpath $(dirname $0))/../
|
||||
BUILDDIR=$(realpath $DIR)/build
|
||||
|
||||
source $(realpath ${DIR}/test/init_tools.sh)
|
||||
|
||||
# Ensure we're on the master branch
|
||||
check_branch() {
|
||||
local version=$1
|
||||
curr_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [ $curr_branch != "v${version}" ]
|
||||
if [ $curr_branch != "release-${version}" ]
|
||||
then
|
||||
echo "Not on v${version} branch."
|
||||
exit 1
|
||||
echo "Not on release-${version} branch."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -21,8 +23,8 @@ check_branch() {
|
||||
check_clean() {
|
||||
if ! git diff-index --quiet HEAD --
|
||||
then
|
||||
echo "Unclean tree"
|
||||
exit 1
|
||||
echo "Unclean tree"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -48,9 +50,9 @@ push_builder_image() {
|
||||
|
||||
push_env_image() {
|
||||
local version=$1
|
||||
envdir=$2
|
||||
imgnamebase=$3
|
||||
imgvariant=$4
|
||||
local envdir=$2
|
||||
local imgnamebase=$3
|
||||
local imgvariant=$4
|
||||
|
||||
if [ -z "$imgvariant" ]
|
||||
then
|
||||
@@ -59,7 +61,7 @@ push_env_image() {
|
||||
else
|
||||
# variant specified - append variant to image name and assume dockerfile
|
||||
# exists with same suffix (e.g. image node-env-debian built from Dockerfile-debian)
|
||||
imgname="$imgname-$imgvariant"
|
||||
imgname="$imgnamebase-$imgvariant"
|
||||
fi
|
||||
echo "Pushing $envdir -> $imgname:$version"
|
||||
|
||||
@@ -149,12 +151,21 @@ push_all() {
|
||||
tag_and_release() {
|
||||
local version=$1
|
||||
local gittag=$version
|
||||
local prefix="v"
|
||||
local gopkgtag=${version/#/${prefix}}
|
||||
|
||||
if [[ ${version} == v* ]]; # if version starts with "v", don't append prefix.
|
||||
then
|
||||
gopkgtag=${version}
|
||||
fi
|
||||
|
||||
# tag the release
|
||||
git tag $gittag
|
||||
|
||||
git tag -a $gopkgtag -m "Fission $gopkgtag"
|
||||
|
||||
# push tag
|
||||
git push origin $gittag
|
||||
git push origin $gopkgtag
|
||||
|
||||
# create gh release
|
||||
gothub release \
|
||||
@@ -269,7 +280,7 @@ generate_changelog() {
|
||||
|
||||
# generate changelog from github
|
||||
github_changelog_generator fission/fission -t ${GITHUB_TOKEN} --future-release ${version} --no-issues -o tmp_CHANGELOG.md
|
||||
sed -i '' -e '$ d' tmp_CHANGELOG.md
|
||||
sed -i '$ d' tmp_CHANGELOG.md
|
||||
|
||||
# concatenate two files
|
||||
cat tmp_CHANGELOG.md >> new_CHANGELOG.md
|
||||
@@ -335,7 +346,7 @@ docker build -t fission-release-builder -f $GOPATH/src/github.com/fission/fissio
|
||||
# Build all binaries & container images in docker
|
||||
# Here we mount docker.sock into container so that docker client can communicate with host docker daemon.
|
||||
# For more detail please visit https://docs.docker.com/machine/overview/
|
||||
docker run --rm -v $GOPATH/src:/go/src -v /var/run/docker.sock:/var/run/docker.sock \
|
||||
docker run --rm -it -v $GOPATH/src:/go/src -v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-e VERSION=$version -w "/go/src/github.com/fission/fission/hack" fission-release-builder sh -c "./release-build.sh"
|
||||
|
||||
push_all $version
|
||||
|
||||
@@ -14,12 +14,12 @@ then
|
||||
fi
|
||||
|
||||
# Get staticcheck
|
||||
STATICCHECK_VERSION=2019.1.1
|
||||
if [ ! -f $TOOL_DIR/staticcheck ]
|
||||
STATICCHECK_VERSION=2019.2.3
|
||||
if [ ! -f $TOOL_DIR/staticcheck ] || (staticcheck -version | grep -v $STATICCHECK_VERSION)
|
||||
then
|
||||
curl -LO https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64
|
||||
chmod +x staticcheck_linux_amd64
|
||||
mv staticcheck_linux_amd64 $TOOL_DIR/staticcheck
|
||||
curl -LO https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64.tar.gz
|
||||
tar xzvf staticcheck_linux_amd64.tar.gz
|
||||
mv staticcheck/staticcheck $TOOL_DIR/staticcheck
|
||||
fi
|
||||
|
||||
K8SCLI_DIR=$HOME/k8scli
|
||||
|
||||
@@ -4,4 +4,4 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
go vet -v $(go list ./...| grep -v vendor)
|
||||
go vet -v $(go list ./...| grep -v "vendor" | grep -v "examples" | grep -v "demos" | grep -v "test")
|
||||
|
||||
@@ -4,14 +4,4 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
ROOT=`realpath $(dirname $0)/..`
|
||||
|
||||
# Currently here only lists the packages that already addressed all warnings for gradual code repair.
|
||||
# That means we don't allow adding new warnings to any of package in list. And eventually, the
|
||||
# list will be replaced by find command.
|
||||
declare -a pkgs=("pkg/builder" "pkg/builder" "pkg/crd" "pkg/logger" "pkg/buildermgr" "pkg/fission-cli" "cmd/fission-cli")
|
||||
|
||||
for pkg in "${pkgs[@]}"
|
||||
do
|
||||
find ${ROOT}/${pkg} -type d |grep -v influxdb | xargs -I@ staticcheck @
|
||||
done
|
||||
go list ./...| grep -v vendor | grep -v "examples" | grep -v "demos" | grep -v "test" | xargs -I@ staticcheck @
|
||||
|
||||
@@ -54,8 +54,8 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ExecutorTypePoolmgr = "poolmgr"
|
||||
ExecutorTypeNewdeploy = "newdeploy"
|
||||
ExecutorTypePoolmgr ExecutorType = "poolmgr"
|
||||
ExecutorTypeNewdeploy ExecutorType = "newdeploy"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -56,10 +56,6 @@ func (c *CanaryConfig) GetObjectKind() schema.ObjectKind {
|
||||
return &c.TypeMeta
|
||||
}
|
||||
|
||||
func (r *Recorder) GetObjectKind() schema.ObjectKind {
|
||||
return &r.TypeMeta
|
||||
}
|
||||
|
||||
func (f *Function) GetObjectMeta() metav1.Object {
|
||||
return &f.Metadata
|
||||
}
|
||||
@@ -85,10 +81,6 @@ func (c *CanaryConfig) GetObjectMeta() metav1.Object {
|
||||
return &c.Metadata
|
||||
}
|
||||
|
||||
func (r *Recorder) GetObjectMeta() metav1.Object {
|
||||
return &r.Metadata
|
||||
}
|
||||
|
||||
func (fl *FunctionList) GetObjectKind() schema.ObjectKind {
|
||||
return &fl.TypeMeta
|
||||
}
|
||||
@@ -110,9 +102,6 @@ func (ml *MessageQueueTriggerList) GetObjectKind() schema.ObjectKind {
|
||||
func (pl *PackageList) GetObjectKind() schema.ObjectKind {
|
||||
return &pl.TypeMeta
|
||||
}
|
||||
func (rl *RecorderList) GetObjectKind() schema.ObjectKind {
|
||||
return &rl.TypeMeta
|
||||
}
|
||||
|
||||
func (cl *CanaryConfigList) GetObjectKind() schema.ObjectKind {
|
||||
return &cl.TypeMeta
|
||||
@@ -140,10 +129,6 @@ func (pl *PackageList) GetListMeta() metav1.ListInterface {
|
||||
return &pl.Metadata
|
||||
}
|
||||
|
||||
func (rl *RecorderList) GetListMeta() metav1.ListInterface {
|
||||
return &rl.Metadata
|
||||
}
|
||||
|
||||
func (cl *CanaryConfigList) GetListMeta() metav1.ListInterface {
|
||||
return &cl.Metadata
|
||||
}
|
||||
@@ -279,13 +264,3 @@ func (ml *MessageQueueTriggerList) Validate() error {
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (r *Recorder) Validate() error {
|
||||
result := &multierror.Error{}
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("Recorder", r.Metadata),
|
||||
r.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
@@ -157,23 +157,6 @@ type (
|
||||
Items []MessageQueueTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Recorder allows user to record all traffic payload to a certain function.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
Recorder struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec RecorderSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// RecorderList is a list of Recorders.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
RecorderList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Recorder `json:"items"`
|
||||
}
|
||||
|
||||
// CanaryConfig is for canary deployment of two functions.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
CanaryConfig struct {
|
||||
@@ -343,7 +326,8 @@ type (
|
||||
// InvokeStrategy is a set of controls which affect how function executes
|
||||
InvokeStrategy InvokeStrategy
|
||||
|
||||
// FunctionTimeout provides a maximum amount of duration wihtin which a request for a particular function execution should be complete.
|
||||
// FunctionTimeout provides a maximum amount of duration within which a request for
|
||||
// a particular function execution should be complete.
|
||||
// This is optional. If not specified default value will be taken as 60s
|
||||
FunctionTimeout int `json:"functionTimeout,omitempty"`
|
||||
}
|
||||
@@ -397,7 +381,6 @@ type (
|
||||
TargetCPUPercent int
|
||||
|
||||
// This is the timeout setting for executor to wait for pod specialization.
|
||||
// Currently, only newdeploy utilizes this value.
|
||||
SpecializationTimeout int
|
||||
}
|
||||
|
||||
@@ -490,6 +473,9 @@ type (
|
||||
// - ImagePullPolicy
|
||||
// - ReadinessProbe
|
||||
Container *apiv1.Container `json:"container,omitempty"`
|
||||
|
||||
// PodSpec will store the spec of the pod that will be applied to the pod created for the builder
|
||||
PodSpec *apiv1.PodSpec `json:"podspec,omitempty"`
|
||||
}
|
||||
|
||||
// EnvironmentSpec contains with builder, runtime and some other related environment settings.
|
||||
@@ -542,6 +528,10 @@ type (
|
||||
// or unarchived file should be placed, which is then used by specialize handler.
|
||||
// (This is mainly for the JVM environment because .jar is one kind of zip archive.)
|
||||
KeepArchive bool `json:"keeparchive"`
|
||||
|
||||
// ImagePullSecret is the secret for Kubernetes to pull an image from a
|
||||
// private registry.
|
||||
ImagePullSecret string `json:"imagepullsecret"`
|
||||
}
|
||||
|
||||
AllowedFunctionsPerContainer string
|
||||
@@ -638,22 +628,6 @@ type (
|
||||
ContentType string `json:"contentType"`
|
||||
}
|
||||
|
||||
// RecorderSpec defines a policy for recording requests and responses
|
||||
// to a function, that can be later inspected or replayed.
|
||||
RecorderSpec struct {
|
||||
// Name of recorder resource
|
||||
Name string `json:"name"`
|
||||
|
||||
// Function to collect requests/responses
|
||||
Function string `json:"function"`
|
||||
|
||||
// HTTP trigger to record the requests and responses.
|
||||
Triggers []string `json:"triggers"`
|
||||
RetentionPolicy string `json:"-"` // `json:"retentionPolicy"`
|
||||
EvictionPolicy string `json:"-"` // `json:"evictionPolicy"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// TimeTrigger invokes the specific function at a time or
|
||||
// times specified by a cron string.
|
||||
TimeTriggerSpec struct {
|
||||
|
||||
@@ -37,7 +37,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
validAzureQueueName = regexp.MustCompile("^[a-z0-9][a-z0-9\\-]*[a-z0-9]$")
|
||||
validAzureQueueName = regexp.MustCompile(`^[a-z0-9][a-z0-9\\-]*[a-z0-9]$`)
|
||||
// Need to use raw string to support escape sequence for - & . chars
|
||||
validKafkaTopicName = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\._]*[a-zA-Z0-9]$`)
|
||||
)
|
||||
@@ -339,7 +339,7 @@ func (es ExecutionStrategy) Validate() error {
|
||||
|
||||
if es.ExecutorType == ExecutorTypeNewdeploy {
|
||||
if es.MinScale < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater or equal to 0"))
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater than or equal to 0"))
|
||||
}
|
||||
|
||||
if es.MaxScale <= 0 {
|
||||
@@ -347,7 +347,7 @@ func (es ExecutionStrategy) Validate() error {
|
||||
}
|
||||
|
||||
if es.MaxScale < es.MinScale {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater or equal to minimum scale"))
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater than or equal to minimum scale"))
|
||||
}
|
||||
|
||||
if es.TargetCPUPercent <= 0 || es.TargetCPUPercent > 100 {
|
||||
@@ -421,7 +421,11 @@ func (spec EnvironmentSpec) Validate() error {
|
||||
}
|
||||
|
||||
if spec.Poolsize < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Poolsize", spec.Poolsize, "Poolsize must be greater or equal to 0"))
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Poolsize", spec.Poolsize, "must be greater than or equal to 0"))
|
||||
}
|
||||
|
||||
if spec.TerminationGracePeriod < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.TerminationGracePeriod", spec.TerminationGracePeriod, "must be greater than or equal to 0"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
@@ -540,33 +544,6 @@ func (spec MessageQueueTriggerSpec) Validate() error {
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec RecorderSpec) Validate() error {
|
||||
result := &multierror.Error{}
|
||||
|
||||
// TODO: Function validation
|
||||
//if len(spec.Function.Name) != 0 {
|
||||
// result = multierror.Append(result, spec.Function.Validate())
|
||||
//}
|
||||
|
||||
// TODO: Triggers validation
|
||||
//for _, trigger := range spec.Triggers {
|
||||
// result = multierror.Append(result, trigger.Validate())
|
||||
//}
|
||||
|
||||
if len(spec.Name) == 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.Name", spec.Name, "not a valid name"))
|
||||
}
|
||||
//if len(spec.RetentionPolicy) == 0 {
|
||||
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.RetentionPolicy", spec.Name, "not a valid retention policy"))
|
||||
//}
|
||||
//if len(spec.EvictionPolicy) == 0 {
|
||||
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "RecorderSpec.EvictionPolicy", spec.Name, "not a valid eviction policy"))
|
||||
//}
|
||||
|
||||
//log.Info("This is the RecorderSpec validation result: %v", result)
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec TimeTriggerSpec) Validate() error {
|
||||
result := &multierror.Error{}
|
||||
|
||||
|
||||
@@ -801,87 +801,6 @@ func (in *PackageStatus) DeepCopy() *PackageStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Recorder) DeepCopyInto(out *Recorder) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Recorder.
|
||||
func (in *Recorder) DeepCopy() *Recorder {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Recorder)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Recorder) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RecorderList) DeepCopyInto(out *RecorderList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Recorder, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecorderList.
|
||||
func (in *RecorderList) DeepCopy() *RecorderList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RecorderList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RecorderList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RecorderSpec) DeepCopyInto(out *RecorderSpec) {
|
||||
*out = *in
|
||||
if in.Triggers != nil {
|
||||
in, out := &in.Triggers, &out.Triggers
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecorderSpec.
|
||||
func (in *RecorderSpec) DeepCopy() *RecorderSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RecorderSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Runtime) DeepCopyInto(out *Runtime) {
|
||||
*out = *in
|
||||
|
||||
@@ -74,7 +74,7 @@ func MakeBuilder(logger *zap.Logger, sharedVolumePath string) *Builder {
|
||||
|
||||
func (builder *Builder) VersionHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
fmt.Fprintf(w, info.BuildInfo().String())
|
||||
w.Write([]byte(info.BuildInfo().String()))
|
||||
}
|
||||
|
||||
func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -489,6 +489,16 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
|
||||
return nil, err
|
||||
}
|
||||
|
||||
podSpec := apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-builder",
|
||||
}
|
||||
|
||||
finalPodSpec, err := util.MergePodSpec(&podSpec, env.Spec.Builder.PodSpec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: ns,
|
||||
@@ -505,10 +515,7 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
|
||||
Labels: sel,
|
||||
Annotations: podAnnotations,
|
||||
},
|
||||
Spec: apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-builder",
|
||||
},
|
||||
Spec: *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, *finalPodSpec)),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func (pkgw *packageWatcher) build(buildCache *cache.Cache, srcpkg *fv1.Package)
|
||||
|
||||
// Ignore duplicate build requests
|
||||
key := fmt.Sprintf("%v-%v", srcpkg.Metadata.Name, srcpkg.Metadata.ResourceVersion)
|
||||
err, _ := buildCache.Set(key, srcpkg)
|
||||
_, err := buildCache.Set(key, srcpkg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -159,7 +159,7 @@ func (c *Cache) Get(key interface{}) (interface{}, error) {
|
||||
|
||||
// if key exists in the cache, the new value is NOT set; instead an
|
||||
// error and the old value are returned
|
||||
func (c *Cache) Set(key interface{}, value interface{}) (error, interface{}) {
|
||||
func (c *Cache) Set(key interface{}, value interface{}) (interface{}, error) {
|
||||
respChannel := make(chan *response)
|
||||
c.requestChannel <- &request{
|
||||
requestType: SET,
|
||||
@@ -168,7 +168,7 @@ func (c *Cache) Set(key interface{}, value interface{}) (error, interface{}) {
|
||||
responseChannel: respChannel,
|
||||
}
|
||||
resp := <-respChannel
|
||||
return resp.error, resp.existingValue
|
||||
return resp.existingValue, resp.error
|
||||
}
|
||||
|
||||
func (c *Cache) Delete(key interface{}) error {
|
||||
|
||||
Vendored
+3
-3
@@ -31,9 +31,9 @@ func checkErr(err error) {
|
||||
func TestCache(t *testing.T) {
|
||||
c := MakeCache(100*time.Millisecond, 100*time.Millisecond)
|
||||
|
||||
err, _ := c.Set("a", "b")
|
||||
_, err := c.Set("a", "b")
|
||||
checkErr(err)
|
||||
err, _ = c.Set("p", "q")
|
||||
_, err = c.Set("p", "q")
|
||||
checkErr(err)
|
||||
|
||||
val, err := c.Get("a")
|
||||
@@ -55,7 +55,7 @@ func TestCache(t *testing.T) {
|
||||
log.Panicf("found deleted element")
|
||||
}
|
||||
|
||||
err, _ = c.Set("expires", "42")
|
||||
_, err = c.Set("expires", "42")
|
||||
checkErr(err)
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
_, err = c.Get("expires")
|
||||
|
||||
@@ -68,7 +68,7 @@ func (cancelFuncMap *canaryConfigCancelFuncMap) lookup(f *metav1.ObjectMeta) (*C
|
||||
|
||||
func (cancelFuncMap *canaryConfigCancelFuncMap) assign(f *metav1.ObjectMeta, value *CanaryProcessingInfo) error {
|
||||
mk := keyFromMetadata(f)
|
||||
err, _ := cancelFuncMap.cache.Set(mk, value)
|
||||
_, err := cancelFuncMap.cache.Set(mk, value)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -67,17 +67,21 @@ func MakeCanaryConfigMgr(logger *zap.Logger, fissionClient *crd.FissionClient, k
|
||||
} else if strings.Contains(envVar, "PROMETHEUS_SERVER_SERVICE_PORT") {
|
||||
prometheusSvcPort = getEnvValue(envVar)
|
||||
}
|
||||
|
||||
if len(prometheusSvcHost) > 0 && len(prometheusSvcPort) > 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(prometheusSvcHost) == 0 && len(prometheusSvcPort) == 0 {
|
||||
return nil, errors.New("unable to get prometheus service url")
|
||||
}
|
||||
prometheusSvc = fmt.Sprintf("http://%v:%v", prometheusSvcHost, prometheusSvcPort)
|
||||
}
|
||||
|
||||
logger.Info("try to start canary config manager with prometheus service url", zap.String("prometheus", prometheusSvc))
|
||||
|
||||
_, err := url.Parse(prometheusSvc)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc)
|
||||
return nil, errors.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc)
|
||||
}
|
||||
|
||||
promClient, err := MakePrometheusClient(logger, prometheusSvc)
|
||||
@@ -443,6 +447,9 @@ func (canaryCfgMgr *canaryConfigMgr) rollback(canaryConfig *fv1.CanaryConfig, tr
|
||||
functionWeights[canaryConfig.Spec.OldFunction] = 100
|
||||
|
||||
err := canaryCfgMgr.updateHttpTriggerWithRetries(trigger.Metadata.Name, trigger.Metadata.Namespace, functionWeights)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = canaryCfgMgr.updateCanaryConfigStatusWithRetries(canaryConfig.Metadata.Name, canaryConfig.Metadata.Namespace,
|
||||
types.CanaryConfigStatusFailed)
|
||||
|
||||
+7
-18
@@ -53,7 +53,6 @@ type (
|
||||
builderManagerUrl string
|
||||
workflowApiUrl string
|
||||
functionNamespace string
|
||||
useIstio bool
|
||||
featureStatus map[string]string
|
||||
}
|
||||
|
||||
@@ -167,7 +166,7 @@ func (api *API) getLogDBConfig(dbType string) logDBConfig {
|
||||
|
||||
func (api *API) HomeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
fmt.Fprintf(w, info.ApiInfo().String())
|
||||
w.Write([]byte(info.ApiInfo().String()))
|
||||
}
|
||||
|
||||
func (api *API) ApiVersionMismatchHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -191,7 +190,7 @@ func (api *API) GetSvcName(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, service.Name+"."+podNamespace)
|
||||
}
|
||||
|
||||
func (api *API) Serve(port int) {
|
||||
func (api *API) GetHandler() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
|
||||
// Give a useful error message if an older CLI attempts to make a request
|
||||
@@ -240,19 +239,6 @@ func (api *API) Serve(port int) {
|
||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/v2/recorders", api.RecorderApiList).Methods("GET")
|
||||
r.HandleFunc("/v2/recorders", api.RecorderApiCreate).Methods("POST")
|
||||
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiGet).Methods("GET")
|
||||
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v2/recorders/{recorder}", api.RecorderApiDelete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/v2/records", api.RecordsApiListAll).Methods("GET")
|
||||
r.HandleFunc("/v2/records/function/{function}", api.RecordsApiFilterByFunction).Methods("GET")
|
||||
r.HandleFunc("/v2/records/trigger/{trigger}", api.RecordsApiFilterByTrigger).Methods("GET")
|
||||
r.HandleFunc("/v2/records/time", api.RecordsApiFilterByTime).Methods("GET")
|
||||
|
||||
r.HandleFunc("/v2/replay/{reqUID}", api.ReplayByReqUID).Methods("GET")
|
||||
|
||||
r.HandleFunc("/v2/secrets/{secret}", api.SecretGet).Methods("GET")
|
||||
r.HandleFunc("/v2/configmaps/{configmap}", api.ConfigMapGet).Methods("GET")
|
||||
|
||||
@@ -270,9 +256,12 @@ func (api *API) Serve(port int) {
|
||||
|
||||
r.Handle("/v2/apidocs.json", openAPI()).Methods("GET")
|
||||
|
||||
address := fmt.Sprintf(":%v", port)
|
||||
return r
|
||||
}
|
||||
|
||||
func (api *API) Serve(port int) {
|
||||
address := fmt.Sprintf(":%v", port)
|
||||
api.logger.Info("server started", zap.Int("port", port))
|
||||
err := http.ListenAndServe(address, r)
|
||||
err := http.ListenAndServe(address, api.GetHandler())
|
||||
api.logger.Fatal("done listening", zap.Error(err))
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -33,7 +31,7 @@ func (c *Client) CanaryConfigCreate(canaryConf *fv1.CanaryConfig) (*metav1.Objec
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("canaryconfigs"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("canaryconfigs", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -57,7 +55,7 @@ func (c *Client) CanaryConfigGet(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error
|
||||
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -106,13 +104,12 @@ func (c *Client) CanaryConfigUpdate(canaryConf *fv1.CanaryConfig) (*metav1.Objec
|
||||
func (c *Client) CanaryConfigDelete(m *metav1.ObjectMeta) error {
|
||||
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
return c.delete(relativeUrl)
|
||||
}
|
||||
|
||||
func (c *Client) CanaryConfigList(ns string) ([]fv1.CanaryConfig, error) {
|
||||
relativeUrl := fmt.Sprintf("canaryconfigs?namespace=%v", ns)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -18,38 +18,56 @@ package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
"github.com/fission/fission/pkg/info"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultRequestHeaders map[string]string
|
||||
)
|
||||
|
||||
type (
|
||||
Client struct {
|
||||
Url string
|
||||
Url string
|
||||
Headers map[string]string
|
||||
}
|
||||
)
|
||||
|
||||
func MakeClient(serverUrl string) *Client {
|
||||
return &Client{Url: strings.TrimSuffix(serverUrl, "/")}
|
||||
return &Client{
|
||||
Url: strings.TrimSuffix(serverUrl, "/"),
|
||||
Headers: DefaultRequestHeaders,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) create(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
|
||||
var reader io.Reader
|
||||
if len(payload) > 0 {
|
||||
reader = bytes.NewReader(payload)
|
||||
}
|
||||
return c.sendRequest(http.MethodPost, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
|
||||
}
|
||||
|
||||
func (c *Client) put(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
|
||||
var reader io.Reader
|
||||
if len(payload) > 0 {
|
||||
reader = bytes.NewReader(payload)
|
||||
}
|
||||
return c.sendRequest(http.MethodPut, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
|
||||
}
|
||||
|
||||
func (c *Client) get(relativeUrl string) (*http.Response, error) {
|
||||
return c.sendRequest(http.MethodGet, c.v2CrdUrl(relativeUrl), nil, nil)
|
||||
}
|
||||
|
||||
func (c *Client) delete(relativeUrl string) error {
|
||||
req, err := http.NewRequest("DELETE", c.url(relativeUrl), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
resp, err := c.sendRequest(http.MethodDelete, c.v2CrdUrl(relativeUrl), nil, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -58,26 +76,42 @@ func (c *Client) delete(relativeUrl string) error {
|
||||
if resp.StatusCode != 200 {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return errors.New("Delete failed")
|
||||
return errors.Wrap(err, "error deleting")
|
||||
} else {
|
||||
return errors.New("Delete failed: " + string(body))
|
||||
return errors.Errorf("failed to delete: %v", string(body))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) put(relativeUrl string, contentType string, body []byte) (*http.Response, error) {
|
||||
req, err := http.NewRequest("PUT", c.url(relativeUrl), bytes.NewReader(body))
|
||||
func (c *Client) proxy(method string, relativeUrl string, payload []byte) (*http.Response, error) {
|
||||
var reader io.Reader
|
||||
if len(payload) > 0 {
|
||||
reader = bytes.NewReader(payload)
|
||||
}
|
||||
return c.sendRequest(method, c.proxyUrl(relativeUrl), nil, reader)
|
||||
}
|
||||
|
||||
func (c *Client) sendRequest(method string, relativeUrl string, headers map[string]string, reader io.Reader) (*http.Response, error) {
|
||||
req, err := http.NewRequest(method, relativeUrl, reader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("Content-type", contentType)
|
||||
for _, hs := range []map[string]string{headers, c.Headers} {
|
||||
for k, v := range hs {
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
}
|
||||
return http.DefaultClient.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) url(relativeUrl string) string {
|
||||
return c.Url + "/v2/" + relativeUrl
|
||||
func (c *Client) v2CrdUrl(relativeUrl string) string {
|
||||
return c.Url + "/v2/" + strings.TrimPrefix(relativeUrl, "/")
|
||||
}
|
||||
|
||||
func (c *Client) proxyUrl(relativeUrl string) string {
|
||||
return c.Url + "/proxy/" + strings.TrimPrefix(relativeUrl, "/")
|
||||
}
|
||||
|
||||
func (c *Client) handleResponse(resp *http.Response) ([]byte, error) {
|
||||
@@ -95,29 +129,3 @@ func (c *Client) handleCreateResponse(resp *http.Response) ([]byte, error) {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
func (c *Client) ServerInfo() (*info.ServerInfo, error) {
|
||||
url := fmt.Sprintf(c.Url)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
resp, err := ctxhttp.Get(ctx, &http.Client{}, url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := &info.ServerInfo{}
|
||||
err = json.Unmarshal(body, info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -17,20 +17,26 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission/pkg/info"
|
||||
)
|
||||
|
||||
func (c *Client) SecretGet(m *metav1.ObjectMeta) (*apiv1.Secret, error) {
|
||||
relativeUrl := fmt.Sprintf("secrets/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -54,7 +60,7 @@ func (c *Client) ConfigMapGet(m *metav1.ObjectMeta) (*apiv1.ConfigMap, error) {
|
||||
relativeUrl := fmt.Sprintf("configmaps/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -75,19 +81,15 @@ func (c *Client) ConfigMapGet(m *metav1.ObjectMeta) (*apiv1.ConfigMap, error) {
|
||||
}
|
||||
|
||||
func (c *Client) GetSvcURL(label string) (string, error) {
|
||||
url := fmt.Sprintf("%s/proxy/svcname?"+label, c.Url)
|
||||
|
||||
resp, err := http.Get(url)
|
||||
|
||||
resp, err := c.proxy(http.MethodGet, "svcname?"+label, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if resp == nil {
|
||||
return "", fmt.Errorf("Failed to find service for given label: %v", label)
|
||||
return "", errors.Errorf("failed to find service for given label: %v", label)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -97,3 +99,27 @@ func (c *Client) GetSvcURL(label string) (string, error) {
|
||||
|
||||
return storageSvc, err
|
||||
}
|
||||
|
||||
func (c *Client) ServerInfo() (*info.ServerInfo, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
resp, err := ctxhttp.Get(ctx, &http.Client{}, c.Url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := &info.ServerInfo{}
|
||||
err = json.Unmarshal(body, info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -43,7 +41,7 @@ func (c *Client) EnvironmentCreate(env *fv1.Environment) (*metav1.ObjectMeta, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("environments"), "application/json", bytes.NewReader(data))
|
||||
resp, err := c.create("environments", "application/json", data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -67,7 +65,7 @@ func (c *Client) EnvironmentGet(m *metav1.ObjectMeta) (*fv1.Environment, error)
|
||||
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -117,13 +115,12 @@ func (c *Client) EnvironmentUpdate(env *fv1.Environment) (*metav1.ObjectMeta, er
|
||||
func (c *Client) EnvironmentDelete(m *metav1.ObjectMeta) error {
|
||||
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
return c.delete(relativeUrl)
|
||||
}
|
||||
|
||||
func (c *Client) EnvironmentList(ns string) ([]fv1.Environment, error) {
|
||||
relativeUrl := fmt.Sprintf("environments?namespace=%v", ns)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -38,7 +36,7 @@ func (c *Client) FunctionCreate(f *fv1.Function) (*metav1.ObjectMeta, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("functions"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("functions", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,7 +60,7 @@ func (c *Client) FunctionGet(m *metav1.ObjectMeta) (*fv1.Function, error) {
|
||||
relativeUrl := fmt.Sprintf("functions/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -87,7 +85,7 @@ func (c *Client) FunctionGetRawDeployment(m *metav1.ObjectMeta) ([]byte, error)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
relativeUrl += fmt.Sprintf("&deploymentraw=1")
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -135,7 +133,7 @@ func (c *Client) FunctionDelete(m *metav1.ObjectMeta) error {
|
||||
|
||||
func (c *Client) FunctionList(functionNamespace string) ([]fv1.Function, error) {
|
||||
relativeUrl := fmt.Sprintf("functions?namespace=%v", functionNamespace)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -38,7 +36,7 @@ func (c *Client) HTTPTriggerCreate(t *fv1.HTTPTrigger) (*metav1.ObjectMeta, erro
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("triggers/http"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("triggers/http", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,7 +60,7 @@ func (c *Client) HTTPTriggerGet(m *metav1.ObjectMeta) (*fv1.HTTPTrigger, error)
|
||||
relativeUrl := fmt.Sprintf("triggers/http/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -121,7 +119,7 @@ func (c *Client) HTTPTriggerDelete(m *metav1.ObjectMeta) error {
|
||||
|
||||
func (c *Client) HTTPTriggerList(triggerNamespace string) ([]fv1.HTTPTrigger, error) {
|
||||
relativeUrl := fmt.Sprintf("triggers/http?namespace=%v", triggerNamespace)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -39,7 +37,7 @@ func (c *Client) WatchCreate(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("watches"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("watches", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,7 +61,7 @@ func (c *Client) WatchGet(m *metav1.ObjectMeta) (*fv1.KubernetesWatchTrigger, er
|
||||
relativeUrl := fmt.Sprintf("watches/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -84,8 +82,7 @@ func (c *Client) WatchGet(m *metav1.ObjectMeta) (*fv1.KubernetesWatchTrigger, er
|
||||
}
|
||||
|
||||
func (c *Client) WatchUpdate(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta, error) {
|
||||
return nil, ferror.MakeError(ferror.ErrorNotImplmented,
|
||||
"watch update not implemented")
|
||||
return nil, ferror.MakeError(ferror.ErrorNotImplmented, "watch update not implemented")
|
||||
}
|
||||
|
||||
func (c *Client) WatchDelete(m *metav1.ObjectMeta) error {
|
||||
@@ -96,7 +93,7 @@ func (c *Client) WatchDelete(m *metav1.ObjectMeta) error {
|
||||
|
||||
func (c *Client) WatchList(ns string) ([]fv1.KubernetesWatchTrigger, error) {
|
||||
relativeUrl := fmt.Sprintf("watches?namespace=%v", ns)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -38,7 +36,7 @@ func (c *Client) MessageQueueTriggerCreate(t *fv1.MessageQueueTrigger) (*metav1.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("triggers/messagequeue"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("triggers/messagequeue", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,7 +60,7 @@ func (c *Client) MessageQueueTriggerGet(m *metav1.ObjectMeta) (*fv1.MessageQueue
|
||||
relativeUrl := fmt.Sprintf("triggers/messagequeue/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -126,7 +124,7 @@ func (c *Client) MessageQueueTriggerList(mqType string, ns string) ([]fv1.Messag
|
||||
relativeUrl += fmt.Sprintf("?mqtype=%v&namespace=%v", mqType, ns)
|
||||
}
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -38,7 +36,7 @@ func (c *Client) PackageCreate(f *fv1.Package) (*metav1.ObjectMeta, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("packages"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("packages", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,7 +60,7 @@ func (c *Client) PackageGet(m *metav1.ObjectMeta) (*fv1.Package, error) {
|
||||
relativeUrl := fmt.Sprintf("packages/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -121,7 +119,7 @@ func (c *Client) PackageDelete(m *metav1.ObjectMeta) error {
|
||||
|
||||
func (c *Client) PackageList(pkgNamespace string) ([]fv1.Package, error) {
|
||||
relativeUrl := fmt.Sprintf("packages?namespace=%v", pkgNamespace)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/redis/build/gen"
|
||||
)
|
||||
|
||||
func (c *Client) RecorderCreate(r *fv1.Recorder) (*metav1.ObjectMeta, error) {
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
return nil, fv1.AggregateValidationErrors("Recorder", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("recorders"), "application/json", bytes.NewReader(reqbody))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleCreateResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var m metav1.ObjectMeta
|
||||
err = json.Unmarshal(body, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &m, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecorderGet(m *metav1.ObjectMeta) (*fv1.Recorder, error) {
|
||||
relativeUrl := fmt.Sprintf("recorders/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r fv1.Recorder
|
||||
err = json.Unmarshal(body, &r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecorderUpdate(recorder *fv1.Recorder) (*metav1.ObjectMeta, error) {
|
||||
err := recorder.Validate()
|
||||
if err != nil {
|
||||
return nil, fv1.AggregateValidationErrors("Recorder", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(recorder)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
relativeUrl := fmt.Sprintf("recorders/%v", recorder.Metadata.Name)
|
||||
|
||||
resp, err := c.put(relativeUrl, "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var m metav1.ObjectMeta
|
||||
err = json.Unmarshal(body, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &m, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecorderDelete(m *metav1.ObjectMeta) error {
|
||||
relativeUrl := fmt.Sprintf("recorders/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
return c.delete(relativeUrl)
|
||||
}
|
||||
|
||||
func (c *Client) RecorderList(ns string) ([]fv1.Recorder, error) {
|
||||
relativeUrl := "recorders"
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
recorders := make([]fv1.Recorder, 0)
|
||||
err = json.Unmarshal(body, &recorders)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return recorders, nil
|
||||
}
|
||||
|
||||
// TODO: Move to different file?
|
||||
func (c *Client) RecordsByFunction(function string) ([]*redisCache.RecordedEntry, error) {
|
||||
relativeUrl := fmt.Sprintf("records/function/%v", function)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
records := make([]*redisCache.RecordedEntry, 0)
|
||||
err = json.Unmarshal(body, &records)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return records, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecordsAll() ([]*redisCache.RecordedEntry, error) {
|
||||
relativeUrl := "records"
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
records := make([]*redisCache.RecordedEntry, 0)
|
||||
err = json.Unmarshal(body, &records)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return records, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecordsByTrigger(trigger string) ([]*redisCache.RecordedEntry, error) {
|
||||
relativeUrl := fmt.Sprintf("records/trigger/%v", trigger)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
records := make([]*redisCache.RecordedEntry, 0)
|
||||
err = json.Unmarshal(body, &records)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return records, nil
|
||||
}
|
||||
|
||||
func (c *Client) RecordsByTime(from string, to string) ([]*redisCache.RecordedEntry, error) {
|
||||
relativeUrl := "records/time"
|
||||
relativeUrl += fmt.Sprintf("?from=%v&to=%v", from, to)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
records := make([]*redisCache.RecordedEntry, 0)
|
||||
err = json.Unmarshal(body, &records)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return records, nil
|
||||
}
|
||||
@@ -17,10 +17,8 @@ limitations under the License.
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -38,7 +36,7 @@ func (c *Client) TimeTriggerCreate(t *fv1.TimeTrigger) (*metav1.ObjectMeta, erro
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := http.Post(c.url("triggers/time"), "application/json", bytes.NewReader(reqbody))
|
||||
resp, err := c.create("triggers/time", "application/json", reqbody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -62,7 +60,7 @@ func (c *Client) TimeTriggerGet(m *metav1.ObjectMeta) (*fv1.TimeTrigger, error)
|
||||
relativeUrl := fmt.Sprintf("triggers/time/%v", m.Name)
|
||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
||||
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -121,7 +119,7 @@ func (c *Client) TimeTriggerDelete(m *metav1.ObjectMeta) error {
|
||||
|
||||
func (c *Client) TimeTriggerList(ns string) ([]fv1.TimeTrigger, error) {
|
||||
relativeUrl := fmt.Sprintf("triggers/time?namespace=%v", ns)
|
||||
resp, err := http.Get(c.url(relativeUrl))
|
||||
resp, err := c.get(relativeUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package controller
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -30,6 +29,7 @@ import (
|
||||
restfulspec "github.com/emicklei/go-restful-openapi"
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -106,12 +106,6 @@ func RegisterFunctionRoute(ws *restful.WebService) {
|
||||
Returns(http.StatusOK, "Only HTTP status returned", nil))
|
||||
}
|
||||
|
||||
func (a *API) getIstioServiceLabels(fnName string) map[string]string {
|
||||
return map[string]string{
|
||||
"functionName": fnName,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *API) FunctionApiList(w http.ResponseWriter, r *http.Request) {
|
||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
||||
if len(ns) == 0 {
|
||||
@@ -258,9 +252,12 @@ func (a *API) FunctionLogsApiPost(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
svcUrl, err := url.Parse(dbCnf.httpURL)
|
||||
if err != nil {
|
||||
a.logger.Error("failed parse url to establish proxy to database for function logs",
|
||||
msg := "failed parse url to establish proxy to database for function logs"
|
||||
a.logger.Error(msg,
|
||||
zap.Error(err),
|
||||
zap.String("database_url", dbCnf.httpURL))
|
||||
a.respondWithError(w, errors.Wrap(err, msg))
|
||||
return
|
||||
}
|
||||
// set up proxy server director
|
||||
director := func(req *http.Request) {
|
||||
@@ -269,6 +266,7 @@ func (a *API) FunctionLogsApiPost(w http.ResponseWriter, r *http.Request) {
|
||||
req.URL.Scheme = svcUrl.Scheme
|
||||
req.URL.Host = svcUrl.Host
|
||||
req.URL.Path = svcUrl.Path
|
||||
req.Host = svcUrl.Host
|
||||
// set up http basic auth for database authentication
|
||||
req.SetBasicAuth(dbCnf.username, dbCnf.password)
|
||||
}
|
||||
@@ -321,7 +319,7 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
|
||||
if len(pods) > 0 {
|
||||
podLogsReq = a.kubernetesClient.CoreV1().Pods(ns).GetLogs(pods[0].ObjectMeta.Name, &podLogOpts)
|
||||
} else {
|
||||
a.respondWithError(w, errors.New("No active pods found"))
|
||||
a.respondWithError(w, errors.New("no active pods found"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -337,5 +335,4 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
)
|
||||
|
||||
func (a *API) RecorderApiList(w http.ResponseWriter, r *http.Request) {
|
||||
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
resp, err := json.Marshal(recorders.Items)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecorderApiCreate(w http.ResponseWriter, r *http.Request) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
var recorder fv1.Recorder
|
||||
err = json.Unmarshal(body, &recorder)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
tnew, err := a.fissionClient.Recorders(recorder.Metadata.Namespace).Create(&recorder)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := json.Marshal(tnew.Metadata)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecorderApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
name := vars["recorder"]
|
||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
||||
if len(ns) == 0 {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
recorder, err := a.fissionClient.Recorders(ns).Get(name)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
resp, err := json.Marshal(recorder)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecorderApiUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
name := vars["recorder"]
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
var recorder fv1.Recorder
|
||||
err = json.Unmarshal(body, &recorder)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
if name != recorder.Metadata.Name {
|
||||
err = ferror.MakeError(ferror.ErrorInvalidArgument, "Recorder name doesn't match URL")
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
rnew, err := a.fissionClient.Recorders(recorder.Metadata.Namespace).Update(&recorder)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := json.Marshal(rnew.Metadata)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecorderApiDelete(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
name := vars["recorder"]
|
||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
||||
if len(ns) == 0 {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
err := a.fissionClient.Recorders(ns).Delete(name, &metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, []byte(""))
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission/pkg/redis"
|
||||
)
|
||||
|
||||
func (a *API) RecordsApiListAll(w http.ResponseWriter, r *http.Request) {
|
||||
resp, err := redis.RecordsListAll(a.logger.Named("redis"))
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecordsApiFilterByFunction(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
query := vars["function"]
|
||||
|
||||
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
triggers, err := a.fissionClient.HTTPTriggers(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := redis.RecordsFilterByFunction(a.logger.Named("redis"), query, recorders, triggers)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecordsApiFilterByTrigger(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
query := vars["trigger"]
|
||||
|
||||
recorders, err := a.fissionClient.Recorders(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
triggers, err := a.fissionClient.HTTPTriggers(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := redis.RecordsFilterByTrigger(a.logger.Named("redis"), query, recorders, triggers)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
|
||||
func (a *API) RecordsApiFilterByTime(w http.ResponseWriter, r *http.Request) {
|
||||
from := r.FormValue("from")
|
||||
to := r.FormValue("to")
|
||||
|
||||
resp, err := redis.RecordsFilterByTime(a.logger.Named("redis"), from, to)
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
a.respondWithSuccess(w, resp)
|
||||
}
|
||||
@@ -69,6 +69,7 @@ func (api *API) StorageServiceProxy(w http.ResponseWriter, r *http.Request) {
|
||||
req.URL.Scheme = ssUrl.Scheme
|
||||
req.URL.Host = ssUrl.Host
|
||||
req.URL.Path = "/v1/archive"
|
||||
req.Host = ssUrl.Host
|
||||
}
|
||||
proxy := &httputil.ReverseProxy{
|
||||
Director: director,
|
||||
|
||||
@@ -24,6 +24,7 @@ func (api *API) WorkflowApiserverProxy(w http.ResponseWriter, r *http.Request) {
|
||||
req.URL.Scheme = ssUrl.Scheme
|
||||
req.URL.Host = ssUrl.Host
|
||||
req.URL.Path = path
|
||||
req.Host = ssUrl.Host
|
||||
}
|
||||
proxy := &httputil.ReverseProxy{
|
||||
Director: director,
|
||||
|
||||
@@ -155,13 +155,6 @@ func configureClient(config *rest.Config) {
|
||||
&metav1.ListOptions{},
|
||||
&metav1.DeleteOptions{},
|
||||
)
|
||||
scheme.AddKnownTypes(
|
||||
groupversion,
|
||||
&fv1.Recorder{},
|
||||
&fv1.RecorderList{},
|
||||
&metav1.ListOptions{},
|
||||
&metav1.DeleteOptions{},
|
||||
)
|
||||
scheme.AddKnownTypes(
|
||||
groupversion,
|
||||
&fv1.CanaryConfig{},
|
||||
@@ -224,9 +217,6 @@ func (fc *FissionClient) TimeTriggers(ns string) TimeTriggerInterface {
|
||||
func (fc *FissionClient) MessageQueueTriggers(ns string) MessageQueueTriggerInterface {
|
||||
return MakeMessageQueueTriggerInterface(fc.crdClient, ns)
|
||||
}
|
||||
func (fc *FissionClient) Recorders(ns string) RecorderInterface {
|
||||
return MakeRecorderInterface(fc.crdClient, ns)
|
||||
}
|
||||
func (fc *FissionClient) Packages(ns string) PackageInterface {
|
||||
return MakePackageInterface(fc.crdClient, ns)
|
||||
}
|
||||
|
||||
@@ -157,22 +157,6 @@ func EnsureFissionCRDs(logger *zap.Logger, clientset *apiextensionsclient.Client
|
||||
},
|
||||
},
|
||||
},
|
||||
// Recorders
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "recorders.fission.io",
|
||||
},
|
||||
Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
|
||||
Group: crdGroupName,
|
||||
Version: crdVersion,
|
||||
Scope: apiextensionsv1beta1.NamespaceScoped,
|
||||
Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
|
||||
Kind: "Recorder",
|
||||
Plural: "recorders",
|
||||
Singular: "recorder",
|
||||
},
|
||||
},
|
||||
},
|
||||
// Packages: archives containing source or binaries for one or more functions
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package crd
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
RecorderInterface interface {
|
||||
Create(*fv1.Recorder) (*fv1.Recorder, error)
|
||||
Get(name string) (*fv1.Recorder, error)
|
||||
Update(*fv1.Recorder) (*fv1.Recorder, error)
|
||||
Delete(name string, opts *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*fv1.RecorderList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
recorderClient struct {
|
||||
client *rest.RESTClient
|
||||
namespace string
|
||||
}
|
||||
)
|
||||
|
||||
func MakeRecorderInterface(crdClient *rest.RESTClient, namespace string) RecorderInterface {
|
||||
return &recorderClient{
|
||||
client: crdClient,
|
||||
namespace: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
func (rc *recorderClient) Create(r *fv1.Recorder) (*fv1.Recorder, error) {
|
||||
var result fv1.Recorder
|
||||
err := rc.client.Post().
|
||||
Resource("recorders").
|
||||
Namespace("default").
|
||||
Body(r).
|
||||
Do().Into(&result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (rc *recorderClient) Get(name string) (*fv1.Recorder, error) {
|
||||
var result fv1.Recorder
|
||||
err := rc.client.Get().
|
||||
Resource("recorders").
|
||||
Namespace(rc.namespace).
|
||||
Name(name).
|
||||
Do().Into(&result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (rc *recorderClient) Update(r *fv1.Recorder) (*fv1.Recorder, error) {
|
||||
var result fv1.Recorder
|
||||
err := rc.client.Put().
|
||||
Resource("recorders").
|
||||
Namespace(rc.namespace).
|
||||
Name(r.Metadata.Name).
|
||||
Body(r).
|
||||
Do().Into(&result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (rc *recorderClient) Delete(name string, opts *metav1.DeleteOptions) error {
|
||||
return rc.client.Delete().
|
||||
Namespace(rc.namespace).
|
||||
Resource("recorders").
|
||||
Name(name).
|
||||
Body(opts).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
func (rc *recorderClient) List(opts metav1.ListOptions) (*fv1.RecorderList, error) {
|
||||
var result fv1.RecorderList
|
||||
err := rc.client.Get().
|
||||
Namespace(rc.namespace).
|
||||
Resource("recorders").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(&result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
func (rc *recorderClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return rc.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(rc.namespace).
|
||||
Resource("recorders").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
+77
-30
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package executor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@@ -25,11 +24,16 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/pkg/errors"
|
||||
"go.opencensus.io/plugin/ochttp"
|
||||
"go.uber.org/zap"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
"github.com/fission/fission/pkg/executor/client"
|
||||
)
|
||||
|
||||
func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -47,7 +51,17 @@ func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *htt
|
||||
return
|
||||
}
|
||||
|
||||
serviceName, err := executor.getServiceForFunction(r.Context(), &m)
|
||||
fn, err := executor.fissionClient.Functions(m.Namespace).Get(m.Name)
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
http.Error(w, "Failed to find function", http.StatusNotFound)
|
||||
} else {
|
||||
http.Error(w, "Failed to get function", http.StatusInternalServerError)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
serviceName, err := executor.getServiceForFunction(fn)
|
||||
if err != nil {
|
||||
code, msg := ferror.GetHTTPError(err)
|
||||
executor.logger.Error("error getting service for function",
|
||||
@@ -70,30 +84,35 @@ func (executor *Executor) getServiceForFunctionApi(w http.ResponseWriter, r *htt
|
||||
// stale addresses are not returned to the router.
|
||||
// To make it optimal, plan is to add an eager cache invalidator function that watches for pod deletion events and
|
||||
// invalidates the cache entry if the pod address was cached.
|
||||
func (executor *Executor) getServiceForFunction(ctx context.Context, m *metav1.ObjectMeta) (string, error) {
|
||||
func (executor *Executor) getServiceForFunction(fn *fv1.Function) (string, error) {
|
||||
// Check function -> svc cache
|
||||
executor.logger.Debug("checking for cached function service",
|
||||
zap.String("function_name", m.Name),
|
||||
zap.String("function_namespace", m.Namespace))
|
||||
zap.String("function_name", fn.Metadata.Name),
|
||||
zap.String("function_namespace", fn.Metadata.Namespace))
|
||||
|
||||
fsvc, err := executor.fsCache.GetByFunction(m)
|
||||
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
et, exists := executor.executorTypes[t]
|
||||
if !exists {
|
||||
return "", errors.Errorf("Unknown executor type '%v'", t)
|
||||
}
|
||||
|
||||
fsvc, err := et.GetFuncSvcFromCache(fn)
|
||||
if err == nil {
|
||||
if executor.isValidAddress(fsvc) {
|
||||
if et.IsValid(fsvc) {
|
||||
// Cached, return svc address
|
||||
return fsvc.Address, nil
|
||||
} else {
|
||||
executor.logger.Debug("deleting cache entry for invalid address",
|
||||
zap.String("function_name", m.Name),
|
||||
zap.String("function_namespace", m.Namespace),
|
||||
zap.String("function_name", fn.Metadata.Name),
|
||||
zap.String("function_namespace", fn.Metadata.Namespace),
|
||||
zap.String("address", fsvc.Address))
|
||||
executor.fsCache.DeleteEntry(fsvc)
|
||||
et.DeleteFuncSvcFromCache(fsvc)
|
||||
}
|
||||
}
|
||||
|
||||
respChan := make(chan *createFuncServiceResponse)
|
||||
executor.requestChan <- &createFuncServiceRequest{
|
||||
ctx: ctx,
|
||||
funcMeta: m,
|
||||
function: fn,
|
||||
respChan: respChan,
|
||||
}
|
||||
resp := <-respChan
|
||||
@@ -104,25 +123,57 @@ func (executor *Executor) getServiceForFunction(ctx context.Context, m *metav1.O
|
||||
}
|
||||
|
||||
// find funcSvc and update its atime
|
||||
// TODO: Deprecated tapService
|
||||
func (executor *Executor) tapService(w http.ResponseWriter, r *http.Request) {
|
||||
// only for upgrade compatibility
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// find funcSvc and update its atime
|
||||
func (executor *Executor) tapServices(w http.ResponseWriter, r *http.Request) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
executor.logger.Error("failed to read tap service request", zap.Error(err))
|
||||
http.Error(w, "Failed to read request", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
svcName := string(body)
|
||||
svcHost := strings.TrimPrefix(svcName, "http://")
|
||||
|
||||
err = executor.fsCache.TouchByAddress(svcHost)
|
||||
tapSvcReqs := []client.TapServiceRequest{}
|
||||
err = json.Unmarshal(body, &tapSvcReqs)
|
||||
if err != nil {
|
||||
executor.logger.Error("error tapping function service",
|
||||
executor.logger.Error("failed to decode tap service request",
|
||||
zap.Error(err),
|
||||
zap.String("service", svcName),
|
||||
zap.String("host", svcHost))
|
||||
zap.String("request-payload", string(body)))
|
||||
http.Error(w, "Failed to decode tap service request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
errs := &multierror.Error{}
|
||||
for _, req := range tapSvcReqs {
|
||||
svcHost := strings.TrimPrefix(req.ServiceUrl, "http://")
|
||||
|
||||
et, exists := executor.executorTypes[req.FnExecutorType]
|
||||
if !exists {
|
||||
errs = multierror.Append(errs,
|
||||
errors.Errorf("error tapping service due to unknown executor type '%v' found",
|
||||
req.FnExecutorType))
|
||||
continue
|
||||
}
|
||||
|
||||
err = et.TapService(svcHost)
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs,
|
||||
errors.Wrapf(err, "'%v' failed to tap function '%v' in '%v' with service url '%v'",
|
||||
req.FnMetadata.Name, req.FnMetadata.Namespace, req.ServiceUrl, req.FnExecutorType))
|
||||
}
|
||||
}
|
||||
|
||||
if errs.ErrorOrNil() != nil {
|
||||
executor.logger.Error("error tapping function service", zap.Error(errs))
|
||||
http.Error(w, "Not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
@@ -130,24 +181,20 @@ func (executor *Executor) healthHandler(w http.ResponseWriter, r *http.Request)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func (executor *Executor) Serve(port int) {
|
||||
executor.logger.Info("starting executor", zap.Int("port", port))
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
executor.ndm.Run(ctx)
|
||||
executor.gpm.Run(ctx)
|
||||
executor.cms.Run(ctx)
|
||||
|
||||
func (executor *Executor) GetHandler() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/v2/getServiceForFunction", executor.getServiceForFunctionApi).Methods("POST")
|
||||
r.HandleFunc("/v2/tapService", executor.tapService).Methods("POST")
|
||||
r.HandleFunc("/v2/tapService", executor.tapService).Methods("POST") // for backward compatibility
|
||||
r.HandleFunc("/v2/tapServices", executor.tapServices).Methods("POST")
|
||||
r.HandleFunc("/healthz", executor.healthHandler).Methods("GET")
|
||||
return r
|
||||
}
|
||||
|
||||
func (executor *Executor) Serve(port int) {
|
||||
executor.logger.Info("starting executor API", zap.Int("port", port))
|
||||
address := fmt.Sprintf(":%v", port)
|
||||
|
||||
err := http.ListenAndServe(address, &ochttp.Handler{
|
||||
Handler: r,
|
||||
Handler: executor.GetHandler(),
|
||||
})
|
||||
executor.logger.Fatal("done listening", zap.Error(err))
|
||||
}
|
||||
|
||||
@@ -32,23 +32,31 @@ import (
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
logger *zap.Logger
|
||||
executorUrl string
|
||||
tappedByUrl map[string]bool
|
||||
requestChan chan string
|
||||
httpClient *http.Client
|
||||
}
|
||||
type (
|
||||
Client struct {
|
||||
logger *zap.Logger
|
||||
executorUrl string
|
||||
tappedByUrl map[string]TapServiceRequest
|
||||
requestChan chan TapServiceRequest
|
||||
httpClient *http.Client
|
||||
}
|
||||
TapServiceRequest struct {
|
||||
FnMetadata metav1.ObjectMeta
|
||||
FnExecutorType fv1.ExecutorType
|
||||
ServiceUrl string
|
||||
}
|
||||
)
|
||||
|
||||
func MakeClient(logger *zap.Logger, executorUrl string) *Client {
|
||||
c := &Client{
|
||||
logger: logger.Named("executor_client"),
|
||||
executorUrl: strings.TrimSuffix(executorUrl, "/"),
|
||||
tappedByUrl: make(map[string]bool),
|
||||
requestChan: make(chan string),
|
||||
tappedByUrl: make(map[string]TapServiceRequest),
|
||||
requestChan: make(chan TapServiceRequest, 100),
|
||||
httpClient: &http.Client{
|
||||
Transport: &ochttp.Transport{},
|
||||
},
|
||||
@@ -87,40 +95,64 @@ func (c *Client) service() {
|
||||
ticker := time.NewTicker(time.Second * 5)
|
||||
for {
|
||||
select {
|
||||
case serviceUrl := <-c.requestChan:
|
||||
c.tappedByUrl[serviceUrl] = true
|
||||
case svcReq := <-c.requestChan:
|
||||
c.tappedByUrl[svcReq.ServiceUrl] = svcReq
|
||||
case <-ticker.C:
|
||||
urls := c.tappedByUrl
|
||||
c.tappedByUrl = make(map[string]bool)
|
||||
if len(urls) > 0 {
|
||||
go func() {
|
||||
for u := range urls {
|
||||
err := c._tapService(u)
|
||||
if err != nil {
|
||||
c.logger.Error("error tapping function service address", zap.Error(err), zap.String("address", u))
|
||||
}
|
||||
}
|
||||
c.logger.Debug("tapped services in batch", zap.Int("service_count", len(urls)))
|
||||
}()
|
||||
if len(c.tappedByUrl) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
urls := c.tappedByUrl
|
||||
c.tappedByUrl = make(map[string]TapServiceRequest)
|
||||
|
||||
go func() {
|
||||
svcReqs := []TapServiceRequest{}
|
||||
for _, req := range urls {
|
||||
svcReqs = append(svcReqs, req)
|
||||
}
|
||||
c.logger.Debug("tapped services in batch", zap.Int("service_count", len(urls)))
|
||||
|
||||
err := c._tapService(svcReqs)
|
||||
if err != nil {
|
||||
c.logger.Error("error tapping function service address", zap.Error(err))
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) TapService(serviceUrl *url.URL) {
|
||||
c.requestChan <- serviceUrl.String()
|
||||
func (c *Client) TapService(fnMeta metav1.ObjectMeta, executorType fv1.ExecutorType, serviceUrl *url.URL) {
|
||||
c.requestChan <- TapServiceRequest{
|
||||
FnMetadata: metav1.ObjectMeta{
|
||||
Name: fnMeta.Name,
|
||||
Namespace: fnMeta.Namespace,
|
||||
ResourceVersion: fnMeta.ResourceVersion,
|
||||
UID: fnMeta.UID,
|
||||
},
|
||||
FnExecutorType: executorType,
|
||||
// service url is for executor to know which
|
||||
// pod/service is currently used to serve user function.
|
||||
ServiceUrl: serviceUrl.String(),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) _tapService(serviceUrlStr string) error {
|
||||
executorUrl := c.executorUrl + "/v2/tapService"
|
||||
func (c *Client) _tapService(tapSvcReqs []TapServiceRequest) error {
|
||||
executorUrl := c.executorUrl + "/v2/tapServices"
|
||||
|
||||
resp, err := http.Post(executorUrl, "application/octet-stream", bytes.NewReader([]byte(serviceUrlStr)))
|
||||
body, err := json.Marshal(tapSvcReqs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := http.Post(executorUrl, "application/json", bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return ferror.MakeErrorFromHTTP(resp)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -29,8 +30,7 @@ import (
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/crd"
|
||||
nd "github.com/fission/fission/pkg/executor/newdeploy"
|
||||
gpm "github.com/fission/fission/pkg/executor/poolmgr"
|
||||
"github.com/fission/fission/pkg/executor/executortype"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -46,10 +46,10 @@ type (
|
||||
|
||||
//MakeConfigSecretController makes a controller for configmaps and secrets which changes related functions
|
||||
func MakeConfigSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
|
||||
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) *ConfigSecretController {
|
||||
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) *ConfigSecretController {
|
||||
logger.Debug("Creating ConfigMap & Secret Controller")
|
||||
_, cmcontroller := initConfigmapController(logger, fissionClient, kubernetesClient, ndm, gpm)
|
||||
_, scontroller := initSecretController(logger, fissionClient, kubernetesClient, ndm, gpm)
|
||||
_, cmcontroller := initConfigmapController(logger, fissionClient, kubernetesClient, types)
|
||||
_, scontroller := initSecretController(logger, fissionClient, kubernetesClient, types)
|
||||
cmsController := &ConfigSecretController{
|
||||
logger: logger,
|
||||
configmapController: cmcontroller,
|
||||
@@ -66,7 +66,7 @@ func (csController *ConfigSecretController) Run(ctx context.Context) {
|
||||
}
|
||||
|
||||
func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClient,
|
||||
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
|
||||
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) (cache.Store, cache.Controller) {
|
||||
resyncPeriod := 30 * time.Second
|
||||
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "configmaps", metav1.NamespaceAll, fields.Everything())
|
||||
store, controller := cache.NewInformer(listWatch, &apiv1.ConfigMap{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
|
||||
@@ -81,12 +81,11 @@ func initConfigmapController(logger *zap.Logger, fissionClient *crd.FissionClien
|
||||
zap.String("configmap_name", newCm.ObjectMeta.Name),
|
||||
zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
|
||||
}
|
||||
|
||||
funcs, err := getConfigmapRelatedFuncs(logger, &newCm.ObjectMeta, fissionClient)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get functions related to secret", zap.String("secret_name", newCm.ObjectMeta.Name), zap.String("secret_namespace", newCm.ObjectMeta.Namespace))
|
||||
logger.Error("Failed to get functions related to configmap", zap.String("configmap_name", newCm.ObjectMeta.Name), zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
|
||||
}
|
||||
recyclePods(logger, funcs, ndm, gpm)
|
||||
recyclePods(logger, funcs, types)
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -112,7 +111,7 @@ func getConfigmapRelatedFuncs(logger *zap.Logger, m *metav1.ObjectMeta, fissionC
|
||||
}
|
||||
|
||||
func initSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
|
||||
kubernetesClient *kubernetes.Clientset, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) (cache.Store, cache.Controller) {
|
||||
kubernetesClient *kubernetes.Clientset, types map[fv1.ExecutorType]executortype.ExecutorType) (cache.Store, cache.Controller) {
|
||||
resyncPeriod := 30 * time.Second
|
||||
listWatch := cache.NewListWatchFromClient(kubernetesClient.CoreV1().RESTClient(), "secrets", metav1.NamespaceAll, fields.Everything())
|
||||
store, controller := cache.NewInformer(listWatch, &apiv1.Secret{}, resyncPeriod, cache.ResourceEventHandlerFuncs{
|
||||
@@ -128,14 +127,12 @@ func initSecretController(logger *zap.Logger, fissionClient *crd.FissionClient,
|
||||
zap.String("configmap_namespace", newS.ObjectMeta.Namespace))
|
||||
|
||||
}
|
||||
|
||||
funcs, err := getSecretRelatedFuncs(logger, &newS.ObjectMeta, fissionClient)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get functions related to secret", zap.String("secret_name", newS.ObjectMeta.Name), zap.String("secret_namespace", newS.ObjectMeta.Namespace))
|
||||
}
|
||||
recyclePods(logger, funcs, ndm, gpm)
|
||||
recyclePods(logger, funcs, types)
|
||||
}
|
||||
|
||||
},
|
||||
})
|
||||
return store, controller
|
||||
@@ -160,19 +157,19 @@ func getSecretRelatedFuncs(logger *zap.Logger, m *metav1.ObjectMeta, fissionClie
|
||||
return relatedFunctions, nil
|
||||
}
|
||||
|
||||
func recyclePods(logger *zap.Logger, funcs []fv1.Function, ndm *nd.NewDeploy, gpm *gpm.GenericPoolManager) {
|
||||
func recyclePods(logger *zap.Logger, funcs []fv1.Function, types map[fv1.ExecutorType]executortype.ExecutorType) {
|
||||
for _, f := range funcs {
|
||||
var err error
|
||||
|
||||
switch f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType {
|
||||
case fv1.ExecutorTypeNewdeploy:
|
||||
err = ndm.RefreshFuncPods(logger, f)
|
||||
case fv1.ExecutorTypePoolmgr:
|
||||
err = gpm.RefreshFuncPods(logger, f)
|
||||
et, exists := types[f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType]
|
||||
if exists {
|
||||
err = et.RefreshFuncPods(logger, f)
|
||||
} else {
|
||||
err = errors.Errorf("Unknown executor type '%v'", f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error("Failed to recycle pods for function after configmap changed",
|
||||
logger.Error("Failed to recycle pods for function after configmap/secret changed",
|
||||
zap.Error(err),
|
||||
zap.Any("function", f))
|
||||
}
|
||||
|
||||
+84
-70
@@ -28,14 +28,14 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"go.uber.org/zap"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/crd"
|
||||
"github.com/fission/fission/pkg/executor/cms"
|
||||
"github.com/fission/fission/pkg/executor/executortype"
|
||||
"github.com/fission/fission/pkg/executor/executortype/newdeploy"
|
||||
"github.com/fission/fission/pkg/executor/executortype/poolmgr"
|
||||
"github.com/fission/fission/pkg/executor/fscache"
|
||||
"github.com/fission/fission/pkg/executor/newdeploy"
|
||||
"github.com/fission/fission/pkg/executor/poolmgr"
|
||||
"github.com/fission/fission/pkg/executor/reaper"
|
||||
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
||||
)
|
||||
@@ -44,19 +44,16 @@ type (
|
||||
Executor struct {
|
||||
logger *zap.Logger
|
||||
|
||||
gpm *poolmgr.GenericPoolManager
|
||||
ndm *newdeploy.NewDeploy
|
||||
cms *cms.ConfigSecretController
|
||||
executorTypes map[fv1.ExecutorType]executortype.ExecutorType
|
||||
cms *cms.ConfigSecretController
|
||||
|
||||
fissionClient *crd.FissionClient
|
||||
fsCache *fscache.FunctionServiceCache
|
||||
|
||||
requestChan chan *createFuncServiceRequest
|
||||
fsCreateWg map[string]*sync.WaitGroup
|
||||
}
|
||||
createFuncServiceRequest struct {
|
||||
ctx context.Context
|
||||
funcMeta *metav1.ObjectMeta
|
||||
function *fv1.Function
|
||||
respChan chan *createFuncServiceResponse
|
||||
}
|
||||
|
||||
@@ -66,21 +63,20 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func MakeExecutor(logger *zap.Logger, gpm *poolmgr.GenericPoolManager, ndm *newdeploy.NewDeploy, cms *cms.ConfigSecretController, fissionClient *crd.FissionClient, fsCache *fscache.FunctionServiceCache) *Executor {
|
||||
func MakeExecutor(logger *zap.Logger, cms *cms.ConfigSecretController,
|
||||
fissionClient *crd.FissionClient, types map[fv1.ExecutorType]executortype.ExecutorType) (*Executor, error) {
|
||||
executor := &Executor{
|
||||
logger: logger.Named("executor"),
|
||||
gpm: gpm,
|
||||
ndm: ndm,
|
||||
cms: cms,
|
||||
fissionClient: fissionClient,
|
||||
fsCache: fsCache,
|
||||
executorTypes: types,
|
||||
|
||||
requestChan: make(chan *createFuncServiceRequest),
|
||||
fsCreateWg: make(map[string]*sync.WaitGroup),
|
||||
}
|
||||
go executor.serveCreateFuncServices()
|
||||
|
||||
return executor
|
||||
return executor, nil
|
||||
}
|
||||
|
||||
// All non-cached function service requests go through this goroutine
|
||||
@@ -92,43 +88,65 @@ func MakeExecutor(logger *zap.Logger, gpm *poolmgr.GenericPoolManager, ndm *newd
|
||||
func (executor *Executor) serveCreateFuncServices() {
|
||||
for {
|
||||
req := <-executor.requestChan
|
||||
m := req.funcMeta
|
||||
fnMetadata := &req.function.Metadata
|
||||
|
||||
// Cache miss -- is this first one to request the func?
|
||||
wg, found := executor.fsCreateWg[crd.CacheKey(m)]
|
||||
wg, found := executor.fsCreateWg[crd.CacheKey(fnMetadata)]
|
||||
if !found {
|
||||
// create a waitgroup for other requests for
|
||||
// the same function to wait on
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
executor.fsCreateWg[crd.CacheKey(m)] = wg
|
||||
executor.fsCreateWg[crd.CacheKey(fnMetadata)] = wg
|
||||
|
||||
// launch a goroutine for each request, to parallelize
|
||||
// the specialization of different functions
|
||||
go func() {
|
||||
fsvc, err := executor.createServiceForFunction(req.ctx, m)
|
||||
// Control overall specialization time by setting function
|
||||
// specialization time to context. The reason not to use
|
||||
// context from router requests is because a request maybe
|
||||
// canceled for unknown reasons and let executor keeps
|
||||
// spawning pods that never finish specialization process.
|
||||
// Also, even a request failed, a specialized function pod
|
||||
// still can serve other subsequent requests.
|
||||
|
||||
buffer := 10 // add some buffer time for specialization
|
||||
specializationTimeout := req.function.Spec.InvokeStrategy.ExecutionStrategy.SpecializationTimeout
|
||||
|
||||
// set minimum specialization timeout to avoid illegal input and
|
||||
// compatibility problem when applying old spec file that doesn't
|
||||
// have specialization timeout field.
|
||||
if specializationTimeout < fv1.DefaultSpecializationTimeOut {
|
||||
specializationTimeout = fv1.DefaultSpecializationTimeOut
|
||||
}
|
||||
|
||||
fnSpecializationTimeoutContext, cancel := context.WithTimeout(context.Background(),
|
||||
time.Duration(specializationTimeout+buffer)*time.Second)
|
||||
defer cancel()
|
||||
|
||||
fsvc, err := executor.createServiceForFunction(fnSpecializationTimeoutContext, req.function)
|
||||
req.respChan <- &createFuncServiceResponse{
|
||||
funcSvc: fsvc,
|
||||
err: err,
|
||||
}
|
||||
delete(executor.fsCreateWg, crd.CacheKey(m))
|
||||
delete(executor.fsCreateWg, crd.CacheKey(fnMetadata))
|
||||
wg.Done()
|
||||
}()
|
||||
} else {
|
||||
// There's an existing request for this function, wait for it to finish
|
||||
go func() {
|
||||
executor.logger.Debug("waiting for concurrent request for the same function",
|
||||
zap.Any("function", m))
|
||||
zap.Any("function", fnMetadata))
|
||||
wg.Wait()
|
||||
|
||||
// get the function service from the cache
|
||||
fsvc, err := executor.fsCache.GetByFunction(m)
|
||||
fsvc, err := executor.getFunctionServiceFromCache(req.function)
|
||||
|
||||
// fsCache return error when the entry does not exist/expire.
|
||||
// It normally happened if there are multiple requests are
|
||||
// waiting for the same function and executor failed to cre-
|
||||
// ate service for function.
|
||||
err = errors.Wrapf(err, "error getting service for function %v in namespace %v", m.Name, m.Namespace)
|
||||
err = errors.Wrapf(err, "error getting service for function %v in namespace %v", fnMetadata.Name, fnMetadata.Namespace)
|
||||
req.respChan <- &createFuncServiceResponse{
|
||||
funcSvc: fsvc,
|
||||
err: err,
|
||||
@@ -138,60 +156,37 @@ func (executor *Executor) serveCreateFuncServices() {
|
||||
}
|
||||
}
|
||||
|
||||
func (executor *Executor) getFunctionExecutorType(meta *metav1.ObjectMeta) (fv1.ExecutorType, error) {
|
||||
fn, err := executor.fissionClient.Functions(meta.Namespace).Get(meta.Name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType, nil
|
||||
}
|
||||
|
||||
func (executor *Executor) createServiceForFunction(ctx context.Context, meta *metav1.ObjectMeta) (*fscache.FuncSvc, error) {
|
||||
func (executor *Executor) createServiceForFunction(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
|
||||
executor.logger.Debug("no cached function service found, creating one",
|
||||
zap.String("function_name", meta.Name),
|
||||
zap.String("function_namespace", meta.Namespace))
|
||||
zap.String("function_name", fn.Metadata.Name),
|
||||
zap.String("function_namespace", fn.Metadata.Namespace))
|
||||
|
||||
executorType, err := executor.getFunctionExecutorType(meta)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var fsvc *fscache.FuncSvc
|
||||
var fsvcErr error
|
||||
|
||||
switch executorType {
|
||||
case fv1.ExecutorTypeNewdeploy:
|
||||
fsvc, fsvcErr = executor.ndm.GetFuncSvc(ctx, meta)
|
||||
default:
|
||||
fsvc, fsvcErr = executor.gpm.GetFuncSvc(ctx, meta)
|
||||
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
e, ok := executor.executorTypes[t]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("Unknown executor type '%v'", t)
|
||||
}
|
||||
|
||||
fsvc, fsvcErr := e.GetFuncSvc(ctx, fn)
|
||||
if fsvcErr != nil {
|
||||
e := "error creating service for function"
|
||||
executor.logger.Error(e,
|
||||
zap.Error(fsvcErr),
|
||||
zap.String("function_name", meta.Name),
|
||||
zap.String("function_namespace", meta.Namespace))
|
||||
fsvcErr = errors.Wrap(fsvcErr, fmt.Sprintf("[%s] %s", meta.Name, e))
|
||||
} else if fsvc != nil {
|
||||
_, err = executor.fsCache.Add(*fsvc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
zap.String("function_name", fn.Metadata.Name),
|
||||
zap.String("function_namespace", fn.Metadata.Namespace))
|
||||
fsvcErr = errors.Wrap(fsvcErr, fmt.Sprintf("[%s] %s", fn.Metadata.Name, e))
|
||||
}
|
||||
|
||||
executor.fsCache.IncreaseColdStarts(meta.Name, string(meta.UID))
|
||||
|
||||
return fsvc, fsvcErr
|
||||
}
|
||||
|
||||
// isValidAddress invokes isValidService or isValidPod depending on the type of executor
|
||||
func (executor *Executor) isValidAddress(fsvc *fscache.FuncSvc) bool {
|
||||
if fsvc.Executor == fscache.NEWDEPLOY {
|
||||
return executor.ndm.IsValid(fsvc)
|
||||
} else {
|
||||
return executor.gpm.IsValid(fsvc)
|
||||
func (executor *Executor) getFunctionServiceFromCache(fn *fv1.Function) (*fscache.FuncSvc, error) {
|
||||
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
e, ok := executor.executorTypes[t]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("Unknown executor type '%v'", t)
|
||||
}
|
||||
return e.GetFuncSvcFromCache(fn)
|
||||
}
|
||||
|
||||
func serveMetric(logger *zap.Logger) {
|
||||
@@ -222,26 +217,45 @@ func StartExecutor(logger *zap.Logger, functionNamespace string, envBuilderNames
|
||||
}
|
||||
|
||||
restClient := fissionClient.GetCrdClient()
|
||||
fsCache := fscache.MakeFunctionServiceCache(logger)
|
||||
executorInstanceID := strings.ToLower(uniuri.NewLen(8))
|
||||
|
||||
poolID := strings.ToLower(uniuri.NewLen(8))
|
||||
reaper.CleanupOldExecutorObjects(logger, kubernetesClient, poolID)
|
||||
go reaper.CleanupRoleBindings(logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30)
|
||||
logger.Info("Starting executor", zap.String("instanceID", executorInstanceID))
|
||||
|
||||
gpm := poolmgr.MakeGenericPoolManager(
|
||||
logger,
|
||||
fissionClient, kubernetesClient,
|
||||
functionNamespace, fetcherConfig, poolID)
|
||||
functionNamespace, fetcherConfig, executorInstanceID)
|
||||
|
||||
ndm := newdeploy.MakeNewDeploy(
|
||||
logger,
|
||||
fissionClient, kubernetesClient, restClient,
|
||||
functionNamespace, fetcherConfig, poolID)
|
||||
functionNamespace, fetcherConfig, executorInstanceID)
|
||||
|
||||
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, ndm, gpm)
|
||||
executorTypes := make(map[fv1.ExecutorType]executortype.ExecutorType)
|
||||
executorTypes[gpm.GetTypeName()] = gpm
|
||||
executorTypes[ndm.GetTypeName()] = ndm
|
||||
|
||||
api := MakeExecutor(logger, gpm, ndm, cms, fissionClient, fsCache)
|
||||
wg := &sync.WaitGroup{}
|
||||
for _, et := range executorTypes {
|
||||
wg.Add(1)
|
||||
go func(et executortype.ExecutorType) {
|
||||
defer wg.Done()
|
||||
et.AdoptOrphanResources()
|
||||
et.Run(context.Background())
|
||||
}(et)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
cms := cms.MakeConfigSecretController(logger, fissionClient, kubernetesClient, executorTypes)
|
||||
cms.Run(context.Background())
|
||||
|
||||
api, err := MakeExecutor(logger, cms, fissionClient, executorTypes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
go reaper.CleanupRoleBindings(logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30)
|
||||
go reaper.CleanupOldExecutorObjects(logger, kubernetesClient, executorInstanceID)
|
||||
go api.Serve(port)
|
||||
go serveMetric(logger)
|
||||
|
||||
|
||||
@@ -25,10 +25,8 @@ package executor
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -99,19 +97,6 @@ func createSvc(kubeClient *kubernetes.Clientset, ns string, name string, targetP
|
||||
return svc
|
||||
}
|
||||
|
||||
func httpGet(url string) string {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
log.Panicf("HTTP Get failed: URL %v: %v", url, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Panicf("HTTP Get failed to read body: URL %v: %v", url, err)
|
||||
}
|
||||
return string(body)
|
||||
}
|
||||
|
||||
func TestExecutor(t *testing.T) {
|
||||
// run in a random namespace so we can have concurrent tests
|
||||
// on a given cluster
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user