Compare commits

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

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

This PR replaces all 3rd-party packages with built-in packages.
2019-12-19 02:54:31 +08:00
Ta-Ching ChenandGitHub bfbb80efcf Add controller API client interface (#1467)
This PR adds an interface for controller API client, it allows us to
implement mock API client for unit testing with ease and we are
able to generate spec file without accessing the real Fission server.
2019-12-16 23:14:14 +08:00
Sahil LakhwaniandTa-Ching Chen 01bdc5bf89 Remove FISSION_ROUTER for fn test (#1465) 2019-12-15 14:32:29 +08:00
Vivek SinghandTa-Ching Chen 711d7c2c41 Show the not present configmap/secret name while fn create in err message [CLI-UX] (#1462) 2019-12-10 22:58:52 +08:00
Ta-Ching Chen 2b4e53e926 CHANGELOG 1.7.1 2019-12-09 05:09:54 +00:00
Ta-Ching Chen 9401c1ee85 Fission 1.7.1 2019-12-09 11:55:01 +08:00
Ta-Ching ChenandGitHub 5c704f053b Fix name conflict when buildermanager merges podspc (#1460) 2019-12-07 16:53:47 +08:00
Ta-Ching ChenandGitHub eb1f971d52 Not to exclude hidden file when creating archive (#1458)
Some of configs are hidden files like .babelrc, we should not ignore them.
2019-12-05 01:54:05 +08:00
Ta-Ching Chen 83bc5508ee CHANGELOG 1.7.0 2019-12-02 14:08:00 +00:00
Ta-Ching Chen d6a8734aae Fission 1.7.0 2019-12-02 21:26:28 +08:00
Ta-Ching ChenandGitHub 3ee98cd13a Fix release script not uploads OpenShift deploy YAML file (#1456) 2019-12-02 21:12:15 +08:00
Ta-Ching ChenandGitHub 275da18cf6 Let executor type manages how to do cleanup for old kubeobjects (#1455)
Add CleanupOldExecutorObjects to executor type interface in order
to let an executor type manages how to clean up the resources it created.
2019-12-02 19:47:31 +08:00
Ta-Ching ChenandGitHub 3f3b11ffbf Prevent deployment from rolling update due to different instance-id (#1454)
The pod template is embedded inside the deployment. So if
the pod annotation contains instance-id, the deployment
will get updated and thus triggers a rolling update whenever
a new executor starts which is unwanted.

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

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

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

To solve this, executor updates the resource spec (HPA/Deployment/Service) with the
latest resources spec. By doing this, we can prevent the inconsistency between resources
created by different executor instance, also minimizes the impact on users.
2019-11-29 21:52:59 +08:00
Ta-Ching ChenandGitHub 47aaa85108 Improve executor bootstrap speed (#1446) 2019-11-29 14:18:23 +08:00
Ta-Ching Chen 3067ecdee3 CHANGELOG 1.7.0-rc.2 2019-11-27 17:10:57 +00:00
Ta-Ching Chen d9a0ee1e33 Fission 1.7.0-rc.2 2019-11-28 00:40:47 +08:00
Ta-Ching ChenandGitHub 5cfc8dee5e Push extra tag to fit go module semver tag format (#1444) 2019-11-28 00:40:20 +08:00
Ta-Ching ChenandGitHub 1ad7ac2dcf Adopt existing orphan kubernetes resources when executor starts up (#1443)
Previously, once the executor is deleted for reasons (like upgrade or cluster scale-in),
the new executor deletes all existing resources created by the old executor and creates
new one. This mechanism becomes a problem when there are requests connecting to the
existing pods. Also in the worst case, the cluster may not have enough resources to create
new pods and cause service downtime.

This PR let each executor type adopts existing resources before starting the executor
API services, and so the alive connections won't experience failure. However, the requests
send to the function that doesn't have alive function pods will still fail due to the
executor is in bootstrapping.
2019-11-27 23:08:45 +08:00
Ta-Ching ChenandGitHub 86446c8879 Revert "Try to fix flaky canary test (#1441)" (#1442)
This reverts commit df857e3194.
Looks like there are some problems when running the test against GKE, so revert it.
2019-11-27 16:19:33 +08:00
Ta-Ching ChenandGitHub df857e3194 Try to fix flaky canary test (#1441) 2019-11-27 02:57:22 +08:00
Ta-Ching ChenandGitHub ad7a3951c5 Fix router tries to update ingress when createIngress is false (#1440) 2019-11-27 00:28:48 +08:00
Ta-Ching ChenandGitHub 7e8e968013 Fix poolmanager sets 0 timeout for function specialization (#1439) 2019-11-26 19:22:49 +08:00
Ta-Ching ChenandGitHub e38baeec36 Add huge response body test (#1437) 2019-11-26 12:50:41 +08:00
Ta-Ching ChenandGitHub ca28f962d4 Return error when specialization failed (#1436) 2019-11-26 09:23:06 +08:00
Ta-Ching ChenandGitHub dfb2c073d2 Collect function metrics after finishing request (#1433) 2019-11-26 02:33:40 +08:00
Ta-Ching ChenandGitHub 51b264e8ca Fix poolmanager terminates running function pod periodically (#1435)
The pool manager keeps terminating function pod periodically even there are
traffic to the function. The root cause is that executor, poolmgr, newdeploy
manage their own functionServiceCache separately. And when router taps a
function, executor updates the access time of the function service entry in its
own cache without notifying executor types to do the update as well. Hence,
the access time of function service entry in poolmanager cache never gets updated.
Due to the access time never gets updated, the idle pod reaper in poolmanager
then thinks the function pod is in idle state and recycle it.

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

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

To solve this, move the context cancel after ReverseProxy finished.
2019-11-21 01:04:35 +08:00
Ta-Ching Chen d8b386a812 Update CHANGELOG for 1.7.0-rc.1 2019-11-18 10:32:46 +00:00
Ta-Ching ChenandTa-Ching Chen 48e7a13c0f Fission 1.7.0-rc.1 2019-11-18 10:06:32 +00:00
Ta-Ching ChenandGitHub 70803e37fa Update release-builder go and helm version (#1418) 2019-11-18 18:06:11 +08:00
Ta-Ching ChenandGitHub 7a770b8627 Fix failed to find init_tools.sh (#1417) 2019-11-18 17:00:56 +08:00
Ta-Ching ChenandGitHub 8b0d99d65d Support semantic version tags (#1416) 2019-11-18 15:54:43 +08:00
Ta-Ching ChenandGitHub 3aca0edfcc Show warning when referencing nonexistent resources in spec (#1415) 2019-11-18 13:46:28 +08:00
Ta-Ching ChenandGitHub 81ece23bfe Add resource info to output message when saving spec file (#1414) 2019-11-18 12:35:14 +08:00
Ta-Ching ChenandGitHub 66b9dfa8e9 Add --spec to package command (#1411) 2019-11-18 11:15:48 +08:00
Ta-Ching ChenandGitHub f8e98f9f14 Always embed URL provided by user in the archive (#1413)
To keep archive creation implementation simple and prevent any
confusion, we decided to remove `--keepurl` flag and embed URL
directly without downloading the file from it . In this way, we can
ensure consistent behavior in either package creation or spec file
creation. Also, it increases the portability of spec file.
2019-11-18 10:05:49 +08:00
Ta-Ching ChenandGitHub b97a3c4b0a Fix wrong command and flag usage description (#1412) 2019-11-17 02:39:31 +08:00
Ta-Ching ChenandGitHub b5c8ea0e13 Update prometheus chart version from 7.1.0 to 9.3.0 (#1389) 2019-11-13 16:29:17 +08:00
Ta-Ching ChenandGitHub cf2d35291e Drop unreleased features (record & replay) (#1406)
1. The records are stored in redis which is not migratable to another cluster for the testing purposes.
2. Some of the requests fields are not recorded.
3. People should consider using https://github.com/buger/goreplay which is an existing mature and well-tested solution for testing purposes.
2019-11-13 15:10:32 +08:00
Ta-Ching ChenandGitHub 1cda7e051b Build error formatting on fission spec apply --wait (#1403)
The character `\n` in buildlog stores in package status
are escaped and so when we have to replace them with
actual line breaker.
2019-11-12 21:00:55 +08:00
Ta-Ching ChenandGitHub a645a1e197 Refactor controller client package (#1402)
The function implementations of controller client package are
inconsistent. This PR lets functions reuse the functions
that already implemented and able to set additional headers to
request.
2019-11-12 18:27:52 +08:00
Ta-Ching ChenandGitHub d0276f1d52 Fix fn test failed to query logs from log database (#1401)
When `fn test` failed to retrieve logs from the function
pod, it turns to query logs from the log database. However,
the logdb type flag is not set to `fn test`, hence the logdb
type is empty (even without default value) and cause `fn logs`
returns an error due to unable to find the corresponding log
database type.

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

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

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

```
extraCoreComponentPodConfig:
```

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

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

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

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

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

This PR allows a user to use URL as the function source when creating a function
and provides a new flag "--keeparchiveurl" to let the user to decided
whether the CLI should download the file first or store the file URL in the
archive directly. If "--keeparchiveurl" is true, then no checksum will be
generated, it's the user's responsibility to ensure the file won't be changed.
2019-10-28 22:37:13 +08:00
Ta-Ching ChenandGitHub 52b5cb0902 Remove UID from CLI output (#1361) 2019-10-28 19:34:02 +08:00
Ta-Ching ChenandGitHub bc5c181fc2 Update fission architecture doc (#1356) 2019-10-22 19:46:57 +08:00
Ta-Ching ChenandGitHub fed30e1b24 Refactor plugin & version subcommands (#1359) 2019-10-22 17:57:56 +08:00
Vivek SinghandTa-Ching Chen 22de11190c Calling the function that handles kafka messages, asynchronously (#1355) 2019-10-19 14:41:46 +08:00
Ta-Ching ChenandGitHub e42f81a7a1 Refactor package CLI command (#1345) 2019-10-13 01:30:20 +08:00
Ta-Ching ChenandGitHub f30e7df43d Fix release script wrongly tags image name & sed problem on Linux (#1353) 2019-10-12 21:38:13 +08:00
Ta-Ching ChenandGitHub c930c69629 Update CHANGELOG for 1.6.0 (#1352) 2019-10-11 04:07:38 +08:00
Ta-Ching Chen 08b6d43ac1 Fission 1.6.0 2019-10-11 01:11:58 +08:00
Ta-Ching ChenandGitHub 53b075a315 Move statefulset to apps/v1 (#1350) 2019-10-10 23:42:40 +08:00
Ta-Ching ChenandGitHub b8311d43ce Fix newdeploy failed to find serviceEntry in cache (#1349)
When a function with executor type newdeploy got created, Newdeploy
is expected to create deployment/HPA/service for it and insert serviceEntry
to the cache for later use. Once clients call the function, newdeploy returns
the serviceEntry to the router.

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

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

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

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

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

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

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

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

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

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

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

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

Command example:

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

Command example:

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

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

In go.mod

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

1. Each build generate unique images for testing and debugging
2. Check whether the testing cluster is being used by another build.
3. Cache docker image & go mod after build finished
4. Improve dockerfiles for reusing docker build cache
2019-07-15 16:33:26 +08:00
Ta-Ching ChenandGitHub a9dd4bf81a Fix fetcher of newdeploy pod error out when starting up (#1210)
* Connect to k8s API server to ensure network connectivity
* Fix readiness probe path
2019-07-14 21:09:35 +08:00
Ta-Ching ChenandGitHub 56beac6508 Make router keep-alive setting configurable (#1225) 2019-07-12 12:12:04 +08:00
Ta-Ching ChenandGitHub b0b29da388 Replace localhost with 127.0.0.1 to prevent DNS resolving problem (#1227) 2019-07-12 09:16:10 +08:00
Ta-Ching ChenandGitHub c1cb9603a5 Fix release script wrongly tags builder as env image (#1226) 2019-07-10 16:03:14 +08:00
Ta-Ching ChenandGitHub 58722f849a Enable go module support for go environment (#1152) 2019-07-10 14:00:29 +08:00
Ta-Ching ChenandGitHub 9e7dd5aa27 Fix nil pointer when CLI unable to get server version (#1223) 2019-07-07 09:55:00 +08:00
Ta-Ching ChenandGitHub 9d13081803 Allow to set log level through environment variable (#1217) 2019-07-07 04:39:42 +08:00
Ta-Ching ChenandGitHub 78a774cfd9 Reuse go docker build cache (#1218) 2019-07-06 09:30:27 +08:00
Ta-Ching ChenandGitHub 9f51f9064d Fix poolmanager specializes a function pod repeatedly if istio is enabled (#1208) 2019-07-03 11:26:35 +08:00
Ta-Ching ChenandGitHub b229d6e1b0 Add experimental environment: tensorflow-serving (#1212) 2019-07-02 15:43:55 +08:00
Ta-Ching ChenandGitHub 2ba66afb9f Fix Istio-proxy cannot collect HTTP-level information (#1209) 2019-07-02 00:08:29 +08:00
VishalandTa-Ching Chen 36e544b537 Configmaps/secrets in function exist check (#1214) 2019-07-01 18:09:07 +08:00
cocoifly10andTa-Ching Chen 5ec841cf2e Modify code to make log collection comprehensive (#1206) 2019-06-24 16:33:42 +08:00
Ta-Ching ChenandGitHub 981bb21756 Reuse maven build cache in JVM environment build process (#1207) 2019-06-20 17:03:17 +08:00
Ta-Ching ChenandGitHub a297a67385 Fix executor panic problem when specialization timeout (#1211) 2019-06-20 13:56:02 +08:00
moluzhangandTa-Ching Chen 5445b75af9 [bugfix] Fix CLI drops controller URL path when querying logs (#1201) 2019-06-17 18:31:02 +09:00
Ta-Ching ChenandGitHub e189ac4fc2 Fallback to get user home directory from env (#1203) 2019-06-05 12:56:30 +08:00
Ta-Ching Chen 4bc5d49792 Add ruby/dotnet20 environment builder to release script 2019-06-03 20:57:55 +08:00
Ta-Ching Chen 3860039f9a Update v1.3.0 changelog 2019-06-03 20:15:49 +08:00
Ta-Ching Chen cb8605cf60 Fission 1.3.0 2019-06-03 18:26:34 +08:00
551 changed files with 38830 additions and 25745 deletions
+15
View File
@@ -0,0 +1,15 @@
ignore:
- "charts"
- "demos"
- "Documentation"
- "examples"
- "test"
- "tools"
- "pkg/apis/genclient"
coverage:
status:
project:
default:
threshold: 2
# Disable patch coverage check since we focus on project coverage.
patch: off
+2
View File
@@ -8,7 +8,9 @@ assignees: ''
---
<!-- Please answer these questions before submitting your issue. Thanks! -->
<!-- Documentation URL: https://docs.fission.io/ -->
<!-- Troubleshooting guide: https://docs.fission.io/trouble-shooting/ -->
**Fission/Kubernetes version**
+14 -8
View File
@@ -4,49 +4,55 @@ dist: trusty
branches:
only:
- master
- master
language: go
go:
- 1.11.6
- 1.12.x
env:
- KUBECONFIG=${HOME}/.kube/config PATH=$HOME/k8scli:$HOME/tool:$HOME/google-cloud-sdk/bin:${PATH} GO111MODULE=on DOCKER_CACHE_DIR=${HOME}/docker/
cache:
directories:
- $HOME/google-cloud-sdk/
- $HOME/k8scli
- $HOME/tool
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
services:
- docker
before_install:
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
# - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- sudo apt-get -y install apache2-utils parallel realpath
- sudo sysctl net.ipv6.conf.all.disable_ipv6=0
install:
- hack/travis-kube-setup.sh
env:
- KUBECONFIG=${HOME}/.kube/config PATH=$HOME/k8scli:$HOME/tool:$HOME/google-cloud-sdk/bin:${PATH} GO111MODULE=on
before_script:
- cd ${TRAVIS_BUILD_DIR}
- go mod download
- go mod vendor
- hack/verify-staticcheck.sh
- hack/verify-gofmt.sh
- hack/verify-govet.sh
- helm lint charts/fission-all/ charts/fission-core/
- hack/runtests.sh
- test/build.sh
script:
- cd ${TRAVIS_BUILD_DIR}
- test/build_and_test.sh
- test/test.sh
- test/upgrade/fission_upgrade_test.sh
after_script:
- bash <(curl -s https://codecov.io/bash)
- kubectl --namespace default delete configmap -l travisID=${TRAVIS_BUILD_ID} # remove in-test configmap to indicate this CI build finished
notifications:
slack:
rooms:
+292 -17
View File
@@ -1,28 +1,304 @@
# 1.2.1
# 1.7.1
[Documentation](https://docs.fission.io/)
## Downloads for 1.2.1
## Downloads for 1.7.1
filename | sha256 hash
-------- | -----------
[fission-all-1.2.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1-minikube.yaml) | `f645d4741c6396d71addcd1af0cdbf6791bb7b9f6dda3f0b3fea0359f70fe233`
[fission-core-1.2.1.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1.yaml) | `aa0c50cd38cdde805c7fac62d18875ca72b0f420ccc17b179c067561eaa7249a`
[fission-all-1.2.1.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1.yaml) | `f814b0e194b137235d8860336f488f51c93dea59cf3f8a15ff3e740a6c2972c1`
[fission-core-1.2.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1-minikube.yaml) | `a12cc0037916c9ea5afb894d666533eaf66a543efb11f1bf4e0492e320039890`
[fission-core-1.2.1.tgz](https://github.com/fission/fission/releases/download/1.2.1/fission-core-1.2.1.tgz) | `09f573bd2cefa5106b0f67bc741ffa8440d9d65c9d87a27cde9a00513dd503d6`
[fission-all-1.2.1.tgz](https://github.com/fission/fission/releases/download/1.2.1/fission-all-1.2.1.tgz) | `9dce2e7bc1e59e4ef2746046751389ebcf8919cbe49829d614cad38449fbf7e1`
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx) | `b171448a109ea8e3813a60068579d601da5b85584e106f52e790d3220a104bda`
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux) | `29de834928464a4389decaaffa89854aa4533d2a914adfcf8844a8a2356e9cf0`
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe) | `279a732cbeadd6eadbdce096d54f0ba242738ab2b5f0e710fc04bc2eb3459878`
[fission-core-1.7.1-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-core-1.7.1-openshift.yaml) | `95ab2841786f734bf958ed94ff49f7c94dd2eb869a84c1de82fba1c111884a2e`
[fission-core-1.7.1.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-core-1.7.1.yaml) | `b329ea2ef925efd01f5d4daa74fe3114bf2e5f1789ab50c1c5b1645c290cbc10`
[fission-all-1.7.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-all-1.7.1-minikube.yaml) | `fca2c8d79367196ca88ddf349d3e11ec198b7def76c26b0a3df8b231b041a6a3`
[fission-all-1.7.1.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-all-1.7.1.yaml) | `c03c8a7ccb4d24e8ed4aba8af825024e38cae6e24468541c96e6bc11886a4a93`
[fission-all-1.7.1-openshift.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-all-1.7.1-openshift.yaml) | `061e76092303480e6434af1ba5c61df9d773089725b93bb15ded60e1cc34af7e`
[fission-core-1.7.1-minikube.yaml](https://github.com/fission/fission/releases/download/1.7.1/fission-core-1.7.1-minikube.yaml) | `2e8da962edc52e3e86c9479cc9df95587f96f15b38ece71b59b08d37203f9f6f`
[fission-core-1.7.1.tgz](https://github.com/fission/fission/releases/download/1.7.1/fission-core-1.7.1.tgz) | `afddabfdc92e4fd26afa94637902b0f7a2c5be2882e121e7576e2ef913803475`
[fission-all-1.7.1.tgz](https://github.com/fission/fission/releases/download/1.7.1/fission-all-1.7.1.tgz) | `f881a3be4a45834bed4323d2b5cb00ae277472e6daacc9645ff2f491b5633d38`
[fission-cli-osx](https://github.com/fission/fission/releases/download/1.7.1/fission-cli-osx) | `23e139108314ce616e863a1c13cd9774f637f4557fd19db2813f9b024d0cbadb`
[fission-cli-windows.exe](https://github.com/fission/fission/releases/download/1.7.1/fission-cli-windows.exe) | `82f40b59380279c4d68f893c6c940f3ec032c72929435caffd723219f56b824a`
[fission-cli-linux](https://github.com/fission/fission/releases/download/1.7.1/fission-cli-linux) | `dca11589c1e927f23e520e4686b165a7fb744ac7acda266047b7fa8d51ec9048`
# Change Log
## [1.7.1](https://github.com/fission/fission/tree/1.7.1) (2019-12-09)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.1...1.7.1)
## [v1.7.1](https://github.com/fission/fission/tree/v1.7.1) (2019-12-09)
[Full Changelog](https://github.com/fission/fission/compare/1.7.0...v1.7.1)
**Merged pull requests:**
- Fix name conflict when buildermanager merges podspec [\#1460](https://github.com/fission/fission/pull/1460) ([life1347](https://github.com/life1347))
- Not to exclude hidden file when creating archive [\#1458](https://github.com/fission/fission/pull/1458) ([life1347](https://github.com/life1347))
- Fission 1.7.0 [\#1457](https://github.com/fission/fission/pull/1457) ([life1347](https://github.com/life1347))
## [1.7.0](https://github.com/fission/fission/tree/1.7.0) (2019-12-02)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0...1.7.0)
## [v1.7.0](https://github.com/fission/fission/tree/v1.7.0) (2019-12-02)
[Full Changelog](https://github.com/fission/fission/compare/1.7.0-rc.2...v1.7.0)
**Merged pull requests:**
- Fix release script not uploads OpenShift deploy YAML file [\#1456](https://github.com/fission/fission/pull/1456) ([life1347](https://github.com/life1347))
- Let executor type manages how to do cleanup for old kubeobjects [\#1455](https://github.com/fission/fission/pull/1455) ([life1347](https://github.com/life1347))
- Prevent deployment from rolling update due to different instance-id [\#1454](https://github.com/fission/fission/pull/1454) ([life1347](https://github.com/life1347))
- Make AdoptExistingResources optional [\#1453](https://github.com/fission/fission/pull/1453) ([life1347](https://github.com/life1347))
- Prevent newdeploy updates deployment if no resources changed [\#1452](https://github.com/fission/fission/pull/1452) ([life1347](https://github.com/life1347))
- Fix CLI unable to get pod logs from controller [\#1451](https://github.com/fission/fission/pull/1451) ([life1347](https://github.com/life1347))
- Ignore hidden file when creating archive file [\#1450](https://github.com/fission/fission/pull/1450) ([life1347](https://github.com/life1347))
- Fix spec init overrides existing deploymentconfig [\#1449](https://github.com/fission/fission/pull/1449) ([life1347](https://github.com/life1347))
- Fix spec shows source archive is not used [\#1448](https://github.com/fission/fission/pull/1448) ([life1347](https://github.com/life1347))
- Fix adopted deployment uses old fetcher image [\#1447](https://github.com/fission/fission/pull/1447) ([life1347](https://github.com/life1347))
- Improve executor bootstrap speed [\#1446](https://github.com/fission/fission/pull/1446) ([life1347](https://github.com/life1347))
- Fission 1.7.0-rc.2 [\#1445](https://github.com/fission/fission/pull/1445) ([life1347](https://github.com/life1347))
## [1.7.0-rc.2](https://github.com/fission/fission/tree/1.7.0-rc.2) (2019-11-27)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.2...1.7.0-rc.2)
## [v1.7.0-rc.2](https://github.com/fission/fission/tree/v1.7.0-rc.2) (2019-11-27)
[Full Changelog](https://github.com/fission/fission/compare/1.7.0-rc.1...v1.7.0-rc.2)
**Merged pull requests:**
- Push extra tag to fit go module semver tag format [\#1444](https://github.com/fission/fission/pull/1444) ([life1347](https://github.com/life1347))
- Adopt existing orphan kubernetes resources when executor starts up [\#1443](https://github.com/fission/fission/pull/1443) ([life1347](https://github.com/life1347))
- Revert "Try to fix flaky canary test" [\#1442](https://github.com/fission/fission/pull/1442) ([life1347](https://github.com/life1347))
- Try to fix flaky canary test [\#1441](https://github.com/fission/fission/pull/1441) ([life1347](https://github.com/life1347))
- Fix router tries to update ingress when createIngress is false [\#1440](https://github.com/fission/fission/pull/1440) ([life1347](https://github.com/life1347))
- Fix poolmanager sets 0 timeout for function specialization [\#1439](https://github.com/fission/fission/pull/1439) ([life1347](https://github.com/life1347))
- Add huge response body test [\#1437](https://github.com/fission/fission/pull/1437) ([life1347](https://github.com/life1347))
- Return error when specialization failed [\#1436](https://github.com/fission/fission/pull/1436) ([life1347](https://github.com/life1347))
- Fix poolmanager terminates running function pod periodically [\#1435](https://github.com/fission/fission/pull/1435) ([life1347](https://github.com/life1347))
- Allow to tap multiple function services at one time [\#1434](https://github.com/fission/fission/pull/1434) ([life1347](https://github.com/life1347))
- Collect function metrics after finishing request [\#1433](https://github.com/fission/fission/pull/1433) ([life1347](https://github.com/life1347))
- Fix poolmanager crashes when failed to list environment [\#1432](https://github.com/fission/fission/pull/1432) ([life1347](https://github.com/life1347))
- Ability to pull builder image from private registry [\#1431](https://github.com/fission/fission/pull/1431) ([life1347](https://github.com/life1347))
- Add checksum and insecure flag for user to skip checksum generation [\#1430](https://github.com/fission/fission/pull/1430) ([life1347](https://github.com/life1347))
- Support to set imagePullSecret when creating environment [\#1429](https://github.com/fission/fission/pull/1429) ([life1347](https://github.com/life1347))
- Fix no kubeobjs get created if fn created before env creation [\#1428](https://github.com/fission/fission/pull/1428) ([life1347](https://github.com/life1347))
- Fix verbosity flag not found in subcommand [\#1425](https://github.com/fission/fission/pull/1425) ([life1347](https://github.com/life1347))
- Improve compatibility with Openshift [\#1424](https://github.com/fission/fission/pull/1424) ([life1347](https://github.com/life1347))
- Fix truncated body returned from router [\#1420](https://github.com/fission/fission/pull/1420) ([life1347](https://github.com/life1347))
- Fission 1.7.0-rc.1 [\#1419](https://github.com/fission/fission/pull/1419) ([life1347](https://github.com/life1347))
## [1.7.0-rc.1](https://github.com/fission/fission/tree/1.7.0-rc.1) (2019-11-18)
[Full Changelog](https://github.com/fission/fission/compare/v1.7.0-rc.1...1.7.0-rc.1)
## [v1.7.0-rc.1](https://github.com/fission/fission/tree/v1.7.0-rc.1) (2019-11-18)
[Full Changelog](https://github.com/fission/fission/compare/1.6.0...v1.7.0-rc.1)
**Merged pull requests:**
- Update release-builder go and helm version [\#1418](https://github.com/fission/fission/pull/1418) ([life1347](https://github.com/life1347))
- Fix failed to find init\_tools.sh [\#1417](https://github.com/fission/fission/pull/1417) ([life1347](https://github.com/life1347))
- Support semantic version tags [\#1416](https://github.com/fission/fission/pull/1416) ([life1347](https://github.com/life1347))
- Show warning when referencing nonexistent resources in spec [\#1415](https://github.com/fission/fission/pull/1415) ([life1347](https://github.com/life1347))
- Add resource info to output message when saving spec file [\#1414](https://github.com/fission/fission/pull/1414) ([life1347](https://github.com/life1347))
- Always embed given URL in the archive [\#1413](https://github.com/fission/fission/pull/1413) ([life1347](https://github.com/life1347))
- Fix wrong command and flag usage description [\#1412](https://github.com/fission/fission/pull/1412) ([life1347](https://github.com/life1347))
- Add --spec to package command [\#1411](https://github.com/fission/fission/pull/1411) ([life1347](https://github.com/life1347))
- Drop unreleased features \(record & replay\) [\#1406](https://github.com/fission/fission/pull/1406) ([life1347](https://github.com/life1347))
- Build error formatting on fission spec apply --wait [\#1403](https://github.com/fission/fission/pull/1403) ([life1347](https://github.com/life1347))
- Refactor controller client package [\#1402](https://github.com/fission/fission/pull/1402) ([life1347](https://github.com/life1347))
- Fix fn test failed to query logs from log database [\#1401](https://github.com/fission/fission/pull/1401) ([life1347](https://github.com/life1347))
- Skip trace for router healthz endpoint [\#1400](https://github.com/fission/fission/pull/1400) ([life1347](https://github.com/life1347))
- Set jaeger collector endpoint as an environment variable [\#1399](https://github.com/fission/fission/pull/1399) ([life1347](https://github.com/life1347))
- Replace deprecated serviceAccount with serviceAccountName [\#1398](https://github.com/fission/fission/pull/1398) ([life1347](https://github.com/life1347))
- Fix helm pre-upgrade check failure problem [\#1397](https://github.com/fission/fission/pull/1397) ([life1347](https://github.com/life1347))
- Prettify console output message [\#1396](https://github.com/fission/fission/pull/1396) ([life1347](https://github.com/life1347))
- fix typo [\#1395](https://github.com/fission/fission/pull/1395) ([jjmengze](https://github.com/jjmengze))
- Reorder command flags and add missing flags [\#1394](https://github.com/fission/fission/pull/1394) ([life1347](https://github.com/life1347))
- Fix CLI exits with status 0 when error occurs [\#1393](https://github.com/fission/fission/pull/1393) ([life1347](https://github.com/life1347))
- Poolmanager wait for function pod till specialization timeout [\#1392](https://github.com/fission/fission/pull/1392) ([life1347](https://github.com/life1347))
- Replace flag text with const [\#1391](https://github.com/fission/fission/pull/1391) ([life1347](https://github.com/life1347))
- Update prometheus version and disable it from the default installation [\#1389](https://github.com/fission/fission/pull/1389) ([life1347](https://github.com/life1347))
- Fix helm shows "Not a table" issue when install Fission [\#1387](https://github.com/fission/fission/pull/1387) ([life1347](https://github.com/life1347))
- Fix githook not aborting push if error occurs [\#1386](https://github.com/fission/fission/pull/1386) ([life1347](https://github.com/life1347))
- Migrate from urfave/cli to cobra [\#1385](https://github.com/fission/fission/pull/1385) ([life1347](https://github.com/life1347))
- Update maintainer info [\#1383](https://github.com/fission/fission/pull/1383) ([life1347](https://github.com/life1347))
- Update Makefile and add git pre-push hook [\#1382](https://github.com/fission/fission/pull/1382) ([life1347](https://github.com/life1347))
- Update staticcheck version and fix all warnings [\#1381](https://github.com/fission/fission/pull/1381) ([life1347](https://github.com/life1347))
- Make CLI functions return error instead of fatal out [\#1379](https://github.com/fission/fission/pull/1379) ([life1347](https://github.com/life1347))
- Refactor record command [\#1378](https://github.com/fission/fission/pull/1378) ([life1347](https://github.com/life1347))
- Fix reverse proxy shows 404 not found when Istio enabled [\#1377](https://github.com/fission/fission/pull/1377) ([life1347](https://github.com/life1347))
- Refactor time trigger command [\#1376](https://github.com/fission/fission/pull/1376) ([life1347](https://github.com/life1347))
- Refactor mqtrigger command [\#1375](https://github.com/fission/fission/pull/1375) ([life1347](https://github.com/life1347))
- added example for builder podspec [\#1374](https://github.com/fission/fission/pull/1374) ([viveksinghggits](https://github.com/viveksinghggits))
- Refactor function command [\#1372](https://github.com/fission/fission/pull/1372) ([life1347](https://github.com/life1347))
- Allow to set API type for tensorflow serving environment [\#1371](https://github.com/fission/fission/pull/1371) ([life1347](https://github.com/life1347))
- Refactor canary config command [\#1370](https://github.com/fission/fission/pull/1370) ([life1347](https://github.com/life1347))
- PodSpec support in environment builder [\#1369](https://github.com/fission/fission/pull/1369) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix utility function uses the wrong flag text to get value [\#1368](https://github.com/fission/fission/pull/1368) ([life1347](https://github.com/life1347))
- Refactor HTTP trigger command [\#1367](https://github.com/fission/fission/pull/1367) ([life1347](https://github.com/life1347))
- Update READEME link and add back the basic usage [\#1366](https://github.com/fission/fission/pull/1366) ([life1347](https://github.com/life1347))
- Refactor kubewatch command [\#1365](https://github.com/fission/fission/pull/1365) ([life1347](https://github.com/life1347))
- Fix accidentally removed timestamp when listing package [\#1364](https://github.com/fission/fission/pull/1364) ([life1347](https://github.com/life1347))
- Move route creation to function [\#1362](https://github.com/fission/fission/pull/1362) ([life1347](https://github.com/life1347))
- Remove UID from CLI output [\#1361](https://github.com/fission/fission/pull/1361) ([life1347](https://github.com/life1347))
- Allow using URL as archive source when creating functions [\#1360](https://github.com/fission/fission/pull/1360) ([life1347](https://github.com/life1347))
- Refactor plugin & version subcommands [\#1359](https://github.com/fission/fission/pull/1359) ([life1347](https://github.com/life1347))
- Provide secrets and configmaps while updating the functions [\#1358](https://github.com/fission/fission/pull/1358) ([viveksinghggits](https://github.com/viveksinghggits))
- Update fission architecture doc [\#1356](https://github.com/fission/fission/pull/1356) ([life1347](https://github.com/life1347))
- calling the function that handles kafka messages, asynchronously [\#1355](https://github.com/fission/fission/pull/1355) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix release script tags wrong image name & sed problem on Linux [\#1353](https://github.com/fission/fission/pull/1353) ([life1347](https://github.com/life1347))
- Update CHANGELOG for 1.6.0 [\#1352](https://github.com/fission/fission/pull/1352) ([life1347](https://github.com/life1347))
- Replace `AlwaysSample` with `ProbabilitySampler` in router \(\#1215\) [\#1348](https://github.com/fission/fission/pull/1348) ([ccamel](https://github.com/ccamel))
- Refactor package CLI command [\#1345](https://github.com/fission/fission/pull/1345) ([life1347](https://github.com/life1347))
## [1.6.0](https://github.com/fission/fission/tree/1.6.0) (2019-10-10)
[Full Changelog](https://github.com/fission/fission/compare/v1.6.0...1.6.0)
## [v1.6.0](https://github.com/fission/fission/tree/v1.6.0) (2019-10-10)
[Full Changelog](https://github.com/fission/fission/compare/1.5.0...v1.6.0)
**Merged pull requests:**
- Fission 1.6.0 [\#1351](https://github.com/fission/fission/pull/1351) ([life1347](https://github.com/life1347))
- Move statefulset to apps/v1 [\#1350](https://github.com/fission/fission/pull/1350) ([life1347](https://github.com/life1347))
- Fix newdeploy failed to find serviceEntry in cache [\#1349](https://github.com/fission/fission/pull/1349) ([life1347](https://github.com/life1347))
- Support encoded path in router [\#1347](https://github.com/fission/fission/pull/1347) ([life1347](https://github.com/life1347))
- Support custom private go vendor [\#1346](https://github.com/fission/fission/pull/1346) ([life1347](https://github.com/life1347))
- Fix the namespace mismatch problem when deploying with a single YAML file [\#1344](https://github.com/fission/fission/pull/1344) ([life1347](https://github.com/life1347))
- Move charts executor service to the right place [\#1343](https://github.com/fission/fission/pull/1343) ([life1347](https://github.com/life1347))
- Allow to deploy router as DaemonSet [\#1342](https://github.com/fission/fission/pull/1342) ([life1347](https://github.com/life1347))
- add package filter feature [\#1341](https://github.com/fission/fission/pull/1341) ([jjmengze](https://github.com/jjmengze))
- Bump jvm builder JDK version [\#1340](https://github.com/fission/fission/pull/1340) ([life1347](https://github.com/life1347))
- Fix executor doesn't apply user-configured container spec correctly [\#1339](https://github.com/fission/fission/pull/1339) ([life1347](https://github.com/life1347))
- Allow to add annotations to router service in helm chart [\#1338](https://github.com/fission/fission/pull/1338) ([prabhu43](https://github.com/prabhu43))
- Remove too verbose and unhelpful debug log [\#1336](https://github.com/fission/fission/pull/1336) ([life1347](https://github.com/life1347))
- package will now be listed, sorted by lastupdatedtime [\#1334](https://github.com/fission/fission/pull/1334) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix router health route not found if no HTTP triggers created [\#1333](https://github.com/fission/fission/pull/1333) ([life1347](https://github.com/life1347))
- Fix spec doesn't update status of failed package when applying spec files [\#1332](https://github.com/fission/fission/pull/1332) ([life1347](https://github.com/life1347))
- Move Deployment API group from extensions/v1beta1 to apps/v1 [\#1331](https://github.com/fission/fission/pull/1331) ([life1347](https://github.com/life1347))
- Fix empty host value when list http triggers [\#1328](https://github.com/fission/fission/pull/1328) ([life1347](https://github.com/life1347))
- List/Delete HTTP triggers by function [\#1327](https://github.com/fission/fission/pull/1327) ([life1347](https://github.com/life1347))
- Add Ingress TLS support [\#1326](https://github.com/fission/fission/pull/1326) ([life1347](https://github.com/life1347))
- Add Ingress host, path and annotations support [\#1325](https://github.com/fission/fission/pull/1325) ([life1347](https://github.com/life1347))
- Set maxSurge to 20% for safe rolling upgrade [\#1321](https://github.com/fission/fission/pull/1321) ([life1347](https://github.com/life1347))
- Disable revision history for newdeploy [\#1319](https://github.com/fission/fission/pull/1319) ([life1347](https://github.com/life1347))
- Pre-built docker go module dependency cache image [\#1318](https://github.com/fission/fission/pull/1318) ([life1347](https://github.com/life1347))
- Fix newdeploy doesn't handle error properly [\#1316](https://github.com/fission/fission/pull/1316) ([life1347](https://github.com/life1347))
- Fix failed to update specialization timeout [\#1315](https://github.com/fission/fission/pull/1315) ([life1347](https://github.com/life1347))
- Add codecov config file [\#1314](https://github.com/fission/fission/pull/1314) ([life1347](https://github.com/life1347))
- Fix potential nil pointer problem when using multierror pkg [\#1311](https://github.com/fission/fission/pull/1311) ([life1347](https://github.com/life1347))
- Use ErrorHandler to handle proxy error [\#1310](https://github.com/fission/fission/pull/1310) ([life1347](https://github.com/life1347))
- Integrate with Codecov [\#1308](https://github.com/fission/fission/pull/1308) ([life1347](https://github.com/life1347))
- Fix executor unable to list secrets/configmaps [\#1307](https://github.com/fission/fission/pull/1307) ([life1347](https://github.com/life1347))
- Add specialization timeout default value to CLI [\#1305](https://github.com/fission/fission/pull/1305) ([life1347](https://github.com/life1347))
- Update CHANGELOG for 1.5.0 [\#1304](https://github.com/fission/fission/pull/1304) ([life1347](https://github.com/life1347))
- Fission 1.5.0 [\#1303](https://github.com/fission/fission/pull/1303) ([life1347](https://github.com/life1347))
- Implement TLS authentication for kafka mqt [\#1300](https://github.com/fission/fission/pull/1300) ([vadasambar](https://github.com/vadasambar))
- Issue 1229: Function level timeout [\#1284](https://github.com/fission/fission/pull/1284) ([parauliya](https://github.com/parauliya))
- Fix kafka producer and consumer logs show empty objects [\#1281](https://github.com/fission/fission/pull/1281) ([vadasambar](https://github.com/vadasambar))
## [1.5.0](https://github.com/fission/fission/tree/1.5.0) (2019-09-09)
[Full Changelog](https://github.com/fission/fission/compare/1.4.1...1.5.0)
**Merged pull requests:**
- Refactor support dump CLI [\#1301](https://github.com/fission/fission/pull/1301) ([life1347](https://github.com/life1347))
- \[fission-cli\]\[feature\] support reverse query function for query log [\#1298](https://github.com/fission/fission/pull/1298) ([moluzhang](https://github.com/moluzhang))
- Fix unit tests failure [\#1297](https://github.com/fission/fission/pull/1297) ([life1347](https://github.com/life1347))
- Support nodejs function with 0 argument [\#1295](https://github.com/fission/fission/pull/1295) ([life1347](https://github.com/life1347))
- Update go environment errors for specializeHandlerV2 [\#1294](https://github.com/fission/fission/pull/1294) ([e-nikolov](https://github.com/e-nikolov))
- Add troubleshooting guide link [\#1292](https://github.com/fission/fission/pull/1292) ([life1347](https://github.com/life1347))
- Bump nokogiri from 1.10.1 to 1.10.4 in /examples/ruby/parse [\#1291](https://github.com/fission/fission/pull/1291) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump Go version to 1.12 [\#1290](https://github.com/fission/fission/pull/1290) ([life1347](https://github.com/life1347))
- Fix typo extraCoreComponmentPodConfig -\> extraCoreComponentPodConfig [\#1287](https://github.com/fission/fission/pull/1287) ([life1347](https://github.com/life1347))
- Improve CI integration test script [\#1285](https://github.com/fission/fission/pull/1285) ([life1347](https://github.com/life1347))
- support for providing multiple CMs and secrets in fn create [\#1282](https://github.com/fission/fission/pull/1282) ([viveksinghggits](https://github.com/viveksinghggits))
- Fix typo "consumer" =\> "producer" [\#1278](https://github.com/fission/fission/pull/1278) ([vadasambar](https://github.com/vadasambar))
- Fix go 1.9.2 & 1.11.4 shows "go mod not found" [\#1276](https://github.com/fission/fission/pull/1276) ([life1347](https://github.com/life1347))
- Fix typo "specialing" -\> "specializing" [\#1275](https://github.com/fission/fission/pull/1275) ([vadasambar](https://github.com/vadasambar))
- Added community meetings and some other changes [\#1273](https://github.com/fission/fission/pull/1273) ([vishal-biyani](https://github.com/vishal-biyani))
- fix a panic bug caused by err.Error\(\) [\#1271](https://github.com/fission/fission/pull/1271) ([cocoifly10](https://github.com/cocoifly10))
- Use fuzzy version for openJDK dependency [\#1269](https://github.com/fission/fission/pull/1269) ([life1347](https://github.com/life1347))
- Set full URL path to request header [\#1266](https://github.com/fission/fission/pull/1266) ([life1347](https://github.com/life1347))
- Refactor environment CLI command [\#1265](https://github.com/fission/fission/pull/1265) ([life1347](https://github.com/life1347))
- Added correct imagePullPolicy [\#1263](https://github.com/fission/fission/pull/1263) ([msshroff](https://github.com/msshroff))
- Make NewDeployment wait timeout configurable [\#1260](https://github.com/fission/fission/pull/1260) ([vadasambar](https://github.com/vadasambar))
- Issue \#1258: Allow empty repository tag in chart values.yaml [\#1259](https://github.com/fission/fission/pull/1259) ([parauliya](https://github.com/parauliya))
- Fix release script tags wrong image name [\#1257](https://github.com/fission/fission/pull/1257) ([life1347](https://github.com/life1347))
- Update tensorflow serving image name in env README [\#1256](https://github.com/fission/fission/pull/1256) ([life1347](https://github.com/life1347))
- V1.4.1 [\#1255](https://github.com/fission/fission/pull/1255) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix environment version validation [\#1253](https://github.com/fission/fission/pull/1253) ([davidsmf](https://github.com/davidsmf))
- Allow to set deployment config uid during initialization [\#1249](https://github.com/fission/fission/pull/1249) ([life1347](https://github.com/life1347))
- Add swagger \(OpenAPI 2.0\) support [\#1245](https://github.com/fission/fission/pull/1245) ([life1347](https://github.com/life1347))
- Update go dependencies [\#1240](https://github.com/fission/fission/pull/1240) ([life1347](https://github.com/life1347))
## [1.4.1](https://github.com/fission/fission/tree/1.4.1) (2019-07-29)
[Full Changelog](https://github.com/fission/fission/compare/1.4.0...1.4.1)
**Merged pull requests:**
- Fix wrongly replace spec api version [\#1254](https://github.com/fission/fission/pull/1254) ([life1347](https://github.com/life1347))
- Revert change of product name in README [\#1250](https://github.com/fission/fission/pull/1250) ([davidsmf](https://github.com/davidsmf))
- Analytics env fix in chart [\#1247](https://github.com/fission/fission/pull/1247) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix CI unable to start test due to the same travis build ID [\#1246](https://github.com/fission/fission/pull/1246) ([life1347](https://github.com/life1347))
- V1.4.0 [\#1244](https://github.com/fission/fission/pull/1244) ([vishal-biyani](https://github.com/vishal-biyani))
## [1.4.0](https://github.com/fission/fission/tree/1.4.0) (2019-07-24)
[Full Changelog](https://github.com/fission/fission/compare/1.3.0...1.4.0)
**Merged pull requests:**
- Update flask version to resolve CVE alert [\#1243](https://github.com/fission/fission/pull/1243) ([life1347](https://github.com/life1347))
- Fix typo where "spec" is spelt "sepc" in some dump directories. [\#1239](https://github.com/fission/fission/pull/1239) ([davidsmf](https://github.com/davidsmf))
- Fix fetcher client doesn't handle error properly [\#1238](https://github.com/fission/fission/pull/1238) ([life1347](https://github.com/life1347))
- Fix build failed due to script unable to find configmap [\#1237](https://github.com/fission/fission/pull/1237) ([life1347](https://github.com/life1347))
- Enable concurrent CI builds [\#1236](https://github.com/fission/fission/pull/1236) ([life1347](https://github.com/life1347))
- Change log-level for better performance and less annoying logs [\#1231](https://github.com/fission/fission/pull/1231) ([life1347](https://github.com/life1347))
- Replace localhost with 127.0.0.1 to prevent DNS resolving problem [\#1227](https://github.com/fission/fission/pull/1227) ([life1347](https://github.com/life1347))
- Fix release script wrongly tags builder as env image [\#1226](https://github.com/fission/fission/pull/1226) ([life1347](https://github.com/life1347))
- Make router keep-alive setting configurable [\#1225](https://github.com/fission/fission/pull/1225) ([life1347](https://github.com/life1347))
- Function Update if config/secret changes [\#1224](https://github.com/fission/fission/pull/1224) ([vishal-biyani](https://github.com/vishal-biyani))
- Fix nil pointer when CLI unable to get server version [\#1223](https://github.com/fission/fission/pull/1223) ([life1347](https://github.com/life1347))
- Reuse go docker build cache [\#1218](https://github.com/fission/fission/pull/1218) ([life1347](https://github.com/life1347))
- Allow to set log level through environment variable [\#1217](https://github.com/fission/fission/pull/1217) ([life1347](https://github.com/life1347))
- Fix roundtripper doesn't increase request timeout setting after each retry [\#1216](https://github.com/fission/fission/pull/1216) ([life1347](https://github.com/life1347))
- Configmaps/secrets in function exist check [\#1214](https://github.com/fission/fission/pull/1214) ([vishal-biyani](https://github.com/vishal-biyani))
- Add experimental environment: tensorflow-serving [\#1212](https://github.com/fission/fission/pull/1212) ([life1347](https://github.com/life1347))
- Fix executor panic problem when specialization timeout [\#1211](https://github.com/fission/fission/pull/1211) ([life1347](https://github.com/life1347))
- Fix fetcher of newdeploy pod error out when starting up. [\#1210](https://github.com/fission/fission/pull/1210) ([life1347](https://github.com/life1347))
- Fix Istio-proxy cannot collect HTTP-level information [\#1209](https://github.com/fission/fission/pull/1209) ([life1347](https://github.com/life1347))
- Fix poolmanager specializes a function pod repeatedly if istio is enabled [\#1208](https://github.com/fission/fission/pull/1208) ([life1347](https://github.com/life1347))
- Reuse docker maven build cache in JVM environment build process [\#1207](https://github.com/fission/fission/pull/1207) ([life1347](https://github.com/life1347))
- modify code to make log collection comprehensive [\#1206](https://github.com/fission/fission/pull/1206) ([cocoifly10](https://github.com/cocoifly10))
- Fallback to get user home directory from env [\#1203](https://github.com/fission/fission/pull/1203) ([life1347](https://github.com/life1347))
- Fission v1.3.0 [\#1202](https://github.com/fission/fission/pull/1202) ([life1347](https://github.com/life1347))
- \[bugfix\] Fix CLI drops controller URL path when querying logs [\#1201](https://github.com/fission/fission/pull/1201) ([moluzhang](https://github.com/moluzhang))
- Fix dotnet example [\#1175](https://github.com/fission/fission/pull/1175) ([CanerPatir](https://github.com/CanerPatir))
- Enable go module support for go environment [\#1152](https://github.com/fission/fission/pull/1152) ([life1347](https://github.com/life1347))
## [1.3.0](https://github.com/fission/fission/tree/1.3.0) (2019-06-03)
[Full Changelog](https://github.com/fission/fission/compare/1.2.1...1.3.0)
**Merged pull requests:**
- Check fission CLI & server git commit SHA before test [\#1200](https://github.com/fission/fission/pull/1200) ([life1347](https://github.com/life1347))
- Add readiness/liveness probes to nat-streaming [\#1199](https://github.com/fission/fission/pull/1199) ([life1347](https://github.com/life1347))
- Update bug issue templates [\#1198](https://github.com/fission/fission/pull/1198) ([life1347](https://github.com/life1347))
- Add static code analysis to CI test [\#1197](https://github.com/fission/fission/pull/1197) ([life1347](https://github.com/life1347))
- Analytics bugfix [\#1195](https://github.com/fission/fission/pull/1195) ([soamvasani](https://github.com/soamvasani))
- Add Terraform configuration and upgrade helm version [\#1194](https://github.com/fission/fission/pull/1194) ([darkgerm](https://github.com/darkgerm))
- Show warning message if spec alters poolsize while env version \< 3 [\#1193](https://github.com/fission/fission/pull/1193) ([life1347](https://github.com/life1347))
- Move packages to proejct/pkg to follow go project folder structure convention [\#1190](https://github.com/fission/fission/pull/1190) ([life1347](https://github.com/life1347))
- router analytics -- close http response body [\#1180](https://github.com/fission/fission/pull/1180) ([soamvasani](https://github.com/soamvasani))
- Remove prometheus server connectivity test during controller initialization [\#1179](https://github.com/fission/fission/pull/1179) ([life1347](https://github.com/life1347))
- V1.2.1 [\#1178](https://github.com/fission/fission/pull/1178) ([vishal-biyani](https://github.com/vishal-biyani))
- Skaffold for Fission [\#1172](https://github.com/fission/fission/pull/1172) ([vishal-biyani](https://github.com/vishal-biyani))
- Add affinity support [\#1170](https://github.com/fission/fission/pull/1170) ([laurence-hudson-mindfoundry](https://github.com/laurence-hudson-mindfoundry))
- Refactor test framework [\#1128](https://github.com/fission/fission/pull/1128) ([darkgerm](https://github.com/darkgerm))
- Function update after change in env [\#1116](https://github.com/fission/fission/pull/1116) ([vishal-biyani](https://github.com/vishal-biyani))
- 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)
**Merged pull requests:**
- Fix dotnet example [\#1175](https://github.com/fission/fission/pull/1175) ([CanerPatir](https://github.com/CanerPatir))
- V1.2.0 [\#1171](https://github.com/fission/fission/pull/1171) ([vishal-biyani](https://github.com/vishal-biyani))
- Fixes broken config path for functions [\#1177](https://github.com/fission/fission/pull/1177) ([vishal-biyani](https://github.com/vishal-biyani))
@@ -43,7 +319,6 @@ filename | sha256 hash
- Fix misleading log when setup portforward [\#1134](https://github.com/fission/fission/pull/1134) ([life1347](https://github.com/life1347))
- V1.1.0 [\#1129](https://github.com/fission/fission/pull/1129) ([vishal-biyani](https://github.com/vishal-biyani))
- support KUBECONFIG with multiple kube config files [\#1126](https://github.com/fission/fission/pull/1126) ([grounded042](https://github.com/grounded042))
- Function update after change in env [\#1116](https://github.com/fission/fission/pull/1116) ([vishal-biyani](https://github.com/vishal-biyani))
- Add configurable timeout to fission function test [\#1091](https://github.com/fission/fission/pull/1091) ([erwinvaneyk](https://github.com/erwinvaneyk))
- Add links to examples for each Fission environment [\#1090](https://github.com/fission/fission/pull/1090) ([erwinvaneyk](https://github.com/erwinvaneyk))
@@ -474,7 +749,6 @@ filename | sha256 hash
- Fix pool manager crash problem if failed at http call [\#418](https://github.com/fission/fission/pull/418) ([life1347](https://github.com/life1347))
- Update nats dependencies [\#411](https://github.com/fission/fission/pull/411) ([life1347](https://github.com/life1347))
- Prepare Fission for IPv6 uses [\#408](https://github.com/fission/fission/pull/408) ([valentin2105](https://github.com/valentin2105))
- Executor API panics if there is err in getting function from backends [\#407](https://github.com/fission/fission/pull/407) ([vishal-biyani](https://github.com/vishal-biyani))
- fission function logs returns logs in correct order now [\#405](https://github.com/fission/fission/pull/405) ([prithviramesh](https://github.com/prithviramesh))
- Fetcher retry [\#403](https://github.com/fission/fission/pull/403) ([vishal-biyani](https://github.com/vishal-biyani))
- Add fission/builder image [\#397](https://github.com/fission/fission/pull/397) ([erwinvaneyk](https://github.com/erwinvaneyk))
@@ -499,6 +773,7 @@ filename | sha256 hash
**Merged pull requests:**
- Executor API panics if there is err in getting function from backends [\#407](https://github.com/fission/fission/pull/407) ([vishal-biyani](https://github.com/vishal-biyani))
- 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))
@@ -657,7 +932,7 @@ filename | sha256 hash
- Fix Markdown table [\#136](https://github.com/fission/fission/pull/136) ([RobertHerhold](https://github.com/RobertHerhold))
- Symlink user function's node\_modules to server's node\_modules [\#133](https://github.com/fission/fission/pull/133) ([soamvasani](https://github.com/soamvasani))
- Add function logs support \(\#53\) [\#131](https://github.com/fission/fission/pull/131) ([life1347](https://github.com/life1347))
- Remove redundant hello.js from charts directory [\#130](https://github.com/fission/fission/pull/130) ([ssudake21](https://github.com/ssudake21))
- Remove redundant hello.js from charts directory [\#130](https://github.com/fission/fission/pull/130) ([sanketsudake](https://github.com/sanketsudake))
- Handle errors in filestore init \(\#108\) [\#127](https://github.com/fission/fission/pull/127) ([soamvasani](https://github.com/soamvasani))
- \[WIP\] Golang runtime [\#125](https://github.com/fission/fission/pull/125) ([nouney](https://github.com/nouney))
- Modify the stock example to show how to change the Content-Type [\#124](https://github.com/fission/fission/pull/124) ([gonrial](https://github.com/gonrial))
@@ -678,8 +953,9 @@ filename | sha256 hash
- Add initial support for PHP7 [\#97](https://github.com/fission/fission/pull/97) ([dgoujard](https://github.com/dgoujard))
- kubewatcher example: send watch updates to slack [\#96](https://github.com/fission/fission/pull/96) ([soamvasani](https://github.com/soamvasani))
- bugfix \(cli\) Update the URL check to work with https [\#94](https://github.com/fission/fission/pull/94) ([andrewstuart](https://github.com/andrewstuart))
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([ssudake21](https://github.com/ssudake21))
- Primary Helm chart for fission [\#90](https://github.com/fission/fission/pull/90) ([sanketsudake](https://github.com/sanketsudake))
- Wait for Pod IP while waiting for pod ready [\#89](https://github.com/fission/fission/pull/89) ([soamvasani](https://github.com/soamvasani))
- Make go vet happy [\#87](https://github.com/fission/fission/pull/87) ([AlekSi](https://github.com/AlekSi))
- Added support for running C\# code in a dotnet core environment [\#84](https://github.com/fission/fission/pull/84) ([ktrance](https://github.com/ktrance))
## [alpha20170124](https://github.com/fission/fission/tree/alpha20170124) (2017-01-24)
@@ -687,7 +963,6 @@ filename | sha256 hash
**Merged pull requests:**
- Make go vet happy [\#87](https://github.com/fission/fission/pull/87) ([AlekSi](https://github.com/AlekSi))
- Ignore glide cache in gofmt check [\#86](https://github.com/fission/fission/pull/86) ([soamvasani](https://github.com/soamvasani))
- Bugfix for internal routes [\#81](https://github.com/fission/fission/pull/81) ([soamvasani](https://github.com/soamvasani))
- Bug fix for handling a route's HTTP method in router [\#79](https://github.com/fission/fission/pull/79) ([soamvasani](https://github.com/soamvasani))
+1 -1
View File
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at codeofconduct@platform9.com. All
reported by contacting the project team at slack channel. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
+1 -2
View File
@@ -34,9 +34,8 @@ If you choose a big chunk of work that involves design changes to
Fission, please talk to us while planning the change; that way we can
all be on the same page before you invest too much work into it.
* Drop by the [slack channel](http://slack.fission.io)
* Drop by the [slack channel](http://slack.fission.io).
* Say hi on [twitter](https://twitter.com/fissionio).
* Email soamvasani@platform9.com
### Contribution Howto
+150 -94
View File
@@ -1,105 +1,186 @@
# A high-level view of the internals of Fission.
A high level view of the internals of Fission.
How it works
============
## How it works
Fission is a FaaS -- users create functions (source level), register
them with fission using a CLI, and associate functions with triggers.
them with Fission using a CLI, and associate functions with triggers.
Fission wraps those functions into a service, and runs them on
Fission wraps those functions into a service and runs them on
Kubernetes on demand.
Here's an overview of the services that make up fission.
Here's an overview of the services that make up Fission.
Components
==========
## Components
Language-neutral components:
Core Components:
* Controller
* Executor
* Environment Container (language-specific)
* Router
* Builder Manager
* Storage Service
* controller
* poolmgr
* router
* kubewatcher
Optional Components:
* Logger
* Kubewatcher
* Message Queue Trigger
* Timer
Language-specific components:
Third-party components:
* InfluxDB: To store function logs.
* Prometheus: For metric collection and canary deployment.
* NATS Streaming: For message queue trigger. (Kafka, Azure are not included in charts deployment.)
* Environment container(s)
## Core Components
### Controller
Controller
----------
The controller contains CRUD APIs for functions, triggers, environments,
Kubernetes event watches, etc. This is the component that the client talks to.
The controller contains CRUD APIs for functions, http triggers,
environments, Kubernetes event watches. This is the component that
the client talks to.
All fission resources are stored in kubernetes CRDs. It needs to be able to
talk to kubernetes API service.
This is the only stateful component. It needs to be configured with a
URL to an etcd cluster and a path to a persistent volume. The volume
is used to store the functions' source code. Etcd is used as the DB.
### Executor
[Work to extend to other storage backends is planned, see issue #83.]
The executor has two simple APIs; the router calls both these endpoints.
Pool Manager
------------
* GetFunctionService takes function metadata and dispatches the corresponding executor
type to get the address of a service/pod and returns it to the router.
* TapService lets executor know a service/pod is being used; if it's not
called for a few minutes the pod(s) backing the service are killed.
Poolmgr manages pools of generic containers and function containers.
It now supports two different executor types:
It has a simple API; both these endpoints are called by the router.
* PoolManager
* NewDeploy
* GetFunctionService takes function metadata and returns the address
of a service.
* TapService lets poolmgr know a service is being used; if it's not
called for a few minutes the pod(s) backing the service are killed.
These two executor types have different strategies to launch, specialize, and manage pod(s).
You should choose one of the executor types wisely based on the scenario.
Poolmgr watches the controller API and eagerly creates generic pools
for environments. It uses Kubernetes deployments to do that. The
environment container runs in a pod with the 'fetcher' container.
Fetcher is a very simple utility that downloads a URL sent to it and
saves it at a configured location.
#### PoolManager
GetFunctionService "specializes" a pod. The implementation chooses a
pod from the pool, relabels it to "orphan" the pod from the
deployment, invokes fetcher to copy the function into the pod, and
hits the the specialize endpoint on the environment container. This
causes the function to be loaded. The pod is now specific to that
function.
PoolManager manages pools of generic containers and function containers.
This function pod is cached; it's cleaned up if it's unused for a few
minutes.
PoolManager watches the environment CRD changes and eagerly creates generic pools
for environments. It uses Kubernetes deployments to do that. The
environment container runs in a pod with the 'fetcher' container.
Fetcher is a straightforward utility that downloads a URL sent to it
and saves it at a configured location (shared volume).
Router
------
The implementation chooses a generic pod from the pool, relabels it to
"orphan". The pod from the deployment invokes fetcher to copy the function
into the pod and hits the specialize endpoint on the environment container.
This causes the function to be loaded. The pod is now specific to that
function. This function pod is cached; it's cleaned up if it's unused for a few minutes.
The router forwards HTTP requests to function pods. If there's no
running service for a function, it requests one from poolmgr, while
holding on to the request; when the function's service is ready it
forwards the request.
PoolManager selects a generic pod from the warm pool, specializes it,
and recycles the pod if there are no further requests to the function after a few minutes.
It makes PoolManager suitable for functions that are short-living
and requires a short cold start time [1].
The router is stateless and can be scaled up if needed, according to
However, PoolManager only selects one pod per function, which is not
suitable for serving massive traffic. In such cases, you should consider
using NewDeploy as executor type of function.
[1] The cold start time depends on the package size of the function. If it's
a snippet of code, the cold start time usually is less then 100ms.
#### NewDeploy
NewDeploy creates deployment, service, and HPA for functions in order to handle
massive traffic.
NewDeploy watches the function CRD changes and creates a Kubernetes deployment,
service, and HPA for a function. NewDeploy will scale the replicas of a function
deployment to the minimum feasible scale setting, if the minimum scale setting of
a function is greater than 0. The 'fetcher' inside the pod uses a URL in the
JSON payload, which is attached as a parameter to start fetcher, to download the
function package instead of waiting for calls from NewDeploy.
When a function experiences a traffic spike, the service helps to distribute the requests to
pods belonging to the function for better workload distribution and lower latency. Also,
the HPA scales the replicas of the deployment based on the conditions set by the user.
This approach though increases the cold time of a function, but also makes NewDeploy
suitable for functions designed to serve massive traffic.
### Environment Container
Environment containers run user-defined functions and are language-specific.
Each environment container must contain an HTTP server and a loader for functions.
The pool manager deploys the environment container into a pod with fetcher
(fetcher is a simple utility that can fetch an HTTP URL to a file at a
configured location). This pod forms a "generic pod" because it can
be loaded with any function in that coding language.
When the pool manager needs to create a service for a function, it calls
fetcher to fetch the function. Fetcher downloads the function into a
volume shared between fetcher and this environment container. Poolmgr
then requests the container to load the function.
### Router
The router forwards HTTP requests to function pods. If there's no
running service for a function, it requests one from executor, while
holding on to the request; the router will forward the request to
the pod once the function service is ready.
The router is the only stateless component and can be scaled up if needed, according to
load.
Kubewatcher
-----------
### Builder Manager
The builder manager watches the package & environments CRD changes and manages
the builds of function source code. Once an environment that contains a builder
image is created, the builder manager will then creates the Kubernetes service
and deployment under the fission-builder namespace to start the environment
builder. And once a package that contains a source archive is created, the
builder manager talks to the environment builder to build the function's source
archive into a deploy archive for function deployment.
After the build, the builder manager asks Builder to upload the deploy archive to the
Storage Service once the build succeeded, and updates the package status attached with build logs.
### Storage Service
The storage service is the home for all archives of packages with sizes larger than 256KB.
The Builder pulls the source archive from the storage service and uploads deploy archive to it.
The fetcher inside the function pod also pulls the deploy archive for function specialization.
## Optional Components
### Logger
Logger is deployed as DaemonSet to help to forward function logs to a centralized
database service for log persistence. Currently, only InfluxDB is supported to store logs.
Following is a diagram describe how log service works:
1. Logger watches pod changes and creates a symlink to the container log if the pod runs on the same node.
2. Fluentd reads logs from symlink and pipes them to InfluxDB
3. `fission function logs ...` retrieve event logs from InfluxDB with optional log filter
4. Logger removes the symlink if the pod no longer exists.
### Kubewatcher
Kubewatcher watches the Kubernetes API and invokes functions
associated with watches, sending the watch event to the function.
The controller keeps track of user's requested watches and associated
functions. Kubewatcher watches the API based on these requests; when
The controller keeps track of the user's requested watches and associated
functions. Kubewatcher watches the API based on these requests; when
a watch event occurs, it serializes the object and calls the function
via the router.
While a few simple retries are done, there isn't yet a reliable
message bus between Kubewatcher and the function. Work for this is
message bus between Kubewatcher and the function. Work for this is
tracked in issue #64.
Message Queue Trigger
---------------------
### Message Queue Trigger
A message queue trigger binds a message queue topic to a function:
events from that topic cause the function to be invoked with the
Events from that topic cause the function to be invoked with the
message as the body of the request. The trigger may also contain a
response topic: if specified, the function's output is sent to this
response.
@@ -108,37 +189,12 @@ Here's a diagram of the components:
![Message queue trigger Diagram](https://user-images.githubusercontent.com/202578/27012344-9457cb24-4f00-11e7-8d6b-926ff01637b3.jpg)
Environment Container
---------------------
### Timer
Environment containers run user-defined functions. Environment
containers are language specific. Each environment container must
contain an HTTP server and a loader for functions.
The timer works like kubernetes CronJob but instead of creating a pod to do the task,
it sends a request to router to invoke the function. It's suitable for the background tasks that
need to executor periodically.
Poolmgr deploys the environment container into a pod with fetcher
(fetcher is a simple utility that can fetch an HTTP url to a file at a
configured location). This pod forms a "generic pod", because it can
be loaded with any function in that language.
When poolmgr needs to create a service for a function, it calls
fetcher to fetch the function. Fetcher downloads the function into a
volume shared between fetcher and this environment container. Poolmgr
then requests the container to load the function.
Logger
------
Logger helps to forward function logs to centralized db service for log
persistence. Currently only influxdb is supported to store logs.
Following is a diagram describe how log service works:
![Logger Diagram](https://cloud.githubusercontent.com/assets/202578/23100399/b0e3ea00-f6ba-11e6-8f2f-6588cfef2e84.png)
1. Pool manager chooses a pod from the pool to execute user function
2. Pool manager makes a HTTP POST to logger helper, once helper receives
the request it creates a symlink to container log for fluentd.
3. Fluentd reads log from symlink and pipes to influxdb
4. `fission function logs ...` retrieve event logs from influxdb with
optional log filter
5. Pool manager removes function pod from pool
6. Pool manager asks logger helper to stop piping logs, logger removes symlink.
The timer works like a Kubernetes CronJob, but instead of creating a
pod to do the task, it sends a request to the router to invoke the
function. It is suitable for background tasks that need to execute periodically.
+26 -24
View File
@@ -11,36 +11,38 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: test
.DEFAULT_GOAL := build
IMAGE ?= fission/fission-bundle
VERSION ?= latest
ARCH ?= amd64
OS ?= linux
.DEFAULT_GOAL := check
test:
go test -v $(go list ./... | grep -v /examples/ | grep -v /environments/)
check: test-run build clean
build: build-bundle build-client
# run basic check scripts
test-run:
hack/verify-gofmt.sh
hack/verify-govet.sh
hack/verify-staticcheck.sh
hack/runtests.sh
@rm -f coverage.txt
build-client:
# ensure the changes are buildable
build:
go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
go build -o cmd/fetcher/fetcher ./cmd/fetcher/
go build -o cmd/fetcher/builder ./cmd/builder/
build-bundle:
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
# install CLI binary to $PATH
install: build
mv cmd/fission-cli/fission $(GOPATH)/bin
build-image:
docker build --rm --tag "$(IMAGE):$(VERSION)" cmd/fission-bundle/
install:
go install ./cmd/fission-cli/
image: build-bundle build-image
image-push: image
docker push "$(IMAGE):$(VERSION)"
# build images (environment images are not included)
image:
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
clean:
@rm -f fission-bundle/fission-bundle
@rm -f fission/fission
@rm -f cmd/fission-bundle/fission-bundle
@rm -f cmd/fission-cli/fission
@rm -f cmd/fetcher/fetcher
@rm -f cmd/fetcher/builder
+40 -48
View File
@@ -1,10 +1,9 @@
Fission: Serverless Functions for Kubernetes
============================================
# Fission: Serverless Functions for Kubernetes
[![Build Status](https://travis-ci.org/fission/fission.svg?branch=master)](https://travis-ci.org/fission/fission)
[![Go Report Card](https://goreportcard.com/badge/github.com/fission/fission)](https://goreportcard.com/report/github.com/fission/fission)
[![Fission Slack](http://slack.fission.io/badge.svg)](http://slack.fission.io)
[fission.io](http://fission.io) [@fissionio](http://twitter.com/fissionio)
[fission.io](http://fission.io) | [@fissionio](http://twitter.com/fissionio) | [Slack](https://join.slack.com/t/fissionio/shared_invite/enQtOTI3NjgyMjE5NzE3LTllODJiODBmYTBiYWUwMWQxZWRhNDhiZDMyN2EyNjAzMTFiYjE2Nzc1NzE0MTU4ZTg2MzVjMDQ1NWY3MGJhZmE)
Fission is a fast serverless framework for Kubernetes with a focus on
developer productivity and high performance.
@@ -18,7 +17,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 +25,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,44 +36,21 @@ Building on Kubernetes also means that anything you do for operations
on your Kubernetes cluster &mdash; such as monitoring or log
aggregation &mdash; also helps with ops on your Fission deployment.
# Getting started and documentation
Fission Concepts
----------------
## Fission Concepts
A _function_ is a piece of code that follows the fission function
interface.
Visit [concepts](https://docs.fission.io/docs/concepts/) for more details.
An _environment_ contains the language- and runtime-specific parts of
running a function.
## Documentations
The following environments are currently available:
| Environment | Image |
| ------------------------------------ | ------------------------- |
| Binary (for executables or scripts) | `fission/binary-env` |
| Go | `fission/go-env` |
| JVM | `fission/jvm-env` |
| .NET | `fission/dotnet-env` |
| .NET 2.0 | `fission/dotnet20-env` |
| NodeJS (Alpine) | `fission/node-env` |
| NodeJS (Debian) | `fission/node-env-debian` |
| Perl | `fission/perl-env` |
| PHP 7 | `fission/php-env` |
| Python 3 | `fission/python-env` |
| Ruby | `fission/ruby-env` |
You can 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.
You can also extend environments or create entirely new
ones if you want. (An environment is essentially just a container
with a webserver and dynamic loader.)
A _trigger_ is something that maps an event to a function; Fission
as of today supports [HTTP request](https://docs.fission.io/usage/trigger/#create-a-http-trigger), [timed](https://docs.fission.io/usage/trigger/#create-a-time-trigger), and [message queue](https://docs.fission.io/usage/trigger/#create-a-message-queue-trigger) triggers.
Usage
-----
## Usage
```bash
# Add the stock NodeJS env to your Fission deployment
$ fission env create --name nodejs --image fission/node-env
@@ -92,20 +68,36 @@ Usage
Hello, world!
```
See the [examples](examples) directory for more.
# Contributing
Running Fission on your Cluster
===============================
## Building Fission
See the [compilation guide](https://docs.fission.io/docs/contributing/).
See the [installation guide](https://docs.fission.io/installation/).
## Contact
Fission is a project by [many contributors](https://github.com/fission/fission/graphs/contributors).
Reach us on [slack](https://join.slack.com/t/fissionio/shared_invite/enQtOTI3NjgyMjE5NzE3LTllODJiODBmYTBiYWUwMWQxZWRhNDhiZDMyN2EyNjAzMTFiYjE2Nzc1NzE0MTU4ZTg2MzVjMDQ1NWY3MGJhZmE) or [twitter](https://twitter.com/fissionio).
Compiling Fission
=================
## Community meeting
See the [compilation guide](https://docs.fission.io/contributing/).
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).
Reach us on [slack](http://slack.fission.io) or
[twitter](https://twitter.com/fissionio).
# Official Releases
Fission is a project by [Platform9 Systems](https://platform9.com/fission/)
and [many contributors](https://github.com/fission/fission/graphs/contributors).
Official releases of Fission can be found on [the releases page](https://github.com/fission/fission/releases).
Please note that it is strongly recommended that you use official releases of Fission, as unreleased versions from
the master branch are subject to changes and incompatibilities that will not be supported in the official releases.
Builds from the master branch can have functionality changed and even removed at any time without compatibility support
and without prior notice.
# Sponsors
The following companies, organizations, and individuals support Fission's ongoing maintenance and development.
Become a sponsor to get your logo on our README on Github with a link to your site.
<p>
<a href="https://infracloud.io/"><img src="https://fission.io/sponsors/infracloud.png" alt="InfraCloud" height="70"></a>
<a href="https://srcmesh.com/"><img src="https://fission.io/sponsors/srcmesh.png" alt="Srcmesh" height="70"></a>
</p>
# Licensing
Fission is under the Apache 2.0 license.
+19 -6
View File
@@ -5,7 +5,7 @@
## Prerequisites
- Kubernetes 1.6 or later
- Kubernetes 1.9 or later
## Helm charts
@@ -43,10 +43,10 @@ Parameter | Description | Default
`routerServiceType` | Type of Fission Router service to use. For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP. | `LoadBalancer`
`repository` | Image base repository | `index.docker.io`
`image` | Fission image repository | `fission/fission-bundle`
`imageTag` | Fission image tag | `1.2.1`
`imageTag` | Fission image tag | `1.8.0`
`pullPolicy` | Image pull policy | `IfNotPresent`
`fetcherImage` | Fission fetcher repository | `fission/fetcher`
`fetcherImageTag` | Fission fetcher image tag | `1.2.1`
`fetcher.image` | Fission fetcher repository | `fission/fetcher`
`fetcher.imageTag` | Fission fetcher image tag | `1.8.0`
`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,9 +62,22 @@ 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`
`extraCoreComponmentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
`extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None
`executor.adoptExistingResources` | If true, executor will try to adopt existing resources created by the old executor instance. | `false`
`router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false`
`router.svcAddressMaxRetries` | Max retries times for router to retry on a certain service URL returns from cache/executor | `5`
`router.svcAddressUpdateTimeout` | The length of update lock expiry time for router to get a service URL returns from executor | `30`
`router.svcAnnotations` | Annotations for router service | None
`router.useEncodedPath` | For router to match encoded path. If true, "/foo%2Fbar" will match the path "/{var}"; Otherwise, it will match the path "/foo/bar". | `false`
`router.traceSamplingRate` | Uniformly sample traces with the given probabilistic sampling rate | `0.5`
`router.roundTrip.disableKeepAlive` | Disable transport keep-alive for fast switching function version | `true`
`router.roundTrip.keepAliveTime` | The keep-alive period for an active network connection to function pod | `30s`
`router.roundTrip.timeout` | HTTP transport request timeout | `50ms`
`router.roundTrip.timeoutExponent` | The length of request timeout will multiply with timeoutExponent after each retry | `2`
`router.roundTrip.maxRetries` | Max retries times of a failed request | `10`
### Extra configuration for `fission-all`
+4 -4
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: fission-all
version: 1.2.1
version: 1.8.0
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.2.1
appVersion: 1.8.0
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: prometheus
repository: https://kubernetes-charts.storage.googleapis.com
version: 7.1.0
digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe
generated: 2019-01-03T16:29:53.158684+01:00
version: 9.3.1
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
generated: "2019-11-18T10:16:20.334338911Z"
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies:
- name: prometheus
version: 7.1.0
version: 9.3.1
repository: https://kubernetes-charts.storage.googleapis.com
condition: prometheusDeploy
condition: prometheus.enabled
+3 -3
View File
@@ -1,13 +1,13 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
Windows:
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
2. You're ready to use Fission!
+13 -1
View File
@@ -25,9 +25,21 @@ 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 -}}
{{/*
This template generates the image name for the deployment depending on the value of "repository" field in values.yaml file.
*/}}
{{- define "fission-bundleImage" -}}
{{- if .Values.repository -}}
{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}
{{- else -}}
{{ .Values.image }}:{{ .Values.imageTag }}
{{- end }}
{{- end -}}
+241 -195
View File
@@ -112,14 +112,20 @@ data:
"config.yaml": {{ include "config" . | b64enc }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: controller
application: fission-api
spec:
replicas: 1
selector:
matchLabels:
svc: controller
application: fission-api
template:
metadata:
labels:
@@ -128,19 +134,23 @@ spec:
spec:
containers:
- name: controller
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- 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
value: {{ .Values.debugEnv | quote }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
readinessProbe:
httpGet:
path: "/healthz"
@@ -158,115 +168,31 @@ spec:
- name: config-volume
mountPath: /etc/config/config.yaml
subPath: config.yaml
serviceAccount: fission-svc
ports:
- containerPort: 8888
name: http
serviceAccountName: fission-svc
volumes:
- name: config-volume
configMap:
name: feature-config
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
{{ if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
{{ else if .Values.analyticsNonHelmInstall }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
{{ end }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: v1
kind: Service
apiVersion: apps/v1
kind: Deployment
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: executor
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
replicas: 1
selector:
svc: executor
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: executor
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
matchLabels:
svc: executor
template:
metadata:
labels:
@@ -278,31 +204,35 @@ spec:
spec:
containers:
- name: executor
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--fission-namespace", "{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: ADOPT_EXISTING_RESOURCES
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcherMinMem | default "16Mi" | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: FETCHER_MINCPU
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcher.resource.mem.limits | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
readinessProbe:
httpGet:
path: "/healthz"
@@ -321,20 +251,24 @@ spec:
name: metrics
- containerPort: 8888
name: http
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: buildermgr
spec:
replicas: 1
selector:
matchLabels:
svc: buildermgr
template:
metadata:
labels:
@@ -342,45 +276,51 @@ spec:
spec:
containers:
- name: buildermgr
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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 }}"
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: BUILDER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: 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 }}
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcherMinMem | default "16Mi" | quote }}
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
value: {{ .Values.fetcher.resource.mem.limits | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubewatcher
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: kubewatcher
spec:
replicas: 1
selector:
matchLabels:
svc: kubewatcher
template:
metadata:
labels:
@@ -388,16 +328,20 @@ spec:
spec:
containers:
- name: kubewatcher
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
@@ -417,14 +361,18 @@ spec:
svc: influxdb
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: influxdb
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: influxdb
spec:
replicas: 1
selector:
matchLabels:
svc: influxdb
template:
metadata:
labels:
@@ -435,20 +383,20 @@ spec:
image: fission/influxdb
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: PRE_CREATE_DB
value: fissionFunctionLog
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: influxdb
key: username
- name: INFLUXDB_INIT_PWD
valueFrom:
secretKeyRef:
name: influxdb
key: password
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
- name: PRE_CREATE_DB
value: fissionFunctionLog
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: influxdb
key: username
- name: INFLUXDB_INIT_PWD
valueFrom:
secretKeyRef:
name: influxdb
key: password
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- if .Values.heapster }}
@@ -471,15 +419,19 @@ spec:
selector:
svc: heapster
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: heapster
spec:
replicas: 1
selector:
matchLabels:
svc: heapster
template:
metadata:
labels:
@@ -492,17 +444,21 @@ spec:
command:
- /heapster
- --source=kubernetes:https://kubernetes.default
serviceAccount: {{ .Release.Namespace }}/fission-svc
serviceAccountName: {{ .Release.Namespace }}/fission-svc
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: timer
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: timer
spec:
replicas: 1
selector:
matchLabels:
svc: timer
template:
metadata:
labels:
@@ -510,13 +466,16 @@ spec:
spec:
containers:
- name: timer
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--timer", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
env:
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
#
@@ -525,7 +484,7 @@ spec:
# "fission".
#
#---
#apiVersion: extensions/v1beta1
#apiVersion: apps/v1
#kind: Deployment
#metadata:
# name: fission-ui
@@ -545,11 +504,11 @@ 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 }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
@@ -557,6 +516,9 @@ metadata:
name: nats-streaming
spec:
replicas: 1
selector:
matchLabels:
svc: nats-streaming
template:
metadata:
labels:
@@ -574,10 +536,8 @@ spec:
]
ports:
- containerPort: 4222
hostPort: 4222
protocol: TCP
- containerPort: 4223
hostPort: 4223
protocol: TCP
readinessProbe:
httpGet:
@@ -592,18 +552,24 @@ spec:
port: 4223
initialDelaySeconds: 30
periodSeconds: 5
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtrigger-nats-streaming
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: mqtrigger
messagequeue: nats-streaming
spec:
replicas: 1
selector:
matchLabels:
svc: mqtrigger
messagequeue: nats-streaming
template:
metadata:
labels:
@@ -612,33 +578,43 @@ spec:
spec:
containers:
- name: mqtrigger
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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 }}
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
{{- if .Values.kafka.enabled }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtrigger-kafka
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: mqtrigger
messagequeue: kafka
spec:
replicas: 1
selector:
matchLabels:
svc: mqtrigger
messagequeue: kafka
template:
metadata:
labels:
@@ -650,7 +626,7 @@ spec:
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: MESSAGE_QUEUE_TYPE
value: kafka
@@ -658,24 +634,77 @@ 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 }}
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
# TLS authentication is TLS with authentication (2 way)
# More info: https://docs.confluent.io/current/kafka/authentication_ssl.html#ssl-overview
{{- if .Values.kafka.authentication.tls.enabled }}
- name: TLS_ENABLED
value: "true"
- name: MESSAGE_QUEUE_SECRETS
value: /etc/fission/secrets
volumeMounts:
- name: kafka-secrets
mountPath: /etc/fission/secrets
{{- end }}
serviceAccountName: fission-svc
{{- if .Values.kafka.authentication.tls.enabled }}
volumes:
- name: kafka-secrets
secret:
secretName: mqtrigger-kafka-secrets
{{- end }}
---
{{- if .Values.kafka.authentication.tls.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: mqtrigger-kafka-secrets
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
data:
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) }}
caCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) | b64enc }}
{{- else }}
{{ fail "Invalid chart. CA Certificate not found." }}
{{- end }}
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) }}
userCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) | b64enc }}
{{- else }}
{{ fail "Invalid chart. User Certificate not found." }}
{{- end }}
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) }}
userKey: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) | b64enc }}
{{- else }}
{{ fail "Invalid chart. User Key not found." }}
{{- end }}
{{- end }}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
{{- if .Values.azureStorageQueue.enabled }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: mqtrigger-azure-storage-queue
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: mqtrigger
messagequeue: azure-storage-queue
spec:
replicas: 1
selector:
matchLabels:
svc: mqtrigger
messagequeue: azure-storage-queue
template:
metadata:
labels:
@@ -687,8 +716,10 @@ spec:
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
env:
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: MESSAGE_QUEUE_TYPE
@@ -700,20 +731,28 @@ spec:
secretKeyRef:
name: azure-storage-account-key
key: key
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: storagesvc
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: storagesvc
application: fission-storage
spec:
replicas: 1
selector:
matchLabels:
svc: storagesvc
application: fission-storage
template:
metadata:
labels:
@@ -722,15 +761,19 @@ spec:
spec:
containers:
- name: storagesvc
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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
value: "{{.Values.pruneInterval}}"
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
volumeMounts:
- name: fission-storage
mountPath: /fission
@@ -747,7 +790,10 @@ spec:
port: 8000
initialDelaySeconds: 35
periodSeconds: 5
serviceAccount: fission-svc
ports:
- containerPort: 8000
name: http
serviceAccountName: fission-svc
volumes:
- name: fission-storage
{{- if .Values.persistence.enabled }}
@@ -756,6 +802,6 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
+28 -3
View File
@@ -20,13 +20,17 @@ data:
{{ fail "invalid chart" }}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: logger
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: logger
spec:
selector:
matchLabels:
svc: logger
template:
metadata:
labels:
@@ -35,15 +39,24 @@ spec:
initContainers:
- name: init
image: busybox
imagePullPolicy: {{ .Values.pullPolicy }}
command: ['mkdir', '-p', '/var/log/fission']
volumeMounts:
- name: container-log
mountPath: /var/log/
readOnly: false
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
containers:
- name: logger
{{ if .Values.repository }}
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: IfNotPresent
{{ else }}
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
{{ end }}
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: NODE_NAME
valueFrom:
@@ -59,8 +72,16 @@ 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 }}"
{{ else }}
image: "{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
{{- end }}
imagePullPolicy: {{ .Values.pullPolicy }}
# CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
command: ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluentbit.conf"]
@@ -83,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/
@@ -93,7 +118,7 @@ spec:
- name: fluentbit-config
mountPath: /fluent-bit/etc/
readOnly: true
serviceAccount: fission-svc
serviceAccountName: fission-svc
volumes:
- name: container-log
hostPath:
@@ -28,5 +28,5 @@ spec:
- name: post-install-job
image: "fission/alpinecurl"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"yaml-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"yaml-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -32,5 +32,5 @@ spec:
- name: post-install-job
image: "fission/alpinecurl"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -32,5 +32,5 @@ spec:
- name: post-upgrade-job
image: "fission/alpinecurl"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-upgrade\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-upgrade\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -30,4 +30,4 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
command: [ "/pre-upgrade-checks" ]
args: ["--fn-pod-namespace", "{{ .Values.functionNamespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
serviceAccount: fission-svc
serviceAccountName: fission-svc
-39
View File
@@ -1,39 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: redis
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: redis
selector:
app: redis
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: redis
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
selector:
matchLabels:
app: redis
serviceName: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:3.2-alpine
imagePullPolicy: {{ .Values.pullPolicy }}
ports:
- containerPort: 6379
name: redis
+94
View File
@@ -0,0 +1,94 @@
apiVersion: apps/v1
{{- if not .Values.router.deployAsDaemonSet }}
kind: Deployment
{{- else }}
kind: DaemonSet
{{- end }}
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: router
application: fission-router
spec:
{{- if not .Values.router.deployAsDaemonSet }}
replicas: 1
{{- end }}
selector:
matchLabels:
application: fission-router
svc: router
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.router.roundTrip.timeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.router.roundTrip.timeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.router.roundTrip.keepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_DISABLE_KEEP_ALIVE
value: {{ .Values.router.roundTrip.disableKeepAlive | default true | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.router.roundTrip.maxRetries | default 10 | quote }}
- name: ROUTER_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
- name: USE_ENCODED_PATH
value: {{ .Values.router.useEncodedPath | default false | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.io/metrics"
{{- else if .Values.analyticsNonHelmInstall }}
- name: ANALYTICS_URL
value: "https://g.fission.io/metrics"
{{- end }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
+20
View File
@@ -6,6 +6,10 @@ metadata:
svc: router
application: fission-router
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.router.svcAnnotations }}
annotations:
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.routerServiceType }}
ports:
@@ -73,3 +77,19 @@ spec:
targetPort: 8000
selector:
svc: storagesvc
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
svc: executor
+108 -15
View File
@@ -10,6 +10,7 @@ serviceType: ClusterIP
routerServiceType: LoadBalancer
## Image base repository
## Leave it empty for using existing local image
repository: index.docker.io
## Fission image repository
@@ -19,13 +20,7 @@ image: fission/fission-bundle
pullPolicy: IfNotPresent
## Fission image version
imageTag: 1.2.1
## Fission fetcher repository
fetcherImage: fission/fetcher
## Fission fetcher image version
fetcherImageTag: 1.2.1
imageTag: 1.8.0
## Port at which Fission controller service should be exposed
controllerPort: 31313
@@ -50,12 +45,88 @@ builderNamespace: fission-builder
## Enable istio integration
enableIstio: false
fetcher:
## Fetcher repository
image: fission/fetcher
## Fetcher image version
imageTag: 1.8.0
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
resource:
cpu:
requests: "10m"
## Low CPU limits will increases the function specialization time.
limits: ""
mem:
requests: "16Mi"
limits: ""
## Logger config
logger:
influxdbAdmin: "admin"
fluentdImageRepository: index.docker.io
fluentdImage: fluent/fluent-bit
fluentdImageTag: 1.0.4
## Fluent-bit writes/reads its own sqlite database to record a history of tracked
## files and a state of offsets, this is very useful to resume a state if the ser-
## vice is restarted. For Kubernetes environment with constraints like OpenShift,
## the containers are limited to write hostPath volume. Hence, we have to enable
## security context and set privileged to true.
enableSecurityContext: false
executor:
adoptExistingResources: false
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
## Display endpoint access logs
## To be aware of enabling logging endpoint access log, it increases
## router resource utilization when under heavy workloads.
displayAccessLog: false
## Add annotations for router
# svcAnnotations:
# cloud.google.com/load-balancer-type: Internal
## For router to match encoded path.
## If true, "/foo%2Fbar" will match the path "/{var}";
## Otherwise, it will match the path "/foo/bar".
useEncodedPath: false
roundTrip:
## If true, router will disable the HTTP keep-alive which result in performance degradation.
## But it ensures that router can redirect new coming requests to new function pods.
##
## If false, router will enable transport keep-alive feature for better performance.
## However, the drawback is it takes longer to switch to newly created function pods
## if using newdeploy as executor type for function. If you want to preserve the
## performance while keeping the short switching time to new function, you can create
## an environment with short grace period by setting flag "--graceperiod" (default 360s),
## so that kubernetes will be able to reap old function pod quickly.
##
## For details, see https://github.com/fission/fission/issues/723
disableKeepAlive: false
## The keep-alive period for an active network connection to function pod.
keepAliveTime: 30s
## HTTP transport request timeout
timeout: 50ms
## The length of request timeout will multiply with timeoutExponent after each retry
timeoutExponent: 2
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Message queue trigger config
### NATS Streaming, enabled by default
@@ -73,7 +144,25 @@ azureStorageQueue:
## Kafka: enable and configure the details
kafka:
enabled: false
brokers: 'broker.kafka:9092'
# note: below link is only for reference.
# Please use the brokers link for your kafka here.
brokers: 'broker.kafka:9092' # or your-bootstrap-server.kafka:9092/9093
authentication:
tls:
enabled: false
caCert: '' # path to certificate containing public key of CA authority
userCert: '' # path to certificate containing public key of the user signed by CA authority
userKey: '' # path to private key of the user
# brokers: 'my-broker.kafka:9092' # or my-bootstrap-server.kafka:9092/9093
# Sample config for authentication
# authentication:
# tls:
# enabled: true
# caCert: 'auth/kafka/ca.crt'
# userCert: 'auth/kafka/user.crt'
# userKey: 'auth/kafka/user.key'
## version of Kafka broker
## For 0.x it must be a string in the format
## "major.minor.veryMinor.patch" example: 0.8.2.0
@@ -109,7 +198,7 @@ persistence:
## Extend the container specs for the core fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponmentPodConfig:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
@@ -119,7 +208,7 @@ persistence:
## operator: In
## values:
## - app
extraCoreComponmentPodConfig:
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
@@ -144,17 +233,21 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
## summary is returned as part of http response
debugEnv: true
debugEnv: false
## set this flag to true if prometheus needs to be deployed along with fission
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:
enabled: true
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
#traceSamplingRate: 0.75
+4 -4
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: fission-core
version: 1.2.1
version: 1.8.0
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.2.1
appVersion: 1.8.0
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: prometheus
repository: https://kubernetes-charts.storage.googleapis.com
version: 9.3.1
digest: sha256:89a63a5f01c08032106a94c59fc7a5929e449458bf5fd06d86c8b048ac628bf4
generated: "2019-11-18T10:16:25.945208326Z"
+2 -2
View File
@@ -1,5 +1,5 @@
dependencies:
- name: prometheus
version: 7.1.0
version: 9.3.1
repository: https://kubernetes-charts.storage.googleapis.com
condition: prometheusDeploy
condition: prometheus.enabled
+3 -3
View File
@@ -1,13 +1,13 @@
1. Install the client CLI.
Mac:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-osx && chmod +x fission && sudo mv fission /usr/local/bin/
Linux:
$ curl -Lo fission https://github.com/fission/fission/releases/download/1.2.1/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
$ curl -Lo fission https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-linux && chmod +x fission && sudo mv fission /usr/local/bin/
Windows:
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/1.2.1/fission-cli-windows.exe
For Windows, you can use the linux binary on WSL. Or you can download this windows executable: https://github.com/fission/fission/releases/download/{{ .Chart.Version }}/fission-cli-windows.exe
2. You're ready to use Fission!
+14 -1
View File
@@ -24,8 +24,21 @@ 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 -}}
{{/*
This template generates the image name for the deployment depending on the value of "repository" field in values.yaml file.
*/}}
{{- define "fission-bundleImage" -}}
{{- if .Values.repository -}}
{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}
{{- else -}}
{{ .Values.image }}:{{ .Values.imageTag }}
{{- end }}
{{- end -}}
+102 -137
View File
@@ -113,14 +113,20 @@ data:
"config.yaml": {{ include "config" . | b64enc }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: controller
application: fission-api
spec:
replicas: 1
selector:
matchLabels:
svc: controller
application: fission-api
template:
metadata:
labels:
@@ -129,11 +135,13 @@ spec:
spec:
containers:
- name: controller
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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
@@ -159,111 +167,32 @@ spec:
- name: config-volume
mountPath: /etc/config/config.yaml
subPath: config.yaml
serviceAccount: fission-svc
ports:
- containerPort: 8888
name: http
serviceAccountName: fission-svc
volumes:
- name: config-volume
configMap:
name: feature-config
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.routerRoundTripTimeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.routerRoundTripTimeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.routerRoundTripKeepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.routerRoundTripMaxRetries | default 10 | quote }}
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.routerRoundTripSvcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_ROUND_TRIP_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.routerRoundTripSvcAddressUpdateTimeout | default 30 | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
{{ if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
{{ else if .Values.analyticsNonHelmInstall }}
- name: ANALYTICS_URL
value: "https://g.fission.sh/metrics"
{{ end }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: executor
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
replicas: 1
selector:
svc: executor
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: executor
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
matchLabels:
svc: executor
template:
metadata:
labels:
@@ -275,29 +204,33 @@ spec:
spec:
containers:
- name: executor
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}", "--fission-namespace", "{{ .Release.Namespace }}", "--collectorEndpoint", "{{ .Values.traceCollectorEndpoint }}"]
args: ["--executorPort", "8888", "--namespace", "{{ .Values.functionNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.traceSamplingRate | default "0.5" | quote }}
- name: ADOPT_EXISTING_RESOURCES
value: {{ .Values.executor.adoptExistingResources | default false | quote }}
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcherMinMem | default "16Mi" | quote }}
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
value: {{ .Values.fetcher.resource.mem.limits | quote }}
readinessProbe:
httpGet:
path: "/healthz"
@@ -311,20 +244,29 @@ spec:
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: buildermgr
spec:
replicas: 1
selector:
matchLabels:
svc: buildermgr
template:
metadata:
labels:
@@ -332,13 +274,13 @@ spec:
spec:
containers:
- name: buildermgr
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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 }}"
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: BUILDER_IMAGE_PULL_POLICY
@@ -350,27 +292,31 @@ spec:
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
value: {{ .Values.fetcherMinCpu | default "10m" | quote }}
value: {{ .Values.fetcher.resource.cpu.requests | quote }}
- name: FETCHER_MINMEM
value: {{ .Values.fetcherMinMem | default "16Mi" | quote }}
value: {{ .Values.fetcher.resource.mem.requests | quote }}
- name: FETCHER_MAXCPU
value: {{ .Values.fetcherMaxCpu | default "1000m" | quote }}
value: {{ .Values.fetcher.resource.cpu.limits | quote }}
- name: FETCHER_MAXMEM
value: {{ .Values.fetcherMaxMem | default "128Mi" | quote }}
serviceAccount: fission-svc
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
value: {{ .Values.fetcher.resource.mem.limits | quote }}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubewatcher
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: kubewatcher
spec:
replicas: 1
selector:
matchLabels:
svc: kubewatcher
template:
metadata:
labels:
@@ -378,27 +324,33 @@ spec:
spec:
containers:
- name: kubewatcher
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: timer
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: timer
spec:
replicas: 1
selector:
matchLabels:
svc: timer
template:
metadata:
labels:
@@ -406,27 +358,35 @@ spec:
spec:
containers:
- name: timer
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: storagesvc
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: storagesvc
application: fission-storage
spec:
replicas: 1
selector:
matchLabels:
svc: storagesvc
application: fission-storage
template:
metadata:
labels:
@@ -435,19 +395,24 @@ spec:
spec:
containers:
- name: storagesvc
image: "{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}"
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:
- name: fission-storage
mountPath: /fission
serviceAccount: fission-svc
ports:
- containerPort: 8000
name: http
serviceAccountName: fission-svc
volumes:
- name: fission-storage
{{- if .Values.persistence.enabled }}
@@ -456,6 +421,6 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.extraCoreComponmentPodConfig }}
{{ toYaml .Values.extraCoreComponmentPodConfig | indent 6 -}}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
@@ -27,5 +27,5 @@ spec:
containers:
- name: post-install-job
image: "fission/alpinecurl"
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"yaml-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"yaml-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -31,5 +31,5 @@ spec:
containers:
- name: post-install-job
image: "fission/alpinecurl"
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-install\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -31,5 +31,5 @@ spec:
containers:
- name: post-upgrade-job
image: "fission/alpinecurl"
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-upgrade\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.sh/analytics || true"]
command: ["sh", "-c", "/usr/bin/curl -m 5 -H \"Content-Type: application/json\" -X POST -d '{\"type\": \"helm-post-upgrade\", \"chartName\": \"{{ .Chart.Name }}\", \"chartVersion\": \"{{ .Chart.Version }}\"}' https://g.fission.io/analytics || true"]
{{- end }}
@@ -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
+94
View File
@@ -0,0 +1,94 @@
apiVersion: apps/v1
{{- if not .Values.router.deployAsDaemonSet }}
kind: Deployment
{{- else }}
kind: DaemonSet
{{- end }}
metadata:
name: router
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: router
application: fission-router
spec:
{{- if not .Values.router.deployAsDaemonSet }}
replicas: 1
{{- end }}
selector:
matchLabels:
application: fission-router
svc: router
template:
metadata:
labels:
application: fission-router
svc: router
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
containers:
- name: router
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--routerPort", "8888", "--executorUrl", "http://executor.{{ .Release.Namespace }}"]
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ROUTER_ROUND_TRIP_TIMEOUT
value: {{ .Values.router.roundTrip.timeout | default "50ms" | quote }}
- name: ROUTER_ROUNDTRIP_TIMEOUT_EXPONENT
value: {{ .Values.router.roundTrip.timeoutExponent | default 2 | quote }}
- name: ROUTER_ROUND_TRIP_KEEP_ALIVE_TIME
value: {{ .Values.router.roundTrip.keepAliveTime | default "30s" | quote }}
- name: ROUTER_ROUND_TRIP_DISABLE_KEEP_ALIVE
value: {{ .Values.router.roundTrip.disableKeepAlive | default true | quote }}
- name: ROUTER_ROUND_TRIP_MAX_RETRIES
value: {{ .Values.router.roundTrip.maxRetries | default 10 | quote }}
- name: ROUTER_SVC_ADDRESS_MAX_RETRIES
value: {{ .Values.router.svcAddressMaxRetries | default 5 | quote }}
- name: ROUTER_SVC_ADDRESS_UPDATE_TIMEOUT
value: {{ .Values.router.svcAddressUpdateTimeout | default "30s" | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.traceCollectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.router.traceSamplingRate | default "0.5" | quote }}
- name: USE_ENCODED_PATH
value: {{ .Values.router.useEncodedPath | default false | quote }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- if .Values.analytics }}
- name: ANALYTICS_URL
value: "https://g.fission.io/metrics"
{{- else if .Values.analyticsNonHelmInstall }}
- name: ANALYTICS_URL
value: "https://g.fission.io/metrics"
{{- end }}
readinessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/router-healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
serviceAccountName: fission-svc
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
+20
View File
@@ -6,6 +6,10 @@ metadata:
svc: router
application: fission-router
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
{{- if .Values.router.svcAnnotations }}
annotations:
{{ toYaml .Values.router.svcAnnotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.routerServiceType }}
ports:
@@ -53,3 +57,19 @@ spec:
targetPort: 8000
selector:
svc: storagesvc
---
apiVersion: v1
kind: Service
metadata:
name: executor
labels:
svc: executor
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
svc: executor
+83 -13
View File
@@ -10,23 +10,18 @@ serviceType: ClusterIP
routerServiceType: LoadBalancer
## Image base repository
## Leave it empty for using existing local image
repository: index.docker.io
## Fission image repository
image: fission/fission-bundle
## Fission image version
imageTag: 1.2.1
imageTag: 1.8.0
## Image pull policy
pullPolicy: IfNotPresent
## Fission fetcher repository
fetcherImage: fission/fetcher
## Fission fetcher image version
fetcherImageTag: 1.2.1
## Port at which Fission controller service should be exposed
controllerPort: 31313
@@ -44,6 +39,75 @@ builderNamespace: fission-builder
## Enable istio integration
enableIstio: false
fetcher:
## Fetcher repository
image: fission/fetcher
## Fetcher image version
imageTag: 1.8.0
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
resource:
cpu:
requests: "10m"
## Low CPU limits will increases the function specialization time.
limits: ""
mem:
requests: "16Mi"
limits: ""
executor:
adoptExistingResources: false
## Router config
router:
deployAsDaemonSet: false
svcAddressMaxRetries: 5
svcAddressUpdateTimeout: 30s
## Display endpoint access logs
## To be aware of enabling logging endpoint access log, it increases
## router resource utilization when under heavy workloads.
displayAccessLog: false
## Add annotations for router
# svcAnnotations:
# cloud.google.com/load-balancer-type: Internal
## For router to match encoded path.
## If true, "/foo%2Fbar" will match the path "/{var}";
## Otherwise, it will match the path "/foo/bar".
useEncodedPath: false
roundTrip:
## If true, router will disable the HTTP keep-alive which result in performance degradation.
## But it ensures that router can redirect new coming requests to new function pods.
##
## If false, router will enable transport keep-alive feature for better performance.
## However, the drawback is it takes longer to switch to newly created function pods
## if using newdeploy as executor type for function. If you want to preserve the
## performance while keeping the short switching time to new function, you can create
## an environment with short grace period by setting flag "--graceperiod" (default 360s),
## so that kubernetes will be able to reap old function pod quickly.
##
## For details, see https://github.com/fission/fission/issues/723
disableKeepAlive: true
## The keep-alive period for an active network connection to function pod.
keepAliveTime: 30s
## HTTP transport request timeout
timeout: 50ms
## The length of request timeout will multiply with timeoutExponent after each retry
timeoutExponent: 2
## Max retries times of a failed request
maxRetries: 10
## Sample with a rate per time window (traces/second)
traceSamplingRate: 0.5
## Persist data to a persistent volume.
persistence:
## If true, fission will create/use a Persistent Volume Claim
@@ -71,7 +135,7 @@ persistence:
## Extend the container specs for the core fission pods.
## Can be used to add things like affinty/tolerations/nodeSelectors/etc.
## For example:
## extraCoreComponmentPodConfig:
## extraCoreComponentPodConfig:
## affinity:
## nodeAffinity:
## requiredDuringSchedulingIgnoredDuringExecution:
@@ -81,7 +145,7 @@ persistence:
## operator: In
## values:
## - app
extraCoreComponmentPodConfig:
#extraCoreComponentPodConfig:
# affinity:
# tolerations:
# nodeSelector:
@@ -103,10 +167,16 @@ preUpgradeChecksImage: fission/pre-upgrade-checks
## if there are any pod specialization errors when a function is triggered and this flag is set to true, the error
## summary is returned as part of http response
debugEnv: true
debugEnv: false
## set this flag to true if prometheus needs to be deployed along with fission
prometheusDeploy: false
## Prometheus for scrapping service metrics
prometheus:
## set this flag to true if prometheus needs to be deployed along with fission
enabled: false
## If enabled is false, please assign the prometheus service URL
## that is accessible by components.
serviceEndpoint: ""
## set this flag to false if you dont need canary deployment feature
canaryDeployment:
@@ -114,4 +184,4 @@ canaryDeployment:
# Use these flags to enable opentracing, the variable is endpoint of Jaeger collector in the format shown below
#traceCollectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
#traceSamplingRate: 0.75
#traceSamplingRate: 0.75
+25 -6
View File
@@ -1,6 +1,27 @@
FROM golang:1.11-alpine as fission-builder
FROM golang:1.12-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
From godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/builder
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
@@ -10,17 +31,15 @@ ARG BUILDVERSION=unknown
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
ARG GOPKG=github.com/fission/fission
COPY . /go/src/${GOPKG}
WORKDIR /go/src/${GOPKG}/cmd/builder
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-o /go/bin/builder \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.5
COPY --from=fission-builder /go/bin/builder /
FROM alpine:3.10 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/builder /
EXPOSE 8001
ENTRYPOINT ["/builder"]
+24 -5
View File
@@ -1,6 +1,27 @@
FROM golang:1.11-alpine as builder
FROM golang:1.12-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
From godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/fetcher
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
@@ -10,16 +31,14 @@ ARG BUILDVERSION=unknown
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
ARG GOPKG=github.com/fission/fission
COPY . /go/src/${GOPKG}
WORKDIR /go/src/${GOPKG}/cmd/fetcher
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-o /go/bin/fetcher \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.4
FROM alpine:3.10 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/fetcher /
EXPOSE 8000
+27 -5
View File
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package app
import (
@@ -8,13 +24,12 @@ import (
"net/http"
"os"
"go.opencensus.io/exporter/jaeger"
"contrib.go.opencensus.io/exporter/jaeger"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/trace"
"go.uber.org/zap"
"github.com/fission/fission/pkg/fetcher"
"github.com/fission/fission/pkg/types"
)
func registerTraceExporter(collectorEndpoint string) error {
@@ -78,7 +93,7 @@ func Run(logger *zap.Logger) {
// do specialization in other goroutine to prevent blocking in newdeploy
go func() {
if *specializeOnStart {
var specializeReq types.FunctionSpecializeRequest
var specializeReq fetcher.FunctionSpecializeRequest
err := json.Unmarshal([]byte(*specializePayload), &specializeReq)
if err != nil {
@@ -100,17 +115,24 @@ func Run(logger *zap.Logger) {
mux.HandleFunc("/specialize", f.SpecializeHandler)
mux.HandleFunc("/upload", f.UploadHandler)
mux.HandleFunc("/version", f.VersionHandler)
mux.HandleFunc("/readniess-healthz", func(w http.ResponseWriter, r *http.Request) {
readinessHandler := func(w http.ResponseWriter, r *http.Request) {
if !*specializeOnStart || readyToServe {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusServiceUnavailable)
}
})
}
mux.HandleFunc("/readiness-healthz", readinessHandler)
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
// For backward compatibility
// TODO: remove this path in future
mux.HandleFunc("/readniess-healthz", readinessHandler)
logger.Info("fetcher ready to receive requests")
http.ListenAndServe(":8000", &ochttp.Handler{
Handler: mux,
+24 -8
View File
@@ -1,6 +1,27 @@
FROM golang:1.11-alpine as builder
FROM golang:1.12-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
From godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/fission-bundle
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
@@ -10,18 +31,13 @@ ARG BUILDVERSION=unknown
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
ARG GOPKG=github.com/fission/fission
COPY . /go/src/${GOPKG}
RUN rm -f /go/src/${GOPKG}/Dockerfile*
WORKDIR /go/src/${GOPKG}/cmd/fission-bundle
ENV GO111MODULE=on
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -mod vendor \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-o /go/bin/fission-bundle \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.4
FROM alpine:3.10 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/fission-bundle /
+42 -17
View File
@@ -1,3 +1,19 @@
/*
Copyright 2019 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
@@ -7,8 +23,8 @@ import (
"os"
"strconv"
"contrib.go.opencensus.io/exporter/jaeger"
docopt "github.com/docopt/docopt-go"
"go.opencensus.io/exporter/jaeger"
"go.opencensus.io/trace"
"go.uber.org/zap"
@@ -34,8 +50,8 @@ func runRouter(logger *zap.Logger, port int, executorUrl string) {
logger.Fatal("router exited")
}
func runExecutor(logger *zap.Logger, port int, fissionNamespace, functionNamespace, envBuilderNamespace string) {
err := executor.StartExecutor(logger, fissionNamespace, functionNamespace, envBuilderNamespace, port)
func runExecutor(logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string) {
err := executor.StartExecutor(logger, functionNamespace, envBuilderNamespace, port)
if err != nil {
logger.Fatal("error starting executor", zap.Error(err))
}
@@ -102,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
}
@@ -180,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.
@@ -208,7 +223,18 @@ Options:
--builderMgr Start builder manager.
--version Print version information
`
logger, err := zap.NewProduction()
var logger *zap.Logger
var err error
isDebugEnv, _ := strconv.ParseBool(os.Getenv("DEBUG_ENV"))
if isDebugEnv {
logger, err = zap.NewDevelopment()
} else {
config := zap.NewProductionConfig()
config.DisableStacktrace = true
logger, err = config.Build()
}
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
@@ -226,7 +252,6 @@ Options:
}
functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function")
fissionNs := getStringArgWithDefault(arguments["--fission-namespace"], "fission")
envBuilderNs := getStringArgWithDefault(arguments["--envbuilder-namespace"], "fission-builder")
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
@@ -245,7 +270,7 @@ Options:
if arguments["--executorPort"] != nil {
port := getPort(logger, arguments["--executorPort"])
runExecutor(logger, port, fissionNs, functionNs, envBuilderNs)
runExecutor(logger, port, functionNs, envBuilderNs)
}
if arguments["--kubewatcher"] == true {
+89
View File
@@ -0,0 +1,89 @@
package app
import (
"github.com/spf13/cobra"
"github.com/fission/fission/pkg/controller/client"
"github.com/fission/fission/pkg/controller/client/rest"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/fission-cli/cmd/canaryconfig"
"github.com/fission/fission/pkg/fission-cli/cmd/environment"
"github.com/fission/fission/pkg/fission-cli/cmd/function"
"github.com/fission/fission/pkg/fission-cli/cmd/httptrigger"
"github.com/fission/fission/pkg/fission-cli/cmd/kubewatch"
"github.com/fission/fission/pkg/fission-cli/cmd/mqtrigger"
_package "github.com/fission/fission/pkg/fission-cli/cmd/package"
"github.com/fission/fission/pkg/fission-cli/cmd/spec"
"github.com/fission/fission/pkg/fission-cli/cmd/support"
"github.com/fission/fission/pkg/fission-cli/cmd/timetrigger"
"github.com/fission/fission/pkg/fission-cli/cmd/version"
"github.com/fission/fission/pkg/fission-cli/console"
"github.com/fission/fission/pkg/fission-cli/flag"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
"github.com/fission/fission/pkg/fission-cli/util"
)
const (
usage = `Fission: Fast and Simple Serverless Functions for Kubernetes
* Github: https://github.com/fission/fission
* Documentation: https://docs.fission.io/docs
`
)
func App() *cobra.Command {
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
Use: "fission",
Long: usage,
//SilenceUsage: true,
PersistentPreRunE: wrapper.Wrapper(
func(input cli.Input) error {
console.Verbosity = input.Int(flagkey.Verbosity)
if input.IsSet(flagkey.ClientOnly) {
// TODO: use fake rest client for offline spec generation
cmd.SetClientset(client.MakeFakeClientset(nil))
} else {
serverUrl, err := util.GetServerURL(input)
if err != nil {
return err
}
restClient := rest.NewRESTClient(serverUrl)
cmd.SetClientset(client.MakeClientset(restClient))
}
return nil
},
),
}
// Workaround fix for not to show help command
// https://github.com/spf13/cobra/issues/587
rootCmd.SetHelpCommand(&cobra.Command{
Use: "no-help",
Hidden: true,
})
wrapper.SetFlags(rootCmd, flag.FlagSet{
Global: []flag.Flag{flag.GlobalServer, flag.GlobalVerbosity},
})
groups := helptemplate.CommandGroups{}
groups = append(groups, helptemplate.CreateCmdGroup("Basic Commands", environment.Commands(), _package.Commands(), function.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Trigger Commands", httptrigger.Commands(), mqtrigger.Commands(), timetrigger.Commands(), kubewatch.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Deploy Strategies Commands", canaryconfig.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Declarative Application Commands", spec.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Other Commands", support.Commands(), version.Commands()))
groups.Add(rootCmd)
flagExposer := helptemplate.ActsAsRootCommand(rootCmd, nil, groups...)
// show global options in usage
flagExposer.ExposeFlags(rootCmd, flagkey.Server, flagkey.Verbosity)
return rootCmd
}
+11 -2
View File
@@ -19,9 +19,18 @@ package main
import (
"os"
fcli "github.com/fission/fission/pkg/fission-cli"
"github.com/fission/fission/cmd/fission-cli/app"
"github.com/fission/fission/pkg/fission-cli/console"
)
func main() {
fcli.NewCliApp().Run(os.Args)
cmd := app.App()
cmd.SilenceErrors = true // use our own error message printer
err := cmd.Execute()
if err != nil {
// let program exit with non-zero code when error occurs
console.Error(err.Error())
os.Exit(1)
}
}
@@ -1,6 +1,27 @@
FROM golang:1.11-alpine as builder
FROM golang:1.12-alpine as godep
RUN apk add bash ca-certificates git gcc g++ libc-dev
ARG GOPKG=github.com/fission/fission
ENV GO111MODULE=on
WORKDIR /go/src/${GOPKG}
# To reuse build cache, copy go.mod & go.sum and download dependencies first.
COPY go.* ./
RUN go mod download
From godep as builder
ARG GOPKG
WORKDIR /go/src/${GOPKG}
# Copy whole fission directory to work dir
COPY ./ ./
WORKDIR /go/src/${GOPKG}/cmd/preupgradechecks
ARG GITCOMMIT=unknown
# E.g. GITCOMMIT=$(git rev-parse HEAD)
@@ -10,17 +31,13 @@ ARG BUILDVERSION=unknown
ARG BUILDDATE=unknown
# E.g. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
ARG GOPKG=github.com/fission/fission
COPY . /go/src/${GOPKG}
WORKDIR /go/src/${GOPKG}/cmd/preupgradechecks
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-o /go/bin/pre-upgrade-checks \
-gcflags=-trimpath=$GOPATH \
-asmflags=-trimpath=$GOPATH \
-ldflags "-X github.com/fission/fission/pkg/info.GitCommit=${GITCOMMIT} -X github.com/fission/fission/pkg/info.BuildDate=${BUILDDATE} -X github.com/fission/fission/pkg/info.Version=${BUILDVERSION}"
FROM alpine:3.4
FROM alpine:3.10 as base
RUN apk add --update ca-certificates
COPY --from=builder /go/bin/pre-upgrade-checks /
+23 -24
View File
@@ -27,9 +27,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/types"
"github.com/fission/fission/pkg/utils"
)
@@ -86,12 +85,11 @@ func (client *PreUpgradeTaskClient) IsFissionReInstall() bool {
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences() {
client.logger.Info("verifying function spec references for all functions in the cluster")
var result *multierror.Error
var err error
var fList *fv1.FunctionList
for i := 0; i < maxRetries; i++ {
fList, err = client.fissionClient.Functions(metav1.NamespaceAll).List(metav1.ListOptions{})
fList, err = client.fissionClient.CoreV1().Functions(metav1.NamespaceAll).List(metav1.ListOptions{})
if err == nil {
break
}
@@ -103,28 +101,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))
if secret.Namespace != fn.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, secret.Name, secret.Namespace))
}
}
configmaps := fn.Spec.ConfigMaps
for _, configmap := range configmaps {
if configmap.Namespace != fn.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))
if configmap.Namespace != fn.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, configmap.Name, configmap.Namespace))
}
}
if fn.Spec.Package.PackageRef.Namespace != fn.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))
if fn.Spec.Package.PackageRef.Namespace != fn.ObjectMeta.Namespace {
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
}
}
if 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"))
@@ -167,12 +167,12 @@ func (client *PreUpgradeTaskClient) RemoveClusterAdminRolesForFissionSAs() {
// This is because, we just deleted the ClusterRoleBindings for these service accounts in the previous function and
// for the existing functions to work, we need to give these SAs the right privileges
func (client *PreUpgradeTaskClient) NeedRoleBindings() bool {
pkgList, err := client.fissionClient.Packages(metav1.NamespaceDefault).List(metav1.ListOptions{})
pkgList, err := client.fissionClient.CoreV1().Packages(metav1.NamespaceDefault).List(metav1.ListOptions{})
if err == nil && len(pkgList.Items) > 0 {
return true
}
fnList, err := client.fissionClient.Functions(metav1.NamespaceDefault).List(metav1.ListOptions{})
fnList, err := client.fissionClient.CoreV1().Functions(metav1.NamespaceDefault).List(metav1.ListOptions{})
if err == nil && len(fnList.Items) > 0 {
return true
}
@@ -189,34 +189,33 @@ func (client *PreUpgradeTaskClient) SetupRoleBindings() {
// the fact that we're here implies that there had been a prior installation of fission and objects are present still
// so, we go ahead and create the role-bindings necessary for the fission-fetcher and fission-builder Service Accounts.
err := utils.SetupRoleBinding(client.logger, client.k8sClient, types.PackageGetterRB, metav1.NamespaceDefault, types.PackageGetterCR, types.ClusterRole, types.FissionFetcherSA, client.fnPodNs)
err := utils.SetupRoleBinding(client.logger, client.k8sClient, fv1.PackageGetterRB, metav1.NamespaceDefault, fv1.PackageGetterCR, fv1.ClusterRole, fv1.FissionFetcherSA, client.fnPodNs)
if err != nil {
client.logger.Fatal("error setting up rolebinding for service account",
zap.Error(err),
zap.String("role_binding", types.PackageGetterRB),
zap.String("service_account", types.FissionFetcherSA),
zap.String("role_binding", fv1.PackageGetterRB),
zap.String("service_account", fv1.FissionFetcherSA),
zap.String("service_account_namespace", client.fnPodNs))
}
err = utils.SetupRoleBinding(client.logger, client.k8sClient, types.PackageGetterRB, metav1.NamespaceDefault, types.PackageGetterCR, types.ClusterRole, types.FissionBuilderSA, client.envBuilderNs)
err = utils.SetupRoleBinding(client.logger, client.k8sClient, fv1.PackageGetterRB, metav1.NamespaceDefault, fv1.PackageGetterCR, fv1.ClusterRole, fv1.FissionBuilderSA, client.envBuilderNs)
if err != nil {
client.logger.Fatal("error setting up rolebinding for service account",
zap.Error(err),
zap.String("role_binding", types.PackageGetterRB),
zap.String("service_account", types.FissionBuilderSA),
zap.String("role_binding", fv1.PackageGetterRB),
zap.String("service_account", fv1.FissionBuilderSA),
zap.String("service_account_namespace", client.envBuilderNs))
}
err = utils.SetupRoleBinding(client.logger, client.k8sClient, types.SecretConfigMapGetterRB, metav1.NamespaceDefault, types.SecretConfigMapGetterCR, types.ClusterRole, types.FissionFetcherSA, client.fnPodNs)
err = utils.SetupRoleBinding(client.logger, client.k8sClient, fv1.SecretConfigMapGetterRB, metav1.NamespaceDefault, fv1.SecretConfigMapGetterCR, fv1.ClusterRole, fv1.FissionFetcherSA, client.fnPodNs)
if err != nil {
client.logger.Fatal("error setting up rolebinding for service account",
zap.Error(err),
zap.String("role_binding", types.SecretConfigMapGetterRB),
zap.String("service_account", types.FissionFetcherSA),
zap.String("role_binding", fv1.SecretConfigMapGetterRB),
zap.String("service_account", fv1.FissionFetcherSA),
zap.String("service_account_namespace", client.fnPodNs))
}
client.logger.Info("created rolebindings in default namespace",
zap.Strings("role_bindings", []string{types.PackageGetterRB, types.SecretConfigMapGetterRB}))
return
zap.Strings("role_bindings", []string{fv1.PackageGetterRB, fv1.SecretConfigMapGetterRB}))
}
-5
View File
@@ -81,11 +81,6 @@ clear
popd
#
# Record replay
#
clear
#
# Canary Deployments
#
+1 -1
View File
@@ -6,7 +6,7 @@ metadata:
name: guestbook
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
fission fn delete --name hi-py
fission route delete --name $(fission route list|grep hi|cut -f1 -d' ')
fission recorder delete --name my-recorder
kubectl -n fission delete pod redis-0
-7
View File
@@ -1,7 +0,0 @@
from flask import request
from flask import current_app
def main():
name=request.args["name"]
return "Hello, %s" % name
-28
View File
@@ -1,28 +0,0 @@
#!/bin/bash
DEMO_RUN_FAST=1
ROOT_DIR=$(dirname $0)/..
. $ROOT_DIR/util.sh
desc "A simple function that takes inputs"
run "cat hi.py"
desc "Set up function"
run "fission function create --name hi-py --env python --code hi.py --entrypoint hi.main"
desc "Set up route"
run "fission route create --function hi-py --url /hi --method GET"
desc "Set up recorder"
run "fission recorder create --name my-recorder --function hi-py"
desc "Run function"
run "curl http://$FISSION_ROUTER/hi?name=world"
desc "View recording"
run "fission records view -v"
requid=$(fission records view -v|tail -1|cut -f1 -d' ')
desc "Replay recording"
run "fission replay --reqUID $requid"
+2 -4
View File
@@ -38,10 +38,8 @@ func (e *Env) ToStringEnv() []string {
func NewEnv(stringEnv []string) *Env {
env := &Env{}
if stringEnv != nil {
for _, rawEnvVar := range stringEnv {
env.SetEnv(FromString(rawEnvVar))
}
for _, rawEnvVar := range stringEnv {
env.SetEnv(FromString(rawEnvVar))
}
return env
}
+7 -4
View File
@@ -1,21 +1,24 @@
ARG GO_VERSION=1.9.2
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
WORKDIR ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM ubuntu:18.04
WORKDIR /
FROM base
COPY --from=builder /server /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/server"]
EXPOSE 8888
+7 -4
View File
@@ -1,21 +1,24 @@
ARG GO_VERSION=1.11.4
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
WORKDIR ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM ubuntu:18.04
WORKDIR /
FROM base
COPY --from=builder /server /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/server"]
EXPOSE 8888
+24
View File
@@ -0,0 +1,24 @@
ARG GO_VERSION=1.12
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM base
COPY --from=builder /server /
ENTRYPOINT ["/server"]
EXPOSE 8888
+24
View File
@@ -0,0 +1,24 @@
ARG GO_VERSION=1.13
FROM ubuntu:18.04 AS base
WORKDIR /
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go
WORKDIR ${APP}
ADD context ${APP}/context
ADD server.go ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM base
COPY --from=builder /server /
ENTRYPOINT ["/server"]
EXPOSE 8888
+14
View File
@@ -0,0 +1,14 @@
ARG BUILDER_IMAGE=fission/builder
ARG GO_VERSION=1.12
FROM ${BUILDER_IMAGE}
FROM golang:${GO_VERSION}
ENV GOPATH /usr
ENV GO111MODULE on
WORKDIR ${GOPATH}
COPY --from=0 /builder /builder
ADD build.sh /usr/local/bin/build
+14
View File
@@ -0,0 +1,14 @@
ARG BUILDER_IMAGE=fission/builder
ARG GO_VERSION=1.13
FROM ${BUILDER_IMAGE}
FROM golang:${GO_VERSION}
ENV GOPATH /usr
ENV GO111MODULE on
WORKDIR ${GOPATH}
COPY --from=0 /builder /builder
ADD build.sh /usr/local/bin/build
+26 -2
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -eux
@@ -6,6 +6,9 @@ srcDir=${GOPATH}/src/$(basename ${SRC_PKG})
trap "rm -rf ${srcDir}" EXIT
# http://ask.xmodulo.com/compare-two-version-numbers.html
version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
if [ -d ${SRC_PKG} ]
then
echo "Building in directory ${srcDir}"
@@ -18,4 +21,25 @@ then
fi
cd ${srcDir}
go build -buildmode=plugin -i -o ${DEPLOY_PKG} .
if [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
if [ -f "go.mod" ]; then
go mod download
else
# still need to do this; otherwise, go will complain "cannot find main module".
go mod init
fi
else # go version lower than go 1.12
if [ -f "go.mod" ]; then
echo "Please update fission/go-builder and fission/go-env image to the latest version to support go module"
exit 1
fi
fi
# use vendor mode if the vendor dir exists when go version is greater
# than 1.12 (the version that fission started to support go module).
if [ -d "vendor" ] && [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then
go build -mod=vendor -buildmode=plugin -i -o ${DEPLOY_PKG} .
else
go build -buildmode=plugin -i -o ${DEPLOY_PKG} .
fi
+39 -47
View File
@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@@ -9,8 +10,12 @@ import (
"path/filepath"
"plugin"
"github.com/pkg/errors"
"go.uber.org/zap"
// DO NOT IMPORT THIRD PARTY PACKAGES
// The 3rd party package version used by go server may be
// different from the one in user's source code and will
// cause plugin version mismatched. Hence, we should never
// import any external packages except the Fission or built-in
// packages.
"github.com/fission/fission/environments/go/context"
)
@@ -40,33 +45,33 @@ type (
var userFunc http.HandlerFunc
func loadPlugin(logger *zap.Logger, codePath, entrypoint string) (http.HandlerFunc, error) {
func loadPlugin(codePath, entrypoint string) (http.HandlerFunc, error) {
// if codepath's a directory, load the file inside it
info, err := os.Stat(codePath)
if err != nil {
return nil, errors.Wrap(err, "error checking plugin path")
return nil, fmt.Errorf("error checking plugin path: %v", err)
}
if info.IsDir() {
files, err := ioutil.ReadDir(codePath)
if err != nil {
return nil, errors.Wrap(err, "error reading directory")
return nil, fmt.Errorf("error reading directory: %v", err)
}
if len(files) == 0 {
return nil, errors.New("No files to load")
return nil, fmt.Errorf("no files to load: %v", codePath)
}
fi := files[0]
codePath = filepath.Join(codePath, fi.Name())
}
logger.Info("loading plugin", zap.String("location", codePath))
log.Printf("loading plugin from %v", codePath)
p, err := plugin.Open(codePath)
if err != nil {
return nil, errors.Wrap(err, "error loading plugin")
return nil, fmt.Errorf("error loading plugin: %v", err)
}
sym, err := p.Lookup(entrypoint)
if err != nil {
return nil, errors.Wrap(err, "entry point not found")
return nil, fmt.Errorf("entry point not found: %v", err)
}
switch h := sym.(type) {
@@ -86,7 +91,7 @@ func loadPlugin(logger *zap.Logger, codePath, entrypoint string) (http.HandlerFu
}
}
func specializeHandler(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
func specializeHandler() func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if userFunc != nil {
w.WriteHeader(http.StatusBadRequest)
@@ -97,37 +102,33 @@ func specializeHandler(logger *zap.Logger) func(http.ResponseWriter, *http.Reque
_, err := os.Stat(CODE_PATH)
if err != nil {
if os.IsNotExist(err) {
log.Printf("code path (%v) does not exist: %v", CODE_PATH, err)
w.WriteHeader(http.StatusNotFound)
logger.Error("code path does not exist",
zap.Error(err),
zap.String("code_path", CODE_PATH))
w.Write([]byte(CODE_PATH + ": not found"))
return
} else {
logger.Error("unknown error looking for code path",
zap.Error(err),
zap.String("code_path", CODE_PATH))
err = errors.Wrap(err, "unknown error")
log.Printf("unknown error looking for code path(%v): %v", CODE_PATH, err)
err = fmt.Errorf("unknown error: %v", err)
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
}
}
logger.Info("specializing ...")
userFunc, err = loadPlugin(logger, CODE_PATH, "Handler")
log.Println("specializing ...")
userFunc, err = loadPlugin(CODE_PATH, "Handler")
if err != nil {
e := "error specializing function"
logger.Error(e, zap.Error(err))
err = fmt.Errorf("error specializing function: %v", err)
log.Println(err.Error())
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(errors.Wrap(err, e).Error()))
w.Write([]byte(err.Error()))
return
}
logger.Info("done")
log.Println("done")
}
}
func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
func specializeHandlerV2() func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if userFunc != nil {
w.WriteHeader(http.StatusBadRequest)
@@ -137,7 +138,7 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
body, err := ioutil.ReadAll(r.Body)
if err != nil {
logger.Error("error reading request body", zap.Error(err))
log.Printf("error reading request body: %v", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
@@ -151,33 +152,29 @@ func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Req
_, err = os.Stat(loadreq.FilePath)
if err != nil {
if os.IsNotExist(err) {
logger.Error("code path does not exist",
zap.Error(err),
zap.String("code_path", CODE_PATH))
log.Printf("code path (%v) does not exist: %v", loadreq.FilePath, err)
w.WriteHeader(http.StatusNotFound)
w.Write([]byte(CODE_PATH + ": not found"))
w.Write([]byte(loadreq.FilePath + ": not found"))
return
} else {
logger.Error("unknown error looking for code path",
zap.Error(err),
zap.String("code_path", CODE_PATH))
err = errors.Wrap(err, "unknown error")
log.Printf("unknown error looking for code path(%v): %v", loadreq.FilePath, err)
err = fmt.Errorf("unknown error: %v", err)
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
}
}
logger.Info("specializing ...")
userFunc, err = loadPlugin(logger, loadreq.FilePath, loadreq.FunctionName)
log.Println("specializing ...")
userFunc, err = loadPlugin(loadreq.FilePath, loadreq.FunctionName)
if err != nil {
e := "error specializing function"
logger.Error(e, zap.Error(err))
err = fmt.Errorf("error specializing function: %v", err)
log.Println(err.Error())
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(errors.Wrap(err, e).Error()))
w.Write([]byte(err.Error()))
return
}
logger.Info("done")
log.Println("done")
}
}
@@ -186,15 +183,10 @@ func readinessProbeHandler(w http.ResponseWriter, r *http.Request) {
}
func main() {
logger, err := zap.NewProduction()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
defer logger.Sync()
http.HandleFunc("/healthz", readinessProbeHandler)
http.HandleFunc("/specialize", specializeHandler(logger.Named("specialize_handler")))
http.HandleFunc("/v2/specialize", specializeHandlerV2(logger.Named("specialize_v2_handler")))
http.HandleFunc("/specialize", specializeHandler())
http.HandleFunc("/v2/specialize", specializeHandlerV2())
// Generic route -- all http requests go to the user function.
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@@ -206,6 +198,6 @@ func main() {
userFunc(w, r)
})
logger.Info("listening on 8888 ...")
log.Println("listening on 8888 ...")
http.ListenAndServe(":8888", nil)
}
+9 -3
View File
@@ -1,7 +1,13 @@
FROM maven:3.5-jdk-8 as BUILD
COPY src /usr/src/myapp/src
COPY pom.xml /usr/src/myapp
RUN mvn -f /usr/src/myapp/pom.xml clean package
WORKDIR /usr/src/myapp/
# To reuse the build cache, here we split maven dependency
# download and package into two RUN commands to avoid cache invalidation.
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src /usr/src/myapp/src/
RUN mvn package
FROM openjdk:8-jdk-alpine
VOLUME /tmp
+3 -2
View File
@@ -16,7 +16,8 @@ ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
ENV JAVA_VERSION 8u181
ENV JAVA_ALPINE_VERSION 8.181.13-r0
## Use "fuzzy" version matching to pin the version to a major/minor release
ENV JAVA_ALPINE_VERSION "~8"
RUN set -x \
&& apk add --no-cache \
@@ -44,4 +45,4 @@ ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
## Fission builder specific section
ADD build.sh /usr/local/bin/build
EXPOSE 8001
EXPOSE 8001
+4
View File
@@ -24,6 +24,10 @@
<artifactId>fission-java-core</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
</dependencies>
<build>
+1 -1
View File
@@ -5,7 +5,7 @@
"contributors": [
{
"name": "Soam Vasani",
"email": "soamvasani@platform9.com"
"email": "soamvasani+1@gmail.com"
},
{
"name": "Gary Yeap",
+15 -4
View File
@@ -13,6 +13,12 @@ if (!argv.port) {
argv.port = 8888;
}
// To catch unhandled exceptions thrown by user code async callbacks,
// these exceptions cannot be catched by try-catch in user function invocation code below
process.on('uncaughtException', (err) => {
console.error(`Caught exception: ${err}`);
});
// User function. Starts out undefined.
let userFunction;
@@ -91,7 +97,7 @@ function specialize(req, res) {
// Request logger
app.use(morgan('combined'))
app.use(morgan('combined'));
app.use(bodyParser.urlencoded({ extended: false, limit: '1mb' }));
app.use(bodyParser.json({limit: '1mb'}));
@@ -132,10 +138,15 @@ app.all('/', function (req, res) {
// you can do that here by adding properties to the context.
//
let functionProm;
if (userFunction.length === 1) { // One argument (context)
if (userFunction.length <= 1) { // One or zero argument (context)
let result;
// Make sure their function returns a promise
Promise.resolve(userFunction(context)).then(function({ status, body, headers }) {
if (userFunction.length === 0) {
result = Promise.resolve(userFunction())
} else {
result = Promise.resolve(userFunction(context))
}
result.then(function({status, body, headers}) {
callback(status, body, headers);
}).catch(function(err) {
console.log(`Function error: ${err}`);
+8 -7
View File
@@ -1,14 +1,15 @@
FROM alpine:3.5
RUN apk update
RUN apk add --no-cache python3 python3-dev build-base libev-dev
RUN pip3 install --upgrade pip
RUN rm -r /root/.cache
WORKDIR /app
RUN apk add --no-cache python3 python3-dev build-base libev-dev && \
pip3 install --upgrade pip && \
rm -r /root/.cache
COPY requirements.txt /app
RUN pip3 install -r requirements.txt
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
ENTRYPOINT ["python3"]
CMD ["server.py"]
+8 -7
View File
@@ -1,14 +1,15 @@
FROM alpine:3.5
RUN apk update
RUN apk add --no-cache python python-dev build-base py-pip libev-dev
RUN pip install --upgrade pip
RUN rm -r /root/.cache
WORKDIR /app
RUN apk add --no-cache python python-dev build-base py-pip libev-dev && \
pip install --upgrade pip && \
rm -r /root/.cache
COPY requirements.txt /app
RUN pip install -r requirements.txt
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["server.py"]
+1 -1
View File
@@ -1,4 +1,4 @@
flask ~= 0.12.3
flask ~= 1.0.4
bjoern
httplib2
python-dateutil
+8 -1
View File
@@ -1,13 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
rack (2.0.6)
daemons (1.3.1)
eventmachine (1.2.7)
rack (2.0.8)
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
PLATFORMS
ruby
DEPENDENCIES
rack
thin
BUNDLED WITH
1.15.1
@@ -0,0 +1,23 @@
ARG GO_VERSION=1.9.2
FROM tensorflow/serving as serving
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
FROM golang:${GO_VERSION} AS builder
ENV GOPATH /usr
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/tensorflow-serving
WORKDIR ${APP}
ADD server.go ${APP}
RUN go get
RUN go build -a -o /server server.go
FROM serving
WORKDIR /
COPY --from=builder /server /
ENTRYPOINT ["/server"]
EXPOSE 8888
+29
View File
@@ -0,0 +1,29 @@
# Fission: Tensorflow Serving Environment
This is the Tensorflow Serving environment for Fission.
It's a Docker image containing a Go runtime, along with a tensorflow serving service.
## How it works
Tensorflow Serving is an serving service that supports both RESTful API and gRPC endpoints. In current implementation,
Go server launches `tensorflow_model_server` to load in model during specialization. As long as the Go server receives
requests from router it creates a reverse proxy that connects to RESTful API endpoint exposed by tensorflow_model_server
and get response from the upstream server for user.
## Build this image
```
docker build -t USER/tensorflow-serving . && docker push USER/tensorflow-serving
```
## Using the image in fission
You can add this customized image to fission with "fission env create":
```
fission env create --name tensorflow --image USER/tensorflow-serving --version 2
```
After this, fission functions that have the env parameter set to the
same environment name as this command will use this environment.
+226
View File
@@ -0,0 +1,226 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/httputil"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/pkg/errors"
"go.uber.org/zap"
)
const (
PortgRPC = 8500
PortRestAPI = 8501
)
var (
specialized = false
// for tensorflow serving to use
MODEL_NAME = ""
API_TYPE = ""
)
type (
FunctionLoadRequest struct {
// FilePath is an absolute filesystem path to the
// function. What exactly is stored here is
// env-specific. Optional.
FilePath string `json:"filepath"`
// FunctionName has an environment-specific meaning;
// usually, it defines a function within a module
// containing multiple functions. Optional; default is
// environment-specific.
FunctionName string `json:"functionName"`
// URL to expose this function at. Optional; defaults
// to "/".
URL string `json:"url"`
}
)
func specializeHandler(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
logger.Error("v1 interface is not implemented")
w.WriteHeader(http.StatusNotImplemented)
}
}
func specializeHandlerV2(logger *zap.Logger) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if specialized {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("Not a generic container"))
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
logger.Error("error reading request body", zap.Error(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
var loadreq FunctionLoadRequest
err = json.Unmarshal(body, &loadreq)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
// Tensorflow-serving supports three types of API: classify, regress, predict
// To get the API type, we need to split the entry point with separator ":"
// POST http://host:port/v1/models/${MODEL_NAME}:(classify|regress:predict)
entrypoint := strings.Split(loadreq.FunctionName, ":")
modelDir, apiType := "", ""
if len(entrypoint) == 0 {
logger.Error("unable to load model due to empty entrypoint")
w.WriteHeader(http.StatusBadRequest)
return
} else if len(entrypoint) == 1 {
modelDir = entrypoint[0]
apiType = "predict" // assign default API type
} else {
modelDir = entrypoint[0]
apiType = entrypoint[1]
}
// To ensure we load model from the expected path
basePath := fmt.Sprintf("%v/%v", loadreq.FilePath, modelDir)
basePath, err = filepath.Abs(basePath)
if err != nil {
msg := "error getting absolute path of model"
logger.Error(msg, zap.Error(err))
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
} else if !strings.HasPrefix(basePath, loadreq.FilePath) {
msg := "incorrect model base path"
logger.Error(msg, zap.String("model_base_path", basePath))
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(msg))
return
}
_, err = os.Stat(basePath)
if err != nil {
msg := "error checking model status"
logger.Error(msg, zap.Error(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
// get directory name that holds model
MODEL_NAME = filepath.Base(basePath)
API_TYPE = apiType
argModelBasePath := fmt.Sprintf("--model_base_path=%v", basePath)
argModelName := fmt.Sprintf("--model_name=%v", MODEL_NAME)
argPortgRPC := fmt.Sprintf("--port=%v", PortgRPC)
argPortREST := fmt.Sprintf("--rest_api_port=%v", PortRestAPI)
logger.Info(fmt.Sprintf("specializing: %v %v", loadreq.FunctionName, loadreq.FilePath))
// Future: could be improved by keeping subprocess open while environment is specialized
cmd := exec.Command("tensorflow_model_server",
argPortgRPC, argPortREST, argModelName, argModelBasePath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Start()
if err != nil {
msg := "error starting tensorflow serving"
logger.Error(msg, zap.Error(err))
err = errors.Wrap(err, msg)
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
}
go func() {
err = cmd.Wait()
if err != nil {
logger.Fatal("error running tensorflow serving", zap.Error(err))
}
}()
t := time.Now()
retryInterval := 50 * time.Millisecond
// tensorflow serving takes some time to load model
// into memory, keep retrying until it starts REST api server.
for {
if time.Since(t) > 30*time.Second {
w.WriteHeader(http.StatusGatewayTimeout)
return
}
conn, err := net.Dial("tcp", "localhost:8501")
if err == nil {
conn.Close()
break
} else {
logger.Info(fmt.Sprintf("waiting for tensorflow serving to be ready: %v", err.Error()))
time.Sleep(retryInterval)
retryInterval = retryInterval * 2
}
}
specialized = true
logger.Info("done")
}
}
func readinessProbeHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func main() {
logger, err := zap.NewProduction()
if err != nil {
log.Fatalf("can't initialize zap logger: %v", err)
}
defer logger.Sync()
http.HandleFunc("/healthz", readinessProbeHandler)
http.HandleFunc("/specialize", specializeHandler(logger.Named("specialize_handler")))
http.HandleFunc("/v2/specialize", specializeHandlerV2(logger.Named("specialize_v2_handler")))
// Generic route -- all http requests go to the user function.
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if !specialized {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("Generic container: no requests supported"))
return
}
// TODO: replace it with gRPC (https://gist.github.com/mauri870/1f953a183ee6c186e70a0a72e78b088c)
// set up proxy server director
director := func(req *http.Request) {
req.URL.Scheme = "http"
req.URL.Host = "localhost:8501"
req.URL.Path = fmt.Sprintf("/v1/models/%v:%v", MODEL_NAME, API_TYPE)
req.Host = "localhost:8501"
}
proxy := &httputil.ReverseProxy{
Director: director,
}
proxy.ServeHTTP(w, r)
})
logger.Info("listening on 8888 ...")
http.ListenAndServe(":8888", nil)
}
+35
View File
@@ -0,0 +1,35 @@
# Go module usage
1. Initialize your project
```bash
$ go mod init "<module>"
```
For example,
```bash
$ go mod init "github.com/fission/fission/examples/go/go-module-example"
```
2. Add dependencies
* See [here](https://github.com/golang/go/wiki/Modules#daily-workflow)
3. Verify
```bash
$ go mod verify
```
4. Archive and create package as usual
```bash
$ zip -r go.zip .
adding: go.mod (deflated 26%)
adding: go.sum (deflated 1%)
adding: README.md (deflated 37%)
adding: main.go (deflated 30%)
$ fission pkg create --env go --src go.zip
```
+3
View File
@@ -0,0 +1,3 @@
module github.com/fission/fission/examples/go/go-module-example
require github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
+1
View File
@@ -0,0 +1 @@
github.com/golang/example v0.0.0-20170904185048-46695d81d1fa/go.mod h1:tO/5UvQ/uKigUjQBPqzstj6uxd3fUIjddi19DxGJeWg=
+2 -3
View File
@@ -7,7 +7,6 @@ spec:
version: 2
builder:
command: build
image: fission/go-builder:0.6.0
image: fission/go-builder-1.12:1.5.0
runtime:
image: fission/go-env:0.6.0
image: fission/go-env-1.12:1.5.0
+1
View File
@@ -31,6 +31,7 @@ spec:
environment:
name: go
namespace: default
functionTimeout: 60
package:
functionName: Handler
packageref:
-202
View File
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-65
View File
@@ -1,65 +0,0 @@
# Go example projects
This repository contains a collection of Go programs and libraries that
demonstrate the language, standard libraries, and tools.
## The examples
### [hello](hello/) ([godoc](//godoc.org/github.com/golang/example/hello)) and [stringutil](stringutil/) ([godoc](//godoc.org/github.com/golang/example/stringutil))
go get github.com/golang/example/hello
A trivial "Hello, world" program that uses a stringutil package.
Command [hello](hello/) covers:
* The basic form of an executable command
* Importing packages (from the standard library and the local repository)
* Printing strings ([fmt](//golang.org/pkg/fmt/))
Library [stringutil](stringutil/) covers:
* The basic form of a library
* Conversion between string and []rune
* Table-driven unit tests ([testing](//golang.org/pkg/testing/))
### [outyet](outyet/) ([godoc](//godoc.org/github.com/golang/example/outyet))
go get github.com/golang/example/outyet
A web server that answers the question: "Is Go 1.x out yet?"
Topics covered:
* Command-line flags ([flag](//golang.org/pkg/flag/))
* Web servers ([net/http](//golang.org/pkg/net/http/))
* HTML Templates ([html/template](//golang.org/pkg/html/template/))
* Logging ([log](//golang.org/pkg/log/))
* Long-running background processes
* Synchronizing data access between goroutines ([sync](//golang.org/pkg/sync/))
* Exporting server state for monitoring ([expvar](//golang.org/pkg/expvar/))
* Unit and integration tests ([testing](//golang.org/pkg/testing/))
* Dependency injection
* Time ([time](//golang.org/pkg/time/))
### [appengine-hello](appengine-hello/) ([godoc](//godoc.org/github.com/golang/example/appengine-hello))
goapp get github.com/golang/example/appengine-hello
A trivial "Hello, world" App Engine application intended to be used as the
starting point for your own code.
_Note_: The `goapp` tool is part of the [Google App Engine SDK for Go](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go).
### [gotypes](gotypes/) ([godoc](//godoc.org/github.com/golang/example/gotypes))
The `go/types` package is a type-checker for Go programs. It is one of the most
complex packages in Go's standard library, so we have provided this tutorial to
help you find your bearings. It comes with several example programs that you
can obtain using `go get` and play with as you learn to build tools that analyze
or manipulate Go programs.
### [template](template/) ([godoc](//godoc.org/github.com/golang/example/template))
A trivial web server that demonstrates the use of the
[`template` package](https://golang.org/pkg/text/template/)'s `block` feature.
@@ -1,11 +0,0 @@
This code is a starting point for your Google App Engine application in
Go.
To run the application locally you need the install the [Go Cloud
SDK](https://cloud.google.com/appengine/docs/go/#Go_tools) and execute the next
command from the directory containing this file:
$ goapp serve app.yaml
To deploy the application you have to first create an App Engine project
and use it as the application file in all the yaml files.
@@ -1,32 +0,0 @@
// Copyright 2015 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package hello is a simple App Engine application that replies to requests
// on /hello with a welcoming message.
package hello
import (
"fmt"
"net/http"
)
// init is run before the application starts serving.
func init() {
// Handle all requests with path /hello with the helloHandler function.
http.HandleFunc("/hello", helloHandler)
}
func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from the Go app")
}
@@ -1,32 +0,0 @@
# Copyright 2015 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http:#www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to writing, software distributed
# under the License is distributed on a "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
application: you-application-id
version: 1
runtime: go
api_version: go1
handlers:
- url: /hello
script: _go_app
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
- url: /
static_files: static/index.html
upload: static/index.html
- url: /
static_dir: static
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -1,34 +0,0 @@
<!DOCTYPE html>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>Hello, world</title>
<link rel="stylesheet" href="/style.css">
<script src="/script.js"></script>
</head>
<body>
<h1>Hello, world</h1>
<button onclick="fetchMessage()">Fetch Message</button>
<p id="message">Click on the button to fetch the message.</p>
</body>
</html>
@@ -1,13 +0,0 @@
all: README.md
go build ./...
README.md: go-types.md weave.go $(wildcard */*.go)
go run weave.go go-types.md >README.md
# This is for previewing using github.
# $HOME/markdown must be a github client.
test: README.md
cp README.md $$HOME/markdown/
(cd $$HOME/markdown/ && git commit -m . README.md && git push)
File diff suppressed because it is too large Load Diff
@@ -1,68 +0,0 @@
package main
import (
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
)
const hello = `package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
`
//!+
func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
Defs: make(map[*ast.Ident]types.Object),
Uses: make(map[*ast.Ident]types.Object),
}
_, err := conf.Check("hello", fset, files, info)
if err != nil {
return err // type error
}
for id, obj := range info.Defs {
fmt.Printf("%s: %q defines %v\n",
fset.Position(id.Pos()), id.Name, obj)
}
for id, obj := range info.Uses {
fmt.Printf("%s: %q uses %v\n",
fset.Position(id.Pos()), id.Name, obj)
}
return nil
}
//!-
func main() {
// Parse one file.
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "hello.go", hello, 0)
if err != nil {
log.Fatal(err) // parse error
}
if err := PrintDefsUses(fset, f); err != nil {
log.Fatal(err) // type error
}
}
/*
//!+output
$ go build github.com/golang/example/gotypes/defsuses
$ ./defsuses
hello.go:1:9: "main" defines <nil>
hello.go:5:6: "main" defines func hello.main()
hello.go:6:9: "fmt" uses package fmt
hello.go:6:13: "Println" uses func fmt.Println(a ...interface{}) (n int, err error)
//!-output
*/
@@ -1,77 +0,0 @@
// The doc command prints the doc comment of a package-level object.
package main
import (
"fmt"
"go/ast"
"go/parser"
"log"
"os"
// TODO: these will use std go/types after Feb 2016
"golang.org/x/tools/go/loader"
"golang.org/x/tools/go/types/typeutil"
)
func main() {
if len(os.Args) != 3 {
log.Fatal("Usage: doc <package> <object>")
}
//!+part1
pkgpath, name := os.Args[1], os.Args[2]
// The loader loads a complete Go program from source code.
conf := loader.Config{ParserMode: parser.ParseComments}
conf.Import(pkgpath)
lprog, err := conf.Load()
if err != nil {
log.Fatal(err) // load error
}
// Find the package and package-level object.
pkg := lprog.Package(pkgpath).Pkg
obj := pkg.Scope().Lookup(name)
if obj == nil {
log.Fatalf("%s.%s not found", pkg.Path(), name)
}
//!-part1
//!+part2
// Print the object and its methods (incl. location of definition).
fmt.Println(obj)
for _, sel := range typeutil.IntuitiveMethodSet(obj.Type(), nil) {
fmt.Printf("%s: %s\n", lprog.Fset.Position(sel.Obj().Pos()), sel)
}
// Find the path from the root of the AST to the object's position.
// Walk up to the enclosing ast.Decl for the doc comment.
_, path, _ := lprog.PathEnclosingInterval(obj.Pos(), obj.Pos())
for _, n := range path {
switch n := n.(type) {
case *ast.GenDecl:
fmt.Println("\n", n.Doc.Text())
return
case *ast.FuncDecl:
fmt.Println("\n", n.Doc.Text())
return
}
}
//!-part2
}
/*
//!+output
$ ./doc net/http File
type net/http.File interface{Readdir(count int) ([]os.FileInfo, error); Seek(offset int64, whence int) (int64, error); Stat() (os.FileInfo, error); io.Closer; io.Reader}
/go/src/io/io.go:92:2: method (net/http.File) Close() error
/go/src/io/io.go:71:2: method (net/http.File) Read(p []byte) (n int, err error)
/go/src/net/http/fs.go:65:2: method (net/http.File) Readdir(count int) ([]os.FileInfo, error)
/go/src/net/http/fs.go:66:2: method (net/http.File) Seek(offset int64, whence int) (int64, error)
/go/src/net/http/fs.go:67:2: method (net/http.File) Stat() (os.FileInfo, error)
A File is returned by a FileSystem's Open method and can be
served by the FileServer implementation.
The methods should behave the same as those on an *os.File.
//!-output
*/
File diff suppressed because it is too large Load Diff
@@ -1,10 +0,0 @@
//!+
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
//!-
@@ -1,81 +0,0 @@
// The hugeparam command identifies by-value parameters that are larger than n bytes.
//
// Example:
// $ ./hugeparams encoding/xml
package main
import (
"flag"
"fmt"
"go/ast"
"go/token"
"go/types"
"log"
"golang.org/x/tools/go/loader"
)
//!+
var bytesFlag = flag.Int("bytes", 48, "maximum parameter size in bytes")
var sizeof = (&types.StdSizes{8, 8}).Sizeof // the sizeof function
func PrintHugeParams(fset *token.FileSet, info *types.Info, files []*ast.File) {
checkTuple := func(descr string, tuple *types.Tuple) {
for i := 0; i < tuple.Len(); i++ {
v := tuple.At(i)
if sz := sizeof(v.Type()); sz > int64(*bytesFlag) {
fmt.Printf("%s: %q %s: %s = %d bytes\n",
fset.Position(v.Pos()),
v.Name(), descr, v.Type(), sz)
}
}
}
checkSig := func(sig *types.Signature) {
checkTuple("parameter", sig.Params())
checkTuple("result", sig.Results())
}
for _, file := range files {
ast.Inspect(file, func(n ast.Node) bool {
switch n := n.(type) {
case *ast.FuncDecl:
checkSig(info.Defs[n.Name].Type().(*types.Signature))
case *ast.FuncLit:
checkSig(info.Types[n.Type].Type.(*types.Signature))
}
return true
})
}
}
//!-
func main() {
flag.Parse()
// The loader loads a complete Go program from source code.
var conf loader.Config
_, err := conf.FromArgs(flag.Args(), false)
if err != nil {
log.Fatal(err) // command syntax error
}
lprog, err := conf.Load()
if err != nil {
log.Fatal(err) // load error
}
for _, info := range lprog.InitialPackages() {
PrintHugeParams(lprog.Fset, &info.Info, info.Files)
}
}
/*
//!+output
% ./hugeparam encoding/xml
/go/src/encoding/xml/marshal.go:167:50: "start" parameter: encoding/xml.StartElement = 56 bytes
/go/src/encoding/xml/marshal.go:734:97: "" result: encoding/xml.StartElement = 56 bytes
/go/src/encoding/xml/marshal.go:761:51: "start" parameter: encoding/xml.StartElement = 56 bytes
/go/src/encoding/xml/marshal.go:781:68: "start" parameter: encoding/xml.StartElement = 56 bytes
/go/src/encoding/xml/xml.go:72:30: "" result: encoding/xml.StartElement = 56 bytes
//!-output
*/
@@ -1,77 +0,0 @@
package main
import (
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
)
//!+input
const input = `package main
type A struct{}
func (*A) f()
type B int
func (B) f()
func (*B) g()
type I interface { f() }
type J interface { g() }
`
//!-input
func main() {
// Parse one file.
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "input.go", input, 0)
if err != nil {
log.Fatal(err) // parse error
}
conf := types.Config{Importer: importer.Default()}
pkg, err := conf.Check("hello", fset, []*ast.File{f}, nil)
if err != nil {
log.Fatal(err) // type error
}
//!+implements
// Find all named types at package level.
var allNamed []*types.Named
for _, name := range pkg.Scope().Names() {
if obj, ok := pkg.Scope().Lookup(name).(*types.TypeName); ok {
allNamed = append(allNamed, obj.Type().(*types.Named))
}
}
// Test assignability of all distinct pairs of
// named types (T, U) where U is an interface.
for _, T := range allNamed {
for _, U := range allNamed {
if T == U || !types.IsInterface(U) {
continue
}
if types.AssignableTo(T, U) {
fmt.Printf("%s satisfies %s\n", T, U)
} else if !types.IsInterface(T) &&
types.AssignableTo(types.NewPointer(T), U) {
fmt.Printf("%s satisfies %s\n", types.NewPointer(T), U)
}
}
}
//!-implements
}
/*
//!+output
$ go build github.com/golang/example/gotypes/implements
$ ./implements
*hello.A satisfies hello.I
hello.B satisfies hello.I
*hello.B satisfies hello.J
//!-output
*/
@@ -1,77 +0,0 @@
package main
import (
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
"strings"
)
//!+input
const hello = `
package main
import "fmt"
// append
func main() {
// fmt
fmt.Println("Hello, world")
// main
main, x := 1, 2
// main
print(main, x)
// x
}
// x
`
//!-input
//!+main
func main() {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments)
if err != nil {
log.Fatal(err) // parse error
}
conf := types.Config{Importer: importer.Default()}
pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil)
if err != nil {
log.Fatal(err) // type error
}
// Each comment contains a name.
// Look up that name in the innermost scope enclosing the comment.
for _, comment := range f.Comments {
pos := comment.Pos()
name := strings.TrimSpace(comment.Text())
fmt.Printf("At %s,\t%q = ", fset.Position(pos), name)
inner := pkg.Scope().Innermost(pos)
if _, obj := inner.LookupParent(name, pos); obj != nil {
fmt.Println(obj)
} else {
fmt.Println("not found")
}
}
}
//!-main
/*
//!+output
$ go build github.com/golang/example/gotypes/lookup
$ ./lookup
At hello.go:6:1, "append" = builtin append
At hello.go:8:9, "fmt" = package fmt
At hello.go:10:9, "main" = func cmd/hello.main()
At hello.go:12:9, "main" = var main int
At hello.go:14:9, "x" = var x int
At hello.go:16:1, "x" = not found
//!-output
*/
@@ -1,104 +0,0 @@
package main
import (
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
)
//!+input
const input = `package main
import "bytes"
func main() {
var buf bytes.Buffer
if buf.Bytes == nil && bytes.Repeat != nil && main == nil {
// ...
}
}
`
//!-input
var fset = token.NewFileSet()
func main() {
f, err := parser.ParseFile(fset, "input.go", input, 0)
if err != nil {
log.Fatal(err) // parse error
}
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
Defs: make(map[*ast.Ident]types.Object),
Uses: make(map[*ast.Ident]types.Object),
Types: make(map[ast.Expr]types.TypeAndValue),
}
if _, err = conf.Check("cmd/hello", fset, []*ast.File{f}, info); err != nil {
log.Fatal(err) // type error
}
ast.Inspect(f, func(n ast.Node) bool {
if n != nil {
CheckNilFuncComparison(info, n)
}
return true
})
}
//!+
// CheckNilFuncComparison reports unintended comparisons
// of functions against nil, e.g., "if x.Method == nil {".
func CheckNilFuncComparison(info *types.Info, n ast.Node) {
e, ok := n.(*ast.BinaryExpr)
if !ok {
return // not a binary operation
}
if e.Op != token.EQL && e.Op != token.NEQ {
return // not a comparison
}
// If this is a comparison against nil, find the other operand.
var other ast.Expr
if info.Types[e.X].IsNil() {
other = e.Y
} else if info.Types[e.Y].IsNil() {
other = e.X
} else {
return // not a comparison against nil
}
// Find the object.
var obj types.Object
switch v := other.(type) {
case *ast.Ident:
obj = info.Uses[v]
case *ast.SelectorExpr:
obj = info.Uses[v.Sel]
default:
return // not an identifier or selection
}
if _, ok := obj.(*types.Func); !ok {
return // not a function or method
}
fmt.Printf("%s: comparison of function %v %v nil is always %v\n",
fset.Position(e.Pos()), obj.Name(), e.Op, e.Op == token.NEQ)
}
//!-
/*
//!+output
$ go build github.com/golang/example/gotypes/nilfunc
$ ./nilfunc
input.go:7:5: comparison of function Bytes == nil is always false
input.go:7:25: comparison of function Repeat != nil is always true
input.go:7:48: comparison of function main == nil is always false
//!-output
*/
@@ -1,64 +0,0 @@
//!+
package main
import (
"fmt"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
)
const hello = `package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}`
func main() {
fset := token.NewFileSet()
// Parse the input string, []byte, or io.Reader,
// recording position information in fset.
// ParseFile returns an *ast.File, a syntax tree.
f, err := parser.ParseFile(fset, "hello.go", hello, 0)
if err != nil {
log.Fatal(err) // parse error
}
// A Config controls various options of the type checker.
// The defaults work fine except for one setting:
// we must specify how to deal with imports.
conf := types.Config{Importer: importer.Default()}
// Type-check the package containing only file f.
// Check returns a *types.Package.
pkg, err := conf.Check("cmd/hello", fset, []*ast.File{f}, nil)
if err != nil {
log.Fatal(err) // type error
}
fmt.Printf("Package %q\n", pkg.Path())
fmt.Printf("Name: %s\n", pkg.Name())
fmt.Printf("Imports: %s\n", pkg.Imports())
fmt.Printf("Scope: %s\n", pkg.Scope())
}
//!-
/*
//!+output
$ go build github.com/golang/example/gotypes/pkginfo
$ ./pkginfo
Package "cmd/hello"
Name: main
Imports: [package fmt ("fmt")]
Scope: package "cmd/hello" scope 0x820533590 {
. func cmd/hello.main()
}
//!-output
*/
@@ -1,115 +0,0 @@
// The skeleton command prints the boilerplate for a concrete type
// that implements the specified interface type.
//
// Example:
// $ ./skeleton io ReadWriteCloser buffer
// // *buffer implements io.ReadWriteCloser.
// type buffer struct{ /* ... */ }
// func (b *buffer) Close() error { panic("unimplemented") }
// func (b *buffer) Read(p []byte) (n int, err error) { panic("unimplemented") }
// func (b *buffer) Write(p []byte) (n int, err error) { panic("unimplemented") }
package main
import (
"fmt"
"go/types"
"log"
"os"
"strings"
"unicode"
"unicode/utf8"
"golang.org/x/tools/go/loader"
)
const usage = "Usage: skeleton <package> <interface> <concrete>"
//!+
func PrintSkeleton(pkg *types.Package, ifacename, concname string) error {
obj := pkg.Scope().Lookup(ifacename)
if obj == nil {
return fmt.Errorf("%s.%s not found", pkg.Path(), ifacename)
}
if _, ok := obj.(*types.TypeName); !ok {
return fmt.Errorf("%v is not a named type", obj)
}
iface, ok := obj.Type().Underlying().(*types.Interface)
if !ok {
return fmt.Errorf("type %v is a %T, not an interface",
obj, obj.Type().Underlying())
}
// Use first letter of type name as receiver parameter.
if !isValidIdentifier(concname) {
return fmt.Errorf("invalid concrete type name: %q", concname)
}
r, _ := utf8.DecodeRuneInString(concname)
fmt.Printf("// *%s implements %s.%s.\n", concname, pkg.Path(), ifacename)
fmt.Printf("type %s struct{}\n", concname)
mset := types.NewMethodSet(iface)
for i := 0; i < mset.Len(); i++ {
meth := mset.At(i).Obj()
sig := types.TypeString(meth.Type(), (*types.Package).Name)
fmt.Printf("func (%c *%s) %s%s {\n\tpanic(\"unimplemented\")\n}\n",
r, concname, meth.Name(),
strings.TrimPrefix(sig, "func"))
}
return nil
}
//!-
func isValidIdentifier(id string) bool {
for i, r := range id {
if !unicode.IsLetter(r) &&
!(i > 0 && unicode.IsDigit(r)) {
return false
}
}
return id != ""
}
func main() {
if len(os.Args) != 4 {
log.Fatal(usage)
}
pkgpath, ifacename, concname := os.Args[1], os.Args[2], os.Args[3]
// The loader loads a complete Go program from source code.
var conf loader.Config
conf.Import(pkgpath)
lprog, err := conf.Load()
if err != nil {
log.Fatal(err) // load error
}
pkg := lprog.Package(pkgpath).Pkg
if err := PrintSkeleton(pkg, ifacename, concname); err != nil {
log.Fatal(err)
}
}
/*
//!+output1
$ ./skeleton io ReadWriteCloser buffer
// *buffer implements io.ReadWriteCloser.
type buffer struct{}
func (b *buffer) Close() error {
panic("unimplemented")
}
func (b *buffer) Read(p []byte) (n int, err error) {
panic("unimplemented")
}
func (b *buffer) Write(p []byte) (n int, err error) {
panic("unimplemented")
}
//!-output1
//!+output2
$ ./skeleton net/http Handler myHandler
// *myHandler implements net/http.Handler.
type myHandler struct{}
func (m *myHandler) ServeHTTP(http.ResponseWriter, *http.Request) {
panic("unimplemented")
}
//!-output2
*/
@@ -1,134 +0,0 @@
package main
import (
"bytes"
"fmt"
"go/ast"
"go/format"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
)
//!+input
const input = `
package main
var m = make(map[string]int)
func main() {
v, ok := m["hello, " + "world"]
print(rune(v), ok)
}
`
//!-input
var fset = token.NewFileSet()
func main() {
f, err := parser.ParseFile(fset, "hello.go", input, 0)
if err != nil {
log.Fatal(err) // parse error
}
conf := types.Config{Importer: importer.Default()}
info := &types.Info{Types: make(map[ast.Expr]types.TypeAndValue)}
if _, err := conf.Check("cmd/hello", fset, []*ast.File{f}, info); err != nil {
log.Fatal(err) // type error
}
//!+inspect
// f is a parsed, type-checked *ast.File.
ast.Inspect(f, func(n ast.Node) bool {
if expr, ok := n.(ast.Expr); ok {
if tv, ok := info.Types[expr]; ok {
fmt.Printf("%-24s\tmode: %s\n", nodeString(expr), mode(tv))
fmt.Printf("\t\t\t\ttype: %v\n", tv.Type)
if tv.Value != nil {
fmt.Printf("\t\t\t\tvalue: %v\n", tv.Value)
}
}
}
return true
})
//!-inspect
}
// nodeString formats a syntax tree in the style of gofmt.
func nodeString(n ast.Node) string {
var buf bytes.Buffer
format.Node(&buf, fset, n)
return buf.String()
}
// mode returns a string describing the mode of an expression.
func mode(tv types.TypeAndValue) string {
s := ""
if tv.IsVoid() {
s += ",void"
}
if tv.IsType() {
s += ",type"
}
if tv.IsBuiltin() {
s += ",builtin"
}
if tv.IsValue() {
s += ",value"
}
if tv.IsNil() {
s += ",nil"
}
if tv.Addressable() {
s += ",addressable"
}
if tv.Assignable() {
s += ",assignable"
}
if tv.HasOk() {
s += ",ok"
}
return s[1:]
}
/*
//!+output
$ go build github.com/golang/example/gotypes/typeandvalue
$ ./typeandvalue
make(map[string]int) mode: value
type: map[string]int
make mode: builtin
type: func(map[string]int) map[string]int
map[string]int mode: type
type: map[string]int
string mode: type
type: string
int mode: type
type: int
m["hello, "+"world"] mode: value,assignable,ok
type: (int, bool)
m mode: value,addressable,assignable
type: map[string]int
"hello, " + "world" mode: value
type: string
value: "hello, world"
"hello, " mode: value
type: untyped string
value: "hello, "
"world" mode: value
type: untyped string
value: "world"
print(rune(v), ok) mode: void
type: ()
print mode: builtin
type: func(rune, bool)
rune(v) mode: value
type: rune
rune mode: type
type: rune
...more not shown...
//!-output
*/
@@ -1,191 +0,0 @@
// The weave command is a simple preprocessor for markdown files.
// It builds a table of contents and processes %include directives.
//
// Example usage:
// $ go run weave.go go-types.md > README.md
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"strings"
)
func main() {
log.SetFlags(0)
log.SetPrefix("weave: ")
if len(os.Args) != 2 {
log.Fatal("usage: weave input.md\n")
}
f, err := os.Open(os.Args[1])
if err != nil {
log.Fatal(err)
}
defer f.Close()
fmt.Println("<!-- Autogenerated by weave; DO NOT EDIT -->")
// Pass 1.
var toc []string
in := bufio.NewScanner(f)
for in.Scan() {
line := in.Text()
if line == "" || (line[0] != '#' && line[0] != '%') {
continue
}
line = strings.TrimSpace(line)
if line == "%toc" {
toc = nil
} else if strings.HasPrefix(line, "# ") || strings.HasPrefix(line, "## ") {
words := strings.Fields(line)
depth := len(words[0])
words = words[1:]
text := strings.Join(words, " ")
for i := range words {
words[i] = strings.ToLower(words[i])
}
line = fmt.Sprintf("%s1. [%s](#%s)",
strings.Repeat("\t", depth-1), text, strings.Join(words, "-"))
toc = append(toc, line)
}
}
// Pass 2.
if _, err := f.Seek(0, os.SEEK_SET); err != nil {
log.Fatalf("can't rewind input: %v", err)
}
in = bufio.NewScanner(f)
for in.Scan() {
line := in.Text()
switch {
case strings.HasPrefix(line, "%toc"): // ToC
for _, h := range toc {
fmt.Println(h)
}
case strings.HasPrefix(line, "%include"):
words := strings.Fields(line)
if len(words) < 2 {
log.Fatal(line)
}
filename := words[1]
// Show caption unless '-' follows.
if len(words) < 4 || words[3] != "-" {
fmt.Printf(" // go get github.com/golang/example/gotypes/%s\n\n",
filepath.Dir(filename))
}
section := ""
if len(words) > 2 {
section = words[2]
}
s, err := include(filename, section)
if err != nil {
log.Fatal(err)
}
fmt.Println("```")
fmt.Println(cleanListing(s)) // TODO(adonovan): escape /^```/ in s
fmt.Println("```")
default:
fmt.Println(line)
}
}
}
// include processes an included file, and returns the included text.
// Only lines between those matching !+tag and !-tag will be returned.
// This is true even if tag=="".
func include(file, tag string) (string, error) {
f, err := os.Open(file)
if err != nil {
return "", err
}
defer f.Close()
startre, err := regexp.Compile("!\\+" + tag + "$")
if err != nil {
return "", err
}
endre, err := regexp.Compile("!\\-" + tag + "$")
if err != nil {
return "", err
}
var text bytes.Buffer
in := bufio.NewScanner(f)
var on bool
for in.Scan() {
line := in.Text()
switch {
case startre.MatchString(line):
on = true
case endre.MatchString(line):
on = false
case on:
text.WriteByte('\t')
text.WriteString(line)
text.WriteByte('\n')
}
}
if text.Len() == 0 {
return "", fmt.Errorf("no lines of %s matched tag %q", file, tag)
}
return text.String(), nil
}
func isBlank(line string) bool { return strings.TrimSpace(line) == "" }
func indented(line string) bool {
return strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t")
}
// cleanListing removes entirely blank leading and trailing lines from
// text, and removes n leading tabs.
func cleanListing(text string) string {
lines := strings.Split(text, "\n")
// remove minimum number of leading tabs from all non-blank lines
tabs := 999
for i, line := range lines {
if strings.TrimSpace(line) == "" {
lines[i] = ""
} else {
if n := leadingTabs(line); n < tabs {
tabs = n
}
}
}
for i, line := range lines {
if line != "" {
line := line[tabs:]
lines[i] = line // remove leading tabs
}
}
// remove leading blank lines
for len(lines) > 0 && lines[0] == "" {
lines = lines[1:]
}
// remove trailing blank lines
for len(lines) > 0 && lines[len(lines)-1] == "" {
lines = lines[:len(lines)-1]
}
return strings.Join(lines, "\n")
}
func leadingTabs(s string) int {
var i int
for i = 0; i < len(s); i++ {
if s[i] != '\t' {
break
}
}
return i
}

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