Compare commits

...
111 Commits
Author SHA1 Message Date
soharab-icandGitHub cf55fbecea Update chart version and app version to v1.20.4 (#3006)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-09-02 12:14:23 +05:30
b80437b78c Configure user ID for logger container's securityContext using helm values.yaml (#3005)
* Run logger as root to allow access to log files from host

* Add to connect part of yaml

* Change fission folder to allow non-root to write
into folder instead

* Configure user ID for logger from helm values.yaml

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Co-authored-by: Mark Retallack <mark.retallack@yunextraffic.com>
2024-09-02 11:06:55 +05:30
waitstoryandGitHub 11baffc92c Fixed time unit loss problem after converting time (#3004)
The time unit of 'function.Spec.FunctionTimeout' is second, but after conversion from the function time.Duration, the unit becomes nanosecond. So it needs to be repaired.

Signed-off-by: waitstory <waitstory@163.com>
2024-08-30 16:54:41 +05:30
markretallackandGitHub ce49eb3e18 Add resource namespace to logger (#2999)
* Add fission resource namespace to logger pod

* Corrected indent

* Fix formating
2024-08-30 16:53:57 +05:30
soharab-icandGitHub bf19e2fae2 Use in-cluster config when kubeconfig file is not found (#2996)
* Use in-cluster config if KUBECONFIG env is not set.
Or when kubeconfig file is not found in user's home directory.
* Fixed e2e cli tests failure
* Resolve review comments
* Join kubeconfig not found and failed to load in-cluster config errors


---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-24 09:01:27 +05:30
soharab-icandGitHub 26f964886e Fix: Message queue trigger update (#2991)
* Handle mqt update
* Update scalemanager to support mqtkind update
* Short circuit evalution may fail metadata update
* Updated mqtmanager test

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-16 11:33:36 +05:30
soharab-icandGitHub cb3a765495 Fix storagesvc url in archive (#2982)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-14 18:02:05 +05:30
7203cbf846 Remove redundant code and simplify input parsing during HTTPTrigger creation (#2990)
* 去除environment创建操作中的注释及更新过程中存在的冗余代码

* Remove redundant code and simplify input parsing during HTTPTrigger creation

---------

Co-authored-by: yufu huang <yufu.huang@gientech.com>
2024-08-14 18:00:22 +05:30
soharab-icandGitHub 0b9d4c6f5a Use typed client from Keda instead of unstructured (#2989)
* Use typed client for Keda
* Downgraded apimachinery version to v0.30.0 because of compilation error
* Upgrade golanggci-lint version to v1.57.0
* Skip cache for golanggci-lint-action
* grpc.WithBlock is deprecated

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-14 16:52:31 +05:30
c6beb29f5a Code cleanup from Fission CLI (#2983)
Co-authored-by: yufu huang <yufu.huang@gientech.com>
2024-08-12 19:11:56 +05:30
soharab-icandGitHub 13abb2e905 Creating large number of MQTs takes time (#2984)
* Implementing workqueue for MessageQueueTriggers
* Fixing some issues with informers and deleteQueue
* Fixing fission_mqt_created metrics
* Rebase with main

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-12 18:00:41 +05:30
soharab-icandGitHub 54db275dc2 Removed armv7 references from goreleaser file (#2988)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-12 12:08:49 +05:30
soharab-icandGitHub 0159802497 Update chart version to v1.20.3 (#2987)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-09 13:38:40 +05:30
soharab-icandGitHub 90d781ca2d Fixed mqtrigger scaling issue (#2986)
* Fixed mqtrigger scaling issue

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Resolve review comments

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Set goreleaser version to v1
Remove armv7 references from goreleaser file

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-08-09 11:58:44 +05:30
Boluwatife VictorandGitHub 1732d9f4b0 Update README.md (#2738)
I added more context to the introduction section
2024-07-20 10:36:16 +05:30
soharab-icandGitHub 8de5a5b0f3 Fix: Storage leak in Builder and Fetcher (#2979)
* Fix storage leak in builder
```
builder pod keeps old src and deployment packages irrespective of build status.
delete src package after every build request is completed.
delete deployment package after package is uploaded.
```
* Optimized src/deploy cleanup pkg code
* Fix high severity security issue
* Add a test for builder's Clean API
* Resolve review comments

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-07-15 18:28:42 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
35276a503b Bump golang.org/x/image from 0.10.0 to 0.18.0 (#2972)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.10.0 to 0.18.0.
- [Commits](https://github.com/golang/image/compare/v0.10.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-13 19:23:12 +05:30
soharab-icandGitHub c6c811ea76 Show warning that --yolo, --concurrency and --rpp fields are valid for executortype poolmgr only (#2971)
* yolo, concurrency and rpp are specifically introduced for executortype poolmgr
```
Show warning if these fields are used with other executortype.
Update CLI with this information.
```

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Add warning for fn update too

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Show warning while updating `--yolo`, `--con` and `--rpp` to an already created newdeploy function.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Fixed a minor bug

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Optmize and increase code readability

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Rename function to checkExecutorPoolManager

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-07-08 12:04:43 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
f2baa17131 Bump github.com/hashicorp/go-retryablehttp from 0.7.5 to 0.7.7 (#2970)
Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.5 to 0.7.7.
- [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-retryablehttp/compare/v0.7.5...v0.7.7)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-retryablehttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-25 12:26:51 +05:30
soharab-icandGitHub a34840b0a7 Set OwnerReferences to K8s resources created by Fission (#2964)
* Poolmanager deployment is created based on environment.
Set environment as owner to poolmanager deployment.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Set OwnerReferences to K8s resources created by fission resources.
```
Set OwnerReferences to deployment, service and HPA created by newdeploy function.
Set OwnerReferences to builderManager deployment and service created by environment.
Set OwnerReferences to deployment, service and HPA created by container function.
```

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Use ControllerRef

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-06-25 12:25:12 +05:30
soharab-icandGitHub 06b52e3631 Update keda connectors image tag (#2963) 2024-06-21 15:13:02 +05:30
jaynisandGitHub 19858521fd added http status code error handling to DownloadUrl function (#2959)
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
2024-06-20 18:43:46 +05:30
soharab-icandGitHub 4c4b574d07 Fix fission-cli cmd pkg getdeploy (#2960)
```
If deployment archive is empty then command will return source archive.
Deployment can be empty if pkg build failed or in running state.
```

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-06-20 18:36:35 +05:30
waitstoryandGitHub 9b978cf2fd Fixed an error when using the command to download src (#2940)
* Fixed an error when using the command to download src

issue: #2938

Signed-off-by: waitstory <waitstory@163.com>

* Fixed an error when using the command to download src

issue: #2938

Signed-off-by: waitstory <waitstory@163.com>

---------

Signed-off-by: waitstory <waitstory@163.com>
2024-06-10 10:00:31 +05:30
pengpengfuandGitHub ef05e242e4 fetcher when call uploadHandler ,archive zip, Use newZip instead of the default DefaultZip to improve the fetcher to accept more upload requests. (#2955) 2024-06-10 09:01:26 +05:30
soharab-icandGitHub 156c1ac2e6 Pin goreleaser version to v1 in github actions (#2956)
```
Latest goreleaser version v2 has some breaking changes.
Due to this CI tests failed.
Therefore, setting goreleaser version to v1.
```

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-06-06 19:49:04 +05:30
soharab-icandGitHub ade2daa013 Make image description template variables less from goreleaser configuration (#2954)
```
Remove variables field from .goreleaser.yml
```

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-06-03 19:32:11 +05:30
soharab-icandGitHub 6a84cee1d8 Add description label to docker images (#2952)
* Add description label to docker images
* Update descriptions

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-29 14:26:29 +05:30
soharab-icandGitHub b95e317a20 fix: Router failed to create ingress resource in fission namespace (#2951)
* Router failed to create ingress resource in `fission` namespace
```
fission-router has access to create ingress in default namespace.
fission is creating ingress in namespace where fission is installed.
updated the helm chart to give fission-router access to create ingress in release namespace.
```
* Add a todo comment for modifying router's permissions


---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-28 19:47:44 +05:30
soharab-icandGitHub 0cfe08df55 Update chart version and app version to v1.20.2 (#2950)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-27 15:51:19 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4e0643eed7 Bump github.com/opencontainers/runc from 1.1.5 to 1.1.12 (#2912)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.5 to 1.1.12.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.1.12/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.5...v1.1.12)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-27 12:58:58 +05:30
soharab-icandGitHub 103c7d57e4 Upgrade libs and go version (#2949)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-27 12:51:54 +05:30
Robbie CroninandGitHub c6d01827b0 Fix: MutatingWebhookConfiguration naming conflict (#2948) 2024-05-27 11:53:53 +05:30
Robbie CroninandGitHub d8fe37e736 Fix: ValidatingWebhookConfiguration conflict (#2947) 2024-05-27 11:24:51 +05:30
soharab-icandGitHub c126298db4 Revert "Remove deprecated mqtrigger with kind fission (#2875)" (#2946)
* Revert "Remove deprecated mqtrigger with kind fission (#2875)"

This reverts commit f44174debc.

* Upgrade sarama version to v1.43.2

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-27 10:21:51 +05:30
soharab-icandGitHub f7e9e71ee1 Set latest envVersion 3 as default (#2945)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-22 14:06:36 +05:30
eveneastandGitHub 3e43c07e5a Fix code comments function names (#2927)
Signed-off-by: eveneast <qcqs@foxmail.com>
2024-05-20 19:22:22 +05:30
robbellMFandGitHub 932be4eb38 Fix fission spec apply --delete deleting environments (#2943) 2024-05-17 22:22:50 +05:30
soharab-icandGitHub 8bfe2d0ed1 Fix CLI pkg getsrc returns deploy archive instead of source archive (#2941)
* CLI command `pkg getsrc` returns deploy archive

```
Fix CLI command to return source archive instead of deploy archive.
If source archive is not available then return deploy archive.
```

* Add e2e tests for `fission package` CLI commands
* Cleanup environments created for pkg test
* Fix unit test failures


---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-16 18:29:58 +05:30
soharab-icandGitHub 9cea0d2b32 Upgrade kind version to v0.23.0 (#2937)
* Upgrade kind version to v0.23.0
```
Upgraded kind version to github workflow push_pr.yaml
Upgraded kind version to github workflow release.yaml
Upgraded kind version to github workflow upgrade_test.yaml
```
* Minor change to trigger CI
* Upgrade kind node image to v1.25.16

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-15 13:21:46 +05:30
soharab-icandGitHub 5337dbfd0b Update Go packages (#2933)
* Update Go packages

```
github.com/elastic/crd-ref-docs: v0.0.10 -> v0.0.12
github.com/go-git/go-git/v5: v5.11.0 -> v5.12.0
github.com/prometheus/client_golang: v1.18.0 -> v1.19.0
github.com/prometheus/common: v0.46.0 -> v0.53.0
github.com/stretchr/testify: v1.8.4 -> v1.9.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp: v0.48.0 -> v0.51.0
go.opentelemetry.io/contrib/propagators/autoprop: v0.48.0 -> v0.51.0
go.opentelemetry.io/otel: v1.23.1 -> v1.26.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace: v1.23.1 -> v1.26.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: v1.23.1 -> v1.26.0
go.opentelemetry.io/otel/sdk: v1.23.1 -> v1.26.0
go.opentelemetry.io/otel/trace: v1.23.1 -> v1.26.0
go.uber.org/zap: v1.26.0 -> v1.27.0
golang.org/x/net: v0.21.0 -> v0.25.0
google.golang.org/grpc: v1.61.1 -> v1.63.2
k8s.io/api: v0.29.2 -> v0.30.0
k8s.io/apiextensions-apiserver: v0.29.2 -> v0.30.0
k8s.io/apimachinery: v0.29.2 -> v0.30.0
k8s.io/client-go: v0.29.2 -> v0.30.0
k8s.io/code-generator: v0.29.2 -> v0.30.0
k8s.io/metrics: v0.29.2 -> v0.30.0
sigs.k8s.io/controller-runtime: v0.17.1 -> v0.18.2
sigs.k8s.io/controller-tools: v0.14.0 -> v0.15.0
```
* update Makefile and update-codegen.sh with latest packages
* Run `make all-generators`

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-08 11:03:00 +05:30
guangwuandGitHub 08c662bc11 fix: close tmp file (#2931) 2024-05-07 12:51:43 +05:30
soharab-icandGitHub 241983d2f7 Fix fission check command doesnt work for namespace other than fission (#2932)
* Fix `fission check` command which does not work outside of `fission` namespace

If user provide namespace then use it for running `fission check` command.
If user does not provide namespace then use `fission` as default namespace.

* Update go version to 1.22.2

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
2024-05-07 11:18:22 +05:30
Sanket SudakeandGitHub 63864a91f2 Update Go to 1.22 and dependencies (#2915)
Go depenencies updated
```
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp: v0.47.0 -> v0.48.0
go.opentelemetry.io/contrib/propagators/autoprop: v0.47.0 -> v0.48.0
go.opentelemetry.io/otel: v1.22.0 -> v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace: v1.22.0 -> v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: v1.22.0 -> v1.23.1
go.opentelemetry.io/otel/sdk: v1.22.0 -> v1.23.1
go.opentelemetry.io/otel/trace: v1.22.0 -> v1.23.1
golang.org/x/net: v0.20.0 -> v0.21.0
google.golang.org/grpc: v1.61.0 -> v1.61.1
k8s.io/api: v0.29.1 -> v0.29.2
k8s.io/apiextensions-apiserver: v0.29.1 -> v0.29.2
k8s.io/apimachinery: v0.29.1 -> v0.29.2
k8s.io/client-go: v0.29.1 -> v0.29.2
k8s.io/code-generator: v0.29.1 -> v0.29.2
k8s.io/metrics: v0.29.1 -> v0.29.2
sigs.k8s.io/controller-runtime: v0.17.0 -> v0.17.1
```

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-02-15 20:39:03 +05:30
Sanket SudakeandGitHub 579d46cc1b Use code-generator v1.29.1 for code-generation (#2908)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-02-06 14:00:16 +05:30
Sanket SudakeandGitHub dcecb10e6c Update Go deps (#2907)
github.com/google/uuid: v1.5.0 -> v1.6.0
github.com/prometheus/common: v0.45.0 -> v0.46.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp: v0.46.1 -> v0.47.0
go.opentelemetry.io/contrib/propagators/autoprop: v0.46.1 -> v0.47.0
go.opentelemetry.io/otel: v1.21.0 -> v1.22.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace: v1.21.0 -> v1.22.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: v1.21.0 -> v1.22.0
go.opentelemetry.io/otel/sdk: v1.21.0 -> v1.22.0
go.opentelemetry.io/otel/trace: v1.21.0 -> v1.22.0
google.golang.org/grpc: v1.60.1 -> v1.61.0
k8s.io/api: v0.29.0 -> v0.29.1
k8s.io/apiextensions-apiserver: v0.29.0 -> v0.29.1
k8s.io/apimachinery: v0.29.0 -> v0.29.1
k8s.io/client-go: v0.29.0 -> v0.29.1
k8s.io/metrics: v0.29.0 -> v0.29.1
sigs.k8s.io/controller-runtime: v0.16.3 -> v0.17.0

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-28 15:01:10 +05:30
dk03051996andGitHub 6144c58a44 Update chart image tag to 1.20.1 (#2903) 2024-01-16 17:31:29 +05:30
Sanket SudakeandGitHub 7e8d5dd7ef Add kubernetes version constraint and update version 1.20.1 in helm chart (#2901)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-14 15:38:42 +05:30
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
796c7a48e8 Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 (#2898)
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-14 14:25:05 +05:30
Sanket SudakeandGitHub b0e4440328 Update Go modules (#2900)
- Update go modules
    + github.com/prometheus/client_golang v1.17.0 [v1.18.0]
   + golang.org/x/net v0.19.0 [v0.20.0]
    + sigs.k8s.io/controller-tools v0.13.0 [v0.14.0]
- Remove Kafka tests disabled.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-14 11:48:40 +05:30
Sanket SudakeandGitHub b801c77432 Add kubernetes QPS and Burst limit configuration (#2899)
Added configurable kubernetes client limits burst and QPS
Default QPS 200 and burst 500. Configurable via helm chart values.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-12 22:21:12 +05:30
Sanket SudakeandGitHub 82b2848eb7 Set default package status to none if deployment exists (#2894)
If package has deployment already, we should set package status to none instead of pending.
If we have package has source, we set status to pending.
If both source and deployment are empty, package marked as failure.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-05 18:31:13 +05:30
dk03051996andGitHub 0c1b03b862 added annotation for signing (#2895) 2024-01-04 10:47:18 +05:30
Sanket SudakeandGitHub 0c8573467b Make common cache typed with generics (#2896)
Making typed common cache so that we don't use wrong types
across set/get methods and more higher-level methods can be
defined for cache.
Currently, we are not able to operate over all keys of the cache
due to generic types.
I also removed code comments around the cache.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2024-01-04 10:46:32 +05:30
Vardhaman SuranaandGitHub 12f8017d9b added fetcher test cases (#2893)
* added fetcher test cases

* error message formatting fix

* error message formatting fix for e2e framework
2023-12-21 17:02:39 +05:30
Sanket SudakeandGitHub 29b0cf24ac Update Go dependencies (#2889)
* Update Go dependencies

---

github.com/go-git/go-git/v5 v5.10.1 [v5.11.0]
github.com/google/uuid v1.4.0 [v1.5.0]
google.golang.org/grpc v1.59.0 [v1.60.0]
k8s.io/api v0.28.4 [v0.29.0]
k8s.io/apiextensions-apiserver v0.28.4 [v0.29.0]
k8s.io/apimachinery v0.28.4 [v0.29.0]
k8s.io/client-go v0.28.4 [v0.29.0]
k8s.io/metrics v0.28.4 [v0.29.0]

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

* update deps

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

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-12-21 10:57:00 +05:30
Dada GoreandGitHub d4aba532f3 Router authentication jwtSigningKey unique for every Fission installation 2023-12-06 10:11:36 +05:30
Sanket SudakeandGitHub 9b57f1f2e7 Update chart version to v1.20.0 (#2886)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-30 17:32:04 +05:30
Dada GoreandGitHub 1fe13624f2 seperated events permission in keda and executor linked roles to remove delete permission (#2885) 2023-11-30 14:19:59 +05:30
Sanket SudakeandGitHub fdecc98775 Auto-approve goreleaser docker builds with cosign (#2883)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-27 14:01:30 +05:30
Sanket SudakeandGitHub 10852c90a5 Update goreleaser cosign prompt approval (#2882) 2023-11-25 19:54:16 +05:30
Sanket SudakeandGitHub 62f729727a Change container base image to cgr.dev/chainguard/static (#2881)
* Change container base image to cgr.dev/chainguard/static
* Lint fixes
* fix test failure
* Add router deployment wait
* add check command in upgrade script

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-24 19:01:31 +05:30
Sanket SudakeandGitHub 95faf60959 Update keda connectors images (#2880)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-24 14:22:47 +05:30
Sanket SudakeandGitHub 17fbe42fcc Update fission version v1.20.0-rc2 (#2879)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-23 13:00:50 +05:30
Sanket SudakeandGitHub f44174debc Remove deprecated mqtrigger with kind fission (#2875)
* Remove deprecated mqtrigger with kind fission
* Remove unused deps

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-21 17:52:37 +05:30
Sanket SudakeandGitHub efeb6951dc Update Go dependencies (#2878)
* Update Go dependencies
* Pin all github workflows dependencies

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-21 16:15:49 +05:30
Sanket SudakeandGitHub b85ba9e419 Use concurrency in poolmanager as per old behaviour (#2876)
* Use concurrency in poolmanager as per old behaviour
* Update code comments

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-21 13:34:17 +05:30
Sanket SudakeandGitHub d23ed572f9 Add tests for preupgradchecks and spec/archive CLI (#2874)
* Add tests for preupgradchecks
* Add spec tests
* Add package archive tests
* Wait for cleanup
* Fix test and coverage

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-17 14:08:38 +05:30
Sanket SudakeandGitHub e7d6381876 Add webhook server to tests (#2873)
* Add webhook server to tests
* fix config for webhoook service
* Fix logger in webhook manager
* Use interface for webhook manager
* single reference for router url
* Cleanup token code

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-16 14:16:28 +05:30
Sanket SudakeandGitHub 57b537f09e Add CLI tests for mqtrigger/timetrigger (#2872)
* Add tests for mqtrigger/timetrigger
* Change command to run tests
* correct coverage command
* update coverpkg

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-13 17:14:47 +05:30
Sanket SudakeandGitHub 2e4825def0 Add function test CLI tests (#2871)
* Add function test CLI tests
* Add few more services to tests

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-13 14:34:56 +05:30
Vardhaman SuranaandGitHub 3fabf64b3c Add informers and internal go routines in manager (#2870)
* used manager's Add function in more places
* exit when ctx.Done is received in archivePruner go routines
* fix manager tests
* fix data race
* added more gpm function in manager and removed manager from a util function
* closed unused channel and stopped ticker after context is done
* added log statements
* used context.Done inside function instead of stopper channel
2023-11-10 12:42:21 +05:30
Vardhaman SuranaandGitHub 2a40b4538c added manger to keep track of go routines in the services (#2869)
- added manager to wait for all go routines to end before exit
- code refactor
- renamed Manafer to Interface and GoRoutineManager to GroupManager
- replaced some go routine calls with manager Add func
- added unit tests for manager
2023-11-07 15:30:48 +05:30
Sanket SudakeandGitHub 27132975c4 Add interfaces for executor/fetcher/storagesvc clients (#2867)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-06 16:09:51 +05:30
Sanket SudakeandGitHub b099db38d7 Update Go deps (#2868)
---

github.com/IBM/sarama v1.41.3 [v1.42.0]
github.com/gorilla/mux v1.8.0 [v1.8.1]
github.com/spf13/cobra v1.7.0 [v1.8.0]

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-11-05 11:33:45 +05:30
Sanket SudakeandGitHub 88039cad63 Update Go Dependencies (#2863)
---

github.com/IBM/sarama v1.41.2 [v1.41.3]
github.com/elastic/crd-ref-docs v0.0.9 [v0.0.10]
github.com/fsnotify/fsnotify v1.6.0 [v1.7.0]
github.com/go-git/go-git/v5 v5.9.0 [v5.10.0]
github.com/google/uuid v1.3.0 [v1.4.0]
github.com/prometheus/common v0.44.0 [v0.45.0]
google.golang.org/grpc v1.58.3 [v1.59.0]
k8s.io/api v0.28.2 [v0.28.3]
k8s.io/apiextensions-apiserver v0.28.2 [v0.28.3]
k8s.io/apimachinery v0.28.2 [v0.28.3]
k8s.io/client-go v0.28.2 [v0.28.3]
k8s.io/metrics v0.28.2 [v0.28.3]
sigs.k8s.io/controller-runtime v0.16.2 [v0.16.3]
sigs.k8s.io/yaml v1.3.0 [v1.4.0]

---

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-30 11:11:06 +05:30
Sanket SudakeandGitHub 267f7faf18 Add cause for all context timeouts (#2862) 2023-10-29 13:19:06 +05:30
Sanket SudakeandGitHub 2223081c80 Test for httptrigger and functions container/newdeploy (#2861)
* Test for httptrigger and functions
* Fixes with multierror
* review changes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-27 15:05:20 +05:30
Vardhaman SuranaandGitHub 2eb2eba88c added function tests for fission cli (#2859)
* added function tests for fission cli

* code refactor
2023-10-26 14:40:38 +05:30
8a17d391c5 Envtest based integration tests for Fission (#2858)
* skeleton for envtest fission
* Refactor code and add CLI test
* hack
* Update server test
* remove skip-ci for lint tests
* Pass client go storagesvc
* Add clientGen interface across code
* Fix storagesvc test
* Fix cmd client
* add retry in server test
* Fix concurrenct access to pool deployment
* Remove old executor test
* get rid of ginkgo/gomega
* disable flaky test
* flaky test
* revert ci change
* handle err from ParseBool

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Pranoy Kundu <pranoy1998k@gmail.com>
2023-10-26 12:09:11 +05:30
Sanket SudakeandGitHub 15e16fcc82 Update chart version 1.20.0-rc1 (#2857)
- Update kubernets version 1.23+
- Update post chart install notes with namespace info
- Update upgrade notes in chart

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-23 19:40:09 +05:30
Sanket SudakeandGitHub 7137b39a14 Avoid duplicate role in release namespace for router (#2856)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-18 20:50:05 +05:30
Vardhaman SuranaandGitHub fc97b7609b added client generator inteface (#2854)
* added client generator inteface
* start router service asynchronously

Signed-off-by: Vardhaman Surana <vardhaman.surana@infracloud.io>
2023-10-18 18:59:28 +05:30
Sanket SudakeandGitHub c6329ee3db Switch to google/uuid from satori/go.uuid (#2852)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-17 12:19:17 +05:30
Sanket SudakeandGitHub 7b21fbc199 Remove unused generator package (#2851)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-17 10:50:58 +05:30
Sanket SudakeandGitHub 703d757c29 Remove controller component from Fission (#2850)
* Remove controller component from Fission
* Cleanup at few more places

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-17 09:29:13 +05:30
Sanket SudakeandGitHub c09319ceb3 Update CI actions and go modules (#2846)
* Update CI actions and go modules
* Fix kind cluster name
* Fix upgrade cluster name

---

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-12 10:13:47 +05:30
Guillaume MARTINEZandGitHub 3762ff80f2 Update the Kubernetes autoscaling API to v2 (#2722) (#2842)
* Update the Kubernetes autoscaling API to v2 (#2722)
  - k8s.io/api/autoscaling/v2
* generate all files
* fix missing v2beta ref

---------

Signed-off-by: Lunik <lunik@tiwabbit.fr>
2023-10-11 11:04:45 +05:30
Sanket SudakeandGitHub b43b31884a Update kubernetes versions in CI verification (#2844)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-10-10 13:11:43 +05:30
56b49dcee8 Ability to retain specialised pods for poolmanager functions (#2830)
- added retainPods flag to take in the number of specialized pods to retain
- add retainPods in both the create function and update function command
- modify crd keys to be typed instead of string
- keep track of function generation in case of update function operation
- add delete handler function to make sure specialized pods are deleted in case function is deleted

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Signed-off-by: Pranoy Kundu <pranoy1998k@gmail.com>
Co-authored-by: Pranoy Kundu <pranoy1998k@gmail.com>
2023-09-27 13:33:19 +05:30
Sanket SudakeandGitHub 657aee7cc2 Update go deps across project (#2837)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-09-24 11:14:43 +05:30
Anthony KingandGitHub 44922bce6c fix missing namespace environment variables for various services (#2828)
the FISSION_..._NAMESPACE environment variables are used by all services during init
to check if the CRDs are loaded.

Move them to the 'fission-resource-namespace' macro to ensure all services know the relavant namespaces.

Signed-off-by: Anthony King <anthony@datapane.com>
2023-09-23 13:01:53 +05:30
Sanket SudakeandGitHub 3bcda55aa8 Update kubernetes libs to latest (#2834)
- k8s.io/api v0.28.1
- k8s.io/apiextensions-apiserver v0.28.1
- k8s.io/apimachinery v0.28.1
- k8s.io/client-go v0.28.1
- k8s.io/metrics v0.28.1
- sigs.k8s.io/controller-runtime v0.16.1
- sigs.k8s.io/controller-tools v0.13.0

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-09-23 09:10:51 +05:30
Sanket SudakeandGitHub 997493351a Update go version 1.21 (#2833)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2023-09-05 22:15:32 +05:30
guangwuandGitHub 3d77077bc5 fix: Environment typo (#2829)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-08-30 07:50:09 +05:30
Shubham BansalandGitHub f955d1182a update chart version to v1.19.0 (#2798)
Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
2023-05-18 15:18:04 +05:30
AmborandGitHub 1cbc0ba9ff fix: passthrough the build log error (#2795)
Signed-off-by: saltbo <saltbo@foxmail.com>
2023-05-18 13:47:54 +05:30
Shubham BansalandGitHub 0936c6a2d7 Update dependencies (#2796)
* updated dependencies

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

* updated depencies related to otel and few other

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

* revert changes for go version

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

* revert changes for k8s dependencies

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

---------

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
2023-05-18 13:44:51 +05:30
Shubham BansalandGitHub f0ec328d24 Changed prometheus version from latest to 45.28.0 (#2797)
* updated prometheus version for CI failure

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

* updated prometheus version for CI failure

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>

---------

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
2023-05-18 12:44:20 +05:30
Shubham BansalandGitHub 2b1ac28300 updating all direct dependencies (#2793)
Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
2023-05-17 12:17:23 +05:30
Shubham BansalandGitHub 0fb2096788 security upgrade for alpine to 3.18 (#2792) 2023-05-16 17:45:36 +05:30
Scott CôtéandGitHub 6e375629e7 Configure router deployment replicas (#2782) 2023-05-16 16:20:29 +05:30
Shubham BansalandGitHub 1133386ce9 update chart version to v1.19.0-rc2 (#2791)
Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
2023-05-12 10:33:51 +05:30
f99f10134c Executor: Dump function service cache for pool manager functions (#2789)
* dump function service cache for executor
* fix lint issue
* code refactor and lint fixes

---------

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2023-05-12 09:49:54 +05:30
6c431e4d9b Ensure handling for specialization failure in pool manager (#2788)
* Add fixes for failure in specialization
* reduce specialization in progress and remove expired requests from queue when specialization is timed out
* rename markSpecializationFailure and remove logger from the queue
* refactor clean up code in api.go and add test case for queue

Details:

- Cleanup svc waiting for the counter in the pool manager if specialization fails
- Cleanup active requests counter in pool manager if client exists the demand for function service while we have allocated function service
- Consider specialization timeout if pod ready timeout > specialization timeout in waiting for ready pod. We also consider if the request to choosePod is cancelled.
- We ensure if we have requests waiting for service requests but if there is no pod in the specialization we clean up those.
---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Pranoy Kundu <pranoy1998k@gmail.com>
2023-05-11 21:03:57 +05:30
31c81e132e fix: lose cold start error counter for the poolmgr functions (#2755)
* fix: lose cold start error counter for the poolmgr functions

Co-authored-by: ZhengHe-MD <ranchardzheng@gmail.com>
Co-authored-by: gw123 <iamakillerforyou@gmail.com>
Signed-off-by: saltbo <saltbo@foxmail.com>

* fix: miss code for the metric

Signed-off-by: saltbo <saltbo@foxmail.com>

---------

Signed-off-by: saltbo <saltbo@foxmail.com>
Co-authored-by: ZhengHe-MD <ranchardzheng@gmail.com>
Co-authored-by: gw123 <iamakillerforyou@gmail.com>
2023-05-09 12:37:58 +05:30
Nikhil SharmaandGitHub a5f3402dbc add functionality to update spec of fission custom resources (#2701)
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
2023-05-08 13:36:05 +05:30
AmborandGitHub 784bd82ec7 fix: panic for the builder/client (#2780)
Signed-off-by: saltbo <saltbo@foxmail.com>
2023-04-13 10:40:45 +05:30
AmborandGitHub cd742a6d18 fix: error port for the pprof server (#2766)
Signed-off-by: saltbo <saltbo@foxmail.com>
2023-04-11 08:43:36 +05:30
AmborandGitHub 32530ac474 fix: add flush to support chunked for the metric middleware (#2772)
Signed-off-by: saltbo <saltbo@foxmail.com>
2023-04-11 08:40:58 +05:30
AmborandGitHub 117c383fac style: typo for the BuilderNamespace (#2776)
Signed-off-by: saltbo <saltbo@foxmail.com>
2023-04-11 08:39:42 +05:30
346 changed files with 27181 additions and 24450 deletions
+3 -5
View File
@@ -1,11 +1,9 @@
ignore:
- "charts"
- "demos"
- "Documentation"
- "examples"
- "test"
- "test/"
- "tools"
- "pkg/apis/genclient"
- "pkg/generated" # generated code
- "pkg/apis/*/*/zz_generated*" # generated code
coverage:
status:
project:
+4 -4
View File
@@ -25,18 +25,18 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
with:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
+2 -2
View File
@@ -19,10 +19,10 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
+7 -6
View File
@@ -18,19 +18,19 @@ on:
workflow_dispatch:
env:
GOLANGCI_LINT_VERSION: v1.51.1
GOLANGCI_LINT_VERSION: v1.57.0
GOLANGCI_LINT_TIMEOUT: 5m
jobs:
lint:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
@@ -41,8 +41,9 @@ jobs:
go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
skip-cache: true
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
@@ -61,7 +62,7 @@ jobs:
run: ./hack/runtests.sh
- name: Upload Coverage report to CodeCov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: unittests
+35 -32
View File
@@ -22,8 +22,9 @@ on:
workflow_dispatch:
env:
HELM_VERSION: v3.10.1
KIND_VERSION: v0.17.0
HELM_VERSION: v3.13.0
KIND_VERSION: v0.23.0
KIND_CLUSTER_NAME: kind
jobs:
# Job to run change detection
@@ -33,42 +34,43 @@ jobs:
strategy:
fail-fast: false
matrix:
kindversion: ["v1.19.16", "v1.20.15", "v1.21.14"]
kindversion: ["v1.25.16", "v1.27.13", "v1.30.0"]
os: [ubuntu-latest]
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: fission/examples
path: examples
- name: Helm installation
uses: Azure/setup-helm@v3
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: ${{ env.HELM_VERSION }}
- name: Kind Cluster
uses: engineerd/setup-kind@v0.5.0
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
image: kindest/node:${{ matrix.kindversion }}
node_image: kindest/node:${{ matrix.kindversion }}
version: ${{ env.KIND_VERSION }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
config: kind.yaml
- name: Configuring and testing the Installation
run: |
kubectl cluster-info --context kind-kind
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl get nodes
sudo apt-get install -y apache2-utils
kubectl config use-context kind-kind
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl config view
- name: Helm chart lint
@@ -82,9 +84,10 @@ jobs:
skaffold version
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
install-only: true
version: "~> v1"
- name: Setup Prometheus Stack
run: |
@@ -92,7 +95,7 @@ jobs:
helm repo update
kubectl create ns monitoring
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
--set grafana.enabled=false --set alertmanager.enabled=false
--version 45.28.0 --set grafana.enabled=false --set alertmanager.enabled=false
- name: Build and Install Fission CLI
run: |
@@ -111,7 +114,6 @@ jobs:
- name: Port-forward fission components
run: |
kubectl port-forward svc/router 8888:80 -nfission &
kubectl port-forward svc/controller 8889:80 -nfission &
- name: Get fission version
timeout-minutes: 10
@@ -132,7 +134,7 @@ jobs:
timeout-minutes: 10
if: ${{ always() }}
run: |
kind export logs --name kind kind-logs
kind export logs --name ${{ env.KIND_CLUSTER_NAME }} kind-logs
- name: Backup prometheus data
timeout-minutes: 10
@@ -143,7 +145,7 @@ jobs:
- name: Archive fission dump
timeout-minutes: 10
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
path: fission-dump/*.zip
@@ -152,7 +154,7 @@ jobs:
- name: Archive prometheus dump
timeout-minutes: 10
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
path: /tmp/prometheus/*
@@ -161,7 +163,7 @@ jobs:
- name: Archive kind logs
timeout-minutes: 10
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
path: kind-logs/*
@@ -179,38 +181,39 @@ jobs:
os: [ubuntu-latest]
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: fission/examples
path: examples
- name: Helm installation
uses: Azure/setup-helm@v3
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: ${{ env.HELM_VERSION }}
- name: Kind Cluster
uses: engineerd/setup-kind@v0.5.0
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
image: kindest/node:${{ matrix.kindversion }}
node_image: kindest/node:${{ matrix.kindversion }}
version: ${{ env.KIND_VERSION }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
config: kind.yaml
- name: Configuring and testing the Installation
run: |
kubectl cluster-info --context kind-kind
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl get nodes
sudo apt-get install -y apache2-utils
kubectl config use-context kind-kind
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl config view
- name: Helm chart lint
@@ -224,9 +227,10 @@ jobs:
skaffold version
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
install-only: true
version: "~> v1"
- name: Setup Prometheus Stack
run: |
@@ -234,7 +238,7 @@ jobs:
helm repo update
kubectl create ns monitoring
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
--set grafana.enabled=false --set alertmanager.enabled=false
--version 45.28.0 --set grafana.enabled=false --set alertmanager.enabled=false
- name: Build and Install Fission CLI
run: |
@@ -253,7 +257,6 @@ jobs:
- name: Port-forward fission components
run: |
kubectl port-forward svc/router 8888:80 -nfission &
kubectl port-forward svc/controller 8889:80 -nfission &
- name: Get fission version
timeout-minutes: 10
@@ -288,7 +291,7 @@ jobs:
- name: Archive fission dump
timeout-minutes: 10
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: fission-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
path: fission-dump/*.zip
@@ -297,7 +300,7 @@ jobs:
- name: Archive prometheus dump
timeout-minutes: 10
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: prom-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
path: /tmp/prometheus/*
@@ -306,7 +309,7 @@ jobs:
- name: Archive kind logs
timeout-minutes: 10
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: kind-logs-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
path: kind-logs/*
+18 -14
View File
@@ -6,20 +6,21 @@ on:
- v2.**
env:
KIND_VERSION: v0.17.0
KIND_NODE_IMAGE_TAG: v1.19.16
KIND_VERSION: v0.23.0
KIND_NODE_IMAGE_TAG: v1.25.16
KIND_CLUSTER_NAME: kind
jobs:
create-draft-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
@@ -29,37 +30,40 @@ jobs:
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
install-only: true
version: "~> v1"
- name: Kind Clutser
uses: engineerd/setup-kind@v0.5.0
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
node_image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
version: ${{ env.KIND_VERSION }}
config: kind.yaml
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Login to ghcr.io
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to docker.io
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Cosign
uses: sigstore/cosign-installer@main
uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
with:
cosign-release: 'v1.12.0'
cosign-release: "v2.2.1"
- name: Check cosign install!
run: cosign version
@@ -76,9 +80,9 @@ jobs:
shell: bash
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
version: latest
version: "~> v1"
args: release
env:
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
+17 -14
View File
@@ -22,8 +22,9 @@ on:
workflow_dispatch:
env:
HELM_VERSION: v3.10.1
KIND_VERSION: v0.17.0
HELM_VERSION: v3.13.0
KIND_VERSION: v0.23.0
KIND_CLUSTER_NAME: kind
jobs:
upgrade-test:
@@ -32,40 +33,42 @@ jobs:
strategy:
fail-fast: false
matrix:
kindimage: ["kindest/node:v1.19.16"]
kindimage: ["kindest/node:v1.25.16"]
os: [ubuntu-latest]
steps:
- name: Checkout action sources
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: true
- name: Setup Helm
uses: Azure/setup-helm@v3
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: ${{ env.HELM_VERSION }}
- name: Setup Kind Clutser
uses: engineerd/setup-kind@v0.5.0
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
image: ${{ matrix.kindimage }}
node_image: ${{ matrix.kindimage }}
version: ${{ env.KIND_VERSION }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
install-only: true
version: "~> v1"
- name: Setup kubectl & fetch node information
run: |
kubectl cluster-info --context kind-kind
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl get nodes
kubectl get storageclasses.storage.k8s.io
kubectl config use-context kind-kind
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
kubectl config set-context --current --namespace=default
kubectl config view
@@ -99,11 +102,11 @@ jobs:
- name: Kind export logs
if: ${{ always() }}
run: |
kind export logs --name kind kind-logs
kind export logs --name ${{ env.KIND_CLUSTER_NAME }} kind-logs
- name: Archive fission dump
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
path: fission-dump/*.zip
@@ -111,7 +114,7 @@ jobs:
- name: Archive kind logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
path: kind-logs/*
+1
View File
@@ -9,6 +9,7 @@ cmd/reporter/reporter
# Logs
test/logs/
test/e2e/cli/fission-dump/
# Pycharm IDE
.idea
+13 -109
View File
@@ -36,9 +36,6 @@ builds:
goarch:
- amd64
- arm64
- arm
goarm:
- 7
binary: builder
dir: ./cmd/builder
- <<: *build-linux
@@ -60,12 +57,6 @@ builds:
ignore:
- goos: windows
goarch: arm64
- goos: darwin
goarch: arm
goarm: 7
- goos: windows
goarch: arm
goarm: 7
- <<: *build-linux
id: pre-upgrade-checks
binary: pre-upgrade-checks
@@ -88,6 +79,7 @@ dockers:
- "ghcr.io/fission/builder:{{ .Tag }}-amd64"
dockerfile: cmd/builder/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=The builder assists in building the fission function source code for deployment."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -103,6 +95,7 @@ dockers:
- "ghcr.io/fission/fetcher:{{ .Tag }}-amd64"
dockerfile: cmd/fetcher/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=Fetcher is a lightweight component used by environment and builder pods. Fetcher helps in fetch and upload of source/deployment packages and specializing environments."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -118,6 +111,7 @@ dockers:
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-amd64"
dockerfile: cmd/fission-bundle/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=fission-bundle is a component which is a single binary for all components. Most server side components running on server side are fission-bundle binary wrapped in container and used with different arguments."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -133,6 +127,7 @@ dockers:
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-amd64"
dockerfile: cmd/preupgradechecks/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=Preupgradechecks ensures that Fission is ready for the targeted version upgrade by performing checks beforehand."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -148,6 +143,7 @@ dockers:
- "ghcr.io/fission/reporter:{{ .Tag }}-amd64"
dockerfile: cmd/reporter/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=The reporter gathers information that assists in improving fission."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -166,6 +162,7 @@ dockers:
- "ghcr.io/fission/builder:{{ .Tag }}-arm64"
dockerfile: cmd/builder/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=The builder assists in building the fission function source code for deployment."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -181,6 +178,7 @@ dockers:
- "ghcr.io/fission/fetcher:{{ .Tag }}-arm64"
dockerfile: cmd/fetcher/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=Fetcher is a lightweight component used by environment and builder pods. Fetcher helps in fetch and upload of source/deployment packages and specializing environments."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -196,6 +194,7 @@ dockers:
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-arm64"
dockerfile: cmd/fission-bundle/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=fission-bundle is a component which is a single binary for all components. Most server side components running on server side are fission-bundle binary wrapped in container and used with different arguments."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -211,6 +210,7 @@ dockers:
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-arm64"
dockerfile: cmd/preupgradechecks/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=Preupgradechecks ensures that Fission is ready for the targeted version upgrade by performing checks beforehand."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -226,191 +226,93 @@ dockers:
- "ghcr.io/fission/reporter:{{ .Tag }}-arm64"
dockerfile: cmd/reporter/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.description=The reporter gathers information that assists in improving fission."
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- &docker-armv7
use: buildx
goos: linux
goarch: arm
goarm: 7
ids:
- builder
image_templates:
- "fission/builder:latest-armv7"
- "fission/builder:{{ .Tag }}-armv7"
- "ghcr.io/fission/builder:latest-armv7"
- "ghcr.io/fission/builder:{{ .Tag }}-armv7"
dockerfile: cmd/builder/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- <<: *docker-armv7
ids:
- fetcher
image_templates:
- "fission/fetcher:latest-armv7"
- "fission/fetcher:{{ .Tag }}-armv7"
- "ghcr.io/fission/fetcher:latest-armv7"
- "ghcr.io/fission/fetcher:{{ .Tag }}-armv7"
dockerfile: cmd/fetcher/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- <<: *docker-armv7
ids:
- fission-bundle
image_templates:
- "fission/fission-bundle:latest-armv7"
- "fission/fission-bundle:{{ .Tag }}-armv7"
- "ghcr.io/fission/fission-bundle:latest-armv7"
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-armv7"
dockerfile: cmd/fission-bundle/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- <<: *docker-armv7
ids:
- pre-upgrade-checks
image_templates:
- "fission/pre-upgrade-checks:latest-armv7"
- "fission/pre-upgrade-checks:{{ .Tag }}-armv7"
- "ghcr.io/fission/pre-upgrade-checks:latest-armv7"
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-armv7"
dockerfile: cmd/preupgradechecks/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
- <<: *docker-armv7
ids:
- reporter
image_templates:
- "fission/reporter:latest-armv7"
- "fission/reporter:{{ .Tag }}-armv7"
- "ghcr.io/fission/reporter:latest-armv7"
- "ghcr.io/fission/reporter:{{ .Tag }}-armv7"
dockerfile: cmd/reporter/Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Tag}}"
docker_manifests:
- name_template: ghcr.io/fission/builder:{{ .Tag }}
image_templates:
- ghcr.io/fission/builder:{{ .Tag }}-amd64
- ghcr.io/fission/builder:{{ .Tag }}-arm64
- ghcr.io/fission/builder:{{ .Tag }}-armv7
- name_template: fission/builder:{{ .Tag }}
image_templates:
- fission/builder:{{ .Tag }}-amd64
- fission/builder:{{ .Tag }}-arm64
- fission/builder:{{ .Tag }}-armv7
- name_template: ghcr.io/fission/fetcher:{{ .Tag }}
image_templates:
- ghcr.io/fission/fetcher:{{ .Tag }}-amd64
- ghcr.io/fission/fetcher:{{ .Tag }}-arm64
- ghcr.io/fission/fetcher:{{ .Tag }}-armv7
- name_template: fission/fetcher:{{ .Tag }}
image_templates:
- fission/fetcher:{{ .Tag }}-amd64
- fission/fetcher:{{ .Tag }}-arm64
- fission/fetcher:{{ .Tag }}-armv7
- name_template: ghcr.io/fission/fission-bundle:{{ .Tag }}
image_templates:
- ghcr.io/fission/fission-bundle:{{ .Tag }}-amd64
- ghcr.io/fission/fission-bundle:{{ .Tag }}-arm64
- ghcr.io/fission/fission-bundle:{{ .Tag }}-armv7
- name_template: fission/fission-bundle:{{ .Tag }}
image_templates:
- fission/fission-bundle:{{ .Tag }}-amd64
- fission/fission-bundle:{{ .Tag }}-arm64
- fission/fission-bundle:{{ .Tag }}-armv7
- name_template: ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}
image_templates:
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-amd64
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-arm64
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-armv7
- name_template: fission/pre-upgrade-checks:{{ .Tag }}
image_templates:
- fission/pre-upgrade-checks:{{ .Tag }}-amd64
- fission/pre-upgrade-checks:{{ .Tag }}-arm64
- fission/pre-upgrade-checks:{{ .Tag }}-armv7
- name_template: ghcr.io/fission/reporter:{{ .Tag }}
image_templates:
- ghcr.io/fission/reporter:{{ .Tag }}-amd64
- ghcr.io/fission/reporter:{{ .Tag }}-arm64
- ghcr.io/fission/reporter:{{ .Tag }}-armv7
- name_template: fission/reporter:{{ .Tag }}
image_templates:
- fission/reporter:{{ .Tag }}-amd64
- fission/reporter:{{ .Tag }}-arm64
- fission/reporter:{{ .Tag }}-armv7
- name_template: ghcr.io/fission/builder:latest
image_templates:
- ghcr.io/fission/builder:latest-amd64
- ghcr.io/fission/builder:latest-arm64
- ghcr.io/fission/builder:latest-armv7
- name_template: fission/builder:latest
image_templates:
- fission/builder:latest-amd64
- fission/builder:latest-arm64
- fission/builder:latest-armv7
- name_template: ghcr.io/fission/fetcher:latest
image_templates:
- ghcr.io/fission/fetcher:latest-amd64
- ghcr.io/fission/fetcher:latest-arm64
- ghcr.io/fission/fetcher:latest-armv7
- name_template: fission/fetcher:latest
image_templates:
- fission/fetcher:latest-amd64
- fission/fetcher:latest-arm64
- fission/fetcher:latest-armv7
- name_template: ghcr.io/fission/fission-bundle:latest
image_templates:
- ghcr.io/fission/fission-bundle:latest-amd64
- ghcr.io/fission/fission-bundle:latest-arm64
- ghcr.io/fission/fission-bundle:latest-armv7
- name_template: fission/fission-bundle:latest
image_templates:
- fission/fission-bundle:latest-amd64
- fission/fission-bundle:latest-arm64
- fission/fission-bundle:latest-armv7
- name_template: ghcr.io/fission/pre-upgrade-checks:latest
image_templates:
- ghcr.io/fission/pre-upgrade-checks:latest-amd64
- ghcr.io/fission/pre-upgrade-checks:latest-arm64
- ghcr.io/fission/pre-upgrade-checks:latest-armv7
- name_template: fission/pre-upgrade-checks:latest
image_templates:
- fission/pre-upgrade-checks:latest-amd64
- fission/pre-upgrade-checks:latest-arm64
- fission/pre-upgrade-checks:latest-armv7
- name_template: ghcr.io/fission/reporter:latest
image_templates:
- ghcr.io/fission/reporter:latest-amd64
- ghcr.io/fission/reporter:latest-arm64
- ghcr.io/fission/reporter:latest-armv7
- name_template: fission/reporter:latest
image_templates:
- fission/reporter:latest-amd64
- fission/reporter:latest-arm64
- fission/reporter:latest-armv7
changelog:
skip: false
archives:
@@ -436,6 +338,7 @@ signs:
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
- '--yes' # needed for cosign 2.0.0+
# signs our docker image
# https://goreleaser.com/customization/docker_sign
@@ -447,4 +350,5 @@ docker_signs:
args:
- 'sign'
- '--key=cosign.key'
- '${artifact}'
- '${artifact}'
- '--yes' # needed for cosign 2.0.0+
+4 -4
View File
@@ -8,10 +8,10 @@ pull_request_rules:
- check-success=CodeQL-Build
- check-success=CodeQL
- check-success=lint
- check-success=upgrade-test (kindest/node:v1.19.11, ubuntu-latest)
- check-success=integration-test (v1.19.11, ubuntu-latest)
- check-success=integration-test (v1.20.7, ubuntu-latest)
- check-success=integration-test (v1.21.1, ubuntu-latest)
- check-success=upgrade-test (kindest/node:v1.23.17, ubuntu-latest)
- check-success=integration-test (v1.23.17, ubuntu-latest)
- check-success=integration-test (v1.25.11, ubuntu-latest)
- check-success=integration-test (v1.27.3, ubuntu-latest)
actions:
merge:
method: squash
+16 -8
View File
@@ -23,6 +23,7 @@ COMMITSHA ?= $(shell git rev-parse HEAD)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOAMD64 ?= $(shell go env GOAMD64)
GOPATH ?= $(shell go env GOPATH)
FISSION-CLI-SUFFIX :=
ifeq ($(GOOS), windows)
@@ -51,7 +52,7 @@ test-run: code-checks
### Binaries
build-fission-cli:
@GOOS=$(GOOS) GOARCH=$(GOARCH) GOAMD64=$(GOAMD64) GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --rm-dist --single-target --id fission-cli
@GOOS=$(GOOS) GOARCH=$(GOARCH) GOAMD64=$(GOAMD64) GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target --id fission-cli
install-fission-cli:
# TODO: Fix this hack, replace v1 with GOAMD64
@@ -59,21 +60,21 @@ install-fission-cli:
### Codegen
codegen: controller-gen-install
@controller-gen object:headerFile="hack/boilerplate.txt" paths="./..."
@./hack/update-codegen.sh
$(GOPATH)/bin/controller-gen object:headerFile="hack/boilerplate.txt" paths="./..."
### CRDs
controller-gen-install:
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
generate-crds: controller-gen-install
controller-gen crd \
$(GOPATH)/bin/controller-gen crd \
paths=./pkg/apis/core/v1 \
output:crd:artifacts:config=crds/v1
### Webhook generation: it generates webhook configs with help of kubebuilder:webhook tag
generate-webhooks: controller-gen-install
controller-gen webhook \
$(GOPATH)/bin/controller-gen webhook \
paths=./pkg/apis/core/v1 \
output:dir=charts/fission-all/templates/webhook-server
@@ -99,11 +100,11 @@ generate-cli-docs:
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
install-crd-ref-docs:
go install github.com/elastic/crd-ref-docs@v0.0.8
go install github.com/elastic/crd-ref-docs@v0.0.12
generate-crd-ref-docs: install-crd-ref-docs
# crd-ref-docs: https://github.com/elastic/crd-ref-docs
crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown
$(GOPATH)/bin/crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown
cp tools/crd-ref-docs/header.md crd_docs.md
cat out.md >> crd_docs.md && rm out.md
mv crd_docs.md ../fission.io/content/en/docs/reference/crd-reference.md
@@ -111,7 +112,7 @@ generate-crd-ref-docs: install-crd-ref-docs
all-generators: codegen generate-crds generate-swagger-doc generate-cli-docs generate-crd-ref-docs
skaffold-prebuild:
@GOOS=linux GOARCH=amd64 GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --rm-dist --single-target
@GOOS=linux GOARCH=amd64 GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target
@cp -v cmd/builder/Dockerfile dist/builder_linux_amd64_v1/Dockerfile
@cp -v cmd/fetcher/Dockerfile dist/fetcher_linux_amd64_v1/Dockerfile
@cp -v cmd/fission-bundle/Dockerfile dist/fission-bundle_linux_amd64_v1/Dockerfile
@@ -127,3 +128,10 @@ release:
@./hack/release.sh $(VERSION)
@./hack/release-tag.sh $(VERSION)
@./hack/changelog.sh
## Envtest
install-envtest:
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
setup-envtest:
setup-envtest -p path use 1.23.x
+3 -2
View File
@@ -40,8 +40,9 @@
--------------
Fission is a fast serverless framework for Kubernetes with a focus on
developer productivity and high performance.
Fission is an open-source, Kubernetes-native serverless framework that simplifies the deployment of functions and applications on Kubernetes. With Fission, developers can easily create and deploy serverless functions that can be triggered by a variety of events, such as HTTP requests, messages from a message queue, or scheduled tasks.
Fission provides a simple, easy-to-use interface for developers to create serverless functions in their language of choice, without having to worry about the underlying infrastructure. The framework also offers automatic scaling, so functions can scale up or down based on demand, without any additional configuration.
Fission operates on _just the code_: Docker and Kubernetes are
abstracted away under normal operation, though you can use both to
+8 -3
View File
@@ -1,8 +1,9 @@
apiVersion: v2
name: fission-all
version: v1.19.0-rc1
appVersion: v1.19.0-rc1
version: v1.20.4
appVersion: v1.20.4
description: Fission is a fast serverless framework for Kubernetes.
kubeVersion: ">=1.25.0-0"
home: https://fission.io/
icon: https://fission.io/images/fission-logo-white.svg
sources:
@@ -21,4 +22,8 @@ maintainers:
- name: Sanket Sudake
email: sanket@infracloud.io
engine: gotpl
type: application
type: application
annotations:
artifacthub.io/signKey: |
fingerprint: 2EAE29FDF8A387050C82CD5ABBDD4FD6A1FFCBF6
url: https://raw.githubusercontent.com/fission/fission-charts/main/public_key/pgp_keys.asc
+20 -1
View File
@@ -4,7 +4,7 @@
## Prerequisites
- Kubernetes 1.19+
- Kubernetes 1.23+
- Helm 3+
## Get Repo Info
@@ -93,6 +93,25 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.
### Upgrade from 1.18.x to 1.20.x
We have removed controller service from fission-all chart.
### Upgrade from 1.17.x to 1.18.x
With 1.18.x, we have major change in the way we are deploying Fission.
We have added parameters `defaultNamespace`, `additionalFissionNamespaces`, `functionNamespace` and `builderNamespace` to manage the namespaces.
We watch and manage specific namespaces for Fission resources configured via `defaultNamespace` and `additionalFissionNamespaces` parameters.
You dont need to worry about `builderNamespace` and `functionNamespace` parameters, unless you want to consider legacy Fission resources.
Please refer to [core changes](https://fission.io/docs/releases/v1.18.0/#fission-core-changes) for more details.
### Upgrade from 1.16.x to 1.17.x
By default, Fission runs with the default security context. This means that it will be run as root. We have added settings in Helm chart for securityContext across all services in Fission. You can enable recommended securityContext settings during Fission installation.
Please refer to [security context settings](https://fission.io/docs/releases/v1.17.0/#security-context-setting-for-fission-installation) for more details.
### Upgrade from 1.15.x to 1.16.x
If you have been using `prometheus.enabled=true` in your fission-all chart, you will need to deploy the prometheus using prometheus community supported chart.
+9 -3
View File
@@ -11,14 +11,20 @@ Windows:
2. You're ready to use Fission!
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
You can create fission resources in the namespaces "{{ .Values.defaultNamespace }},{{ join "," .Values.additionalFissionNamespaces }}"
{{- else }}
You can create fission resources in the namespace "{{ .Values.defaultNamespace }}"
{{- end }}
# Create an environment
$ fission env create --name nodejs --image fission/node-env
$ fission env create --name nodejs --image fission/node-env --namespace {{ .Values.defaultNamespace }}
# Get a hello world
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
# Register this function with Fission
$ fission function create --name hello --env nodejs --code hello.js
$ fission function create --name hello --env nodejs --code hello.js --namespace {{ .Values.defaultNamespace }}
{{- if .Values.authentication.enabled }}
@@ -29,6 +35,6 @@ Windows:
{{- end }}
# Run this function
$ fission function test --name hello
$ fission function test --name hello --namespace {{ .Values.defaultNamespace }}
Hello, world!
@@ -15,28 +15,6 @@ rules:
- patch
- delete
{{- end }}
{{- define "controller-rules" }}
rules:
- apiGroups:
- fission.io
resources:
- canaryconfigs
- environments
- functions
- httptriggers
- kuberneteswatchtriggers
- messagequeuetriggers
- packages
- timetriggers
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
{{- end }}
{{- define "executor-rules" }}
rules:
- apiGroups:
@@ -63,44 +63,6 @@ rules:
- list
- watch
{{- end }}
{{- define "controller-kuberules" }}
rules:
- apiGroups:
- ""
resources:
- services
verbs:
- list
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- get
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- watch
{{- end }}
{{- define "executor-kuberules" }}
rules:
- apiGroups:
@@ -109,7 +71,6 @@ rules:
- pods
- services
- replicationcontrollers
- events
verbs:
- create
- delete
@@ -117,6 +78,16 @@ rules:
- list
- watch
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- get
- list
- watch
- patch
- apiGroups:
- ""
resources:
@@ -289,7 +260,6 @@ rules:
- pods
- services
- replicationcontrollers
- events
verbs:
- create
- delete
@@ -297,6 +267,16 @@ rules:
- list
- watch
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- get
- list
- watch
- patch
- apiGroups:
- ""
resources:
@@ -374,6 +354,8 @@ rules:
# TODO: Kept for future in case preupgrade needs any permissions in the future
rules: []
{{- end }}
# TODO: Currently, router needs ingress related permissions only.
# In future if router's permissions are modified then check the configured namespace.
{{- define "router-kuberules" }}
rules:
- apiGroups:
@@ -17,9 +17,6 @@ metadata:
{{- if eq "canaryconfig" .component }}
{{- include "canaryconfig-kuberules" . }}
{{- end }}
{{- if eq "controller" .component }}
{{- include "controller-kuberules" . }}
{{- end }}
{{- if eq "fluentbit" .component }}
{{- include "fluentbit-kuberules" . }}
{{- end }}
@@ -14,9 +14,6 @@ metadata:
{{- if eq "buildermgr" .component }}
{{- include "buildermgr-rules" . }}
{{- end }}
{{- if eq "controller" .component }}
{{- include "controller-rules" . }}
{{- end }}
{{- if eq "executor" .component }}
{{- include "executor-rules" . }}
{{- end }}
+13
View File
@@ -89,6 +89,12 @@ This template generates the image name for the deployment depending on the value
{{- end }}
{{- define "fission-resource-namespace.envs" }}
- name: FISSION_BUILDER_NAMESPACE
value: "{{ .Values.builderNamespace }}"
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
- name: FISSION_DEFAULT_NAMESPACE
value: "{{ .Values.defaultNamespace }}"
- name: FISSION_RESOURCE_NAMESPACES
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
value: "{{ .Values.defaultNamespace }},{{ join "," .Values.additionalFissionNamespaces }}"
@@ -97,6 +103,13 @@ This template generates the image name for the deployment depending on the value
{{- end }}
{{- end }}
{{- define "kube_client.envs" }}
- name: KUBE_CLIENT_QPS
value: "{{ .Values.kubernetesClientQPS }}"
- name: KUBE_CLIENT_BURST
value: "{{ .Values.kubernetesClientBurst }}"
{{- end}}
{{/*
Define the svc's name
*/}}
@@ -39,12 +39,6 @@ spec:
value: "{{ .Values.pullPolicy }}"
- name: BUILDER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: FISSION_BUILDER_NAMESPACE
value: "{{ .Values.builderNamespace }}"
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
- name: FISSION_DEFAULT_NAMESPACE
value: "{{ .Values.defaultNamespace }}"
- name: ENABLE_ISTIO
value: "{{ .Values.enableIstio }}"
- name: FETCHER_MINCPU
@@ -62,6 +56,7 @@ spec:
- name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
{{- if .Values.builderPodSpec.enabled }}
volumeMounts:
@@ -37,7 +37,8 @@ spec:
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
@@ -1,102 +0,0 @@
{{- if .Values.controller.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
svc: controller
application: fission-api
spec:
replicas: 1
selector:
matchLabels:
svc: controller
application: fission-api
template:
metadata:
labels:
svc: controller
application: fission-api
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
{{- if .Values.controller.securityContext.enabled }}
securityContext: {{- omit .Values.controller.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: controller
image: {{ include "fission-bundleImage" . | quote }}
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--controllerPort", "8888"]
env:
- name: FISSION_DEFAULT_NAMESPACE
value: "{{ .Values.defaultNamespace }}"
- name: FISSION_BUILDER_NAMESPACE
value: "{{ .Values.builderNamespace }}"
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.controller.resources | nindent 10 }}
{{- if .Values.terminationMessagePath }}
terminationMessagePath: {{ .Values.terminationMessagePath }}
{{- end }}
{{- if .Values.terminationMessagePolicy }}
terminationMessagePolicy: {{ .Values.terminationMessagePolicy }}
{{- end }}
readinessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 1
periodSeconds: 1
failureThreshold: 30
livenessProbe:
httpGet:
path: "/healthz"
port: 8888
initialDelaySeconds: 35
periodSeconds: 5
volumeMounts:
- name: config-volume
mountPath: /etc/config/config.yaml
subPath: config.yaml
ports:
- containerPort: 8080
name: metrics
- containerPort: 8888
name: http
{{- if .Values.pprof.enabled }}
- containerPort: 6060
name: pprof
{{- end }}
serviceAccountName: fission-controller
volumes:
- name: config-volume
configMap:
name: feature-config
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.extraCoreComponentPodConfig }}
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
{{- end }}
{{- end -}}
@@ -1,9 +0,0 @@
{{- if .Values.controller.enabled }}
{{- include "fission-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "controller") .) }}
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
{{- range $namespace := $.Values.additionalFissionNamespaces }}
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "controller") $) }}
{{- end }}
{{- end }}
{{- end -}}
@@ -1,13 +0,0 @@
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "controller") .) }}
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
{{- range $namespace := $.Values.additionalFissionNamespaces }}
{{ include "kubernetes-role-generator" (merge (dict "namespace" $namespace "component" "controller") $) }}
{{- end }}
{{- end }}
{{- if .Values.builderNamespace -}}
{{ include "kubernetes-role-generator" (merge (dict "namespace" .Values.builderNamespace "component" "controller") $) }}
{{- end }}
{{- if .Values.functionNamespace -}}
{{ include "kubernetes-role-generator" (merge (dict "namespace" .Values.functionNamespace "component" "controller") $) }}
{{- end }}
@@ -1,7 +0,0 @@
{{- if .Values.controller.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-controller
namespace: {{ .Release.Namespace }}
{{- end -}}
@@ -1,24 +0,0 @@
{{- if .Values.controller.enabled }}
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: controller-monitor
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
svc: controller
endpoints:
- targetPort: 8080
{{- end -}}
{{- end -}}
@@ -1,20 +0,0 @@
{{- if .Values.controller.enabled }}
apiVersion: v1
kind: Service
metadata:
name: controller
labels:
svc: controller
application: fission-api
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: {{ .Values.serviceType }}
ports:
- port: 80
targetPort: 8888
{{- if eq .Values.serviceType "NodePort" }}
nodePort: {{ .Values.controllerPort }}
{{- end }}
selector:
svc: controller
{{- end -}}
@@ -37,12 +37,6 @@ spec:
{{- end }}
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: FISSION_BUILDER_NAMESPACE
value: "{{ .Values.builderNamespace }}"
- name: FISSION_FUNCTION_NAMESPACE
value: "{{ .Values.functionNamespace }}"
- name: FISSION_DEFAULT_NAMESPACE
value: "{{ .Values.defaultNamespace }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: ADOPT_EXISTING_RESOURCES
@@ -84,6 +78,7 @@ spec:
value: {{ .Values.executor.serviceAccountCheck.interval | quote }}
{{- end}}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
- name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }}
{{- include "opentelemtry.envs" . | indent 8 }}
@@ -118,6 +118,7 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
{{- include "fission-resource-namespace.envs" . | indent 12 }}
command: ["/fission-bundle"]
args: ["--logger"]
volumeMounts:
@@ -127,10 +128,8 @@ spec:
- name: docker-log
mountPath: /var/lib/docker/containers
readOnly: true
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
{{- toYaml .Values.logger.securityContext | nindent 12 }}
- name: fluentbit
{{- if .Values.repository }}
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
@@ -29,7 +29,8 @@ spec:
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.kubewatcher.resources | nindent 10 }}
@@ -47,6 +47,7 @@ spec:
- name: REDIS_IMAGE
value: "{{ .Values.mqt_keda.connector_images.redis.image }}:{{ .Values.mqt_keda.connector_images.redis.tag }}"
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.mqt_keda.resources | nindent 10 }}
@@ -37,6 +37,7 @@ spec:
command: [ "/pre-upgrade-checks" ]
env:
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- if .Values.terminationMessagePath }}
terminationMessagePath: {{ .Values.terminationMessagePath }}
{{- end }}
@@ -12,7 +12,7 @@ metadata:
application: fission-router
spec:
{{- if not .Values.router.deployAsDaemonSet }}
replicas: 1
replicas: {{ .Values.router.replicas | default 1 }}
{{- end }}
selector:
matchLabels:
@@ -83,7 +83,8 @@ spec:
value: {{ .Values.pprof.enabled | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.router.resources | nindent 10 }}
@@ -1,4 +1,3 @@
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "router") .) }}
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Release.Namespace "component" "router") .) }}
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
@@ -10,5 +10,5 @@ metadata:
data:
username: {{ .Values.authentication.authUsername | b64enc | quote }}
password: {{ randAlphaNum 20 | b64enc | quote }}
jwtSigningKey: {{ .Values.authentication.jwtSigningKey | b64enc | quote }}
jwtSigningKey: {{ default (randAlphaNum 20) .Values.authentication.jwtSigningKey | b64enc | quote }}
{{- end }}
@@ -61,6 +61,7 @@ spec:
value: {{ .Values.persistence.s3.region }}
{{- end }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.storagesvc.resources | nindent 10 }}
@@ -30,6 +30,7 @@ spec:
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "fission-resource-namespace.envs" . | indent 8 }}
{{- include "kube_client.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.timer.resources | nindent 10 }}
@@ -16,7 +16,7 @@ apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
creationTimestamp: null
name: mutating-webhook-configuration
name: fission-mutating-webhooks
{{- if $certManagerEnabled }}
annotations:
cert-manager.io/inject-ca-from: "{{ .Release.Namespace }}/fission-webhook-cert"
@@ -49,7 +49,7 @@ apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
creationTimestamp: null
name: validating-webhook-configuration
name: fission-validating-webhooks
{{- if $certManagerEnabled }}
annotations:
cert-manager.io/inject-ca-from: "{{ .Release.Namespace }}/fission-webhook-cert"
+45 -56
View File
@@ -1,7 +1,7 @@
## Fission chart configuration
##
## serviceType to consider while creating Fission Controller service.
## serviceType to consider while creating Fission webhook service.
## For minikube/kind, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
##
serviceType: ClusterIP
@@ -25,7 +25,7 @@ image: fission/fission-bundle
## It is also used by the chart to identify version of the few more images apart from fission-bundle.
## Keep it empty for using latest tag.
##
imageTag: v1.19.0-rc1
imageTag: v1.20.4
## pullPolicy represents the pull policy to use for images in the chart.
##
@@ -53,10 +53,6 @@ terminationMessagePath: /dev/termination-log
##
terminationMessagePolicy: File
## controllerPort represents the port at which the Fission controller service should be exposed.
##
controllerPort: 31313
## routerPort represents the port at which the Fission Router service should be exposed.
##
routerPort: 31314
@@ -96,6 +92,13 @@ createNamespace: true
##
enableIstio: false
## Kubernetes client QPS and Burst settings
##
## kubernetesClientQPS represents the maximum queries per second to the kubernetes api server from client instances of fission components.
kubernetesClientQPS: 200
## kubernetesClientBurst represents the maximum burst queries to the kubernetes api server from client instances of fission components.
kubernetesClientBurst: 500
## fetcher is a light weight component that helps in running functions.
## fetcher helps in fetching function source code/build and uploading it when function is invoked.
##
@@ -103,7 +106,7 @@ fetcher:
## image represents the image of the fetcher component.
image: fission/fetcher
## imageTag represents the tag of the image of the fetcher component.
imageTag: v1.19.0-rc1
imageTag: v1.20.4
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
@@ -211,6 +214,9 @@ router:
## deployAsDaemonSet decides whether to deploy router as a DaemonSet or a Deployment.
##
deployAsDaemonSet: false
## replicas decides how many router pods to deploy. Only used when deployAsDaemonSet is false.
##
replicas: 1
## svcAddressMaxRetries is the max times for router to retry with a specific function service address
##
svcAddressMaxRetries: 5
@@ -337,34 +343,6 @@ buildermgr:
runAsUser: 10001
runAsGroup: 10001
## controller is the component that the client talks to.
## It contains CRUD APIs for functions, triggers, environments, Kubernetes event watches, etc. and proxy APIs to internal 3rd-party services.
##
controller:
enabled: false
## Pod resources as:
## resources:
## limits:
## cpu: <tbd>
## memory: <tbd>
## requests:
## cpu: <tbd>
## memory: <tbd>
##
resources: {}
## Security Context
## It holds pod-level and container level security configuration.
## This is an experimental section, please verify before enabling in production.
## Ref: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1
securityContext:
enabled: true
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## webhook is the component that validates API calls.
## It contains validation and mutation for functions, triggers, environments, Kubernetes event watches, etc.
##
@@ -531,7 +509,7 @@ kafka:
# version: "0.11.2.0"
# The following components expose Prometheus metrics and have servicemonitors in this chart (disabled by default)
# Controller, router, executor, storage svc
# router, executor, storage svc
serviceMonitor:
enabled: false
##namespace in which you want to deploy servicemonitor
@@ -642,11 +620,22 @@ logger:
## 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,
## 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
## The user ID in runAsUser should have access to the `/var/log` and
## `/var/lib/docker/containers` directories on your host.
## On many hosts, this user might be root ,i.e., `runAsUser: 0`.
## Although it is recommended not to use root user for security reasons.
##
## The `/var/log` and `/var/lib/docker/containers` directories on host are mounted
## to logger container with volumeType `HostPath`.
securityContext: {}
# privileged: true
# runAsUser: 0
## Enable PodSecurityPolicies to allow privileged container
## Only required in some clusters and when enableSecurityContext is true
@@ -685,7 +674,7 @@ preUpgradeChecks:
image: fission/pre-upgrade-checks
## pre-install/pre-upgrade checks image version
##
imageTag: v1.19.0-rc1
imageTag: v1.20.4
## Fission post-install/post-upgrade reporting live in this image
##
@@ -753,7 +742,7 @@ authentication:
## jwtSigningKey is the signing key used for
## signing the JWT token
##
jwtSigningKey: serverless
jwtSigningKey:
## jwtExpiryTime is the JWT expiry time
## in seconds
## default '120'
@@ -816,29 +805,29 @@ mqt_keda:
enabled: true
connector_images:
kafka:
image: fission/keda-kafka-http-connector
tag: v0.11
image: ghcr.io/fission/keda-kafka-http-connector
tag: v0.15
rabbitmq:
image: fission/keda-rabbitmq-http-connector
tag: v0.10
image: ghcr.io/fission/keda-rabbitmq-http-connector
tag: v0.13
awskinesis:
image: fission/keda-aws-kinesis-http-connector
tag: v0.10
image: ghcr.io/fission/keda-aws-kinesis-http-connector
tag: v0.13
aws_sqs:
image: fission/keda-aws-sqs-http-connector
tag: v0.10
image: ghcr.io/fission/keda-aws-sqs-http-connector
tag: v0.14
nats_steaming:
image: fission/keda-nats-streaming-http-connector
tag: v0.12
image: ghcr.io/fission/keda-nats-streaming-http-connector
tag: v0.16
nats_jetstream:
image: fission/keda-nats-jetstream-http-connector
tag: v0.2
image: ghcr.io/fission/keda-nats-jetstream-http-connector
tag: v0.7
gcp_pubsub:
image: fission/keda-gcp-pubsub-http-connector
tag: v0.5
image: ghcr.io/fission/keda-gcp-pubsub-http-connector
tag: v0.9
redis:
image: fission/keda-redis-http-connector
tag: v0.3
image: ghcr.io/fission/keda-redis-http-connector
tag: v0.6
## Pod resources as:
## resources:
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.17
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY builder /builder
ENTRYPOINT ["/builder"]
+4 -2
View File
@@ -24,16 +24,18 @@ import (
builder "github.com/fission/fission/pkg/builder"
"github.com/fission/fission/pkg/utils/httpserver"
"github.com/fission/fission/pkg/utils/manager"
)
// Usage: builder <shared volume path>
func Run(ctx context.Context, logger *zap.Logger, shareVolume string) {
func Run(ctx context.Context, logger *zap.Logger, mgr manager.Interface, shareVolume string) {
builder := builder.MakeBuilder(logger, shareVolume)
mux := http.NewServeMux()
mux.HandleFunc("/", builder.Handler)
mux.HandleFunc("/clean", builder.Clean)
mux.HandleFunc("/version", builder.VersionHandler)
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
httpserver.StartServer(ctx, logger, "builder", "8001", mux)
httpserver.StartServer(ctx, logger, mgr, "builder", "8001", mux)
}
+8 -2
View File
@@ -24,15 +24,21 @@ import (
"github.com/fission/fission/cmd/builder/app"
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/pkg/utils/profile"
)
// Usage: builder <shared volume path>
func main() {
mgr := manager.New()
defer mgr.Wait()
logger := loggerfactory.GetLogger()
defer logger.Sync()
ctx := signals.SetupSignalHandler()
profile.ProfileIfEnabled(ctx, logger)
profile.ProfileIfEnabled(ctx, logger, mgr)
shareVolume := os.Args[1]
if _, err := os.Stat(shareVolume); err != nil {
if os.IsNotExist(err) {
@@ -42,5 +48,5 @@ func main() {
}
}
}
app.Run(ctx, logger, shareVolume)
app.Run(ctx, logger, mgr, shareVolume)
}
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.17
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY fetcher /
ENTRYPOINT ["/fetcher"]
+7 -5
View File
@@ -28,8 +28,10 @@ import (
"go.opentelemetry.io/otel"
"go.uber.org/zap"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/fetcher"
"github.com/fission/fission/pkg/utils/httpserver"
"github.com/fission/fission/pkg/utils/manager"
otelUtils "github.com/fission/fission/pkg/utils/otel"
)
@@ -37,7 +39,7 @@ var (
readyToServe uint32
)
func Run(ctx context.Context, logger *zap.Logger) {
func Run(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port string, podInfoMountDir string) {
flag.Usage = fetcherUsage
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod startup")
specializePayload := flag.String("specialize-request", "", "JSON payload for specialize request")
@@ -72,13 +74,13 @@ func Run(ctx context.Context, logger *zap.Logger) {
ctx, span := tracer.Start(ctx, "fetcher/Run")
defer span.End()
f, err := fetcher.MakeFetcher(logger, dir, *secretDir, *configDir)
f, err := fetcher.MakeFetcher(logger, clientGen, dir, *secretDir, *configDir, podInfoMountDir)
if err != nil {
logger.Fatal("error making fetcher", zap.Error(err))
}
// do specialization in other goroutine to prevent blocking in newdeploy
go func() {
mgr.Add(ctx, func(_ context.Context) {
if *specializeOnStart {
var specializeReq fetcher.FunctionSpecializeRequest
@@ -93,7 +95,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
}
}
atomic.StoreUint32(&readyToServe, 1)
}()
})
mux := http.NewServeMux()
mux.HandleFunc("/fetch", f.FetchHandler)
@@ -119,7 +121,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
logger.Info("fetcher ready to receive requests")
handler := otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
httpserver.StartServer(ctx, logger, "fetcher", "8000", handler)
httpserver.StartServer(ctx, logger, mgr, "fetcher", port, handler)
}
func fetcherUsage() {
+12 -2
View File
@@ -20,16 +20,26 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"github.com/fission/fission/cmd/fetcher/app"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/pkg/utils/profile"
)
const fetcherPort = "8000"
// Usage: fetcher <shared volume path>
func main() {
mgr := manager.New()
defer mgr.Wait()
logger := loggerfactory.GetLogger()
defer logger.Sync()
ctx := signals.SetupSignalHandler()
profile.ProfileIfEnabled(ctx, logger)
app.Run(ctx, logger)
profile.ProfileIfEnabled(ctx, logger, mgr)
app.Run(ctx, crd.NewClientGenerator(), logger, mgr, fetcherPort, fv1.PodInfoMount)
}
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.17
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY fission-bundle /
ENTRYPOINT ["/fission-bundle"]
+54 -57
View File
@@ -26,12 +26,14 @@ import (
docopt "github.com/docopt/docopt-go"
"go.uber.org/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
cnwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
"github.com/fission/fission/cmd/fission-bundle/mqtrigger"
"github.com/fission/fission/pkg/buildermgr"
"github.com/fission/fission/pkg/canaryconfigmgr"
"github.com/fission/fission/pkg/controller"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/executor"
eclient "github.com/fission/fission/pkg/executor/client"
"github.com/fission/fission/pkg/info"
"github.com/fission/fission/pkg/kubewatcher"
functionLogger "github.com/fission/fission/pkg/logger"
@@ -40,59 +42,58 @@ import (
"github.com/fission/fission/pkg/storagesvc"
"github.com/fission/fission/pkg/timer"
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/profile"
"github.com/fission/fission/pkg/webhook"
)
// runWebhook starts admission webhook server
func runWebhook(ctx context.Context, logger *zap.Logger, port int) error {
return webhook.Start(ctx, logger, port)
func runWebhook(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, port int) error {
return webhook.Start(ctx, clientGen, logger, cnwebhook.Options{
Port: port,
})
}
func runController(ctx context.Context, logger *zap.Logger, port int) {
controller.Start(ctx, logger, port, false)
func runCanaryConfigServer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) error {
return canaryconfigmgr.StartCanaryServer(ctx, clientGen, logger, mgr, false)
}
func runCanaryConfigServer(ctx context.Context, logger *zap.Logger) error {
return canaryconfigmgr.StartCanaryServer(ctx, logger, false)
func runRouter(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, executorUrl string) error {
return router.Start(ctx, clientGen, logger, mgr, port, eclient.MakeClient(logger, executorUrl))
}
func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string) {
router.Start(ctx, logger, port, executorUrl)
func runExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int) error {
return executor.StartExecutor(ctx, clientGen, logger, mgr, port)
}
func runExecutor(ctx context.Context, logger *zap.Logger, port int) error {
return executor.StartExecutor(ctx, logger, port)
func runKubeWatcher(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
return kubewatcher.Start(ctx, clientGen, logger, mgr, routerUrl)
}
func runKubeWatcher(ctx context.Context, logger *zap.Logger, routerUrl string) error {
return kubewatcher.Start(ctx, logger, routerUrl)
func runTimer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
return timer.Start(ctx, clientGen, logger, mgr, routerUrl)
}
func runTimer(ctx context.Context, logger *zap.Logger, routerUrl string) error {
return timer.Start(ctx, logger, routerUrl)
}
func runMessageQueueMgr(ctx context.Context, logger *zap.Logger, routerUrl string) error {
return mqtrigger.Start(ctx, logger, routerUrl)
func runMessageQueueMgr(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
return mqtrigger.Start(ctx, clientGen, logger, mgr, routerUrl)
}
// KEDA based MessageQueue Trigger Manager
func runMQManager(ctx context.Context, logger *zap.Logger, routerURL string) error {
return mqt.StartScalerManager(ctx, logger, routerURL)
func runMQManager(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerURL string) error {
return mqt.StartScalerManager(ctx, clientGen, logger, mgr, routerURL)
}
func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage) error {
return storagesvc.Start(ctx, logger, storage, port)
func runStorageSvc(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, storage storagesvc.Storage) error {
return storagesvc.Start(ctx, clientGen, logger, storage, mgr, port)
}
func runBuilderMgr(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error {
return buildermgr.Start(ctx, logger, storageSvcUrl)
func runBuilderMgr(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, storageSvcUrl string) error {
return buildermgr.Start(ctx, clientGen, logger, mgr, storageSvcUrl)
}
func runLogger(ctx context.Context, logger *zap.Logger) {
functionLogger.Start(ctx, logger)
func runLogger(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger) error {
return functionLogger.Start(ctx, clientGen, logger)
}
func getPort(logger *zap.Logger, portArg interface{}) int {
@@ -115,9 +116,7 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
func getServiceName(arguments map[string]interface{}) string {
serviceName := "Fission-Unknown"
if arguments["--controllerPort"] != nil {
serviceName = "Fission-Controller"
} else if arguments["--routerPort"] != nil {
if arguments["--routerPort"] != nil {
serviceName = "Fission-Router"
} else if arguments["--executorPort"] != nil {
serviceName = "Fission-Executor"
@@ -145,6 +144,9 @@ func exitWithSync(logger *zap.Logger) {
}
func main() {
mgr := manager.New()
defer mgr.Wait()
var err error
// From https://github.com/containous/traefik/pull/1817/files
@@ -155,18 +157,17 @@ func main() {
// TODO: fix the lint error. Error checking here is causing all components to crash with error "logtostderr not found"
flag.Set("logtostderr", "true") //nolint: errcheck
usage := `fission-bundle: Package of all fission microservices: controller, router, executor.
usage := `fission-bundle: Package of all fission microservices: router, executor.
Use it to start one or more of the fission servers:
Controller is a stateless API frontend for fission resources.
Pool manager maintains a pool of generalized function containers, and
specializes them on-demand. Executor must be run from a pod in a
Kubernetes cluster.
Router implements HTTP triggers: it routes to running instances,
working with the controller and executor.
working with the executor.
Kubewatcher implements Kubernetes Watch triggers: it watches
Kubernetes resources and invokes functions described in the
@@ -177,7 +178,6 @@ Use it to start one or more of the fission servers:
backends.
Usage:
fission-bundle --controllerPort=<port>
fission-bundle --canaryConfig
fission-bundle --routerPort=<port> [--executorUrl=<url>]
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
@@ -191,7 +191,6 @@ Usage:
fission-bundle --logger
fission-bundle --version
Options:
--controllerPort=<port> Port that the controller should listen on.
--canaryConfig Start canary config server.
--webhookPort=<port> Port that the webhook should listen on.
--routerPort=<port> Port that the router should listen on.
@@ -214,7 +213,7 @@ Options:
defer exitWithSync(logger)
ctx := signals.SetupSignalHandler()
profile.ProfileIfEnabled(ctx, logger)
profile.ProfileIfEnabled(ctx, logger, mgr)
version := fmt.Sprintf("Fission Bundle Version: %s", info.BuildInfo().String())
arguments, err := docopt.ParseArgs(usage, nil, version)
@@ -235,23 +234,17 @@ Options:
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
clientGen := crd.NewClientGenerator()
if arguments["--webhookPort"] != nil {
port := getPort(logger, arguments["--webhookPort"])
err = runWebhook(ctx, logger, port)
err = runWebhook(ctx, clientGen, logger, port)
logger.Error("webhook server exited:", zap.Error(err))
return
}
if arguments["--controllerPort"] != nil {
port := getPort(logger, arguments["--controllerPort"])
runController(ctx, logger, port)
logger.Error("controller exited")
return
}
if arguments["--canaryConfig"] == true {
err := runCanaryConfigServer(ctx, logger)
err := runCanaryConfigServer(ctx, clientGen, logger, mgr)
if err != nil {
logger.Error("canary config server exited with error: ", zap.Error(err))
return
@@ -260,14 +253,16 @@ Options:
if arguments["--routerPort"] != nil {
port := getPort(logger, arguments["--routerPort"])
runRouter(ctx, logger, port, executorUrl)
logger.Error("router exited")
return
err = runRouter(ctx, clientGen, logger, mgr, port, executorUrl)
if err != nil {
logger.Error("router exited", zap.Error(err))
return
}
}
if arguments["--executorPort"] != nil {
port := getPort(logger, arguments["--executorPort"])
err = runExecutor(ctx, logger, port)
err = runExecutor(ctx, clientGen, logger, mgr, port)
if err != nil {
logger.Error("executor exited", zap.Error(err))
return
@@ -275,7 +270,7 @@ Options:
}
if arguments["--kubewatcher"] == true {
err = runKubeWatcher(ctx, logger, routerUrl)
err = runKubeWatcher(ctx, clientGen, logger, mgr, routerUrl)
if err != nil {
logger.Error("kubewatcher exited", zap.Error(err))
return
@@ -283,7 +278,7 @@ Options:
}
if arguments["--timer"] == true {
err = runTimer(ctx, logger, routerUrl)
err = runTimer(ctx, clientGen, logger, mgr, routerUrl)
if err != nil {
logger.Error("timer exited", zap.Error(err))
return
@@ -291,7 +286,7 @@ Options:
}
if arguments["--mqt"] == true {
err = runMessageQueueMgr(ctx, logger, routerUrl)
err = runMessageQueueMgr(ctx, clientGen, logger, mgr, routerUrl)
if err != nil {
logger.Error("message queue manager exited", zap.Error(err))
return
@@ -299,7 +294,7 @@ Options:
}
if arguments["--mqt_keda"] == true {
err = runMQManager(ctx, logger, routerUrl)
err = runMQManager(ctx, clientGen, logger, mgr, routerUrl)
if err != nil {
logger.Error("mqt scaler manager exited", zap.Error(err))
return
@@ -307,7 +302,7 @@ Options:
}
if arguments["--builderMgr"] == true {
err = runBuilderMgr(ctx, logger, storageSvcUrl)
err = runBuilderMgr(ctx, clientGen, logger, mgr, storageSvcUrl)
if err != nil {
logger.Error("builder manager exited", zap.Error(err))
return
@@ -315,8 +310,10 @@ Options:
}
if arguments["--logger"] == true {
runLogger(ctx, logger)
logger.Error("logger exited")
err = runLogger(ctx, clientGen, logger)
if err != nil {
logger.Error("logger exited", zap.Error(err))
}
return
}
@@ -330,7 +327,7 @@ Options:
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
storage = storagesvc.NewLocalStorage("/fission")
}
err := runStorageSvc(ctx, logger, port, storage)
err := runStorageSvc(ctx, clientGen, logger, mgr, port, storage)
if err != nil {
logger.Error("storage service exited", zap.Error(err))
return
+24 -5
View File
@@ -22,26 +22,29 @@ import (
"os"
"path"
"strings"
"time"
"github.com/pkg/errors"
"go.uber.org/zap"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd"
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
"github.com/fission/fission/pkg/mqtrigger"
"github.com/fission/fission/pkg/mqtrigger/factory"
"github.com/fission/fission/pkg/mqtrigger/messageQueue"
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/kafka"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
clientGen := crd.NewClientGenerator()
func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
fissionClient, err := clientGen.GetFissionClient()
if err != nil {
return errors.Wrap(err, "failed to get fission client")
}
err = crd.WaitForCRDs(ctx, logger, fissionClient)
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
if err != nil {
return errors.Wrap(err, "error waiting for CRDs")
}
@@ -73,8 +76,24 @@ func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
if err != nil {
logger.Fatal("failed to connect to remote message queue server", zap.Error(err))
}
mqtMgr := mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, mq)
mqtMgr.Run(ctx)
finformerFactory := make(map[string]genInformer.SharedInformerFactory, 0)
for _, ns := range utils.DefaultNSResolver().FissionResourceNS {
finformerFactory[ns] = genInformer.NewFilteredSharedInformerFactory(fissionClient, time.Minute*30, ns, nil)
}
mqtMgr, err := mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, finformerFactory, mq)
if err != nil {
return err
}
// Start informer factory
for _, factory := range finformerFactory {
factory.Start(ctx.Done())
}
mqtMgr.Run(ctx, ctx.Done(), mgr)
return nil
}
+3 -5
View File
@@ -49,7 +49,7 @@ const (
`
)
func App() *cobra.Command {
func App(clientOptions cmd.ClientOptions) *cobra.Command {
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
@@ -59,9 +59,7 @@ func App() *cobra.Command {
PersistentPreRunE: wrapper.Wrapper(
func(input cli.Input) error {
console.Verbosity = input.Int(flagkey.Verbosity)
clientOptions := cmd.ClientOptions{
KubeContext: input.String(flagkey.KubeContext),
}
clientOptions.KubeContext = input.String(flagkey.KubeContext)
// TODO: use fake rest client for offline spec generation
// if input.IsSet(flagkey.ClientOnly) || input.IsSet(flagkey.PreCheckOnly) {
// }
@@ -83,7 +81,7 @@ func App() *cobra.Command {
})
wrapper.SetFlags(rootCmd, flag.FlagSet{
Global: []flag.Flag{flag.GlobalServer, flag.GlobalVerbosity, flag.KubeContext, flag.Namespace},
Global: []flag.Flag{flag.GlobalVerbosity, flag.KubeContext, flag.Namespace},
})
groups := helptemplate.CommandGroups{}
+2 -1
View File
@@ -20,11 +20,12 @@ import (
"os"
"github.com/fission/fission/cmd/fission-cli/app"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/fission-cli/console"
)
func main() {
cmd := app.App()
cmd := app.App(cmd.ClientOptions{})
cmd.SilenceErrors = true // use our own error message printer
err := cmd.Execute()
+1 -2
View File
@@ -1,4 +1,3 @@
FROM alpine:3.17
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY pre-upgrade-checks /
ENTRYPOINT ["/pre-upgrade-checks"]
+18 -18
View File
@@ -18,11 +18,10 @@ package main
import (
"context"
"errors"
"fmt"
"strings"
multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"go.uber.org/zap"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
@@ -51,19 +50,19 @@ const (
MqtCRD = "messagequeuetriggers.fission.io"
)
func makePreUpgradeTaskClient(logger *zap.Logger) (*PreUpgradeTaskClient, error) {
clientGen := crd.NewClientGenerator()
func makePreUpgradeTaskClient(clientGen crd.ClientGeneratorInterface, logger *zap.Logger) (*PreUpgradeTaskClient, error) {
var err error
fissionClient, err := clientGen.GetFissionClient()
if err != nil {
return nil, errors.Wrap(err, "failed to get fission client")
return nil, fmt.Errorf("failed to get fission client: %w", err)
}
k8sClient, err := clientGen.GetKubernetesClient()
if err != nil {
return nil, errors.Wrap(err, "failed to get kubernetes client")
return nil, fmt.Errorf("failed to get kubernetes client: %w", err)
}
apiExtClient, err := clientGen.GetApiExtensionsClient()
if err != nil {
return nil, errors.Wrap(err, "failed to get apiextensions client")
return nil, fmt.Errorf("failed to get apiextensions client: %w", err)
}
return &PreUpgradeTaskClient{
@@ -125,12 +124,12 @@ func (client *PreUpgradeTaskClient) LatestSchemaApplied(ctx context.Context) err
// VerifyFunctionSpecReferences verifies that a function references secrets, configmaps, pkgs in its own namespace and
// outputs a list of functions that don't adhere to this requirement.
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Context) {
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Context) error {
client.logger.Info("verifying function spec references for all functions in the cluster")
var err error
var fList *fv1.FunctionList
errs := &multierror.Error{}
var errs error
for _, namespace := range utils.DefaultNSResolver().FissionResourceNS {
for i := 0; i < maxRetries; i++ {
@@ -141,9 +140,11 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Con
}
if err != nil {
client.logger.Fatal("error listing functions after max retries",
client.logger.Error("error listing functions after max retries",
zap.Error(err),
zap.Int("max_retries", maxRetries))
errs = errors.Join(errs, fmt.Errorf("error listing functions in namespace : %s", namespace))
continue
}
// check that all secrets, configmaps, packages are in the same namespace
@@ -151,28 +152,27 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Con
secrets := fn.Spec.Secrets
for _, secret := range secrets {
if secret.Namespace != "" && 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))
errs = errors.Join(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 != "" && 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))
errs = errors.Join(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.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))
errs = errors.Join(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
}
}
}
if errs.ErrorOrNil() != nil {
client.logger.Fatal("installation failed",
zap.Error(errs),
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
if errs != nil {
return errs
}
client.logger.Info("function spec references verified")
return nil
}
+31
View File
@@ -0,0 +1,31 @@
package main
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/fission/fission/test/e2e/framework"
)
func TestPreUpgradeTaskClient(t *testing.T) {
f := framework.NewFramework()
defer f.Logger().Sync()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err := f.Start(ctx)
require.NoError(t, err)
preupgradeClient, err := makePreUpgradeTaskClient(f.ClientGen(), f.Logger())
require.NoError(t, err)
crd := preupgradeClient.GetFunctionCRD(ctx)
require.NotNil(t, crd)
err = preupgradeClient.LatestSchemaApplied(ctx)
require.NoError(t, err)
err = preupgradeClient.VerifyFunctionSpecReferences(ctx)
require.NoError(t, err)
}
+10 -6
View File
@@ -20,6 +20,7 @@ import (
"go.uber.org/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -27,22 +28,25 @@ func main() {
logger := loggerfactory.GetLogger()
defer logger.Sync()
crdBackedClient, err := makePreUpgradeTaskClient(logger)
ctx := signals.SetupSignalHandler()
preupgradeClient, err := makePreUpgradeTaskClient(crd.NewClientGenerator(), logger)
if err != nil {
logger.Fatal("error creating a crd client, please retry helm upgrade",
zap.Error(err))
}
ctx := signals.SetupSignalHandler()
crd := crdBackedClient.GetFunctionCRD(ctx)
crd := preupgradeClient.GetFunctionCRD(ctx)
if crd == nil {
logger.Info("nothing to do since CRDs are not present on the cluster")
return
}
err = crdBackedClient.LatestSchemaApplied(ctx)
err = preupgradeClient.LatestSchemaApplied(ctx)
if err != nil {
logger.Fatal("New CRDs are not applied", zap.Error(err))
}
crdBackedClient.VerifyFunctionSpecReferences(ctx)
err = preupgradeClient.VerifyFunctionSpecReferences(ctx)
if err != nil {
logger.Fatal("Function spec references are not valid", zap.Error(err))
}
}
+2 -3
View File
@@ -1,4 +1,3 @@
FROM alpine:3.17
RUN apk add --update ca-certificates
FROM cgr.dev/chainguard/static:latest
COPY reporter /
ENTRYPOINT ["/reporter"]
ENTRYPOINT ["/reporter"]
+12 -8
View File
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
name: canaryconfigs.fission.io
spec:
group: fission.io
@@ -21,14 +20,19 @@ spec:
description: CanaryConfig is for canary deployment of two functions.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+53 -37
View File
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
name: httptriggers.fission.io
spec:
group: fission.io
@@ -22,14 +21,19 @@ spec:
HTTP requests.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
@@ -47,35 +51,39 @@ spec:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
description: |-
Function Reference by weight. this map contains function name as key and its weight
as the value. This is for canary upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
description: |-
Type indicates whether this function reference is by name or selector. For now,
the only supported reference type is by "name". Future reference types:
* Function by label or annotation
* Branch or tag of a versioned function
* A "rolling upgrade" from one version of a function to another
Available value:
- name
- function-weights
type: string
required:
- name
- type
type: object
host:
description: 'TODO: remove this field since we have IngressConfig
already Deprecated: the original idea of this field is not for setting
Ingress. Since we have IngressConfig now, remove Host after couple
releases.'
description: |-
TODO: remove this field since we have IngressConfig already
Deprecated: the original idea of this field is not for setting Ingress.
Since we have IngressConfig now, remove Host after couple releases.
type: string
ingressconfig:
description: 'TODO: make IngressConfig an independent Fission resource
IngressConfig for router to set up Ingress.'
description: |-
TODO: make IngressConfig an independent Fission resource
IngressConfig for router to set up Ingress.
properties:
annotations:
additionalProperties:
@@ -85,26 +93,32 @@ spec:
nullable: true
type: object
host:
description: Host is for ingress controller to apply rules. If
host is empty or "*", the rule applies to all inbound HTTP traffic.
description: |-
Host is for ingress controller to apply rules. If
host is empty or "*", the rule applies to all
inbound HTTP traffic.
type: string
path:
description: Path is for path matching. The format of path depends
on what ingress controller you used.
description: |-
Path is for path matching. The format of path
depends on what ingress controller you used.
type: string
tls:
description: TLS is for user to specify a Secret that contains
TLS key and certificate. The domain name in the key and crt
must match the value of Host field.
description: |-
TLS is for user to specify a Secret that contains
TLS key and certificate. The domain name in the
key and crt must match the value of Host field.
type: string
type: object
keepPrefix:
description: When function is exposed with Prefix based path, keepPrefix
decides whether to keep or trim prefix in URL while invoking function.
description: |-
When function is exposed with Prefix based path,
keepPrefix decides whether to keep or trim prefix in URL while invoking function.
type: boolean
method:
description: Use Methods instead of Method. This field is going to
be deprecated in a future release HTTP method to access a function.
description: |-
Use Methods instead of Method. This field is going to be deprecated in a future release
HTTP method to access a function.
type: string
methods:
description: HTTP methods to access a function
@@ -112,9 +126,11 @@ spec:
type: string
type: array
prefix:
description: 'Prefix with which functions are exposed. NOTE: Prefix
takes precedence over URL/RelativeURL. Note that it does not treat
slashes specially ("/foobar/" will be matched by the prefix "/foobar").'
description: |-
Prefix with which functions are exposed.
NOTE: Prefix takes precedence over URL/RelativeURL.
Note that it does not treat slashes specially ("/foobar/" will be matched by
the prefix "/foobar").
type: string
relativeurl:
description: RelativeURL is the exposed URL for external client to
+27 -19
View File
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
name: kuberneteswatchtriggers.fission.io
spec:
group: fission.io
@@ -22,14 +21,19 @@ spec:
invokes functions.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
@@ -37,27 +41,31 @@ spec:
description: KubernetesWatchTriggerSpec defines spec of KuberenetesWatchTrigger
properties:
functionref:
description: The reference to a function for kubewatcher to invoke
with when receiving events.
description: |-
The reference to a function for kubewatcher to invoke with
when receiving events.
properties:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
description: |-
Function Reference by weight. this map contains function name as key and its weight
as the value. This is for canary upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
description: |-
Type indicates whether this function reference is by name or selector. For now,
the only supported reference type is by "name". Future reference types:
* Function by label or annotation
* Branch or tag of a versioned function
* A "rolling upgrade" from one version of a function to another
Available value:
- name
- function-weights
type: string
required:
- name
File diff suppressed because it is too large Load Diff
+46 -29
View File
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
name: packages.fission.io
spec:
group: fission.io
@@ -23,14 +22,19 @@ spec:
description: Package Think of these as function-level images.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
@@ -47,24 +51,30 @@ spec:
runtime used to run user function.
properties:
checksum:
description: Checksum ensures the integrity of packages referenced
by URL. Ignored for literals.
description: |-
Checksum ensures the integrity of packages
referenced by URL. Ignored for literals.
properties:
sum:
type: string
type:
description: ChecksumType specifies the checksum algorithm,
such as sha256, used for a checksum.
description: |-
ChecksumType specifies the checksum algorithm, such as
sha256, used for a checksum.
type: string
type: object
literal:
description: Literal contents of the package. Can be used for
description: |-
Literal contents of the package. Can be used for
encoding packages below TODO (256 KB?) size.
format: byte
type: string
type:
description: 'Type defines how the package is specified: literal
or URL. Available value: - literal - url'
description: |-
Type defines how the package is specified: literal or URL.
Available value:
- literal
- url
type: string
url:
description: URL references a package.
@@ -83,30 +93,36 @@ spec:
- namespace
type: object
source:
description: Source is the archive contains source code and dependencies
file. If the package status is in PENDING state, builder manager
will then notify builder to compile source and save the result as
deployable archive.
description: |-
Source is the archive contains source code and dependencies file.
If the package status is in PENDING state, builder manager will then
notify builder to compile source and save the result as deployable archive.
properties:
checksum:
description: Checksum ensures the integrity of packages referenced
by URL. Ignored for literals.
description: |-
Checksum ensures the integrity of packages
referenced by URL. Ignored for literals.
properties:
sum:
type: string
type:
description: ChecksumType specifies the checksum algorithm,
such as sha256, used for a checksum.
description: |-
ChecksumType specifies the checksum algorithm, such as
sha256, used for a checksum.
type: string
type: object
literal:
description: Literal contents of the package. Can be used for
description: |-
Literal contents of the package. Can be used for
encoding packages below TODO (256 KB?) size.
format: byte
type: string
type:
description: 'Type defines how the package is specified: literal
or URL. Available value: - literal - url'
description: |-
Type defines how the package is specified: literal or URL.
Available value:
- literal
- url
type: string
url:
description: URL references a package.
@@ -126,9 +142,10 @@ spec:
description: BuildStatus is the package build status.
type: string
lastUpdateTimestamp:
description: LastUpdateTimestamp will store the timestamp the package
was last updated metav1.Time is a wrapper around time.Time which
supports correct marshaling to YAML and JSON. https://github.com/kubernetes/apimachinery/blob/44bd77c24ef93cd3a5eb6fef64e514025d10d44e/pkg/apis/meta/v1/time.go#L26-L35
description: |-
LastUpdateTimestamp will store the timestamp the package was last updated
metav1.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON.
https://github.com/kubernetes/apimachinery/blob/44bd77c24ef93cd3a5eb6fef64e514025d10d44e/pkg/apis/meta/v1/time.go#L26-L35
format: date-time
nullable: true
type: string
+26 -18
View File
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
name: timetriggers.fission.io
spec:
group: fission.io
@@ -21,19 +20,25 @@ spec:
description: TimeTrigger invokes functions based on given cron schedule.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: TimeTriggerSpec invokes the specific function at a time or
description: |-
TimeTriggerSpec invokes the specific function at a time or
times specified by a cron string.
properties:
cron:
@@ -45,21 +50,24 @@ spec:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
description: |-
Function Reference by weight. this map contains function name as key and its weight
as the value. This is for canary upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
description: |-
Type indicates whether this function reference is by name or selector. For now,
the only supported reference type is by "name". Future reference types:
* Function by label or annotation
* Branch or tag of a versioned function
* A "rolling upgrade" from one version of a function to another
Available value:
- name
- function-weights
type: string
required:
- name
+123 -126
View File
@@ -1,196 +1,193 @@
module github.com/fission/fission
go 1.20
go 1.22.2
require (
github.com/Shopify/sarama v1.37.2
dario.cat/mergo v1.0.0
github.com/IBM/sarama v1.43.2
github.com/bep/debounce v1.2.1
github.com/dchest/uniuri v1.2.0
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/dustin/go-humanize v1.0.0
github.com/elastic/crd-ref-docs v0.0.8
github.com/emicklei/go-restful-openapi/v2 v2.9.1
github.com/emicklei/go-restful/v3 v3.10.1
github.com/fatih/color v1.13.0
github.com/fsnotify/fsnotify v1.6.0
github.com/go-git/go-git/v5 v5.4.2
github.com/go-openapi/spec v0.20.7
github.com/golang-jwt/jwt/v4 v4.4.3
github.com/google/go-cmp v0.5.9
github.com/gorilla/mux v1.8.0
github.com/dustin/go-humanize v1.0.1
github.com/elastic/crd-ref-docs v0.0.12
github.com/fatih/color v1.16.0
github.com/fsnotify/fsnotify v1.7.0
github.com/go-git/go-git/v5 v5.12.0
github.com/go-logr/zapr v1.3.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/graymeta/stow v0.2.8
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/imdario/mergo v0.3.13
github.com/influxdata/influxdb v1.11.0
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/influxdata/influxdb v1.11.5
github.com/kedacore/keda/v2 v2.15.0
github.com/mholt/archiver/v3 v3.5.1
github.com/minio/minio-go v6.0.14+incompatible
github.com/ory/dockertest v3.3.5+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/common v0.37.0
github.com/robfig/cron/v3 v3.0.0
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.55.0
github.com/robfig/cron/v3 v3.0.1
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/spf13/cobra v1.6.1
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.9.0
github.com/wcharczuk/go-chart v2.0.1+incompatible
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0
go.opentelemetry.io/contrib/propagators/autoprop v0.37.0
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2
go.opentelemetry.io/otel/sdk v1.11.2
go.opentelemetry.io/otel/trace v1.11.2
go.uber.org/zap v1.24.0
golang.org/x/net v0.7.0
google.golang.org/grpc v1.51.0
k8s.io/api v0.25.4
k8s.io/apiextensions-apiserver v0.25.4
k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.4
k8s.io/metrics v0.25.4
sigs.k8s.io/controller-runtime v0.13.1
sigs.k8s.io/controller-tools v0.10.0
sigs.k8s.io/yaml v1.3.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0
go.opentelemetry.io/contrib/propagators/autoprop v0.51.0
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0
go.opentelemetry.io/otel/sdk v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.27.0
google.golang.org/grpc v1.65.0
k8s.io/api v0.30.0
k8s.io/apiextensions-apiserver v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/client-go v0.30.0
k8s.io/code-generator v0.30.0
k8s.io/metrics v0.30.0
sigs.k8s.io/controller-runtime v0.18.2
sigs.k8s.io/controller-tools v0.15.0
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
sigs.k8s.io/yaml v1.4.0
)
require (
cloud.google.com/go v0.99.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.42.34 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blend/go-sdk v1.20220112.5 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/continuity v0.2.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/eapache/go-resiliency v1.3.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/go-resiliency v1.6.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/evanphx/json-patch v5.8.1+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/expr-lang/expr v1.16.9 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-ini/ini v1.66.4 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/gobuffalo/flect v0.2.5 // indirect
github.com/goccy/go-yaml v1.1.5 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
github.com/goccy/go-yaml v1.11.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/huandu/xstrings v1.2.1 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/lib/pq v1.10.4 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/ulikunitz/xz v0.5.9 // indirect
github.com/xanzy/ssh-agent v0.3.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
go.opentelemetry.io/contrib/propagators/aws v1.12.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.12.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.12.0 // indirect
go.opentelemetry.io/contrib/propagators/ot v1.12.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
go.opentelemetry.io/otel/metric v0.34.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/image v0.5.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
google.golang.org/protobuf v1.28.1 // indirect
go.opentelemetry.io/contrib/propagators/aws v1.26.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.26.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.26.0 // indirect
go.opentelemetry.io/contrib/propagators/ot v1.26.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools v2.2.0+incompatible // indirect
k8s.io/component-base v0.25.4 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
knative.dev/pkg v0.0.0-20240805063731-c88d5dad9653 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
)
+302 -840
View File
File diff suppressed because it is too large Load Diff
+14 -7
View File
@@ -28,12 +28,19 @@ set +x
# for codecov
echo "" > coverage.txt
make install-envtest
KUBEBUILDER_ASSETS=$(setup-envtest -p path use 1.23.x)
export KUBEBUILDER_ASSETS
# The executor unit test only works with NodePort-type services for
# now. So disable it for our travis ci tests except some partial tests.
for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v executor | grep -v 'benchmark') github.com/fission/fission/pkg/executor/util; do
go test -race -v -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
# for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v 'benchmark'); do
# echo "Running tests in $d"
# go test -race -v -coverprofile=profile.out -covermode=atomic $d
# if [ -f profile.out ]; then
# cat profile.out >> coverage.txt
# rm profile.out
# fi
# done
echo "Running tests ..."
go test -race -v -coverprofile=coverage.txt -covermode=atomic --coverpkg=./... ./...
+22 -12
View File
@@ -3,17 +3,27 @@ set -o errexit
set -o nounset
set -o pipefail
if [ ! -d "../code-generator" ]; then
echo "Please get code-generator from fission org"
exit 1
fi
GOPATH=$(go env GOPATH)
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
CODEGEN_PKG=${CODEGEN_PKG:-$(
cd "${SCRIPT_ROOT}"
ls -d -1 ${SCRIPT_ROOT}/../code-generator 2>/dev/null || echo $GOPATH/pkg/mod/k8s.io/code-generator@v0.30.0
)}
OUTDIR="${SCRIPT_ROOT}/pkg/generated"
bash "${CODEGEN_PKG}"/generate-groups.sh "client,informer,lister" \
github.com/fission/fission/pkg/generated \
github.com/fission/fission/pkg/apis \
"core:v1" \
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
--go-header-file "$(dirname "${BASH_SOURCE[0]}")/boilerplate.txt"
echo "Generating code under ${OUTDIR} using ${CODEGEN_PKG} ..."
source "${CODEGEN_PKG}/kube_codegen.sh"
# kube::codegen::gen_helpers \
# --input-pkg-root github.com/fission/fission/pkg/apis \
# --output-base "${OUTDIR}" \
# --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.txt"
kube::codegen::gen_client \
--with-watch \
--with-applyconfig \
--output-pkg github.com/fission/fission/pkg/generated \
--output-dir "${OUTDIR}" \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.txt" \
"${SCRIPT_ROOT}/pkg/apis" \
+7 -6
View File
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -50,19 +51,19 @@ func (r *CanaryConfig) Default() {
var _ webhook.Validator = &CanaryConfig{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *CanaryConfig) ValidateCreate() error {
func (r *CanaryConfig) ValidateCreate() (admission.Warnings, error) {
canaryconfiglog.Debug("validate create", zap.String("name", r.Name))
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *CanaryConfig) ValidateUpdate(old runtime.Object) error {
func (r *CanaryConfig) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
canaryconfiglog.Debug("validate update", zap.String("name", r.Name))
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *CanaryConfig) ValidateDelete() error {
func (r *CanaryConfig) ValidateDelete() (admission.Warnings, error) {
canaryconfiglog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+8 -7
View File
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -49,24 +50,24 @@ func (r *Environment) Default() {
var _ webhook.Validator = &Environment{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Environment) ValidateCreate() error {
func (r *Environment) ValidateCreate() (admission.Warnings, error) {
environmentlog.Debug("validate create", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("Environment", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Environment) ValidateUpdate(old runtime.Object) error {
func (r *Environment) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
environmentlog.Debug("validate update", zap.String("name", r.Name))
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Environment) ValidateDelete() error {
func (r *Environment) ValidateDelete() (admission.Warnings, error) {
environmentlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+13 -12
View File
@@ -23,6 +23,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -50,55 +51,55 @@ func (r *Function) Default() {
var _ webhook.Validator = &Function{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Function) ValidateCreate() error {
func (r *Function) ValidateCreate() (admission.Warnings, error) {
functionlog.Debug("validate create", zap.String("name", r.Name))
for _, cnfMap := range r.Spec.ConfigMaps {
if cnfMap.Namespace != r.ObjectMeta.Namespace {
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
}
for _, secret := range r.Spec.Secrets {
if secret.Namespace != r.ObjectMeta.Namespace {
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
}
err := r.Validate()
if err != nil {
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Function) ValidateUpdate(old runtime.Object) error {
func (r *Function) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
functionlog.Debug("validate update", zap.String("name", r.Name))
for _, cnfMap := range r.Spec.ConfigMaps {
if cnfMap.Namespace != r.ObjectMeta.Namespace {
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
}
for _, secret := range r.Spec.Secrets {
if secret.Namespace != r.ObjectMeta.Namespace {
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
}
err := r.Validate()
if err != nil {
return AggregateValidationErrors("Function", err)
return nil, AggregateValidationErrors("Function", err)
}
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Function) ValidateDelete() error {
func (r *Function) ValidateDelete() (admission.Warnings, error) {
functionlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+9 -8
View File
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -49,31 +50,31 @@ func (r *HTTPTrigger) Default() {
var _ webhook.Validator = &HTTPTrigger{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (t *HTTPTrigger) ValidateCreate() error {
func (t *HTTPTrigger) ValidateCreate() (admission.Warnings, error) {
httptriggerlog.Debug("validate create", zap.String("name", t.Name))
err := t.Validate()
if err != nil {
err = AggregateValidationErrors("HTTPTrigger", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *HTTPTrigger) ValidateUpdate(old runtime.Object) error {
func (r *HTTPTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
httptriggerlog.Debug("validate update", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("HTTPTrigger", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *HTTPTrigger) ValidateDelete() error {
func (r *HTTPTrigger) ValidateDelete() (admission.Warnings, error) {
httptriggerlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -49,24 +50,24 @@ func (r *KubernetesWatchTrigger) Default() {
var _ webhook.Validator = &KubernetesWatchTrigger{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *KubernetesWatchTrigger) ValidateCreate() error {
func (r *KubernetesWatchTrigger) ValidateCreate() (admission.Warnings, error) {
kuberneteswatchtriggerlog.Debug("validate create", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("Watch", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *KubernetesWatchTrigger) ValidateUpdate(old runtime.Object) error {
func (r *KubernetesWatchTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
// WATCH UPDATE NOT IMPLEMENTED
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *KubernetesWatchTrigger) ValidateDelete() error {
func (r *KubernetesWatchTrigger) ValidateDelete() (admission.Warnings, error) {
kuberneteswatchtriggerlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
@@ -49,29 +50,29 @@ func (r *MessageQueueTrigger) Default() {
var _ webhook.Validator = &MessageQueueTrigger{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *MessageQueueTrigger) ValidateCreate() error {
func (r *MessageQueueTrigger) ValidateCreate() (admission.Warnings, error) {
messagequeuetriggerlog.Debug("validate create", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("MessageQueueTrigger", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *MessageQueueTrigger) ValidateUpdate(old runtime.Object) error {
func (r *MessageQueueTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
messagequeuetriggerlog.Debug("validate update", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("MessageQueueTrigger", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *MessageQueueTrigger) ValidateDelete() error {
func (r *MessageQueueTrigger) ValidateDelete() (admission.Warnings, error) {
messagequeuetriggerlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+21 -11
View File
@@ -24,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/utils/loggerfactory"
@@ -46,7 +47,16 @@ var _ webhook.Defaulter = &Package{}
func (r *Package) Default() {
packagelog.Debug("default", zap.String("name", r.Name))
if r.Status.BuildStatus == "" {
r.Status.BuildStatus = BuildStatusPending
if !r.Spec.Deployment.IsEmpty() {
// deployment package exists
r.Status.BuildStatus = BuildStatusNone
} else if !r.Spec.Source.IsEmpty() {
// source package with no deployment is a pending build
r.Status.BuildStatus = BuildStatusPending
} else {
r.Status.BuildStatus = BuildStatusFailed // empty package
r.Status.BuildLog = "Both source and deployment are empty"
}
}
}
@@ -56,43 +66,43 @@ func (r *Package) Default() {
var _ webhook.Validator = &Package{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Package) ValidateCreate() error {
func (r *Package) ValidateCreate() (admission.Warnings, error) {
packagelog.Debug("validate create", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("Package", err)
return err
return nil, err
}
// Ensure size limits
if len(r.Spec.Source.Literal) > int(ArchiveLiteralSizeLimit) {
err := ferror.MakeError(ferror.ErrorInvalidArgument,
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
return err
return nil, err
}
if len(r.Spec.Deployment.Literal) > int(ArchiveLiteralSizeLimit) {
err := ferror.MakeError(ferror.ErrorInvalidArgument,
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Package) ValidateUpdate(old runtime.Object) error {
func (r *Package) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
packagelog.Debug("validate update", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("Package", err)
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Package) ValidateDelete() error {
func (r *Package) ValidateDelete() (admission.Warnings, error) {
packagelog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+11 -10
View File
@@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/utils/loggerfactory"
@@ -50,42 +51,42 @@ func (r *TimeTrigger) Default() {
var _ webhook.Validator = &TimeTrigger{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *TimeTrigger) ValidateCreate() error {
func (r *TimeTrigger) ValidateCreate() (admission.Warnings, error) {
timetriggerlog.Debug("validate create", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("TimeTrigger", err)
return err
return nil, err
}
err = IsValidCronSpec(r.Spec.Cron)
if err != nil {
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *TimeTrigger) ValidateUpdate(old runtime.Object) error {
func (r *TimeTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
timetriggerlog.Debug("validate update", zap.String("name", r.Name))
err := r.Validate()
if err != nil {
err = AggregateValidationErrors("TimeTrigger", err)
return err
return nil, err
}
err = IsValidCronSpec(r.Spec.Cron)
if err != nil {
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
return err
return nil, err
}
return nil
return nil, nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *TimeTrigger) ValidateDelete() error {
func (r *TimeTrigger) ValidateDelete() (admission.Warnings, error) {
timetriggerlog.Debug("validate delete", zap.String("name", r.Name))
return nil
return nil, nil
}
+12 -3
View File
@@ -17,7 +17,7 @@ limitations under the License.
package v1
import (
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
asv2 "k8s.io/api/autoscaling/v2"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -399,6 +399,11 @@ type (
// +optional
OnceOnly bool `json:"onceOnly,omitempty"`
// RetainPods specifies the number of specialized pods that should be retained after serving requests
// This is optional. If not specified default value will be taken as 0
// +optional
RetainPods int `json:"retainPods,omitempty"`
// Podspec specifies podspec to use for executor type container based functions
// Different arguments mentioned for container based function are populated inside a pod.
// +optional
@@ -470,12 +475,12 @@ type (
// created for the function.
// Applicable for executor type newdeploy and container.
// +optional
Metrics []asv2beta2.MetricSpec `json:"hpaMetrics,omitempty"`
Metrics []asv2.MetricSpec `json:"hpaMetrics,omitempty"`
// hpaBehavior is the behavior of HPA when scaling in up/down direction.
// Applicable for executor type newdeploy and container.
// +optional
Behavior *asv2beta2.HorizontalPodAutoscalerBehavior `json:"hpaBehavior,omitempty"`
Behavior *asv2.HorizontalPodAutoscalerBehavior `json:"hpaBehavior,omitempty"`
}
// FunctionReferenceType refers to type of Function
@@ -876,6 +881,10 @@ func (fn Function) GetConcurrency() int {
return fn.Spec.Concurrency
}
func (fn Function) GetRetainPods() int {
return fn.Spec.RetainPods
}
func (fn Function) GetRequestPerPod() int {
if fn.Spec.RequestsPerPod == 0 {
return DefaultRequestsPerPod
+7 -8
View File
@@ -129,25 +129,24 @@ func ValidateKubeLabel(field string, labels map[string]string) error {
}
func ValidateKubePort(field string, port int) error {
result := &multierror.Error{}
var err error
e := validation.IsValidPortNum(port)
if len(e) > 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, port, e...))
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, port, e...))
}
return result.ErrorOrNil()
return err
}
func ValidateKubeName(field string, val string) error {
result := &multierror.Error{}
var err error
e := validation.IsDNS1123Label(val)
if len(e) > 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, val, e...))
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, val, e...))
}
return result.ErrorOrNil()
return err
}
// validateNS is to match the k8s behaviour. Where it is not mandatory to provide a NS. And so we validate it if user has provided one.
@@ -338,7 +337,7 @@ func (es ExecutionStrategy) Validate() error {
}
// TODO Add validation warning
//if es.SpecializationTimeout < 120 {
// if es.SpecializationTimeout < 120 {
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.SpecializationTimeout", es.SpecializationTimeout, "SpecializationTimeout must be a value equal to or greater than 120"))
//}
}
+3 -4
View File
@@ -1,5 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright The Fission Authors.
@@ -22,7 +21,7 @@ limitations under the License.
package v1
import (
"k8s.io/api/autoscaling/v2beta2"
"k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
@@ -303,14 +302,14 @@ func (in *ExecutionStrategy) DeepCopyInto(out *ExecutionStrategy) {
*out = *in
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]v2beta2.MetricSpec, len(*in))
*out = make([]v2.MetricSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Behavior != nil {
in, out := &in.Behavior, &out.Behavior
*out = new(v2beta2.HorizontalPodAutoscalerBehavior)
*out = new(v2.HorizontalPodAutoscalerBehavior)
(*in).DeepCopyInto(*out)
}
}
+537
View File
@@ -0,0 +1,537 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 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.
*/
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&Environment{}, func(obj interface{}) { SetObjectDefaults_Environment(obj.(*Environment)) })
scheme.AddTypeDefaultingFunc(&EnvironmentList{}, func(obj interface{}) { SetObjectDefaults_EnvironmentList(obj.(*EnvironmentList)) })
scheme.AddTypeDefaultingFunc(&Function{}, func(obj interface{}) { SetObjectDefaults_Function(obj.(*Function)) })
scheme.AddTypeDefaultingFunc(&FunctionList{}, func(obj interface{}) { SetObjectDefaults_FunctionList(obj.(*FunctionList)) })
scheme.AddTypeDefaultingFunc(&MessageQueueTrigger{}, func(obj interface{}) { SetObjectDefaults_MessageQueueTrigger(obj.(*MessageQueueTrigger)) })
scheme.AddTypeDefaultingFunc(&MessageQueueTriggerList{}, func(obj interface{}) { SetObjectDefaults_MessageQueueTriggerList(obj.(*MessageQueueTriggerList)) })
return nil
}
func SetObjectDefaults_Environment(in *Environment) {
if in.Spec.Runtime.Container != nil {
for i := range in.Spec.Runtime.Container.Ports {
a := &in.Spec.Runtime.Container.Ports[i]
if a.Protocol == "" {
a.Protocol = "TCP"
}
}
if in.Spec.Runtime.Container.LivenessProbe != nil {
if in.Spec.Runtime.Container.LivenessProbe.ProbeHandler.GRPC != nil {
if in.Spec.Runtime.Container.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Runtime.Container.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if in.Spec.Runtime.Container.ReadinessProbe != nil {
if in.Spec.Runtime.Container.ReadinessProbe.ProbeHandler.GRPC != nil {
if in.Spec.Runtime.Container.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Runtime.Container.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if in.Spec.Runtime.Container.StartupProbe != nil {
if in.Spec.Runtime.Container.StartupProbe.ProbeHandler.GRPC != nil {
if in.Spec.Runtime.Container.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Runtime.Container.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
if in.Spec.Runtime.PodSpec != nil {
for i := range in.Spec.Runtime.PodSpec.InitContainers {
a := &in.Spec.Runtime.PodSpec.InitContainers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.Runtime.PodSpec.Containers {
a := &in.Spec.Runtime.PodSpec.Containers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.Runtime.PodSpec.EphemeralContainers {
a := &in.Spec.Runtime.PodSpec.EphemeralContainers[i]
for j := range a.EphemeralContainerCommon.Ports {
b := &a.EphemeralContainerCommon.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.EphemeralContainerCommon.LivenessProbe != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
}
if in.Spec.Builder.Container != nil {
for i := range in.Spec.Builder.Container.Ports {
a := &in.Spec.Builder.Container.Ports[i]
if a.Protocol == "" {
a.Protocol = "TCP"
}
}
if in.Spec.Builder.Container.LivenessProbe != nil {
if in.Spec.Builder.Container.LivenessProbe.ProbeHandler.GRPC != nil {
if in.Spec.Builder.Container.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Builder.Container.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if in.Spec.Builder.Container.ReadinessProbe != nil {
if in.Spec.Builder.Container.ReadinessProbe.ProbeHandler.GRPC != nil {
if in.Spec.Builder.Container.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Builder.Container.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if in.Spec.Builder.Container.StartupProbe != nil {
if in.Spec.Builder.Container.StartupProbe.ProbeHandler.GRPC != nil {
if in.Spec.Builder.Container.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
in.Spec.Builder.Container.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
if in.Spec.Builder.PodSpec != nil {
for i := range in.Spec.Builder.PodSpec.InitContainers {
a := &in.Spec.Builder.PodSpec.InitContainers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.Builder.PodSpec.Containers {
a := &in.Spec.Builder.PodSpec.Containers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.Builder.PodSpec.EphemeralContainers {
a := &in.Spec.Builder.PodSpec.EphemeralContainers[i]
for j := range a.EphemeralContainerCommon.Ports {
b := &a.EphemeralContainerCommon.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.EphemeralContainerCommon.LivenessProbe != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
}
}
func SetObjectDefaults_EnvironmentList(in *EnvironmentList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_Environment(a)
}
}
func SetObjectDefaults_Function(in *Function) {
if in.Spec.PodSpec != nil {
for i := range in.Spec.PodSpec.InitContainers {
a := &in.Spec.PodSpec.InitContainers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.PodSpec.Containers {
a := &in.Spec.PodSpec.Containers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.PodSpec.EphemeralContainers {
a := &in.Spec.PodSpec.EphemeralContainers[i]
for j := range a.EphemeralContainerCommon.Ports {
b := &a.EphemeralContainerCommon.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.EphemeralContainerCommon.LivenessProbe != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
}
}
func SetObjectDefaults_FunctionList(in *FunctionList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_Function(a)
}
}
func SetObjectDefaults_MessageQueueTrigger(in *MessageQueueTrigger) {
if in.Spec.PodSpec != nil {
for i := range in.Spec.PodSpec.InitContainers {
a := &in.Spec.PodSpec.InitContainers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.PodSpec.Containers {
a := &in.Spec.PodSpec.Containers[i]
for j := range a.Ports {
b := &a.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.LivenessProbe != nil {
if a.LivenessProbe.ProbeHandler.GRPC != nil {
if a.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.ReadinessProbe != nil {
if a.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.StartupProbe != nil {
if a.StartupProbe.ProbeHandler.GRPC != nil {
if a.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
for i := range in.Spec.PodSpec.EphemeralContainers {
a := &in.Spec.PodSpec.EphemeralContainers[i]
for j := range a.EphemeralContainerCommon.Ports {
b := &a.EphemeralContainerCommon.Ports[j]
if b.Protocol == "" {
b.Protocol = "TCP"
}
}
if a.EphemeralContainerCommon.LivenessProbe != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC != nil {
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service == nil {
var ptrVar1 string = ""
a.EphemeralContainerCommon.StartupProbe.ProbeHandler.GRPC.Service = &ptrVar1
}
}
}
}
}
}
func SetObjectDefaults_MessageQueueTriggerList(in *MessageQueueTriggerList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_MessageQueueTrigger(a)
}
}
@@ -203,6 +203,7 @@ var map_FunctionSpec = map[string]string{
"concurrency": "Maximum number of pods to be specialized which will serve requests This is optional. If not specified default value will be taken as 500",
"requestsPerPod": "RequestsPerPod indicates the maximum number of concurrent requests that can be served by a specialized pod This is optional. If not specified default value will be taken as 1",
"onceOnly": "OnceOnly specifies if specialized pod will serve exactly one request in its lifetime and would be garbage collected after serving that one request This is optional. If not specified default value will be taken as false",
"retainPods": "RetainPods specifies the number of specialized pods that should be retained after serving requests This is optional. If not specified default value will be taken as 0",
"podspec": "Podspec specifies podspec to use for executor type container based functions Different arguments mentioned for container based function are populated inside a pod.",
}
+33
View File
@@ -35,6 +35,7 @@ import (
"go.uber.org/zap"
"github.com/fission/fission/pkg/info"
"github.com/fission/fission/pkg/utils"
otelUtils "github.com/fission/fission/pkg/utils/otel"
)
@@ -154,6 +155,38 @@ func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
builder.reply(r.Context(), w, deployPkgFilename, buildLogs, http.StatusOK)
}
func (builder *Builder) Clean(w http.ResponseWriter, r *http.Request) {
logger := otelUtils.LoggerWithTraceID(r.Context(), builder.logger)
if r.Method != "DELETE" {
e := "method not allowed"
logger.Error(e, zap.String("http_method", r.Method))
builder.reply(r.Context(), w, "", fmt.Sprintf("%s: %s", e, r.Method), http.StatusMethodNotAllowed)
return
}
startTime := time.Now()
defer func() {
elapsed := time.Since(startTime)
logger.Info("clean request complete", zap.Duration("elapsed_time", elapsed))
}()
srcPkgFilename := r.URL.Query().Get("name")
srcPkgPath := filepath.Join(builder.sharedVolumePath, srcPkgFilename)
logger.Info("builder received clean request", zap.Any("source_package", srcPkgFilename))
err := utils.DeleteOldPackages(srcPkgPath, envSrcPkg)
if err != nil {
e := "error deleting src package after build"
logger.Error(e, zap.Error(err))
builder.reply(r.Context(), w, srcPkgFilename, "", http.StatusInternalServerError)
return
}
builder.reply(r.Context(), w, srcPkgFilename, "", http.StatusOK)
}
func (builder *Builder) reply(ctx context.Context, w http.ResponseWriter, pkgFilename string, buildLogs string, statusCode int) {
logger := otelUtils.LoggerWithTraceID(ctx, builder.logger)
resp := PackageBuildResponse{
+46
View File
@@ -168,4 +168,50 @@ func TestBuilder(t *testing.T) {
})
}
})
// Test CleanHandler
t.Run("CleanHandler", func(t *testing.T) {
for _, test := range []struct {
name string
srcPkgFilename string
handler func(w http.ResponseWriter, r *http.Request)
status int
}{
{
name: "should fail deleting src pkg: invalid shared volume path",
srcPkgFilename: "test2",
handler: func(w http.ResponseWriter, r *http.Request) {
builder.Clean(w, r)
},
status: http.StatusInternalServerError,
},
{
name: "should fail deleting src pkg: method not allowed",
srcPkgFilename: "test3",
handler: func(w http.ResponseWriter, r *http.Request) {
builder.Handler(w, r)
},
status: http.StatusMethodNotAllowed,
},
} {
t.Run(test.name, func(t *testing.T) {
_, err := os.MkdirTemp(dir, test.srcPkgFilename)
if err != nil {
t.Fatal(err)
}
srcFile, err := os.Create(dir + "/" + test.srcPkgFilename)
if err != nil {
t.Fatal(err)
}
defer srcFile.Close()
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodDelete, "/clean/"+test.srcPkgFilename, http.NoBody)
test.handler(w, r)
resp := w.Result()
if resp.StatusCode != test.status {
t.Errorf("expected status code %d, got %d", test.status, resp.StatusCode)
}
})
}
})
}
+42 -5
View File
@@ -21,6 +21,7 @@ import (
"context"
"encoding/json"
"io"
"net/http"
"strings"
"github.com/hashicorp/go-retryablehttp"
@@ -35,24 +36,34 @@ import (
)
type (
Client struct {
ClientInterface interface {
Build(context.Context, *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error)
Clean(context.Context, string) error
}
client struct {
logger *zap.Logger
url string
httpClient *retryablehttp.Client
}
)
func MakeClient(logger *zap.Logger, builderUrl string) *Client {
func MakeClient(logger *zap.Logger, builderUrl string) ClientInterface {
hc := retryablehttp.NewClient()
hc.ErrorHandler = retryablehttp.PassthroughErrorHandler
hc.HTTPClient.Transport = otelhttp.NewTransport(hc.HTTPClient.Transport)
return &Client{
return &client{
logger: logger.Named("builder_client"),
url: strings.TrimSuffix(builderUrl, "/"),
httpClient: hc,
}
}
func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error) {
func (c *client) getCleanUrl(srcPkgFilename string) string {
return c.url + "/clean" + "?name=" + srcPkgFilename
}
func (c *client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error) {
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
body, err := json.Marshal(req)
@@ -62,7 +73,7 @@ func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*
resp, err := ctxhttp.Post(ctx, c.httpClient.StandardClient(), c.url, "application/json", bytes.NewReader(body))
if err != nil {
return nil, ferror.MakeErrorFromHTTP(resp)
return nil, err
}
defer resp.Body.Close()
@@ -81,3 +92,29 @@ func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*
return &pkgBuildResp, ferror.MakeErrorFromHTTP(resp)
}
func (c *client) Clean(ctx context.Context, srcPkgFilename string) error {
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
req, err := http.NewRequest(http.MethodDelete, c.getCleanUrl(srcPkgFilename), http.NoBody)
if err != nil {
return errors.Wrap(err, "failed to create http request for clean api")
}
resp, err := ctxhttp.Do(ctx, c.httpClient.StandardClient(), req)
if err != nil {
logger.Error("error sending clean request", zap.Error(err))
return err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusMethodNotAllowed {
return nil
}
if resp.StatusCode != http.StatusOK {
return ferror.MakeErrorFromHTTP(resp)
}
return nil
}
+14 -7
View File
@@ -18,6 +18,7 @@ package buildermgr
import (
"context"
"os"
"time"
"github.com/pkg/errors"
@@ -28,13 +29,13 @@ import (
"github.com/fission/fission/pkg/executor/util"
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
// Start the buildermgr service.
func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error {
func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, storageSvcUrl string) error {
bmLogger := logger.Named("builder_manager")
clientGen := crd.NewClientGenerator()
fissionClient, err := clientGen.GetFissionClient()
if err != nil {
return errors.Wrap(err, "failed to get fission client")
@@ -44,7 +45,7 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error
return errors.Wrap(err, "failed to get kubernetes client")
}
err = crd.WaitForCRDs(ctx, logger, fissionClient)
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
if err != nil {
return errors.Wrap(err, "error waiting for CRDs")
}
@@ -55,17 +56,23 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error
}
podSpecPatch, err := util.GetSpecFromConfigMap(fv1.BuilderPodSpecPath)
if err != nil {
if err != nil && !os.IsNotExist(err) {
logger.Warn("error reading data for pod spec patch", zap.String("path", fv1.BuilderPodSpecPath), zap.Error(err))
}
envWatcher := makeEnvironmentWatcher(ctx, bmLogger, fissionClient, kubernetesClient, fetcherConfig, podSpecPatch)
envWatcher.Run(ctx)
envWatcher, err := makeEnvironmentWatcher(ctx, bmLogger, fissionClient, kubernetesClient, fetcherConfig, podSpecPatch)
if err != nil {
return err
}
envWatcher.Run(ctx, mgr)
pkgWatcher := makePackageWatcher(bmLogger, fissionClient,
kubernetesClient, storageSvcUrl,
utils.GetK8sInformersForNamespaces(kubernetesClient, time.Minute*30, fv1.Pods),
utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.PackagesResource))
pkgWatcher.Run(ctx)
err = pkgWatcher.Run(ctx, mgr)
if err != nil {
return err
}
return nil
}
+18
View File
@@ -60,6 +60,15 @@ func buildPackage(ctx context.Context, logger *zap.Logger, fissionClient version
fetcherC := fetcherClient.MakeClient(logger, fmt.Sprintf("http://%v:8000", svcName))
builderC := builderClient.MakeClient(logger, fmt.Sprintf("http://%v:8001", svcName))
defer func() {
logger.Info("cleaning src pkg from builder storage", zap.String("source_package", srcPkgFilename))
errC := cleanPackage(ctx, builderC, srcPkgFilename)
if errC != nil {
m := "error cleaning src pkg from builder storage"
logger.Error(m, zap.Error(errC))
}
}()
fetchReq := &fetcher.FunctionFetchRequest{
FetchType: fv1.FETCH_SOURCE,
Package: pkg.ObjectMeta,
@@ -121,6 +130,15 @@ func buildPackage(ctx context.Context, logger *zap.Logger, fissionClient version
return uploadResp, buildResp.BuildLogs, nil
}
func cleanPackage(ctx context.Context, builderClient builderClient.ClientInterface, srcPkgFileName string) error {
err := builderClient.Clean(ctx, srcPkgFileName)
if err != nil {
return err
}
return nil
}
func updatePackage(ctx context.Context, logger *zap.Logger, fissionClient versioned.Interface,
pkg *fv1.Package, status fv1.BuildStatus, buildLogs string,
uploadResp *fetcher.ArchiveUploadResponse) (*fv1.Package, error) {
+47 -29
View File
@@ -23,12 +23,13 @@ import (
"strconv"
"time"
"github.com/pkg/errors"
"go.uber.org/zap"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes"
k8sCache "k8s.io/client-go/tools/cache"
@@ -39,6 +40,7 @@ import (
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
const (
@@ -63,7 +65,7 @@ type (
environmentWatcher struct {
logger *zap.Logger
cache map[string]*builderInfo
cache map[types.UID]*builderInfo
fissionClient versioned.Interface
kubernetesClient kubernetes.Interface
nsResolver *utils.NamespaceResolver
@@ -81,7 +83,7 @@ func makeEnvironmentWatcher(
fissionClient versioned.Interface,
kubernetesClient kubernetes.Interface,
fetcherConfig *fetcherConfig.Config,
podSpecPatch *apiv1.PodSpec) *environmentWatcher {
podSpecPatch *apiv1.PodSpec) (*environmentWatcher, error) {
useIstio := false
enableIstio := os.Getenv("ENABLE_ISTIO")
@@ -97,7 +99,7 @@ func makeEnvironmentWatcher(
envWatcher := &environmentWatcher{
logger: logger.Named("environment_watcher"),
cache: make(map[string]*builderInfo),
cache: make(map[types.UID]*builderInfo),
fissionClient: fissionClient,
kubernetesClient: kubernetesClient,
nsResolver: utils.DefaultNSResolver(),
@@ -108,8 +110,11 @@ func makeEnvironmentWatcher(
envWatchInformer: utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.EnvironmentResource),
}
envWatcher.EnvWatchEventHandlers(ctx)
return envWatcher
err := envWatcher.EnvWatchEventHandlers(ctx)
if err != nil {
return nil, err
}
return envWatcher, nil
}
func (env *environmentWatcher) getDeploymentLabels(envName string) map[string]string {
@@ -128,15 +133,13 @@ func (envw *environmentWatcher) getLabels(envName string, envNamespace string, e
}
}
func (envw *environmentWatcher) Run(ctx context.Context) {
for _, informer := range envw.envWatchInformer {
go informer.Run(ctx.Done())
}
func (envw *environmentWatcher) Run(ctx context.Context, mgr manager.Interface) {
mgr.AddInformers(ctx, envw.envWatchInformer)
}
func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) {
func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) error {
for _, informer := range envw.envWatchInformer {
informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
_, err := informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
envObj := obj.(*fv1.Environment)
envw.AddUpdateBuilder(ctx, envObj)
@@ -153,19 +156,23 @@ func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) {
envw.DeleteBuilder(ctx, envObj)
},
})
if err != nil {
return err
}
}
return nil
}
func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.Environment) {
//builder is not supported with v1 interface and ignore env without builder image
// builder is not supported with v1 interface and ignore env without builder image
if env.Spec.Version != 1 && len(env.Spec.Builder.Image) != 0 {
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; !ok {
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; !ok {
builderInfo, err := envw.createBuilder(ctx, env, envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace))
if err != nil {
envw.logger.Error("error creating builder service", zap.Error(err))
return
}
envw.cache[crd.CacheKeyUID(&env.ObjectMeta)] = builderInfo
envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)] = builderInfo
} else {
envw.DeleteBuilder(ctx, env)
// once older builder deleted then add new builder service
@@ -174,16 +181,16 @@ func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.E
envw.logger.Error("error updating builder service", zap.Error(err))
return
}
envw.cache[crd.CacheKeyUID(&env.ObjectMeta)] = builderInfo
envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)] = builderInfo
}
}
}
func (envw *environmentWatcher) DeleteBuilder(ctx context.Context, env *fv1.Environment) {
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
envw.DeleteBuilderService(ctx, env)
envw.DeleteBuilderDeployment(ctx, env)
delete(envw.cache, crd.CacheKeyUID(&env.ObjectMeta))
delete(envw.cache, crd.CacheKeyUIDFromMeta(&env.ObjectMeta))
envw.logger.Info("builder service deleted", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
} else {
envw.logger.Debug("builder service not found", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
@@ -198,7 +205,7 @@ func (envw *environmentWatcher) DeleteBuilderService(ctx context.Context, env *f
}
for _, svc := range svcList {
envName := svc.ObjectMeta.Labels[LABEL_ENV_NAME]
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
err := envw.deleteBuilderServiceByName(ctx, svc.ObjectMeta.Name, svc.ObjectMeta.Namespace)
if err != nil {
envw.logger.Error("error removing builder service", zap.Error(err),
@@ -222,7 +229,7 @@ func (envw *environmentWatcher) DeleteBuilderDeployment(ctx context.Context, env
envw.logger.Error("error getting the builder deployment list", zap.Error(err))
}
for _, deploy := range deployList {
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
err := envw.deleteBuilderDeploymentByName(ctx, deploy.ObjectMeta.Name, deploy.ObjectMeta.Namespace)
if err != nil {
envw.logger.Error("error removing builder deployment", zap.Error(err),
@@ -252,9 +259,7 @@ func (envw *environmentWatcher) createBuilder(ctx context.Context, env *fv1.Envi
if len(svcList) == 0 {
svc, err = envw.createBuilderService(ctx, env, ns)
if err != nil {
return nil, errors.Wrap(err,
fmt.Sprintf("error creating builder service for environment in namespace %s %s", env.ObjectMeta.Name, ns))
return nil, fmt.Errorf("error creating builder service for environment in namespace %s %s: %w", env.ObjectMeta.Name, ns, err)
}
} else if len(svcList) == 1 {
svc = &svcList[0]
@@ -270,8 +275,7 @@ func (envw *environmentWatcher) createBuilder(ctx context.Context, env *fv1.Envi
if len(deployList) == 0 {
deploy, err = envw.createBuilderDeployment(ctx, env, ns)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("error creating builder deployment for environment in namespace %s %s", env.ObjectMeta.Name, ns))
return nil, fmt.Errorf("error creating builder deployment for environment in namespace %s %s: %w", env.ObjectMeta.Name, ns, err)
}
} else if len(deployList) == 1 {
deploy = &deployList[0]
@@ -291,7 +295,7 @@ func (envw *environmentWatcher) deleteBuilderServiceByName(ctx context.Context,
Services(namespace).
Delete(ctx, name, delOpt)
if err != nil {
return errors.Wrapf(err, "error deleting builder service %s.%s", name, namespace)
return fmt.Errorf("error deleting builder service %s.%s: %w", name, namespace, err)
}
return nil
}
@@ -301,7 +305,7 @@ func (envw *environmentWatcher) deleteBuilderDeploymentByName(ctx context.Contex
Deployments(namespace).
Delete(ctx, name, delOpt)
if err != nil {
return errors.Wrapf(err, "error deleting builder deployment %s.%s", name, namespace)
return fmt.Errorf("error deleting builder deployment %s.%s: %w", name, namespace, err)
}
return nil
}
@@ -313,7 +317,7 @@ func (envw *environmentWatcher) getBuilderServiceList(ctx context.Context, sel m
LabelSelector: labels.Set(sel).AsSelector().String(),
})
if err != nil {
return nil, errors.Wrap(err, "error getting builder service list")
return nil, fmt.Errorf("error getting builder service list for namespace %s: %w", ns, err)
}
return svcList.Items, nil
}
@@ -326,6 +330,13 @@ func (envw *environmentWatcher) createBuilderService(ctx context.Context, env *f
Namespace: ns,
Name: name,
Labels: sel,
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(env, schema.GroupVersionKind{
Group: "fission.io",
Version: "v1",
Kind: "Environment",
}),
},
},
Spec: apiv1.ServiceSpec{
Selector: sel,
@@ -367,7 +378,7 @@ func (envw *environmentWatcher) getBuilderDeploymentList(ctx context.Context, se
LabelSelector: labels.Set(sel).AsSelector().String(),
})
if err != nil {
return nil, errors.Wrap(err, "error getting builder deployment list")
return nil, fmt.Errorf("error getting builder deployment list for namespace %s: %w", ns, err)
}
return deployList.Items, nil
}
@@ -437,6 +448,13 @@ func (envw *environmentWatcher) createBuilderDeployment(ctx context.Context, env
Namespace: ns,
Name: name,
Labels: sel,
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(env, schema.GroupVersionKind{
Group: "fission.io",
Version: "v1",
Kind: "Environment",
}),
},
},
Spec: appsv1.DeploymentSpec{
Replicas: &replicas,
+50 -63
View File
@@ -30,8 +30,10 @@ import (
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/cache"
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/pkg/utils/metrics"
)
@@ -44,7 +46,7 @@ type (
podInformer map[string]k8sCache.SharedIndexInformer
pkgInformer map[string]k8sCache.SharedIndexInformer
storageSvcUrl string
buildCache *cache.Cache
buildCache *cache.Cache[crd.CacheKeyUR, *fv1.Package]
}
)
@@ -59,13 +61,13 @@ func makePackageWatcher(logger *zap.Logger, fissionClient versioned.Interface, k
podInformer: podInformer,
pkgInformer: pkgInformer,
storageSvcUrl: storageSvcUrl,
buildCache: cache.MakeCache(0, 0),
buildCache: cache.MakeCache[crd.CacheKeyUR, *fv1.Package](0, 0),
}
return pkgw
}
func (pkgw *packageWatcher) buildCacheKey(obj metav1.ObjectMeta) string {
return fmt.Sprintf("%s-%s-%s", obj.Namespace, obj.Name, obj.ResourceVersion)
func (pkgw *packageWatcher) buildCacheKey(obj metav1.ObjectMeta) crd.CacheKeyUR {
return crd.CacheKeyURFromMeta(&obj)
}
func (pkgw *packageWatcher) buildWithCache(ctx context.Context, srcpkg *fv1.Package) {
@@ -89,33 +91,33 @@ func (pkgw *packageWatcher) buildWithCache(ctx context.Context, srcpkg *fv1.Pack
// 6. Update package status to succeed state
// *. Update package status to failed state,if any one of steps above failed/time out
func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
key := pkgw.buildCacheKey(srcpkg.ObjectMeta)
logger := pkgw.logger.With(zap.String("package", srcpkg.Name), zap.String("namespace", srcpkg.Namespace), zap.String("resource_version", srcpkg.ResourceVersion), zap.String("key", key.String()))
defer func() {
key := pkgw.buildCacheKey(srcpkg.ObjectMeta)
err := pkgw.buildCache.Delete(key)
if err != nil {
pkgw.logger.Error("error deleting key from cache", zap.String("key", key), zap.Error(err))
logger.Error("error deleting key from cache", zap.Any("key", key), zap.Error(err))
}
}()
pkgw.logger.Info("starting build for package", zap.String("package_name", srcpkg.ObjectMeta.Name), zap.String("resource_version", srcpkg.ObjectMeta.ResourceVersion))
logger.Info("starting build for package")
pkg, err := updatePackage(ctx, pkgw.logger, pkgw.fissionClient, srcpkg, fv1.BuildStatusRunning, "", nil)
pkg, err := updatePackage(ctx, logger, pkgw.fissionClient, srcpkg, fv1.BuildStatusRunning, "", nil)
if err != nil {
pkgw.logger.Error("error setting package pending state", zap.Error(err))
logger.Error("error setting package pending state", zap.Error(err))
return
}
env, err := pkgw.fissionClient.CoreV1().Environments(pkg.Spec.Environment.Namespace).Get(ctx, pkg.Spec.Environment.Name, metav1.GetOptions{})
if k8serrors.IsNotFound(err) {
e := "environment does not exist"
pkgw.logger.Error(e, zap.String("environment", pkg.Spec.Environment.Name))
_, er := updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg,
logger.Error(e, zap.String("environment", pkg.Spec.Environment.Name))
_, er := updatePackage(ctx, logger, pkgw.fissionClient, pkg,
fv1.BuildStatusFailed, fmt.Sprintf("%s: %q", e, pkg.Spec.Environment.Name), nil)
if er != nil {
pkgw.logger.Error(
logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(er),
)
}
@@ -126,7 +128,9 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
healthCheckBackOff := utils.NewDefaultBackOff()
builderNs := pkgw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)
//if err != nil {
logger = logger.With(zap.String("environment", env.Name), zap.String("builder_namespace", builderNs), zap.String("environment_namespace", env.Namespace))
// if err != nil {
// pkgw.logger.Error("Unable to create BackOff for Health Check", zap.Error(err))
//}
// Do health check for environment builder pod
@@ -135,12 +139,12 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
// iterate all available environment builders.
items := pkgw.podInformer[builderNs].GetStore().List()
if err != nil {
pkgw.logger.Error("error retrieving pod information for environment", zap.Error(err), zap.String("environment", env.ObjectMeta.Name))
logger.Error("error retrieving pod information for environment", zap.Error(err))
return
}
if len(items) == 0 {
pkgw.logger.Info("builder pod does not exist for environment, will retry again later", zap.String("environment", pkg.Spec.Environment.Name))
logger.Info("builder pod does not exist for environment, will retry again later")
time.Sleep(healthCheckBackOff.GetCurrentBackoffDuration())
continue
}
@@ -164,27 +168,22 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
}
if !podIsReady {
pkgw.logger.Info("builder pod is not ready for environment, will retry again later", zap.String("environment", pkg.Spec.Environment.Name))
logger.Info("builder pod is not ready for environment, will retry again later")
time.Sleep(healthCheckBackOff.GetCurrentBackoffDuration())
break
}
uploadResp, buildLogs, err := buildPackage(ctx, pkgw.logger, pkgw.fissionClient, builderNs, pkgw.storageSvcUrl, pkg)
if err != nil {
pkgw.logger.Error("error building package", zap.Error(err), zap.String("package_name", pkg.ObjectMeta.Name))
_, er := updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
logger.Error("error building package", zap.Error(err))
_, er := updatePackage(ctx, logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
if er != nil {
pkgw.logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(er),
)
logger.Error("error updating package", zap.Error(er))
}
return
}
pkgw.logger.Info("starting package info update", zap.String("package_name", pkg.ObjectMeta.Name))
logger.Info("starting package info update")
fnList, err := pkgw.fissionClient.CoreV1().
Functions(pkg.Namespace).List(ctx, metav1.ListOptions{})
@@ -196,8 +195,6 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
if er != nil {
pkgw.logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(er),
)
}
@@ -214,57 +211,41 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
_, err = pkgw.fissionClient.CoreV1().Functions(fn.ObjectMeta.Namespace).Update(ctx, &fn, metav1.UpdateOptions{})
if err != nil {
e := "error updating function package resource version"
pkgw.logger.Error(e, zap.Error(err))
logger.Error(e, zap.Error(err))
buildLogs += fmt.Sprintf("%s: %v\n", e, err)
_, er := updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
_, er := updatePackage(ctx, logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
if er != nil {
pkgw.logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(er),
)
logger.Error("error updating package", zap.Error(er))
}
return
}
}
}
_, err = updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg,
_, err = updatePackage(ctx, logger, pkgw.fissionClient, pkg,
fv1.BuildStatusSucceeded, buildLogs, uploadResp)
if err != nil {
pkgw.logger.Error("error updating package info", zap.Error(err), zap.String("package_name", pkg.ObjectMeta.Name))
_, er := updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
logger.Error("error updating package info", zap.Error(err))
_, er := updatePackage(ctx, logger, pkgw.fissionClient, pkg, fv1.BuildStatusFailed, buildLogs, nil)
if er != nil {
pkgw.logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(er),
)
logger.Error("error updating package", zap.Error(er))
}
return
}
pkgw.logger.Info("completed package build request", zap.String("package_name", pkg.ObjectMeta.Name))
logger.Info("completed package build request")
return
}
time.Sleep(healthCheckBackOff.GetNext())
}
// build timeout
_, err = updatePackage(ctx, pkgw.logger, pkgw.fissionClient, pkg,
_, err = updatePackage(ctx, logger, pkgw.fissionClient, pkg,
fv1.BuildStatusFailed, "Build timeout due to environment builder not ready", nil)
if err != nil {
pkgw.logger.Error(
"error updating package",
zap.String("package_name", pkg.ObjectMeta.Name),
zap.String("resource_version", pkg.ObjectMeta.ResourceVersion),
zap.Error(err),
)
logger.Error("error updating package", zap.Error(err))
}
pkgw.logger.Error("max retries exceeded in building source package, timeout due to environment builder not ready",
zap.String("package", fmt.Sprintf("%s.%s", pkg.ObjectMeta.Name, pkg.ObjectMeta.Namespace)))
logger.Error("max retries exceeded in building source package, timeout due to environment builder not ready")
}
func (pkgw *packageWatcher) packageInformerHandler(ctx context.Context) k8sCache.ResourceEventHandlerFuncs {
@@ -308,15 +289,21 @@ func (pkgw *packageWatcher) packageInformerHandler(ctx context.Context) k8sCache
}
}
func (pkgw *packageWatcher) Run(ctx context.Context) {
go metrics.ServeMetrics(ctx, pkgw.logger)
for _, podInformer := range pkgw.podInformer {
go podInformer.Run(ctx.Done())
}
func (pkgw *packageWatcher) Run(ctx context.Context, mgr manager.Interface) error {
mgr.Add(ctx, func(ctx context.Context) {
metrics.ServeMetrics(ctx, "buildermgr", pkgw.logger, mgr)
})
mgr.AddInformers(ctx, pkgw.podInformer)
for _, pkgInformer := range pkgw.pkgInformer {
pkgInformer.AddEventHandler(pkgw.packageInformerHandler(ctx))
go pkgInformer.Run(ctx.Done())
_, err := pkgInformer.AddEventHandler(pkgw.packageInformerHandler(ctx))
if err != nil {
pkgw.logger.Fatal("error adding package informer handler", zap.Error(err))
return err
}
}
mgr.AddInformers(ctx, pkgw.pkgInformer)
return nil
}
// setInitialBuildStatus sets initial build status to a package if it is empty.
+36 -36
View File
@@ -34,33 +34,33 @@ const (
)
type (
Value struct {
Value[V any] struct {
ctime time.Time
atime time.Time
value interface{}
value V
}
Cache struct {
cache map[interface{}]*Value
Cache[K comparable, V any] struct {
cache map[K]*Value[V]
ctimeExpiry time.Duration
atimeExpiry time.Duration
requestChannel chan *request
requestChannel chan *request[K, V]
}
request struct {
request[K comparable, V any] struct {
requestType
key interface{}
value interface{}
responseChannel chan *response
key K
value V
responseChannel chan *response[K, V]
}
response struct {
response[K comparable, V any] struct {
error
existingValue interface{}
mapCopy map[interface{}]interface{}
value interface{}
existingValue V
mapCopy map[K]V
value V
}
)
func (c *Cache) IsOld(v *Value) bool {
func (c *Cache[K, V]) IsOld(v *Value[V]) bool {
if (c.ctimeExpiry != time.Duration(0)) && (time.Since(v.ctime) > c.ctimeExpiry) {
return true
}
@@ -72,12 +72,12 @@ func (c *Cache) IsOld(v *Value) bool {
return false
}
func MakeCache(ctimeExpiry, atimeExpiry time.Duration) *Cache {
c := &Cache{
cache: make(map[interface{}]*Value),
func MakeCache[K comparable, V any](ctimeExpiry, atimeExpiry time.Duration) *Cache[K, V] {
c := &Cache[K, V]{
cache: make(map[K]*Value[V]),
ctimeExpiry: ctimeExpiry,
atimeExpiry: atimeExpiry,
requestChannel: make(chan *request),
requestChannel: make(chan *request[K, V]),
}
go c.service()
if ctimeExpiry != time.Duration(0) || atimeExpiry != time.Duration(0) {
@@ -86,10 +86,10 @@ func MakeCache(ctimeExpiry, atimeExpiry time.Duration) *Cache {
return c
}
func (c *Cache) service() {
func (c *Cache[K, V]) service() {
for {
req := <-c.requestChannel
resp := &response{}
resp := &response[K, V]{}
switch req.requestType {
case GET:
val, ok := c.cache[req.key]
@@ -115,7 +115,7 @@ func (c *Cache) service() {
resp.existingValue = val.value
resp.error = ferror.MakeError(ferror.ErrorNameExists, "key already exists")
} else {
c.cache[req.key] = &Value{
c.cache[req.key] = &Value[V]{
value: req.value,
ctime: now,
atime: now,
@@ -133,7 +133,7 @@ func (c *Cache) service() {
}
// no response
case COPY:
resp.mapCopy = make(map[interface{}]interface{})
resp.mapCopy = make(map[K]V)
for k, v := range c.cache {
resp.mapCopy[k] = v.value
}
@@ -146,9 +146,9 @@ func (c *Cache) service() {
}
}
func (c *Cache) Get(key interface{}) (interface{}, error) {
respChannel := make(chan *response)
c.requestChannel <- &request{
func (c *Cache[K, V]) Get(key K) (V, error) {
respChannel := make(chan *response[K, V])
c.requestChannel <- &request[K, V]{
requestType: GET,
key: key,
responseChannel: respChannel,
@@ -159,9 +159,9 @@ func (c *Cache) Get(key interface{}) (interface{}, error) {
// if key exists in the cache, the new value is NOT set; instead an
// error and the old value are returned
func (c *Cache) Set(key interface{}, value interface{}) (interface{}, error) {
respChannel := make(chan *response)
c.requestChannel <- &request{
func (c *Cache[K, V]) Set(key K, value V) (V, error) {
respChannel := make(chan *response[K, V])
c.requestChannel <- &request[K, V]{
requestType: SET,
key: key,
value: value,
@@ -171,9 +171,9 @@ func (c *Cache) Set(key interface{}, value interface{}) (interface{}, error) {
return resp.existingValue, resp.error
}
func (c *Cache) Delete(key interface{}) error {
respChannel := make(chan *response)
c.requestChannel <- &request{
func (c *Cache[K, V]) Delete(key K) error {
respChannel := make(chan *response[K, V])
c.requestChannel <- &request[K, V]{
requestType: DELETE,
key: key,
responseChannel: respChannel,
@@ -182,9 +182,9 @@ func (c *Cache) Delete(key interface{}) error {
return resp.error
}
func (c *Cache) Copy() map[interface{}]interface{} {
respChannel := make(chan *response)
c.requestChannel <- &request{
func (c *Cache[K, V]) Copy() map[K]V {
respChannel := make(chan *response[K, V])
c.requestChannel <- &request[K, V]{
requestType: COPY,
responseChannel: respChannel,
}
@@ -192,10 +192,10 @@ func (c *Cache) Copy() map[interface{}]interface{} {
return resp.mapCopy
}
func (c *Cache) expiryService() {
func (c *Cache[K, V]) expiryService() {
for {
time.Sleep(time.Minute)
c.requestChannel <- &request{
c.requestChannel <- &request[K, V]{
requestType: EXPIRE,
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ func checkErr(err error) {
}
func TestCache(t *testing.T) {
c := MakeCache(100*time.Millisecond, 100*time.Millisecond)
c := MakeCache[string, string](100*time.Millisecond, 100*time.Millisecond)
_, err := c.Set("a", "b")
checkErr(err)
+3 -4
View File
@@ -27,7 +27,7 @@ import (
type (
canaryConfigCancelFuncMap struct {
cache *cache.Cache // map[metadataKey]*context.Context
cache *cache.Cache[metadataKey, *CanaryProcessingInfo]
}
// metav1.ObjectMeta is not hashable, so we make a hashable copy
@@ -45,7 +45,7 @@ type (
func makecanaryConfigCancelFuncMap() *canaryConfigCancelFuncMap {
return &canaryConfigCancelFuncMap{
cache: cache.MakeCache(0, 0),
cache: cache.MakeCache[metadataKey, *CanaryProcessingInfo](0, 0),
}
}
@@ -62,8 +62,7 @@ func (cancelFuncMap *canaryConfigCancelFuncMap) lookup(f *metav1.ObjectMeta) (*C
if err != nil {
return nil, err
}
value := item.(*CanaryProcessingInfo)
return value, nil
return item, nil
}
func (cancelFuncMap *canaryConfigCancelFuncMap) assign(f *metav1.ObjectMeta, value *CanaryProcessingInfo) error {
+25 -21
View File
@@ -18,13 +18,13 @@ package canaryconfigmgr
import (
"context"
"errors"
"fmt"
"net/url"
"os"
"strings"
"time"
"github.com/pkg/errors"
"go.uber.org/zap"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -35,6 +35,7 @@ import (
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
const (
@@ -78,7 +79,7 @@ func MakeCanaryConfigMgr(ctx context.Context, logger *zap.Logger, fissionClient
_, err := url.Parse(prometheusSvc)
if err != nil {
return nil, errors.Errorf("prometheus service url not found/invalid, can't create canary config manager: %v", prometheusSvc)
return nil, fmt.Errorf("prometheus service url not found/invalid, can't create canary config manager: %s", prometheusSvc)
}
promClient, err := MakePrometheusClient(logger, prometheusSvc)
@@ -94,13 +95,16 @@ func MakeCanaryConfigMgr(ctx context.Context, logger *zap.Logger, fissionClient
canaryCfgCancelFuncMap: makecanaryConfigCancelFuncMap(),
}
configMgr.canaryConfigInformer = utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.CanaryConfigResource)
configMgr.CanaryConfigEventHandlers(ctx)
err = configMgr.CanaryConfigEventHandlers(ctx)
if err != nil {
return nil, err
}
return configMgr, nil
}
func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Context) {
func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Context) error {
for _, informer := range canaryCfgMgr.canaryConfigInformer {
informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
_, err := informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
canaryConfig := obj.(*fv1.CanaryConfig)
if canaryConfig.Status.Status == fv1.CanaryConfigStatusPending {
@@ -126,13 +130,15 @@ func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Conte
},
})
if err != nil {
return err
}
}
return nil
}
func (canaryCfgMgr *canaryConfigMgr) Run(ctx context.Context) {
for _, informer := range canaryCfgMgr.canaryConfigInformer {
go informer.Run(ctx.Done())
}
func (canaryCfgMgr *canaryConfigMgr) Run(ctx context.Context, mgr manager.Interface) {
mgr.AddInformers(ctx, canaryCfgMgr.canaryConfigInformer)
canaryCfgMgr.logger.Info("started canary configmgr controller")
}
@@ -374,9 +380,8 @@ func (canaryCfgMgr *canaryConfigMgr) updateHttpTriggerWithRetries(ctx context.Co
for i := 0; i < maxRetries; i++ {
triggerObj, err := canaryCfgMgr.fissionClient.CoreV1().HTTPTriggers(triggerNamespace).Get(ctx, triggerName, metav1.GetOptions{})
if err != nil {
e := "error getting http trigger object"
canaryCfgMgr.logger.Error(e, zap.Error(err), zap.String("trigger_name", triggerName), zap.String("trigger_namespace", triggerNamespace))
return errors.Wrap(err, e)
canaryCfgMgr.logger.Error("error getting http trigger object", zap.Error(err), zap.String("trigger_name", triggerName), zap.String("trigger_namespace", triggerNamespace))
return fmt.Errorf("error getting http trigger object: %w", err)
}
triggerObj.Spec.FunctionReference.FunctionWeights = fnWeights
@@ -394,11 +399,11 @@ func (canaryCfgMgr *canaryConfigMgr) updateHttpTriggerWithRetries(ctx context.Co
continue
default:
e := "error updating http trigger"
canaryCfgMgr.logger.Error(e,
canaryCfgMgr.logger.Error("error updating http trigger",
zap.Error(err),
zap.String("trigger_name", triggerName),
zap.String("trigger_namespace", triggerNamespace))
return errors.Wrapf(err, "%s: %s.%s", e, triggerName, triggerNamespace)
return fmt.Errorf("%s: %s.%s %w", e, triggerName, triggerNamespace, err)
}
}
@@ -415,7 +420,7 @@ func (canaryCfgMgr *canaryConfigMgr) updateCanaryConfigStatusWithRetries(ctx con
zap.String("name", cfgName),
zap.String("namespace", cfgNamespace),
zap.String("status", status))
return errors.Wrap(err, e)
return fmt.Errorf("%s: %s.%s %w", e, cfgName, cfgNamespace, err)
}
canaryCfgMgr.logger.Info("updating status of canary config",
@@ -444,7 +449,7 @@ func (canaryCfgMgr *canaryConfigMgr) updateCanaryConfigStatusWithRetries(ctx con
zap.Error(err),
zap.String("name", cfgName),
zap.String("namespace", cfgNamespace))
return errors.Wrapf(err, "%s: %s.%s", e, cfgName, cfgNamespace)
return fmt.Errorf("%s: %s.%s %w", e, cfgName, cfgNamespace, err)
}
}
@@ -552,20 +557,19 @@ func getEnvValue(envVar string) string {
return envVarSplit[1]
}
func StartCanaryServer(ctx context.Context, logger *zap.Logger, unitTestFlag bool) error {
func StartCanaryServer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, unitTestFlag bool) error {
cLogger := logger.Named("CanaryServer")
clientGen := crd.NewClientGenerator()
fissionClient, err := clientGen.GetFissionClient()
if err != nil {
return errors.Wrap(err, "failed to get fission client")
return fmt.Errorf("failed to get fission client: %w", err)
}
kubernetesClient, err := clientGen.GetKubernetesClient()
if err != nil {
return errors.Wrap(err, "failed to get kubernetes client")
return fmt.Errorf("failed to get kubernetes client: %w", err)
}
err = ConfigureFeatures(ctx, cLogger, unitTestFlag, fissionClient, kubernetesClient)
err = ConfigureFeatures(ctx, cLogger, unitTestFlag, fissionClient, kubernetesClient, mgr)
if err != nil {
cLogger.Error("error configuring features - proceeding without optional features", zap.Error(err))
}
+5 -3
View File
@@ -25,17 +25,19 @@ import (
config "github.com/fission/fission/pkg/featureconfig"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils/manager"
)
// ConfigureFeatures gets the feature config and configures the features that are enabled
func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode bool, fissionClient versioned.Interface, kubeClient kubernetes.Interface) error {
func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode bool, fissionClient versioned.Interface,
kubeClient kubernetes.Interface, mgr manager.Interface) error {
// set feature enabled to false if unitTestMode
if unitTestMode {
return nil
}
// get the featureConfig from config map mounted onto the file system
featureConfig, err := config.GetFeatureConfig()
featureConfig, err := config.GetFeatureConfig(logger)
if err != nil {
logger.Error("error getting feature config", zap.Error(err))
return err
@@ -47,7 +49,7 @@ func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode boo
if err != nil {
return errors.Wrap(err, "failed to start canary config manager")
}
canaryCfgMgr.Run(ctx)
canaryCfgMgr.Run(ctx, mgr)
return err
}
-271
View File
@@ -1,271 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"github.com/gorilla/mux"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/fission-cli/logdb"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/info"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/httpserver"
"github.com/fission/fission/pkg/utils/metrics"
"github.com/fission/fission/pkg/utils/otel"
)
var podNamespace string
func init() {
podNamespace = os.Getenv("POD_NAMESPACE")
if podNamespace == "" {
podNamespace = "fission"
}
}
type (
API struct {
logger *zap.Logger
fissionClient versioned.Interface
kubernetesClient kubernetes.Interface
storageServiceUrl string
builderManagerUrl string
workflowApiUrl string
functionNamespace string
featureStatus map[string]string
}
logDBConfig struct {
httpURL string
username string
password string
}
)
func MakeAPI(logger *zap.Logger, fissionClient versioned.Interface, kubernetesClient kubernetes.Interface) (*API, error) {
api, err := makeCRDBackedAPI(logger, fissionClient, kubernetesClient)
u := os.Getenv("STORAGE_SERVICE_URL")
if len(u) > 0 {
api.storageServiceUrl = strings.TrimSuffix(u, "/")
} else {
api.storageServiceUrl = "http://storagesvc"
}
u = os.Getenv("BUILDER_MANAGER_URL")
if len(u) > 0 {
api.builderManagerUrl = strings.TrimSuffix(u, "/")
} else {
api.builderManagerUrl = "http://buildermgr"
}
wfEnv := os.Getenv("WORKFLOW_API_URL")
if len(u) > 0 {
api.workflowApiUrl = strings.TrimSuffix(wfEnv, "/")
} else {
api.workflowApiUrl = "http://workflows-apiserver"
}
nsResolver := utils.DefaultNSResolver()
api.functionNamespace = nsResolver.ResolveNamespace(os.Getenv(utils.ENV_FUNCTION_NAMESPACE))
return api, err
}
func (api *API) respondWithSuccess(w http.ResponseWriter, resp []byte) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
_, err := w.Write(resp)
if err != nil {
// this will probably fail too, but try anyway
api.respondWithError(w, err)
}
}
func (api *API) respondWithError(w http.ResponseWriter, err error) {
// this error type comes with an HTTP code, so just use that
se, ok := err.(*kerrors.StatusError)
if ok {
api.logger.Error(err.Error(), zap.Int32("code", se.ErrStatus.Code))
http.Error(w, se.Error(), int(se.ErrStatus.Code))
return
}
code, msg := ferror.GetHTTPError(err)
api.logger.Error(msg, zap.Int("code", code))
http.Error(w, msg, code)
}
func (api *API) extractQueryParamFromRequest(r *http.Request, queryParam string) string {
values := r.URL.Query()
return values.Get(queryParam)
}
// check if namespace exists, if not create it.
func (api *API) createNsIfNotExists(ctx context.Context, ns string) error {
if ns == metav1.NamespaceDefault {
// we don't have to create default ns
return nil
}
_, err := api.kubernetesClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{})
if err != nil && kerrors.IsNotFound(err) {
ns := &apiv1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
}
_, err = api.kubernetesClient.CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{})
}
return err
}
func (api *API) getLogDBConfig(dbType string) logDBConfig {
dbType = strings.ToUpper(dbType)
// retrieve db auth config from the env
url := os.Getenv(fmt.Sprintf("%s_URL", dbType))
if url == "" {
// set up default database url
url = logdb.INFLUXDB_URL
}
username := os.Getenv(fmt.Sprintf("%s_USERNAME", dbType))
password := os.Getenv(fmt.Sprintf("%s_PASSWORD", dbType))
return logDBConfig{
httpURL: url,
username: username,
password: password,
}
}
func (api *API) HomeHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
_, err := w.Write([]byte(info.ApiInfo().String()))
if err != nil {
api.respondWithError(w, err)
}
}
func (api *API) ApiVersionMismatchHandler(w http.ResponseWriter, r *http.Request) {
err := ferror.MakeError(ferror.ErrorNotFound, "Fission server supports API v2 only -- v1 is not supported. Please upgrade your Fission client/CLI.")
api.respondWithError(w, err)
}
func (api *API) HealthHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (api *API) GetSvcName(w http.ResponseWriter, r *http.Request) {
appLabelSelector := "application=" + r.URL.Query().Get("application")
services, err := api.kubernetesClient.CoreV1().Services(podNamespace).List(r.Context(), metav1.ListOptions{
LabelSelector: appLabelSelector,
})
if err != nil || len(services.Items) > 1 || len(services.Items) == 0 {
api.respondWithError(w, err)
}
service := services.Items[0]
fmt.Fprintf(w, service.Name+"."+podNamespace)
}
func (api *API) GetHandler() http.Handler {
r := mux.NewRouter()
r.Use(metrics.HTTPMetricMiddleware)
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
// Give a useful error message if an older CLI attempts to make a request
r.HandleFunc(`/v1/{rest:[a-zA-Z0-9=\-\/]+}`, api.ApiVersionMismatchHandler)
r.HandleFunc("/", api.HomeHandler)
r.HandleFunc("/v2/packages", api.PackageApiList).Methods("GET")
r.HandleFunc("/v2/packages", api.PackageApiCreate).Methods("POST")
r.HandleFunc("/v2/packages/{package}", api.PackageApiGet).Methods("GET")
r.HandleFunc("/v2/packages/{package}", api.PackageApiUpdate).Methods("PUT")
r.HandleFunc("/v2/packages/{package}", api.PackageApiDelete).Methods("DELETE")
r.HandleFunc("/v2/functions", api.FunctionApiList).Methods("GET")
r.HandleFunc("/v2/functions", api.FunctionApiCreate).Methods("POST")
r.HandleFunc("/v2/functions/{function}", api.FunctionApiGet).Methods("GET")
r.HandleFunc("/v2/functions/{function}", api.FunctionApiUpdate).Methods("PUT")
r.HandleFunc("/v2/functions/{function}", api.FunctionApiDelete).Methods("DELETE")
r.HandleFunc("/v2/functions/{function}/pods", api.FunctionApiPodList).Methods("GET")
r.HandleFunc("/v2/triggers/http", api.HTTPTriggerApiList).Methods("GET")
r.HandleFunc("/v2/triggers/http", api.HTTPTriggerApiCreate).Methods("POST")
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiGet).Methods("GET")
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiUpdate).Methods("PUT")
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/v2/environments", api.EnvironmentApiList).Methods("GET")
r.HandleFunc("/v2/environments", api.EnvironmentApiCreate).Methods("POST")
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiGet).Methods("GET")
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiUpdate).Methods("PUT")
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiDelete).Methods("DELETE")
r.HandleFunc("/v2/environments/{environment}/pods", api.EnvironmentApiPodList).Methods("GET")
r.HandleFunc("/v2/watches", api.WatchApiList).Methods("GET")
r.HandleFunc("/v2/watches", api.WatchApiCreate).Methods("POST")
r.HandleFunc("/v2/watches/{watch}", api.WatchApiGet).Methods("GET")
r.HandleFunc("/v2/watches/{watch}", api.WatchApiUpdate).Methods("PUT")
r.HandleFunc("/v2/watches/{watch}", api.WatchApiDelete).Methods("DELETE")
r.HandleFunc("/v2/triggers/time", api.TimeTriggerApiList).Methods("GET")
r.HandleFunc("/v2/triggers/time", api.TimeTriggerApiCreate).Methods("POST")
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiGet).Methods("GET")
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiUpdate).Methods("PUT")
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/v2/triggers/messagequeue", api.MessageQueueTriggerApiList).Methods("GET")
r.HandleFunc("/v2/triggers/messagequeue", api.MessageQueueTriggerApiCreate).Methods("POST")
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiGet).Methods("GET")
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiUpdate).Methods("PUT")
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
r.HandleFunc("/v2/secrets/{secret}", api.SecretExists).Methods("GET")
r.HandleFunc("/v2/configmaps/{configmap}", api.ConfigMapExists).Methods("GET")
r.HandleFunc("/v2/canaryconfigs", api.CanaryConfigApiCreate).Methods("POST")
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiGet).Methods("GET")
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiUpdate).Methods("PUT")
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiDelete).Methods("DELETE")
r.HandleFunc("/v2/canaryconfigs", api.CanaryConfigApiList).Methods("GET")
r.HandleFunc("/proxy/{dbType}", api.FunctionLogsApiPost).Methods("POST")
r.HandleFunc("/proxy/storage/v1/archive", api.StorageServiceProxy)
r.HandleFunc("/proxy/logs/{function}", api.FunctionPodLogs).Methods("POST")
r.HandleFunc("/proxy/workflows-apiserver/{path:.*}", api.WorkflowApiserverProxy) // Deprecated
r.HandleFunc("/proxy/svcname", api.GetSvcName).Queries("application", "").Methods("GET")
r.Handle("/v2/apidocs.json", openAPI()).Methods("GET")
return r
}
func (api *API) Serve(ctx context.Context, port int) {
handler := otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
go metrics.ServeMetrics(ctx, api.logger)
httpserver.StartServer(ctx, api.logger, "controller", fmt.Sprintf("%d", port), handler)
}
-554
View File
@@ -1,554 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"context"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"reflect"
"strings"
"testing"
"time"
uuid "github.com/satori/go.uuid"
"go.uber.org/zap"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/controller/client"
"github.com/fission/fission/pkg/controller/client/rest"
"github.com/fission/fission/pkg/crd"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
var (
// g struct {
// cmd.CommandActioner
// }
testNS = metav1.NamespaceDefault
)
func panicIf(err error) {
if err != nil {
log.Panicf("err: %v", err)
}
}
func assert(c bool, msg string) {
if !c {
log.Fatalf("assert failed: %v", msg)
}
}
func assertNameReuseFailure(err error, name string) {
assert(err != nil, "recreating "+name+" with same name must fail")
fe, ok := err.(ferror.Error)
assert(ok, "error must be a fission Error")
assert(fe.Code == ferror.ErrorNameExists, "error must be a name exists error")
}
func assertNotFoundFailure(err error, name string) {
assert(err != nil, "requesting a non-existent "+name+" must fail")
fe, ok := err.(ferror.Error)
assert(ok, "error must be a fission Error")
if fe.Code != ferror.ErrorNotFound {
log.Fatalf("error must be a not found error: %v", fe)
}
}
func assertCronSpecFails(err error) {
assert(err != nil, "using an invalid cron spec must fail")
ok := strings.Contains(err.Error(), "not a valid cron spec")
assert(ok, "invalid cron spec must fail")
}
func TestFunctionApi(t *testing.T) {
testFunc := &fv1.Function{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: testNS,
},
Spec: fv1.FunctionSpec{
Environment: fv1.EnvironmentReference{
Name: "nodejs",
Namespace: testNS,
},
Package: fv1.FunctionPackageRef{
FunctionName: "xxx",
PackageRef: fv1.PackageRef{
Namespace: testNS,
Name: "xxx",
ResourceVersion: "12345",
},
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().Function().Get(&metav1.ObjectMeta{
Name: testFunc.ObjectMeta.Name,
Namespace: testNS,
})
assertNotFoundFailure(err, "function")
m, err := dClient.V1().Function().Create(testFunc)
panicIf(err)
defer func() {
err := dClient.V1().Function().Delete(m)
panicIf(err)
}()
_, err = dClient.V1().Function().Create(testFunc)
assertNameReuseFailure(err, "function")
testFunc.ObjectMeta.ResourceVersion = m.ResourceVersion
testFunc.Spec.Package.FunctionName = "yyy"
_, err = dClient.V1().Function().Update(testFunc)
panicIf(err)
testFunc.ObjectMeta.ResourceVersion = ""
testFunc.ObjectMeta.Name = "bar"
m2, err := dClient.V1().Function().Create(testFunc)
panicIf(err)
defer func() {
err := dClient.V1().Function().Delete(m2)
panicIf(err)
}()
funcs, err := dClient.V1().Function().List(testNS)
panicIf(err)
assert(len(funcs) == 2, fmt.Sprintf("created two functions, but found %v", len(funcs)))
funcs_url := dClient.ServerURL() + "/v2/functions"
resp, err := http.Get(funcs_url)
panicIf(err)
defer resp.Body.Close()
assert(resp.StatusCode == 200, "http get status code on /v1/functions")
var found bool = false
for _, b := range resp.Header["Content-Type"] {
if b == "application/json; charset=utf-8" {
found = true
}
}
assert(found, "incorrect response content type")
}
func TestHTTPTriggerApi(t *testing.T) {
testTrigger := &fv1.HTTPTrigger{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: testNS,
},
Spec: fv1.HTTPTriggerSpec{
Methods: []string{http.MethodGet},
RelativeURL: "/hello",
FunctionReference: fv1.FunctionReference{
Type: fv1.FunctionReferenceTypeFunctionName,
Name: "foo",
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().HTTPTrigger().Get(&metav1.ObjectMeta{
Name: testTrigger.ObjectMeta.Name,
Namespace: testNS,
})
assertNotFoundFailure(err, "httptrigger")
m, err := dClient.V1().HTTPTrigger().Create(testTrigger)
panicIf(err)
defer func() {
err := dClient.V1().HTTPTrigger().Delete(m)
panicIf(err)
}()
_, err = dClient.V1().HTTPTrigger().Create(testTrigger)
assertNameReuseFailure(err, "httptrigger")
tr, err := dClient.V1().HTTPTrigger().Get(m)
panicIf(err)
assert(len(testTrigger.Spec.Methods) == len(tr.Spec.Methods) &&
testTrigger.Spec.RelativeURL == tr.Spec.RelativeURL &&
testTrigger.Spec.FunctionReference.Type == tr.Spec.FunctionReference.Type &&
testTrigger.Spec.FunctionReference.Name == tr.Spec.FunctionReference.Name, "trigger should match after reading")
testTrigger.ObjectMeta.ResourceVersion = m.ResourceVersion
testTrigger.Spec.RelativeURL = "/hi"
_, err = dClient.V1().HTTPTrigger().Update(testTrigger)
panicIf(err)
testTrigger.ObjectMeta.ResourceVersion = ""
testTrigger.ObjectMeta.Name = "yyy"
_, err = dClient.V1().HTTPTrigger().Create(testTrigger)
assert(err != nil, "duplicate trigger should not be allowed")
testTrigger.Spec.RelativeURL = "/hi2"
m2, err := dClient.V1().HTTPTrigger().Create(testTrigger)
panicIf(err)
defer func() {
err = dClient.V1().HTTPTrigger().Delete(m2)
panicIf(err)
}()
ts, err := dClient.V1().HTTPTrigger().List(testNS)
panicIf(err)
assert(len(ts) == 2, fmt.Sprintf("created two triggers, but found %v", len(ts)))
}
func createFissionFnForMultipleTrigger() {
testFunc := &fv1.Function{
ObjectMeta: metav1.ObjectMeta{
Name: "foo1",
Namespace: testNS,
},
Spec: fv1.FunctionSpec{
Environment: fv1.EnvironmentReference{
Name: "nodejs",
Namespace: testNS,
},
Package: fv1.FunctionPackageRef{
FunctionName: "xxx",
PackageRef: fv1.PackageRef{
Namespace: testNS,
Name: "xxx",
ResourceVersion: "12345",
},
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().Function().Create(testFunc)
panicIf(err)
defer func() {
panicIf(err)
}()
testFunc.Name = "foo2"
_, err = dClient.V1().Function().Create(testFunc)
panicIf(err)
defer func() {
panicIf(err)
}()
}
func TestHTTPTriggerCreateMultipleTrigger(t *testing.T) {
logger := loggerfactory.GetLogger()
createFissionFnForMultipleTrigger()
prefix := "url_new"
testTrigger := &fv1.HTTPTrigger{
ObjectMeta: metav1.ObjectMeta{
Name: "foo1",
Namespace: testNS,
},
Spec: fv1.HTTPTriggerSpec{
Methods: []string{http.MethodGet},
Prefix: &prefix,
FunctionReference: fv1.FunctionReference{
Type: fv1.FunctionReferenceTypeFunctionName,
Name: "foo1",
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
m, err := dClient.V1().HTTPTrigger().Create(testTrigger)
panicIf(err)
defer panicIf(dClient.V1().HTTPTrigger().Delete(m))
prefix_2 := "url_another"
testTrigger2 := &fv1.HTTPTrigger{
ObjectMeta: metav1.ObjectMeta{
Name: "foo2",
Namespace: testNS,
},
Spec: fv1.HTTPTriggerSpec{
Methods: []string{http.MethodGet},
Prefix: &prefix_2,
FunctionReference: fv1.FunctionReference{
Type: fv1.FunctionReferenceTypeFunctionName,
Name: "foo2",
},
},
}
m2, err := dClient.V1().HTTPTrigger().Create(testTrigger2)
if err != nil {
t.Fatal()
}
defer func() {
if m2 != nil {
err := dClient.V1().HTTPTrigger().Delete(m2)
if err != nil {
logger.Error("Error deleting http trigger", zap.String("name", m2.Name), zap.Error(err))
}
}
}()
}
func TestEnvironmentApi(t *testing.T) {
testEnv := &fv1.Environment{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: testNS,
},
Spec: fv1.EnvironmentSpec{
Version: 1,
Runtime: fv1.Runtime{
Image: "gcr.io/xyz",
},
Resources: v1.ResourceRequirements{},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().Environment().Get(&metav1.ObjectMeta{
Name: testEnv.ObjectMeta.Name,
Namespace: testNS,
})
assertNotFoundFailure(err, "environment")
m, err := dClient.V1().Environment().Create(testEnv)
panicIf(err)
defer func() {
err := dClient.V1().Environment().Delete(m)
panicIf(err)
}()
_, err = dClient.V1().Environment().Create(testEnv)
assertNameReuseFailure(err, "environment")
e, err := dClient.V1().Environment().Get(m)
panicIf(err)
assert(reflect.DeepEqual(testEnv.Spec, e.Spec), "env should match after reading")
testEnv.ObjectMeta.ResourceVersion = m.ResourceVersion
testEnv.Spec.Runtime.Image = "another-img"
_, err = dClient.V1().Environment().Update(testEnv)
panicIf(err)
testEnv.ObjectMeta.ResourceVersion = ""
testEnv.ObjectMeta.Name = "bar"
m2, err := dClient.V1().Environment().Create(testEnv)
panicIf(err)
defer func() {
err := dClient.V1().Environment().Delete(m2)
panicIf(err)
}()
ts, err := dClient.V1().Environment().List(testNS)
panicIf(err)
assert(len(ts) == 2, fmt.Sprintf("created two envs, but found %v", len(ts)))
}
func TestWatchApi(t *testing.T) {
testWatch := &fv1.KubernetesWatchTrigger{
ObjectMeta: metav1.ObjectMeta{
Name: "xxx",
Namespace: testNS,
},
Spec: fv1.KubernetesWatchTriggerSpec{
Namespace: "default",
Type: "pod",
FunctionReference: fv1.FunctionReference{
Type: fv1.FunctionReferenceTypeFunctionName,
Name: "foo",
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().KubeWatcher().Get(&metav1.ObjectMeta{
Name: testWatch.ObjectMeta.Name,
Namespace: testNS,
})
assertNotFoundFailure(err, "watch")
m, err := dClient.V1().KubeWatcher().Create(testWatch)
panicIf(err)
defer func() {
err := dClient.V1().KubeWatcher().Delete(m)
panicIf(err)
}()
_, err = dClient.V1().KubeWatcher().Create(testWatch)
assertNameReuseFailure(err, "watch")
w, err := dClient.V1().KubeWatcher().Get(m)
panicIf(err)
assert(testWatch.Spec.Namespace == w.Spec.Namespace &&
testWatch.Spec.Type == w.Spec.Type &&
testWatch.Spec.FunctionReference.Type == w.Spec.FunctionReference.Type &&
testWatch.Spec.FunctionReference.Name == w.Spec.FunctionReference.Name, "watch should match after reading")
testWatch.ObjectMeta.Name = "yyy"
m2, err := dClient.V1().KubeWatcher().Create(testWatch)
panicIf(err)
defer func() {
err := dClient.V1().KubeWatcher().Delete(m2)
panicIf(err)
}()
ws, err := dClient.V1().KubeWatcher().List(testNS)
panicIf(err)
assert(len(ws) == 2, fmt.Sprintf("created two watches, but found %v", len(ws)))
}
func TestTimeTriggerApi(t *testing.T) {
testTrigger := &fv1.TimeTrigger{
ObjectMeta: metav1.ObjectMeta{
Name: "xxx",
Namespace: testNS,
},
Spec: fv1.TimeTriggerSpec{
Cron: "0 30 * * * *",
FunctionReference: fv1.FunctionReference{
Type: fv1.FunctionReferenceTypeFunctionName,
Name: "asdf",
},
},
}
restClient := rest.NewRESTClient("http://localhost:8888")
dClient := client.MakeClientset(restClient)
_, err := dClient.V1().TimeTrigger().Get(&metav1.ObjectMeta{Name: testTrigger.ObjectMeta.Name})
assertNotFoundFailure(err, "trigger")
m, err := dClient.V1().TimeTrigger().Create(testTrigger)
panicIf(err)
defer func() {
err := dClient.V1().TimeTrigger().Delete(m)
panicIf(err)
}()
_, err = dClient.V1().TimeTrigger().Create(testTrigger)
assertNameReuseFailure(err, "trigger")
tr, err := dClient.V1().TimeTrigger().Get(m)
panicIf(err)
assert(testTrigger.Spec.Cron == tr.Spec.Cron &&
testTrigger.Spec.FunctionReference.Type == tr.Spec.FunctionReference.Type &&
testTrigger.Spec.FunctionReference.Name == tr.Spec.FunctionReference.Name, "trigger should match after reading")
testTrigger.ObjectMeta.ResourceVersion = m.ResourceVersion
testTrigger.Spec.Cron = "@hourly"
_, err = dClient.V1().TimeTrigger().Update(testTrigger)
panicIf(err)
testTrigger.ObjectMeta.ResourceVersion = ""
testTrigger.ObjectMeta.Name = "yyy"
testTrigger.Spec.Cron = "Not valid cron spec"
_, err = dClient.V1().TimeTrigger().Create(testTrigger)
assertCronSpecFails(err)
ts, err := dClient.V1().TimeTrigger().List(testNS)
panicIf(err)
assert(len(ts) == 1, fmt.Sprintf("created two time triggers, but found %v", len(ts)))
}
func TestMain(m *testing.M) {
flag.Parse()
ctx, cancel := context.WithCancel(context.Background())
logger := loggerfactory.GetLogger()
// skip test if no cluster available for testing
kubeconfig := os.Getenv("KUBECONFIG")
if len(kubeconfig) == 0 {
log.Println("Skipping test, no kubernetes cluster")
cancel()
return
}
clientGen := crd.NewClientGenerator()
kubeClient, err := clientGen.GetKubernetesClient()
panicIf(err)
// testNS isolation for running multiple CI builds concurrently.
id, err := uuid.NewV4()
panicIf(err)
testNS = id.String()
_, err = kubeClient.CoreV1().Namespaces().Create(ctx, &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: testNS,
},
}, metav1.CreateOptions{})
panicIf(err)
go Start(ctx, logger, 8888, true)
time.Sleep(5 * time.Second)
client, err := cmd.NewClient(cmd.ClientOptions{})
panicIf(err)
// TODO: use fake rest client for offline spec generation
cmd.SetClientset(*client)
resp, err := http.Get("http://localhost:8888/")
panicIf(err)
assert(resp.StatusCode == 200, "http get status code on root")
var found bool = false
for _, b := range resp.Header["Content-Type"] {
if b == "application/json; charset=utf-8" {
found = true
}
}
assert(found, "incorrect response content type")
_, err = io.ReadAll(resp.Body)
panicIf(err)
exitVal := m.Run()
logger.Info("Deleting test namespace", zap.String("namespace", testNS))
gracePeriod := int64(0)
err = kubeClient.CoreV1().Namespaces().Delete(ctx, testNS, metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod})
if err != nil {
logger.Error("error deleting test namespace", zap.String("namespace", testNS), zap.Error(err))
}
cancel()
os.Exit(exitVal)
}
-254
View File
@@ -1,254 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"encoding/json"
"fmt"
"io"
"net/http"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
ferror "github.com/fission/fission/pkg/error"
config "github.com/fission/fission/pkg/featureconfig"
)
func RegisterCanaryConfigRoute(ws *restful.WebService) {
tags := []string{"CanaryConfig"}
specTag = append(specTag, spec.Tag{TagProps: spec.TagProps{Name: "CanaryConfig", Description: "CanaryConfig Operation"}})
ws.Route(
ws.GET("/v2/canaryconfigs").
Doc("List all canary configs").
Metadata(restfulspec.KeyOpenAPITags, tags).
To(func(req *restful.Request, resp *restful.Response) {
resp.ResponseWriter.WriteHeader(http.StatusOK)
}).
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
Produces(restful.MIME_JSON).
Writes([]fv1.CanaryConfig{}).
Returns(http.StatusOK, "List of canaryConfigs", []fv1.CanaryConfig{}))
ws.Route(
ws.POST("/v2/canaryconfigs").
Doc("Create canary config").
Metadata(restfulspec.KeyOpenAPITags, tags).
To(func(req *restful.Request, resp *restful.Response) {
resp.ResponseWriter.WriteHeader(http.StatusOK)
}).
Produces(restful.MIME_JSON).
Reads(fv1.CanaryConfig{}).
Writes(metav1.ObjectMeta{}).
Returns(http.StatusCreated, "ObjectMeta of created canaryConfig", metav1.ObjectMeta{}))
ws.Route(
ws.GET("/v2/canaryconfigs/{canaryConfig}").
Doc("Get detail of canary config").
Metadata(restfulspec.KeyOpenAPITags, tags).
To(func(req *restful.Request, resp *restful.Response) {
resp.ResponseWriter.WriteHeader(http.StatusOK)
}).
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
Produces(restful.MIME_JSON).
Writes(fv1.CanaryConfig{}). // on the response
Returns(http.StatusOK, "A canaryConfig", fv1.CanaryConfig{}))
ws.Route(
ws.PUT("/v2/canaryconfigs/{canaryConfig}").
Doc("Update canary config").
Metadata(restfulspec.KeyOpenAPITags, tags).
To(func(req *restful.Request, resp *restful.Response) {
resp.ResponseWriter.WriteHeader(http.StatusOK)
}).
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
Produces(restful.MIME_JSON).
Reads(fv1.CanaryConfig{}).
Writes(metav1.ObjectMeta{}). // on the response
Returns(http.StatusOK, "ObjectMeta of updated canaryConfig", metav1.ObjectMeta{}))
ws.Route(
ws.DELETE("/v2/canaryconfigs/{canaryConfig}").
Doc("Delete canary config").
Metadata(restfulspec.KeyOpenAPITags, tags).
To(func(req *restful.Request, resp *restful.Response) {
resp.ResponseWriter.WriteHeader(http.StatusOK)
}).
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
Produces(restful.MIME_JSON).
Returns(http.StatusOK, "Only HTTP status returned", nil))
}
func (a *API) CanaryConfigApiCreate(w http.ResponseWriter, r *http.Request) {
featureErr := a.featureStatus[config.CanaryFeature]
if len(featureErr) > 0 {
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
return
}
body, err := io.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
return
}
var canaryCfg fv1.CanaryConfig
err = json.Unmarshal(body, &canaryCfg)
if err != nil {
a.logger.Error("failed to unmarshal request body", zap.Error(err), zap.Binary("body", body))
a.respondWithError(w, err)
return
}
canaryCfgNew, err := a.fissionClient.CoreV1().CanaryConfigs(canaryCfg.ObjectMeta.Namespace).Create(r.Context(), &canaryCfg, metav1.CreateOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(canaryCfgNew.ObjectMeta)
if err != nil {
a.respondWithError(w, err)
return
}
w.WriteHeader(http.StatusCreated)
a.respondWithSuccess(w, resp)
}
func (a *API) CanaryConfigApiGet(w http.ResponseWriter, r *http.Request) {
featureErr := a.featureStatus[config.CanaryFeature]
if len(featureErr) > 0 {
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
return
}
vars := mux.Vars(r)
name := vars["canaryConfig"]
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
}
canaryCfg, err := a.fissionClient.CoreV1().CanaryConfigs(ns).Get(r.Context(), name, metav1.GetOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(canaryCfg)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) CanaryConfigApiList(w http.ResponseWriter, r *http.Request) {
featureErr := a.featureStatus[config.CanaryFeature]
if len(featureErr) > 0 {
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
return
}
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
}
canaryCfgs, err := a.fissionClient.CoreV1().CanaryConfigs(ns).List(r.Context(), metav1.ListOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(canaryCfgs.Items)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) CanaryConfigApiUpdate(w http.ResponseWriter, r *http.Request) {
featureErr := a.featureStatus[config.CanaryFeature]
if len(featureErr) > 0 {
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
return
}
body, err := io.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
return
}
var c fv1.CanaryConfig
err = json.Unmarshal(body, &c)
if err != nil {
a.respondWithError(w, err)
return
}
canayCfgNew, err := a.fissionClient.CoreV1().CanaryConfigs(c.ObjectMeta.Namespace).Update(r.Context(), &c, metav1.UpdateOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
resp, err := json.Marshal(canayCfgNew.ObjectMeta)
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, resp)
}
func (a *API) CanaryConfigApiDelete(w http.ResponseWriter, r *http.Request) {
featureErr := a.featureStatus[config.CanaryFeature]
if len(featureErr) > 0 {
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
return
}
vars := mux.Vars(r)
name := vars["canaryConfig"]
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
}
err := a.fissionClient.CoreV1().CanaryConfigs(ns).Delete(r.Context(), name, metav1.DeleteOptions{})
if err != nil {
a.respondWithError(w, err)
return
}
a.respondWithSuccess(w, []byte(""))
}
-49
View File
@@ -1,49 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"github.com/fission/fission/pkg/controller/client/rest"
v1 "github.com/fission/fission/pkg/controller/client/v1"
)
type (
Interface interface {
V1() v1.V1Interface
ServerURL() string
}
Clientset struct {
restClient rest.Interface
v1 v1.V1Interface
}
)
func MakeClientset(restClient rest.Interface) Interface {
return &Clientset{
restClient: restClient,
v1: v1.MakeV1Client(restClient),
}
}
func (c *Clientset) V1() v1.V1Interface {
return c.v1
}
func (c *Clientset) ServerURL() string {
return c.restClient.ServerURL()
}
-43
View File
@@ -1,43 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"github.com/fission/fission/pkg/controller/client/rest"
v1 "github.com/fission/fission/pkg/controller/client/v1"
"github.com/fission/fission/pkg/controller/client/v1/fake"
)
type (
FakeClientset struct {
v1 v1.V1Interface
}
)
func MakeFakeClientset(restClient rest.Interface) Interface {
return &FakeClientset{
v1: fake.MakeV1Client(nil),
}
}
func (c *FakeClientset) V1() v1.V1Interface {
return c.v1
}
func (c *FakeClientset) ServerURL() string {
return ""
}
-128
View File
@@ -1,128 +0,0 @@
/*
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 rest
import (
"bytes"
"context"
"io"
"net/http"
"strings"
"github.com/pkg/errors"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)
type (
Interface interface {
Create(relativeUrl string, contentType string, payload []byte) (*http.Response, error)
Put(relativeUrl string, contentType string, payload []byte) (*http.Response, error)
Get(relativeUrl string) (*http.Response, error)
Delete(relativeUrl string) error
Proxy(method string, relativeUrl string, payload []byte) (*http.Response, error)
ServerInfo() (*http.Response, error)
ServerURL() string
}
RESTClient struct {
url string
HTTPClient *http.Client
}
)
func NewRESTClient(serverUrl string) Interface {
return &RESTClient{
url: strings.TrimSuffix(serverUrl, "/"),
HTTPClient: &http.Client{
Transport: otelhttp.NewTransport(http.DefaultTransport),
},
}
}
func (c *RESTClient) Create(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(context.TODO(), http.MethodPost, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
}
func (c *RESTClient) Put(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(context.TODO(), http.MethodPut, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
}
func (c *RESTClient) Get(relativeUrl string) (*http.Response, error) {
return c.sendRequest(context.TODO(), http.MethodGet, c.v2CrdUrl(relativeUrl), nil, nil)
}
func (c *RESTClient) Delete(relativeUrl string) error {
resp, err := c.sendRequest(context.TODO(), http.MethodDelete, c.v2CrdUrl(relativeUrl), nil, nil)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
body, err := io.ReadAll(resp.Body)
if err != nil {
return errors.Wrap(err, "error deleting")
} else {
return errors.Errorf("failed to delete: %v", string(body))
}
}
return nil
}
func (c *RESTClient) Proxy(method string, relativeUrl string, payload []byte) (*http.Response, error) {
var reader io.Reader
if len(payload) > 0 {
reader = bytes.NewReader(payload)
}
return c.sendRequest(context.TODO(), method, c.proxyUrl(relativeUrl), nil, reader)
}
func (c *RESTClient) ServerInfo() (*http.Response, error) {
return c.sendRequest(context.TODO(), http.MethodGet, c.url, nil, nil)
}
func (c *RESTClient) ServerURL() string {
return c.url
}
func (c *RESTClient) sendRequest(ctx context.Context, method string, relativeUrl string, headers map[string]string, reader io.Reader) (*http.Response, error) {
req, err := http.NewRequestWithContext(ctx, method, relativeUrl, reader)
if err != nil {
return nil, err
}
for k, v := range headers {
req.Header.Set(k, v)
}
return c.HTTPClient.Do(req)
}
func (c *RESTClient) v2CrdUrl(relativeUrl string) string {
return c.url + "/v2/" + strings.TrimPrefix(relativeUrl, "/")
}
func (c *RESTClient) proxyUrl(relativeUrl string) string {
return c.url + "/proxy/" + strings.TrimPrefix(relativeUrl, "/")
}
-153
View File
@@ -1,153 +0,0 @@
/*
Copyright 2016 The Fission Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
"encoding/json"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/controller/client/rest"
)
type (
CanaryConfigGetter interface {
CanaryConfig() CanaryConfigInterface
}
CanaryConfigInterface interface {
Create(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error)
Get(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error)
Update(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error)
Delete(m *metav1.ObjectMeta) error
List(ns string) ([]fv1.CanaryConfig, error)
}
CanaryConfig struct {
client rest.Interface
}
)
func newCanaryConfigClient(c *V1) CanaryConfigInterface {
return &CanaryConfig{client: c.restClient}
}
func (c *CanaryConfig) Create(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
reqbody, err := json.Marshal(canaryConf)
if err != nil {
return nil, err
}
resp, err := c.client.Create("canaryconfigs", "application/json", reqbody)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := handleCreateResponse(resp)
if err != nil {
return nil, err
}
var m metav1.ObjectMeta
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *CanaryConfig) Get(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error) {
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
resp, err := c.client.Get(relativeUrl)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := handleResponse(resp)
if err != nil {
return nil, err
}
var canaryCfg fv1.CanaryConfig
err = json.Unmarshal(body, &canaryCfg)
if err != nil {
return nil, err
}
return &canaryCfg, nil
}
func (c *CanaryConfig) Update(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
reqbody, err := json.Marshal(canaryConf)
if err != nil {
return nil, err
}
relativeUrl := fmt.Sprintf("canaryconfigs/%v", canaryConf.ObjectMeta.Name)
resp, err := c.client.Put(relativeUrl, "application/json", reqbody)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := handleResponse(resp)
if err != nil {
return nil, err
}
var m metav1.ObjectMeta
err = json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
return &m, nil
}
func (c *CanaryConfig) Delete(m *metav1.ObjectMeta) error {
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
return c.client.Delete(relativeUrl)
}
func (c *CanaryConfig) List(ns string) ([]fv1.CanaryConfig, error) {
relativeUrl := fmt.Sprintf("canaryconfigs?namespace=%v", ns)
resp, err := c.client.Get(relativeUrl)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := handleResponse(resp)
if err != nil {
return nil, err
}
canaryCfgs := make([]fv1.CanaryConfig, 0)
err = json.Unmarshal(body, &canaryCfgs)
if err != nil {
return nil, err
}
return canaryCfgs, nil
}

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