Compare commits

...
61 Commits
Author SHA1 Message Date
b36e0516f4 Update chart version v1.17.0 (#2549)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-16 18:40:41 +05:30
121f962399 Add yaml manifest generation (#2548)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-16 18:13:46 +05:30
58f33d6f6c Add artifact and image signing (#2547)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-15 19:31:10 +05:30
61f4d4f5ad Fix dashboard template (#2546)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-15 19:17:31 +05:30
Shubham BansalandGitHub dc4c6e20e3 Add metric fission_mqt_message_lag for kafka mqt connector (#2544)
These changes have specifically been made for Kafka connector. This will expose a new metric named `fission_mqt_message_lag`, which will show a number of messages lag per topic and partition.

We can use this metric in the auto-scaling of the pod for the new deploy type executor function. While creating a new deploy function we need to add hpa metrics of external type inside the function definition.
2022-09-15 14:45:51 +05:30
12d323e32f Update chart and app version (#2542)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-13 15:05:03 +05:30
2882e0d3e7 allow two HTTP triggers with no URLs and different prefix (#2540)
* allow two HTTP triggers with no URL and different prefix
* update dependency
* Fix controller existing tests
* Ensure namespace cleanup in API test
* update test cases
* handle error conditions in test

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2022-09-13 13:30:00 +05:30
79b41ec070 Add servicemonitor additional labels and podmonitor (#2541)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-12 20:25:17 +05:30
05130949ad Add grafana dashboards and configmap creation for auto provisioning (#2519)
* Add grafana dashboards and configmap creation
* Fix Data source, job and template rules
* Add units to all panels
* fix units and fix linting issues
* Enable verbose linting for dashboards

Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-12 17:10:07 +05:30
Sanket SudakeandGitHub dea7b2be94 Generate fission code using code-generator from upstream 1.25 release (#2534)
* Generate fission code using code-generator from upstream 1.25 release
* Update sigs.k8s.io/controller-runtime v0.13.0

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-09-07 10:15:29 +05:30
Sanket SudakeandGitHub 294ff5bb19 Optimize Github action workflows for Go version identification (#2533)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-09-06 17:30:21 +05:30
7dad7c8399 Ensure newdeploy function pod restart on referred configmap update (#2528)
Configmap inside pods for newdeploy and pool manager executor type were not being updated if the user update the configmap.
This fix will help to update the pods for both executor type with new configmap. As per the changes if there is any configmap update then pods will get restarted for both executor type and then it will refer new configmap.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2022-09-06 16:12:55 +05:30
e0c09ce340 Fix dashboard linting workflow (#2530)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-02 14:08:48 +05:30
e4751d54cb Add dashboard linting workflow (#2529)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-09-02 13:40:49 +05:30
ed6f4ea375 Dump labels and annotations for function via getmeta cli (#2525)
Co-authored-by: Nemanja Miletic <nmiletic@paloaltonetworks.com>
2022-08-31 12:51:11 +05:30
Sanket SudakeandGitHub fef2d8f875 Propogate context for prometheus queries via canaryconfig ops (#2527)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-31 12:03:00 +05:30
Sanket SudakeandGitHub 6971bcd287 Update Go version 1.19 (#2523)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-30 11:40:01 +05:30
neha_guptaandGitHub b16010dfa3 add values for nats jetstream keda connector (#2515)
* add values for jetstream connector

* formatte fission cli

* Update jetstream connector version
2022-08-29 10:45:18 +05:30
Andrey DudinandGitHub 9016b6d28c Correct error message in otel propagators test (#2522) 2022-08-26 11:43:37 +05:30
Andrey DudinandGitHub ce887f360a Fix fission version command in issue template (#2521) 2022-08-26 11:41:40 +05:30
Andrey DudinandGitHub 8238916340 Add endPoint property example (#2518) 2022-08-24 21:55:38 +05:30
Sanket SudakeandGitHub b1f8ad8dca Remove usused files and refactor crd ref docs generation (#2516)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-22 16:38:28 +05:30
Sanket SudakeandGitHub dca306d87f Change default branch to main across repository (#2514)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-22 14:57:00 +05:30
Sanket SudakeandGitHub 3b4211b581 Update go dependencies to latest and actions used in workflows (#2510)
* Updated all Go language dependencies to latest version available
* Formatted all files as per gofmt
* Update Golangci-lint version to 1.48.0
* Updated action version wherer application in Github workflows
* Updated Kubernetes version to latest available
* Remove "io/ioutil" references and replace with "io"/"os"

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-19 13:36:37 +05:30
5c4121ca1e Remove CRD generation from release workflow (#2513)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-08-18 16:26:48 +05:30
a3fde534e2 Add Github actions release CI (#2505)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
2022-08-18 16:08:39 +05:30
neha_guptaandGitHub 63c1c25fda Update keda connector versions (#2512)
- kafka: v0.11
- rabbitmq: v0.10
- awskinesis: v0.10
- aws_sqs: v0.10
- nats_steaming: v0.12
- gcp_pubsub: v0.5
- redis: v0.3
2022-08-18 14:00:01 +05:30
Sanket SudakeandGitHub d32e09aaf9 Update go-restful libraries (#2509)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-09 16:09:40 +05:30
Sanket SudakeandGitHub 1184864c14 Reestablish kakfa consumer group session on disconnection (#2504)
* Reestablish kakfa consumer group session on disconnection
* Add wait for the consumer
* Ignore empty message
* Update github.com/Shopify/sarama to v1.35.0

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-09 11:06:19 +05:30
Sanket SudakeandGitHub 9343eb9911 Use sig.k8s.io/yaml instead of ghodss/yaml (#2506)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-05 16:09:34 +05:30
Sanket SudakeandGitHub 3ecf21a6f1 Update kubernetes and opentelemetry dependencies (#2507)
* Update kubernetes libs to v0.24.3
* Update opentelemtry libraries

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-08-05 15:14:42 +05:30
Shubham BansalandGitHub 904413db6d Capture previous command exit code in integration tests cleanup (#2503)
* show previous response code

* log previous response code of shell script command
2022-08-04 10:16:05 +05:30
Shubham BansalandGitHub 3c8edab514 removed unused reference of TRACING_SAMPLING_RATE (#2498) 2022-07-27 14:30:30 +05:30
Sanket SudakeandGitHub 5c886e4cf4 Upgrade Opentelemetry Libraries and adopt enhancements (#2484)
1. Use websocket support introduced in Openetelemetry Librarries
2. Use propagators settings introduced in Opentelemetry Go SDK
3. Use samplers settings introduced in Openetelemetry Go SDK

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-07-20 11:13:12 +05:30
Pranoy Kumar KunduandGitHub dba9143f45 Prevent creating function of executor type container via fn create command (#2486) 2022-07-19 15:26:12 +05:30
Shubham BansalandGitHub 1abe4dadb7 fix to change value of BuildStatus from Pending to pending (#2489) 2022-07-19 13:29:36 +05:30
Shubham BansalandGitHub 9cedeb4fa6 Generate package within 63 character limit when creating function (#2482) 2022-07-13 10:19:45 +05:30
Sanket SudakeandGitHub 899e6e96d6 cleanup: Remove Opentracing support as no active users (#2196)
References:
[1] #2193
[2] https://fissionio.slack.com/archives/C3LUX6BBP/p1631706812069300

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-07-12 14:52:17 +05:30
Ankit ChawlaandGitHub 7838debadf Added fix to retrieve correct s3 urls (#2465)
* Added fix to retrieve correct s3 urls

* Fixes to S3 url

* Squashing commits

* Fixing if conditions for storagetype in geturl
2022-07-12 11:56:25 +05:30
Shubham BansalandGitHub db13455a7b Upgrade alpine version from 3.15 to 3.16 (#2480) 2022-07-11 16:06:53 +05:30
Shubham BansalandGitHub 5838340594 Increase time for port forwarding exponentially in fission CLI (#2468) 2022-07-07 15:36:36 +05:30
Sanket SudakeandGitHub 655456ee03 Update changelog for 1.17.0-rc1 (#2471)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-07-06 15:55:10 +05:30
Sanket SudakeandGitHub 770c19a27b Update release version v1.17.0-rc1 (#2470)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-07-06 15:01:39 +05:30
Sanket SudakeandGitHub 613062549d Update controller-tools to v0.9.2 (#2467)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-07-04 16:48:32 +05:30
Shubham BansalandGitHub f3a45b6549 OpenTelemetry package update to v1.7.0 (#2466) 2022-06-30 16:40:50 +05:30
Shubham BansalandGitHub c71867169b Pods immediately terminate for idletimeout in new deployment and container executer type (#2459)
* added waitgroup to handle multiple goroutine scenario
* changes for cache service
* changes to get function service from cache by UID
2022-06-29 11:49:34 +05:30
Ankit ChawlaandGitHub 473acc4e2b Added support to set builder and fn pod specs via helm chart (#2461)
The users can now set the pod spec for builder and fn pods via helm chart.
Currently we have set some default securitycontext for the pods. Before there were no permissions set and the user would by default enter root when kubectl exec into pod. Now the permissions have been set and the user will not be able to access root directory in poolmgr and newdeploy pods.
2022-06-27 16:52:28 +05:30
21ea35b02a CLI to operate archives managed by Storage Service (#2450)
* Add API for listing storage service archives
If id is mentioned we allow user to download specific
archive. If id is not mentioned we list all archives
present with storage service.
This will allow us to build CLI with storage service
and help users to debug storage service.
* Added commands for storagesvc cli and functionalities
* Reusing code and added geturl and download.
* Fixed geturl for localstorage.
* Fixed description of fission archive command
* Added unit tests for function getstorageurl
* Added integration test for archive cli




Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2022-06-15 18:53:36 +05:30
Shubham BansalandGitHub 7f21b708e7 Avoid fission installation failure due to analytics connection error (#2457) 2022-06-15 11:32:06 +05:30
Ankit ChawlaandGitHub b80b41e1fd Added variable to enable or disable archivePruner (#2458)
* Added variable to enable or disable archivePruner

* Made fixes according to code review comments

* Minor changes
2022-06-15 10:48:24 +05:30
fe8f53375e builder: Allow command with arguments via custom build options (#2453)
* allow buildcmd command to process arguments
* Add unit tests for builder with different scenarios

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2022-06-13 19:26:05 +05:30
Ankit ChawlaandGitHub a2b6f95656 Fix for issue in poolmgr fns caused by skipping address validation (#2441) 2022-06-13 15:09:29 +05:30
Ankit ChawlaandGitHub fa3347077a Fix for archivepruner to delete files only from subdir (#2456) 2022-06-13 12:35:49 +05:30
Shubham NazareandGitHub 5d010fe1fa Fix pre-check failure during new fission installation (#2437)
* Add pre-check flag to root cmd
* Make precheck flag optional
* Remove pre from global optional flag

Signed-off-by: Shubham Nazare <shubham4443@gmail.com>
2022-06-13 11:48:26 +05:30
Sanket SudakeandGitHub 979880ae2d Upgraded controller-gen to remove status from fission CRDs (#2454)
Updated controller-gen to 0.9.0 and regenerated CRDs to
remove status from all Fission CRDs.
2022-06-10 10:01:56 +05:30
Yatish SharmaandGitHub 7be3e4f410 [issue-2401] Added pod security context for Fission Components (#2449)
Following component has been updated with securityContext -
1. buildermgr
2. controller
3. executor
4. kubewatcher
5. router
6. timer
7. storagesvc

* Removed the security context from fetcher as per the offline discussion
2022-06-09 16:25:09 +05:30
Ankit ChawlaandGitHub 709af6e432 Update github.com/opencontainers/runc dependency to 1.1.2 (#2448) 2022-06-06 13:49:22 +05:30
Ankit ChawlaandGitHub ac3307bd91 Fixed help for ColdStarts metric in executor according to new labels (#2446) 2022-06-02 12:26:05 +05:30
VishalandGitHub 063209dc9e More users added (#2440) 2022-05-26 18:21:53 +05:30
83303471c5 Adding users of Fission (#2439)
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
2022-05-26 18:09:51 +05:30
Sanket SudakeandGitHub 8bcc9503d1 Add changelog for 1.16.0 release (#2434)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-05-24 14:24:13 +05:30
230 changed files with 22831 additions and 6123 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ assignees: ''
<!-- If you tested with other services, for example Istio, please also provide the version of service as well. --> <!-- If you tested with other services, for example Istio, please also provide the version of service as well. -->
<pre> <pre>
$ fission --version $ fission version
$ kubectl version $ kubectl version
</pre> </pre>
+9 -10
View File
@@ -3,14 +3,14 @@ name: Code Scanning
on: on:
push: push:
branches: branches:
- master - main
paths: paths:
- '**.go' - '**.go'
- go.mod - go.mod
- go.sum - go.sum
pull_request: pull_request:
branches: branches:
- master - main
paths: paths:
- '**.go' - '**.go'
- go.mod - go.mod
@@ -25,19 +25,18 @@ jobs:
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v3
- uses: actions/cache@v2 - name: setup go
uses: actions/setup-go@v3
with: with:
path: ~/go/pkg/mod go-version-file: "go.mod"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} cache: true
restore-keys: |
${{ runner.os }}-go-
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v2
with: with:
languages: go languages: go
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v2
+35
View File
@@ -0,0 +1,35 @@
name: Lint dashboards
on:
push:
branches:
- main
paths:
- 'charts/fission-all/dashboards/**.json'
pull_request:
branches:
- main
paths:
- 'charts/fission-all/dashboards/**.json'
workflow_dispatch:
jobs:
lint-dashboards:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.5
- name: Install dashboard linter
run: |
go get github.com/grafana/dashboard-linter
go install github.com/grafana/dashboard-linter
- name: Run dashboard linter
run: ./hack/lint-dashboards.sh
+27 -37
View File
@@ -3,69 +3,59 @@ name: Lint and Unit tests
on: on:
push: push:
branches: branches:
- master - main
paths: paths:
- '**.go' - "**.go"
- go.mod - go.mod
- go.sum - go.sum
pull_request: pull_request:
branches: branches:
- master - main
paths: paths:
- '**.go' - "**.go"
- go.mod - go.mod
- go.sum - go.sum
workflow_dispatch: workflow_dispatch:
env:
GOLANGCI_LINT_VERSION: v1.49.0
GOLANGCI_LINT_TIMEOUT: 5m
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v3
- uses: actions/cache@v2 - name: Set up Go
uses: actions/setup-go@v3
with: with:
path: ~/go/pkg/mod go-version-file: "go.mod"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} cache: true
restore-keys: |
${{ runner.os }}-go-
- name: Verify dependencies - name: Verify dependencies
run: | run: |
go mod verify go mod verify
go mod download go mod download
LINT_VERSION=1.45.0 - name: Run golangci-lint
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \ uses: golangci/golangci-lint-action@v3
tar xz --strip-components 1 --wildcards \*/golangci-lint with:
mkdir -p bin && mv golangci-lint bin/ version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
- name: Run checks - name: Detect git changes
if: always()
run: | run: |
STATUS=0 if [[ $(git diff --stat) != '' ]]; then
assert-nothing-changed() { echo -e '❌ \033[0;31m. Fix lint changes.\033[0m'
local diff git diff --color
"$@" >/dev/null || return 1 exit 1
if ! diff="$(git diff -U1 --color --exit-code)"; then else
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2 echo '✔ No issues detected. Have a nice day :-)'
git checkout -- . fi
STATUS=1
fi
}
assert-nothing-changed go fmt ./...
assert-nothing-changed go mod tidy
bin/golangci-lint run --out-format=github-actions --timeout=5m || STATUS=$?
exit $STATUS
- name: Run unit tests - name: Run unit tests
run: ./hack/runtests.sh run: ./hack/runtests.sh
+17 -19
View File
@@ -3,7 +3,7 @@ name: Fission CI
on: on:
push: push:
branches: branches:
- master - main
paths: paths:
- "**.go" - "**.go"
- "charts/**" - "charts/**"
@@ -12,7 +12,7 @@ on:
- go.sum - go.sum
pull_request: pull_request:
branches: branches:
- master - main
paths: paths:
- "**.go" - "**.go"
- "charts/**" - "charts/**"
@@ -21,6 +21,10 @@ on:
- go.sum - go.sum
workflow_dispatch: workflow_dispatch:
env:
HELM_VERSION: v3.9.0
KIND_VERSION: v0.14.0
jobs: jobs:
# Job to run change detection # Job to run change detection
integration-test: integration-test:
@@ -28,40 +32,34 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
kindversion: ["v1.19.11", "v1.20.7", "v1.21.1"] kindversion: ["v1.19.16", "v1.20.15", "v1.21.12"]
os: [ubuntu-latest] os: [ubuntu-latest]
steps: steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: setup go - name: setup go
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.18.1 go-version-file: "go.mod"
cache: true
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2.3.4 uses: actions/checkout@v3
- name: Checkout sources
uses: actions/checkout@v2.3.4
with: with:
repository: fission/examples repository: fission/examples
path: examples path: examples
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Helm installation - name: Helm installation
uses: Azure/setup-helm@v1 uses: Azure/setup-helm@v3
with: with:
version: v3.3.4 version: ${{ env.HELM_VERSION }}
- name: Kind Clutser - name: Kind Clutser
uses: engineerd/setup-kind@v0.5.0 uses: engineerd/setup-kind@v0.5.0
with: with:
image: kindest/node:${{ matrix.kindversion }} image: kindest/node:${{ matrix.kindversion }}
version: v0.11.1 version: ${{ env.KIND_VERSION }}
config: kind.yaml config: kind.yaml
- name: Configuring and testing the Installation - name: Configuring and testing the Installation
+82
View File
@@ -0,0 +1,82 @@
name: Create Draft release
on:
push:
tags:
- v1.**
- v2.**
env:
KIND_VERSION: v0.14.0
KIND_NODE_IMAGE_TAG: v1.19.16
jobs:
create-draft-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
install-only: true
- name: Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
version: ${{ env.KIND_VERSION }}
config: kind.yaml
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.12.0'
- name: Check cosign install!
run: cosign version
- name: Write cosign signing key to disk
run: 'echo "$KEY" > cosign.key'
shell: bash
env:
KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
- name: Generate yaml for manifest, Minikube and Openshift installation
run: ${GITHUB_WORKSPACE}/hack/build-yaml.sh $VERSION
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
shell: bash
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release
env:
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
GORELEASER_CURRENT_TAG: ${{ steps.get_version.outputs.VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_CLI_EXPERIMENTAL: "enabled"
#ToDo - Verify and upload releases
+67 -69
View File
@@ -3,100 +3,98 @@ name: Fission CI upgrade
on: on:
push: push:
branches: branches:
- master - main
paths: paths:
- '**.go' - "**.go"
- 'charts/**' - "charts/**"
- 'test/**' - "test/**"
- go.mod - go.mod
- go.sum - go.sum
pull_request: pull_request:
branches: branches:
- master - main
paths: paths:
- '**.go' - "**.go"
- 'charts/**' - "charts/**"
- 'test/**' - "test/**"
- go.mod - go.mod
- go.sum - go.sum
workflow_dispatch: workflow_dispatch:
env:
HELM_VERSION: v3.9.0
KIND_VERSION: v0.14.0
jobs: jobs:
upgrade-test: upgrade-test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
kindimage : [ 'kindest/node:v1.19.11' ] kindimage: ["kindest/node:v1.19.16"]
os: [ ubuntu-latest ] os: [ubuntu-latest]
steps: steps:
- name: Setup go - name: Checkout action sources
uses: actions/setup-go@v2 uses: actions/checkout@v3
with:
go-version: 1.18.1
- name: Checkout action sources - name: Setup go
uses: actions/checkout@v2.3.4 uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
- uses: actions/cache@v2 - name: Setup Helm
with: uses: Azure/setup-helm@v3
path: ~/go/pkg/mod with:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} version: ${{ env.HELM_VERSION }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Helm - name: Setup Kind Clutser
uses: Azure/setup-helm@v1 uses: engineerd/setup-kind@v0.5.0
with: with:
version: v3.3.4 image: ${{ matrix.kindimage }}
version: ${{ env.KIND_VERSION }}
- name: Setup Kind Clutser - name: Install GoReleaser
uses: engineerd/setup-kind@v0.5.0 uses: goreleaser/goreleaser-action@v2
with: with:
image: ${{ matrix.kindimage }} install-only: true
version: v0.11.1
- name: Install GoReleaser - name: Setup kubectl & fetch node information
uses: goreleaser/goreleaser-action@v2 run: |
with: kubectl cluster-info --context kind-kind
install-only: true kubectl get nodes
kubectl get storageclasses.storage.k8s.io
- name: Setup kubectl & fetch node information - name: Dump system info
run: | run: |
kubectl cluster-info --context kind-kind source ./test/upgrade_test/fission_objects.sh dump_system_info
kubectl get nodes
kubectl get storageclasses.storage.k8s.io
- name: Dump system info - name: Install and configure previous stable fission
run: | run: |
source ./test/upgrade_test/fission_objects.sh dump_system_info source ./test/upgrade_test/fission_objects.sh install_stable_release \
&& create_fission_objects \
&& test_fission_objects
- name: Install and configure previous stable fission - name: Upgrade fission to latest
run: | run: |
source ./test/upgrade_test/fission_objects.sh install_stable_release \ source ./test/upgrade_test/fission_objects.sh build_docker_images \
&& create_fission_objects \ && kind_image_load \
&& test_fission_objects && install_current_release \
&& install_fission_cli
- name: Upgrade fission to latest - name: Test previously created fission objects with new release
run: | run: |
source ./test/upgrade_test/fission_objects.sh build_docker_images \ source ./test/upgrade_test/fission_objects.sh test_fission_objects
&& kind_image_load \
&& install_current_release \
&& install_fission_cli
- name: Test previously created fission objects with new release - name: Collect Fission Dump
run: | if: ${{ always() }}
source ./test/upgrade_test/fission_objects.sh test_fission_objects run: |
command -v fission && fission support dump
- name: Collect Fission Dump - name: Archive fission dump
if: ${{ always() }} if: ${{ failure() }}
run: | uses: actions/upload-artifact@v2
command -v fission && fission support dump with:
name: fission-dump
- name: Archive fission dump path: fission-dump/*.zip
if: ${{ failure() }} retention-days: 5
uses: actions/upload-artifact@v2
with:
name: fission-dump
path: fission-dump/*.zip
retention-days: 5
+4
View File
@@ -33,3 +33,7 @@ local/
build/ build/
dist/ dist/
manifest/ manifest/
.vscode/
coverage.txt
cosign.key
-4
View File
@@ -1,16 +1,13 @@
linters: linters:
enable: enable:
# Default linter # Default linter
- deadcode
- errcheck - errcheck
- gosimple - gosimple
- govet - govet
- ineffassign - ineffassign
- staticcheck - staticcheck
- structcheck
- typecheck - typecheck
- unused - unused
- varcheck
# Additional linters # Additional linters
- gofmt - gofmt
- goimports - goimports
@@ -22,7 +19,6 @@ linters:
# - dogsled # - dogsled
# - dupl # - dupl
# - gosec # - gosec
# - ifshort
# - nilerr # - nilerr
# - prealloc # - prealloc
# - revive # - revive
+29 -4
View File
@@ -8,7 +8,6 @@ release:
header: | header: |
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/ Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
Install Guide: https://fission.io/docs/installation/ Install Guide: https://fission.io/docs/installation/
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md
extra_files: extra_files:
- glob: ./manifest/charts/* - glob: ./manifest/charts/*
- glob: ./manifest/yamls/* - glob: ./manifest/yamls/*
@@ -27,9 +26,9 @@ builds:
- -X github.com/fission/fission/pkg/info.BuildDate={{.Date}} - -X github.com/fission/fission/pkg/info.BuildDate={{.Date}}
- -X github.com/fission/fission/pkg/info.Version={{.Tag}} - -X github.com/fission/fission/pkg/info.Version={{.Tag}}
gcflags: gcflags:
- all=-trimpath={{.Env.PWD}} - all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
asmflags: asmflags:
- all=-trimpath={{.Env.PWD}} - all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
goos: goos:
@@ -258,7 +257,7 @@ docker_manifests:
- fission/reporter:latest-arm64 - fission/reporter:latest-arm64
- fission/reporter:latest-armv7 - fission/reporter:latest-armv7
changelog: changelog:
skip: true skip: false
archives: archives:
- id: fission - id: fission
builds: builds:
@@ -268,3 +267,29 @@ archives:
checksum: checksum:
name_template: "checksums.txt" name_template: "checksums.txt"
algorithm: sha256 algorithm: sha256
# signs the checksum file
# https://goreleaser.com/customization/sign
signs:
- cmd: cosign
artifacts: all
stdin: '{{ .Env.COSIGN_PWD }}'
output: true
args:
- sign-blob
- '--key=cosign.key'
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
# signs our docker image
# https://goreleaser.com/customization/docker_sign
docker_signs:
- cmd: cosign
artifacts: all
stdin: '{{ .Env.COSIGN_PWD }}'
output: true
args:
- 'sign'
- '--key=cosign.key'
- '${artifact}'
+1 -1
View File
@@ -1,7 +1,7 @@
pull_request_rules: pull_request_rules:
- name: Automatic merge on approval - name: Automatic merge on approval
conditions: conditions:
- base=master - base=main
- "#approved-reviews-by>=1" - "#approved-reviews-by>=1"
- label=ready-to-merge - label=ready-to-merge
- label!=hold-off-merging - label!=hold-off-merging
+30
View File
@@ -1,5 +1,35 @@
# Changelog # Changelog
## [v1.17.0-rc1](https://github.com/fission/fission/tree/v1.17.0-rc1) (2022-07-06)
[Full Changelog](https://github.com/fission/fission/compare/v1.16.0...v1.17.0-rc1)
**Merged pull requests:**
- Update controller-tools to v0.9.2 [\#2467](https://github.com/fission/fission/pull/2467) ([sanketsudake](https://github.com/sanketsudake))
- OpenTelemetry package update to v1.7.0 [\#2466](https://github.com/fission/fission/pull/2466) ([shubham-bansal96](https://github.com/shubham-bansal96))
- Added support to set builder and fn pod specs via helm chart [\#2461](https://github.com/fission/fission/pull/2461) ([blackfly19](https://github.com/blackfly19))
- Pods immediately terminate for idletimeout in new deployment and container executer type [\#2459](https://github.com/fission/fission/pull/2459) ([shubham-bansal96](https://github.com/shubham-bansal96))
- Added variable to enable or disable archivePruner [\#2458](https://github.com/fission/fission/pull/2458) ([blackfly19](https://github.com/blackfly19))
- Avoid fission installation failure due to analytics connection error [\#2457](https://github.com/fission/fission/pull/2457) ([shubham-bansal96](https://github.com/shubham-bansal96))
- Fix for archivepruner to delete files only from subdir [\#2456](https://github.com/fission/fission/pull/2456) ([blackfly19](https://github.com/blackfly19))
- Upgraded controller-gen to remove status from fission CRDs [\#2454](https://github.com/fission/fission/pull/2454) ([sanketsudake](https://github.com/sanketsudake))
- builder: Allow command with arguments via custom build options [\#2453](https://github.com/fission/fission/pull/2453) ([shubham-bansal96](https://github.com/shubham-bansal96))
- CLI to operate archives managed by Storage Service [\#2450](https://github.com/fission/fission/pull/2450) ([blackfly19](https://github.com/blackfly19))
- \[issue-2401\] Added pod security context for Fission Components [\#2449](https://github.com/fission/fission/pull/2449) ([baba230896](https://github.com/baba230896))
- Update github.com/opencontainers/runc dependency to 1.1.2 [\#2448](https://github.com/fission/fission/pull/2448) ([blackfly19](https://github.com/blackfly19))
- Fixed help for ColdStarts metric in executor according to new labels [\#2446](https://github.com/fission/fission/pull/2446) ([blackfly19](https://github.com/blackfly19))
- Ensure poolmanager fn address validation even if pod has active connections [\#2441](https://github.com/fission/fission/pull/2441) ([blackfly19](https://github.com/blackfly19))
- Fix pre-check failure during new fission installation [\#2437](https://github.com/fission/fission/pull/2437) ([shubham4443](https://github.com/shubham4443))
## [v1.16.0](https://github.com/fission/fission/tree/v1.16.0) (2022-05-24)
[Full Changelog](https://github.com/fission/fission/compare/v1.16.0-rc2...v1.16.0)
**Merged pull requests:**
- Updated keda image versions [\#2433](https://github.com/fission/fission/pull/2433) ([blackfly19](https://github.com/blackfly19))
## [v1.16.0-rc2](https://github.com/fission/fission/tree/v1.16.0-rc2) (2022-05-11) ## [v1.16.0-rc2](https://github.com/fission/fission/tree/v1.16.0-rc2) (2022-05-11)
[Full Changelog](https://github.com/fission/fission/compare/v1.16.0-rc1...v1.16.0-rc2) [Full Changelog](https://github.com/fission/fission/compare/v1.16.0-rc1...v1.16.0-rc2)
+10 -6
View File
@@ -42,9 +42,7 @@ debug-vars: print-GOOS print-GOARCH print-GOAMD64 print-VERSION print-TIMESTAMP
check: test-run build-fission-cli clean check: test-run build-fission-cli clean
code-checks: code-checks:
hack/verify-gofmt.sh golangci-lint run
hack/verify-govet.sh
hack/verify-staticcheck.sh
# run basic check scripts # run basic check scripts
test-run: code-checks test-run: code-checks
@@ -64,8 +62,11 @@ codegen:
@./hack/update-codegen.sh @./hack/update-codegen.sh
### CRDs ### CRDs
generate-crds: controller-gen-install:
controller-gen crd:trivialVersions=false,preserveUnknownFields=false \ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2
generate-crds: controller-gen-install
controller-gen crd \
paths=./pkg/apis/core/v1 \ paths=./pkg/apis/core/v1 \
output:crd:artifacts:config=crds/v1 output:crd:artifacts:config=crds/v1
@@ -89,7 +90,10 @@ generate-swagger-doc:
generate-cli-docs: generate-cli-docs:
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli" go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
generate-crd-ref-docs: install-crd-ref-docs:
go install github.com/elastic/crd-ref-docs@master
generate-crd-ref-docs: install-crd-ref-docs
# crd-ref-docs: https://github.com/elastic/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 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 cp tools/crd-ref-docs/header.md crd_docs.md
+18 -2
View File
@@ -5,7 +5,7 @@
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/fission/fission/blob/master/LICENSE"> <a href="https://github.com/fission/fission/blob/main/LICENSE">
<img alt="Fission Licence" src="https://img.shields.io/github/license/fission/fission"> <img alt="Fission Licence" src="https://img.shields.io/github/license/fission/fission">
</a> </a>
<a href="https://github.com/fission/fission/releases"> <a href="https://github.com/fission/fission/releases">
@@ -20,7 +20,7 @@
<a href="https://github.com/fission/fission/graphs/contributors"> <a href="https://github.com/fission/fission/graphs/contributors">
<img alt="Fission contributors" src="https://img.shields.io/github/contributors/fission/fission"> <img alt="Fission contributors" src="https://img.shields.io/github/contributors/fission/fission">
</a> </a>
<a href="https://github.com/fission/fission/commits/master"> <a href="https://github.com/fission/fission/commits/main">
<img alt="Commit Activity" src="https://img.shields.io/github/commit-activity/m/fission/fission"> <img alt="Commit Activity" src="https://img.shields.io/github/commit-activity/m/fission/fission">
</a> </a>
<br> <br>
@@ -60,6 +60,7 @@ Table of Contents
- [Getting Started](#getting-started) - [Getting Started](#getting-started)
- [Learn More](#learn-more) - [Learn More](#learn-more)
- [Contributing](#contributing) - [Contributing](#contributing)
- [Who is using Fission?](#who-is-using-fission)
- [Sponsors](#sponsors) - [Sponsors](#sponsors)
- [License](#license) - [License](#license)
@@ -108,6 +109,21 @@ aggregation &mdash; also helps with ops on your Fission deployment.
Check out the [contributing guide](CONTRIBUTING.md). Check out the [contributing guide](CONTRIBUTING.md).
## Who is using Fission?
- [Fareye](https://www.getfareye.com)
- Apple
- [iQuanti](https://www.iquanti.com)
- A large telecom CSP
- [Gadget](https://gadget.dev)
- [CinnamonAI](https://cinnamon.is/en)
- [Armo](https://www.armosec.io/)
- [The Social Audience](https://thesocialaudience.com/)
- [KubeML](https://github.com/DiegoStock12/kubeml)
- Unilever
- [BD](https://www.bd.com/en-in)
- [Biofourmis](https://biofourmis.com/)
- [Babylon](https://www.babylonhealth.com/en-gb)
## Sponsors ## Sponsors
The following companies, organizations, and individuals support Fission's ongoing maintenance and development. If you are using/contributing to Fission, we would be happy to list you here, please raise a Pull request. The following companies, organizations, and individuals support Fission's ongoing maintenance and development. If you are using/contributing to Fission, we would be happy to list you here, please raise a Pull request.
+2 -2
View File
@@ -1,7 +1,7 @@
apiVersion: v2 apiVersion: v2
name: fission-all name: fission-all
version: v1.16.0 version: v1.17.0
appVersion: v1.16.0 appVersion: v1.17.0
description: Fission is a fast serverless framework for Kubernetes. description: Fission is a fast serverless framework for Kubernetes.
home: https://fission.io/ home: https://fission.io/
icon: https://fission.io/images/fission-logo-white.svg icon: https://fission.io/images/fission-logo-white.svg
+13
View File
@@ -0,0 +1,13 @@
exclusions:
template-job-rule:
reason: "Most panels dont need to be filtered by job"
template-instance-rule:
reason: "Most panels dont need to be filtered by instance"
target-job-rule:
reason: "Most panels dont need to be filtered by job"
target-instance-rule:
reason: "Most panels dont need to be filtered by instance"
panel-units-rule:
reason: "Some panels are using the 'number' unit which throws a linting error."
target-counter-agg-rule:
reason: "disabled for fission_archives_total. This metric should be not have total due to naming conventions as its a gauge, not a counter"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,648 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "Shows function calls, namespaces and their response codes.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "reqps"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "increase(fission_function_calls_total{function_name=~\"$Function_Name\",function_namespace=~\"$Function_Namespace\"}[1m])",
"interval": "",
"legendFormat": "Namespace:{{function_namespace}} Func:{{function_name}} {{method}} Response: {{code}} ",
"range": true,
"refId": "A"
}
],
"title": "Function calls",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "Shows any functions that return 400 or 500 errors.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "reqps"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "increase(fission_function_errors_total{function_name=~\"$Function_Name\",function_namespace=~\"$Function_Namespace\"}[1m])",
"legendFormat": "Namespace:{{function_namespace}} Function:{{function_name}} Response:{{code}} ",
"range": true,
"refId": "A"
}
],
"title": "Function Errors",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "Tracks cold starts of all functions.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "increase(fission_function_cold_starts_total{function_name=~\"$Function_Name\",function_namespace=~\"$Function_Namespace\"}[1m])",
"legendFormat": "{{function_name}}",
"range": true,
"refId": "A"
}
],
"title": "Function cold starts",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 16
},
"id": 12,
"panels": [],
"title": "Http Requests",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "Shows the number of requests currently in flight per function path",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 17
},
"id": 8,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "http_requests_in_flight{path=~\"$Path\"}",
"legendFormat": "{{path}}",
"range": true,
"refId": "A"
}
],
"title": "Http Requests in Flight (function)",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "Shows the average latency for each path.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 17
},
"id": 10,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "http_requests_duration_seconds_sum{path!=\"/healthz\",path!~\"/v2/.*\",path!~\"/router.*\",path=~\"$Path\"}/http_requests_duration_seconds_count{path=~\"$Path\"}",
"legendFormat": "{{path}}",
"range": true,
"refId": "A"
}
],
"title": "Request latency",
"type": "timeseries"
}
],
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "Prometheus",
"value": "Prometheus"
},
"hide": 0,
"includeAll": false,
"label": "Data Source",
"multi": false,
"name": "datasource",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"allValue": ".*",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(fission_function_calls_total, function_name)",
"hide": 0,
"includeAll": true,
"multi": false,
"name": "Function_Name",
"options": [],
"query": {
"query": "label_values(fission_function_calls_total, function_name)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": ".*",
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(http_requests_total, path)",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "Path",
"options": [],
"query": {
"query": "label_values(http_requests_total, path)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": ".*",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(kube_namespace_labels, namespace)",
"description": "",
"hide": 0,
"includeAll": true,
"multi": false,
"name": "Function_Namespace",
"options": [],
"query": {
"query": "label_values(kube_namespace_labels, namespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "fission",
"value": "fission"
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(fission_function_calls_total, namespace)",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "Fission_Namespace",
"options": [],
"query": {
"query": "label_values(fission_function_calls_total, namespace)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-5m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Fission User Dashboard",
"uid": "he2w3Xq7z",
"version": 3,
"weekStart": ""
}
@@ -71,12 +71,3 @@ This template generates the image name for the deployment depending on the value
- name: OTEL_PROPAGATORS - name: OTEL_PROPAGATORS
value: "{{ .Values.openTelemetry.propagators }}" value: "{{ .Values.openTelemetry.propagators }}"
{{- end }} {{- end }}
{{- define "opentracing.envs" }}
- name: OPENTRACING_ENABLED
value: {{ .Values.openTracing.enabled | default false | quote }}
- name: TRACE_JAEGER_COLLECTOR_ENDPOINT
value: "{{ .Values.openTracing.collectorEndpoint }}"
- name: TRACING_SAMPLING_RATE
value: {{ .Values.openTracing.samplingRate | default "0.5" | quote }}
{{- end }}
@@ -0,0 +1,9 @@
{{- if .Values.builderPodSpec.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: builder-podspec-patch
data:
spec: |
{{- toYaml .Values.builderPodSpec.podSpec | nindent 4 }}
{{- end -}}
@@ -19,6 +19,9 @@ spec:
prometheus.io/path: "/metrics" prometheus.io/path: "/metrics"
prometheus.io/port: "8080" prometheus.io/port: "8080"
spec: spec:
{{- if .Values.buildermgr.securityContext.enabled }}
securityContext: {{- omit .Values.buildermgr.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: buildermgr - name: buildermgr
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -52,7 +55,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
- name: HELM_RELEASE_NAME - name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }} value: {{ .Release.Name | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
ports: ports:
- containerPort: 8080 - containerPort: 8080
@@ -0,0 +1,23 @@
{{- if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: buildermgr-monitor
{{- if .Values.podMonitor.namespace }}
namespace: {{ .Values.podMonitor.namespace }}
{{- end }}
{{- with .Values.podMonitor.additionalPodMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
svc: buildermgr
podMetricsEndpoints:
- port: "metrics"
path: "/metrics"
{{- end -}}
@@ -22,6 +22,9 @@ spec:
prometheus.io/path: "/metrics" prometheus.io/path: "/metrics"
prometheus.io/port: "8080" prometheus.io/port: "8080"
spec: spec:
{{- if .Values.controller.securityContext.enabled }}
securityContext: {{- omit .Values.controller.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: controller - name: controller
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -39,7 +42,6 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.controller.resources | nindent 10 }} {{- toYaml .Values.controller.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }} {{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }} {{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
namespaceSelector: namespaceSelector:
matchNames: matchNames:
@@ -0,0 +1,17 @@
{{- if .Values.grafana.dashboards.enable }}
{{- $files := .Files }}
{{- range $path, $bytes := .Files.Glob "dashboards/*.json" }}
{{- $filename := trimSuffix (ext $path) (base $path) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" $.Chart.Name $filename | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.grafana.namespace }}
labels:
grafana_dashboard: "1"
created_by: "{{ $.Chart.Name }}"
data:
{{ base $path }}: '{{ $files.Get $path }}'
---
{{- end }}
{{- end }}
@@ -0,0 +1,9 @@
{{- if .Values.runtimePodSpec.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: runtime-podspec-patch
data:
spec: |
{{- toYaml .Values.runtimePodSpec.podSpec | nindent 4 }}
{{- end -}}
@@ -19,6 +19,9 @@ spec:
prometheus.io/path: "/metrics" prometheus.io/path: "/metrics"
prometheus.io/port: "8080" prometheus.io/port: "8080"
spec: spec:
{{- if .Values.executor.securityContext.enabled }}
securityContext: {{- omit .Values.executor.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: executor - name: executor
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -56,7 +59,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
- name: HELM_RELEASE_NAME - name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }} value: {{ .Release.Name | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.executor.resources | nindent 10 }} {{- toYaml .Values.executor.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }} {{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }} {{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
namespaceSelector: namespaceSelector:
matchNames: matchNames:
@@ -118,8 +118,6 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: spec.nodeName fieldPath: spec.nodeName
- name: OPENTRACING_ENABLED
value: {{ .Values.openTracing.enabled | default false | quote }}
command: ["/fission-bundle"] command: ["/fission-bundle"]
args: ["--logger"] args: ["--logger"]
volumeMounts: volumeMounts:
@@ -161,8 +159,6 @@ spec:
key: password key: password
- name: LOG_PATH - name: LOG_PATH
value: /var/log/fission/*.log value: /var/log/fission/*.log
- name: OPENTRACING_ENABLED
value: {{ .Values.openTracing.enabled | default false | quote }}
{{- if .Values.logger.enableSecurityContext }} {{- if .Values.logger.enableSecurityContext }}
securityContext: securityContext:
privileged: true privileged: true
@@ -15,6 +15,9 @@ spec:
labels: labels:
svc: kubewatcher svc: kubewatcher
spec: spec:
{{- if .Values.kubewatcher.securityContext.enabled }}
securityContext: {{- omit .Values.kubewatcher.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: kubewatcher - name: kubewatcher
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -26,7 +29,6 @@ spec:
value: {{ .Values.debugEnv | quote }} value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED - name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.kubewatcher.resources | nindent 10 }} {{- toYaml .Values.kubewatcher.resources | nindent 10 }}
@@ -33,6 +33,9 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }} imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"] command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"] args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
ports:
- containerPort: 8080
name: metrics
env: env:
- name: MESSAGE_QUEUE_TYPE - name: MESSAGE_QUEUE_TYPE
value: kafka value: kafka
@@ -44,7 +47,6 @@ spec:
value: {{ .Values.debugEnv | quote }} value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED - name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
# TLS authentication is TLS with authentication (2 way) # TLS authentication is TLS with authentication (2 way)
# More info: https://docs.confluent.io/current/kafka/authentication_ssl.html#ssl-overview # More info: https://docs.confluent.io/current/kafka/authentication_ssl.html#ssl-overview
@@ -0,0 +1,23 @@
{{- if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: mqt-fission-kafka-monitor
{{- if .Values.podMonitor.namespace }}
namespace: {{ .Values.podMonitor.namespace }}
{{- end }}
{{- with .Values.podMonitor.additionalPodMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
svc: mqtrigger
podMetricsEndpoints:
- port: "metrics"
path: "/metrics"
{{- end -}}
@@ -40,11 +40,12 @@ spec:
value: "{{ .Values.mqt_keda.connector_images.aws_sqs.image }}:{{ .Values.mqt_keda.connector_images.aws_sqs.tag }}" value: "{{ .Values.mqt_keda.connector_images.aws_sqs.image }}:{{ .Values.mqt_keda.connector_images.aws_sqs.tag }}"
- name: STAN_IMAGE - name: STAN_IMAGE
value: "{{ .Values.mqt_keda.connector_images.nats_steaming.image }}:{{ .Values.mqt_keda.connector_images.nats_steaming.tag }}" value: "{{ .Values.mqt_keda.connector_images.nats_steaming.image }}:{{ .Values.mqt_keda.connector_images.nats_steaming.tag }}"
- name: NATS-JETSTREAM_IMAGE
value: "{{ .Values.mqt_keda.connector_images.nats_jetstream.image }}:{{ .Values.mqt_keda.connector_images.nats_jetstream.tag }}"
- name: GCP-PUBSUB_IMAGE - name: GCP-PUBSUB_IMAGE
value: "{{ .Values.mqt_keda.connector_images.gcp_pubsub.image }}:{{ .Values.mqt_keda.connector_images.gcp_pubsub.tag }}" value: "{{ .Values.mqt_keda.connector_images.gcp_pubsub.image }}:{{ .Values.mqt_keda.connector_images.gcp_pubsub.tag }}"
- name: REDIS_IMAGE - name: REDIS_IMAGE
value: "{{ .Values.mqt_keda.connector_images.redis.image }}:{{ .Values.mqt_keda.connector_images.redis.tag }}" value: "{{ .Values.mqt_keda.connector_images.redis.image }}:{{ .Values.mqt_keda.connector_images.redis.tag }}"
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.mqt_keda.resources | nindent 10 }} {{- toYaml .Values.mqt_keda.resources | nindent 10 }}
@@ -28,6 +28,9 @@ spec:
prometheus.io/path: "/metrics" prometheus.io/path: "/metrics"
prometheus.io/port: "8080" prometheus.io/port: "8080"
spec: spec:
{{- if .Values.router.securityContext.enabled }}
securityContext: {{- omit .Values.router.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: router - name: router
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -80,7 +83,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
- name: DISPLAY_ACCESS_LOG - name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }} value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.router.resources | nindent 10 }} {{- toYaml .Values.router.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }} {{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }} {{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
namespaceSelector: namespaceSelector:
matchNames: matchNames:
@@ -22,6 +22,9 @@ spec:
prometheus.io/path: "/metrics" prometheus.io/path: "/metrics"
prometheus.io/port: "8080" prometheus.io/port: "8080"
spec: spec:
{{- if .Values.storagesvc.securityContext.enabled }}
securityContext: {{- omit .Values.storagesvc.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: storagesvc - name: storagesvc
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -33,8 +36,12 @@ spec:
args: ["--storageServicePort", "8000", "--storageType", "local"] args: ["--storageServicePort", "8000", "--storageType", "local"]
{{- end }} {{- end }}
env: env:
- name: PRUNE_ENABLED
value: "{{.Values.storagesvc.archivePruner.enabled}}"
{{- if .Values.storagesvc.archivePruner.enabled }}
- name: PRUNE_INTERVAL - name: PRUNE_INTERVAL
value: "{{.Values.pruneInterval}}" value: "{{.Values.storagesvc.archivePruner.interval}}"
{{- end }}
- name: DEBUG_ENV - name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }} value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED - name: PPROF_ENABLED
@@ -53,7 +60,6 @@ spec:
- name: STORAGE_S3_REGION - name: STORAGE_S3_REGION
value: {{ .Values.persistence.s3.region }} value: {{ .Values.persistence.s3.region }}
{{- end }} {{- end }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.storagesvc.resources | nindent 10 }} {{- toYaml .Values.storagesvc.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }} {{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }} namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }} {{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
namespaceSelector: namespaceSelector:
matchNames: matchNames:
@@ -15,6 +15,9 @@ spec:
labels: labels:
svc: timer svc: timer
spec: spec:
{{- if .Values.timer.securityContext.enabled }}
securityContext: {{- omit .Values.timer.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers: containers:
- name: timer - name: timer
image: {{ include "fission-bundleImage" . | quote }} image: {{ include "fission-bundleImage" . | quote }}
@@ -26,7 +29,6 @@ spec:
value: {{ .Values.debugEnv | quote }} value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED - name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }} value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }} {{- include "opentelemtry.envs" . | indent 8 }}
resources: resources:
{{- toYaml .Values.timer.resources | nindent 10 }} {{- toYaml .Values.timer.resources | nindent 10 }}
+180 -28
View File
@@ -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. ## 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. ## Keep it empty for using latest tag.
## ##
imageTag: v1.16.0 imageTag: v1.17.0
## pullPolicy represents the pull policy to use for images in the chart. ## pullPolicy represents the pull policy to use for images in the chart.
## ##
@@ -92,7 +92,7 @@ fetcher:
## image represents the image of the fetcher component. ## image represents the image of the fetcher component.
image: fission/fetcher image: fission/fetcher
## imageTag represents the tag of the image of the fetcher component. ## imageTag represents the tag of the image of the fetcher component.
imageTag: v1.16.0 imageTag: v1.17.0
## Fetcher is only for to downloading or uploading archive. ## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary. ## Normally, you don't need to change the value here, unless necessary.
@@ -143,6 +143,18 @@ executor:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## router is responsible for routing function calls to the appropriate function. ## router is responsible for routing function calls to the appropriate function.
## ##
router: router:
@@ -248,6 +260,18 @@ router:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## The builder manager watches the package & environments CRD changes and manages the builds of function source code. ## The builder manager watches the package & environments CRD changes and manages the builds of function source code.
## ##
buildermgr: buildermgr:
@@ -262,6 +286,18 @@ buildermgr:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## controller is the component that the client talks to. ## 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. ## It contains CRUD APIs for functions, triggers, environments, Kubernetes event watches, etc. and proxy APIs to internal 3rd-party services.
## ##
@@ -277,6 +313,18 @@ controller:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## kubewatcher watches the Kubernetes API and invokes functions associated with watches, sending the watch event to the function. ## kubewatcher watches the Kubernetes API and invokes functions associated with watches, sending the watch event to the function.
## ##
kubewatcher: kubewatcher:
@@ -291,6 +339,18 @@ kubewatcher:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## The storage service is the home for all archives of packages with sizes larger than 256KB. ## The storage service is the home for all archives of packages with sizes larger than 256KB.
## ##
storagesvc: storagesvc:
@@ -305,6 +365,24 @@ storagesvc:
## ##
resources: {} resources: {}
## Archive pruner removes archives from storage which are not referenced by any package.
archivePruner:
enabled: true
## Run prune routine at interval (in minutes)
interval: 60
## 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## The timer works like kubernetes CronJob but instead of creating a pod to do the task ## The timer works like kubernetes CronJob but instead of creating a pod to do the task
## It sends a request to router to invoke the function. ## It sends a request to router to invoke the function.
## ##
@@ -320,6 +398,18 @@ timer:
## ##
resources: {} 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: false
## Mark it false, if you want to stop the non root user validation
runAsNonRoot: true
fsGroup: 10001
runAsUser: 10001
runAsGroup: 10001
## Kafka: enable and configure the details ## Kafka: enable and configure the details
## ##
kafka: kafka:
@@ -362,11 +452,33 @@ kafka:
## ##
# version: "0.11.2.0" # 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
serviceMonitor: serviceMonitor:
enabled: false enabled: false
##namespace in which you want to deploy servicemonitor ##namespace in which you want to deploy servicemonitor
## ##
namespace: "" namespace: ""
## Map of additional lables to add to the ServiceMonitor resources
# to allow selecting sepcific ServiceMonitors
# in case of multiple prometheus deployments
additionalServiceMonitorLabels: {}
# release: "monitoring"
# key: "value"
# The following components expose Prometheus metrics and have podmonitors in this chart (disabled by default)
#
podMonitor:
enabled: false
##namespace in which you want to deploy podmonitor
##
namespace: ""
## Map of additional lables to add to the PodMonitor resources
# to allow selecting sepcific PodMonitor
# in case of multiple prometheus deployments
additionalPodMonitorLabels: {}
# release: "monitoring"
# key: "value"
## Persist data to a persistent volume. ## Persist data to a persistent volume.
## ##
@@ -389,6 +501,8 @@ persistence:
# accessKeyId: <awsAccessKeyId> # accessKeyId: <awsAccessKeyId>
# secretAccessKey: <awsSecretAccessKey> # secretAccessKey: <awsSecretAccessKey>
# region: <awsRegion> # region: <awsRegion>
## For Minio and other s3 compatible storage systems set endPoint property
# endPoint: <s3StorageUrl>
## A manually managed Persistent Volume Claim name ## A manually managed Persistent Volume Claim name
## Requires persistence.enabled: true ## Requires persistence.enabled: true
@@ -483,7 +597,6 @@ busyboxImage: busybox
## This interval configures the frequency at which it runs inside the storagesvc pod. ## This interval configures the frequency at which it runs inside the storagesvc pod.
## The value is in minutes. ## The value is in minutes.
## ##
pruneInterval: 60
preUpgradeChecks: preUpgradeChecks:
## Run pre-install/pre-upgrade checks if true ## Run pre-install/pre-upgrade checks if true
@@ -494,7 +607,7 @@ preUpgradeChecks:
image: fission/pre-upgrade-checks image: fission/pre-upgrade-checks
## pre-install/pre-upgrade checks image version ## pre-install/pre-upgrade checks image version
## ##
imageTag: v1.16.0 imageTag: v1.17.0
## Fission post-install/post-upgrade reporting live in this image ## Fission post-install/post-upgrade reporting live in this image
## ##
@@ -550,23 +663,6 @@ authentication:
## ##
jwtIssuer: fission jwtIssuer: fission
## Use the following flags to enable OpenTracing.
## Note: OpenTracing support will be removed in an upcoming release.
## Please prefer using OpenTelemetry instead.
##
openTracing:
## set this flag to true if you wish to enable OpenTracing
##
enabled: false
## if enabled is true, the variable is endpoint of Jaeger collector in the format shown below
##
#collectorEndpoint: "http://jaeger-collector.jaeger.svc:14268/api/traces?format=jaeger.thrift"
## uniformly sample traces with the given probabilistic sampling rate
##
#samplingRate: 0.75
## OpenTelemetry is a set of tools for collecting, analyzing, and visualizing ## OpenTelemetry is a set of tools for collecting, analyzing, and visualizing
## distributed tracing data across function calls. ## distributed tracing data across function calls.
## ##
@@ -590,6 +686,7 @@ openTelemetry:
## parentbased_always_on - (default if empty) Sampler that respects its parent span's sampling decision, but otherwise always samples. ## parentbased_always_on - (default if empty) Sampler that respects its parent span's sampling decision, but otherwise always samples.
## parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples. ## parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples.
## parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate. ## parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate.
## See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration
## ##
tracesSampler: "parentbased_traceidratio" tracesSampler: "parentbased_traceidratio"
## Each Sampler type defines its own expected input, if any. ## Each Sampler type defines its own expected input, if any.
@@ -607,6 +704,8 @@ openTelemetry:
## jaeger - Jaeger uber-trace-id header ## jaeger - Jaeger uber-trace-id header
## xray - AWS X-Ray (third party) ## xray - AWS X-Ray (third party)
## ottrace - OpenTracing Trace (third party) ## ottrace - OpenTracing Trace (third party)
## none - No tracing
## See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration
## ##
propagators: "tracecontext,baggage" propagators: "tracecontext,baggage"
@@ -617,25 +716,28 @@ mqt_keda:
connector_images: connector_images:
kafka: kafka:
image: fission/keda-kafka-http-connector image: fission/keda-kafka-http-connector
tag: v0.10 tag: v0.11
rabbitmq: rabbitmq:
image: fission/keda-rabbitmq-http-connector image: fission/keda-rabbitmq-http-connector
tag: v0.9 tag: v0.10
awskinesis: awskinesis:
image: fission/keda-aws-kinesis-http-connector image: fission/keda-aws-kinesis-http-connector
tag: v0.9 tag: v0.10
aws_sqs: aws_sqs:
image: fission/keda-aws-sqs-http-connector image: fission/keda-aws-sqs-http-connector
tag: v0.9 tag: v0.10
nats_steaming: nats_steaming:
image: fission/keda-nats-streaming-http-connector image: fission/keda-nats-streaming-http-connector
tag: v0.11 tag: v0.12
nats_jetstream:
image: fission/keda-nats-jetstream-http-connector
tag: v0.2
gcp_pubsub: gcp_pubsub:
image: fission/keda-gcp-pubsub-http-connector image: fission/keda-gcp-pubsub-http-connector
tag: v0.4 tag: v0.5
redis: redis:
image: fission/keda-redis-http-connector image: fission/keda-redis-http-connector
tag: v0.2 tag: v0.3
## Pod resources as: ## Pod resources as:
## resources: ## resources:
@@ -652,3 +754,53 @@ mqt_keda:
## ##
pprof: pprof:
enabled: false enabled: false
## Enable runtimePodSpec and add spec to your poolmgr or newdeploy pods
##
runtimePodSpec:
## Setting it false by default so that integration tests pass
##
enabled: false
## Checkout PodSpec in https://fission.io/docs/reference/crd-reference/#runtime
##
podSpec:
## Default podspec to improve security of the pods
##
securityContext:
fsGroup: 10001
runAsGroup: 10001
runAsNonRoot: true
runAsUser: 10001
## Enable builderPodSpec and add spec to your env builder pods
##
builderPodSpec:
## Setting it false by default so that integration tests pass
##
enabled: false
## Checkout PodSpec in https://fission.io/docs/reference/crd-reference/#builder
##
podSpec:
## Default podspec to improve security of the pods
##
securityContext:
fsGroup: 10001
runAsGroup: 10001
runAsNonRoot: true
runAsUser: 10001
## Enable Grafana Dashboard configmaps for auto dashboard provisioning
## If you use kube-prometheus stack for monitoring, these will get imported into grafana
grafana:
## The namespace in which grafana pod is present
namespace: monitoring
dashboards:
## Disabled by default. switch to true to deploy them
enable: false
+1 -1
View File
@@ -1,4 +1,4 @@
FROM alpine:3.15 FROM alpine:3.16
RUN apk add --update ca-certificates RUN apk add --update ca-certificates
COPY builder /builder COPY builder /builder
ENTRYPOINT ["/builder"] ENTRYPOINT ["/builder"]
+1 -1
View File
@@ -38,7 +38,7 @@ func main() {
if os.IsNotExist(err) { if os.IsNotExist(err) {
err = os.MkdirAll(shareVolume, os.ModeDir|0700) err = os.MkdirAll(shareVolume, os.ModeDir|0700)
if err != nil { if err != nil {
logger.Fatal("error creating directory: %v", zap.Error(err), zap.String("directory", shareVolume)) logger.Fatal("error creating directory: %s", zap.Error(err), zap.String("directory", shareVolume))
} }
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
FROM alpine:3.15 FROM alpine:3.16
RUN apk add --update ca-certificates RUN apk add --update ca-certificates
COPY fetcher / COPY fetcher /
ENTRYPOINT ["/fetcher"] ENTRYPOINT ["/fetcher"]
+8 -24
View File
@@ -25,14 +25,12 @@ import (
"os" "os"
"sync/atomic" "sync/atomic"
"go.opencensus.io/plugin/ochttp"
"go.opentelemetry.io/otel" "go.opentelemetry.io/otel"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/fission/fission/pkg/fetcher" "github.com/fission/fission/pkg/fetcher"
"github.com/fission/fission/pkg/utils/httpserver" "github.com/fission/fission/pkg/utils/httpserver"
otelUtils "github.com/fission/fission/pkg/utils/otel" otelUtils "github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/tracing"
) )
var ( var (
@@ -41,7 +39,6 @@ var (
func Run(ctx context.Context, logger *zap.Logger) { func Run(ctx context.Context, logger *zap.Logger) {
flag.Usage = fetcherUsage flag.Usage = fetcherUsage
collectorEndpoint := flag.String("jaeger-collector-endpoint", "", "")
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod startup") 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") specializePayload := flag.String("specialize-request", "", "JSON payload for specialize request")
secretDir := flag.String("secret-dir", "", "Path to shared secrets directory") secretDir := flag.String("secret-dir", "", "Path to shared secrets directory")
@@ -62,21 +59,13 @@ func Run(ctx context.Context, logger *zap.Logger) {
} }
} }
} }
openTracingEnabled := tracing.TracingEnabled(logger)
if openTracingEnabled { shutdown, err := otelUtils.InitProvider(ctx, logger, "Fission-Fetcher")
go func() { if err != nil {
if err := tracing.RegisterTraceExporter(logger, *collectorEndpoint, "Fission-Fetcher"); err != nil { logger.Fatal("error initializing provider for OTLP", zap.Error(err))
logger.Fatal("could not register trace exporter", zap.Error(err), zap.String("collector_endpoint", *collectorEndpoint)) }
} if shutdown != nil {
}() defer shutdown(ctx)
} else {
shutdown, err := otelUtils.InitProvider(ctx, logger, "Fission-Fetcher")
if err != nil {
logger.Fatal("error initializing provider for OTLP", zap.Error(err))
}
if shutdown != nil {
defer shutdown(ctx)
}
} }
tracer := otel.Tracer("fetcher") tracer := otel.Tracer("fetcher")
@@ -129,12 +118,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
logger.Info("fetcher ready to receive requests") logger.Info("fetcher ready to receive requests")
var handler http.Handler handler := otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
if openTracingEnabled {
handler = &ochttp.Handler{Handler: mux}
} else {
handler = otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
}
httpserver.StartServer(ctx, logger, "fetcher", "8000", handler) httpserver.StartServer(ctx, logger, "fetcher", "8000", handler)
} }
+1 -1
View File
@@ -1,4 +1,4 @@
FROM alpine:3.15 FROM alpine:3.16
RUN apk add --update ca-certificates RUN apk add --update ca-certificates
COPY fission-bundle / COPY fission-bundle /
ENTRYPOINT ["/fission-bundle"] ENTRYPOINT ["/fission-bundle"]
+19 -29
View File
@@ -42,19 +42,18 @@ import (
"github.com/fission/fission/pkg/utils/otel" "github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/profile" "github.com/fission/fission/pkg/utils/profile"
"github.com/fission/fission/pkg/utils/signals" "github.com/fission/fission/pkg/utils/signals"
"github.com/fission/fission/pkg/utils/tracing"
) )
func runController(ctx context.Context, logger *zap.Logger, port int, openTracingEnabled bool) { func runController(ctx context.Context, logger *zap.Logger, port int) {
controller.Start(ctx, logger, port, false, openTracingEnabled) controller.Start(ctx, logger, port, false)
} }
func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string, openTracingEnabled bool) { func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string) {
router.Start(ctx, logger, port, executorUrl, openTracingEnabled) router.Start(ctx, logger, port, executorUrl)
} }
func runExecutor(ctx context.Context, logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string, openTracingEnabled bool) error { func runExecutor(ctx context.Context, logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string) error {
return executor.StartExecutor(ctx, logger, functionNamespace, envBuilderNamespace, port, openTracingEnabled) return executor.StartExecutor(ctx, logger, functionNamespace, envBuilderNamespace, port)
} }
func runKubeWatcher(ctx context.Context, logger *zap.Logger, routerUrl string) error { func runKubeWatcher(ctx context.Context, logger *zap.Logger, routerUrl string) error {
@@ -74,8 +73,8 @@ func runMQManager(ctx context.Context, logger *zap.Logger, routerURL string) err
return mqt.StartScalerManager(ctx, logger, routerURL) return mqt.StartScalerManager(ctx, logger, routerURL)
} }
func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage, openTracingEnabled bool) error { func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage) error {
return storagesvc.Start(ctx, logger, storage, port, openTracingEnabled) return storagesvc.Start(ctx, logger, storage, port)
} }
func runBuilderMgr(ctx context.Context, logger *zap.Logger, storageSvcUrl string, envBuilderNamespace string) error { func runBuilderMgr(ctx context.Context, logger *zap.Logger, storageSvcUrl string, envBuilderNamespace string) error {
@@ -210,22 +209,13 @@ Options:
return return
} }
openTracingEnabled := tracing.TracingEnabled(logger) shutdown, err := otel.InitProvider(ctx, logger, getServiceName(arguments))
if openTracingEnabled { if err != nil {
err = tracing.RegisterTraceExporter(logger, os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT"), getServiceName(arguments)) logger.Error("error initializing provider for OTLP", zap.Error(err), zap.Any("argument", arguments))
if err != nil { return
logger.Error("failed to register trace exporter", zap.Error(err), zap.Any("argument", arguments)) }
return if shutdown != nil {
} defer shutdown(ctx)
} else {
shutdown, err := otel.InitProvider(ctx, logger, getServiceName(arguments))
if err != nil {
logger.Error("error initializing provider for OTLP", zap.Error(err), zap.Any("argument", arguments))
return
}
if shutdown != nil {
defer shutdown(ctx)
}
} }
functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function") functionNs := getStringArgWithDefault(arguments["--namespace"], "fission-function")
@@ -237,21 +227,21 @@ Options:
if arguments["--controllerPort"] != nil { if arguments["--controllerPort"] != nil {
port := getPort(logger, arguments["--controllerPort"]) port := getPort(logger, arguments["--controllerPort"])
runController(ctx, logger, port, openTracingEnabled) runController(ctx, logger, port)
logger.Error("controller exited") logger.Error("controller exited")
return return
} }
if arguments["--routerPort"] != nil { if arguments["--routerPort"] != nil {
port := getPort(logger, arguments["--routerPort"]) port := getPort(logger, arguments["--routerPort"])
runRouter(ctx, logger, port, executorUrl, openTracingEnabled) runRouter(ctx, logger, port, executorUrl)
logger.Error("router exited") logger.Error("router exited")
return return
} }
if arguments["--executorPort"] != nil { if arguments["--executorPort"] != nil {
port := getPort(logger, arguments["--executorPort"]) port := getPort(logger, arguments["--executorPort"])
err = runExecutor(ctx, logger, port, functionNs, envBuilderNs, openTracingEnabled) err = runExecutor(ctx, logger, port, functionNs, envBuilderNs)
if err != nil { if err != nil {
logger.Error("executor exited", zap.Error(err)) logger.Error("executor exited", zap.Error(err))
return return
@@ -314,7 +304,7 @@ Options:
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) { } else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
storage = storagesvc.NewLocalStorage("/fission") storage = storagesvc.NewLocalStorage("/fission")
} }
err := runStorageSvc(ctx, logger, port, storage, openTracingEnabled) err := runStorageSvc(ctx, logger, port, storage)
if err != nil { if err != nil {
logger.Error("storage service exited", zap.Error(err)) logger.Error("storage service exited", zap.Error(err))
return return
+3 -2
View File
@@ -22,6 +22,7 @@ import (
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra" wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate" "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate"
"github.com/fission/fission/pkg/fission-cli/cmd" "github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/fission-cli/cmd/archive"
"github.com/fission/fission/pkg/fission-cli/cmd/canaryconfig" "github.com/fission/fission/pkg/fission-cli/cmd/canaryconfig"
"github.com/fission/fission/pkg/fission-cli/cmd/check" "github.com/fission/fission/pkg/fission-cli/cmd/check"
"github.com/fission/fission/pkg/fission-cli/cmd/environment" "github.com/fission/fission/pkg/fission-cli/cmd/environment"
@@ -61,7 +62,7 @@ func App() *cobra.Command {
func(input cli.Input) error { func(input cli.Input) error {
console.Verbosity = input.Int(flagkey.Verbosity) console.Verbosity = input.Int(flagkey.Verbosity)
if input.IsSet(flagkey.ClientOnly) { if input.IsSet(flagkey.ClientOnly) || input.IsSet(flagkey.PreCheckOnly) {
// TODO: use fake rest client for offline spec generation // TODO: use fake rest client for offline spec generation
cmd.SetClientset(client.MakeFakeClientset(nil)) cmd.SetClientset(client.MakeFakeClientset(nil))
} else { } else {
@@ -91,7 +92,7 @@ func App() *cobra.Command {
groups := helptemplate.CommandGroups{} groups := helptemplate.CommandGroups{}
groups = append(groups, helptemplate.CreateCmdGroup("Auth Commands(Note: Authentication should be enabled to use a command in this group.)", token.Commands())) groups = append(groups, helptemplate.CreateCmdGroup("Auth Commands(Note: Authentication should be enabled to use a command in this group.)", token.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Basic Commands", environment.Commands(), _package.Commands(), function.Commands())) groups = append(groups, helptemplate.CreateCmdGroup("Basic Commands", environment.Commands(), _package.Commands(), function.Commands(), archive.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Trigger Commands", httptrigger.Commands(), mqtrigger.Commands(), timetrigger.Commands(), kubewatch.Commands())) groups = append(groups, helptemplate.CreateCmdGroup("Trigger Commands", httptrigger.Commands(), mqtrigger.Commands(), timetrigger.Commands(), kubewatch.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Deploy Strategies Commands", canaryconfig.Commands())) groups = append(groups, helptemplate.CreateCmdGroup("Deploy Strategies Commands", canaryconfig.Commands()))
groups = append(groups, helptemplate.CreateCmdGroup("Declarative Application Commands", spec.Commands())) groups = append(groups, helptemplate.CreateCmdGroup("Declarative Application Commands", spec.Commands()))
@@ -1,4 +1,4 @@
FROM alpine:3.15 FROM alpine:3.16
RUN apk add --update ca-certificates RUN apk add --update ca-certificates
COPY pre-upgrade-checks / COPY pre-upgrade-checks /
ENTRYPOINT ["/pre-upgrade-checks"] ENTRYPOINT ["/pre-upgrade-checks"]
+1 -1
View File
@@ -1,4 +1,4 @@
FROM alpine:3.15 FROM alpine:3.16
RUN apk add --update ca-certificates RUN apk add --update ca-certificates
COPY reporter / COPY reporter /
ENTRYPOINT ["/reporter"] ENTRYPOINT ["/reporter"]
+8 -3
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
@@ -51,10 +51,15 @@ func eventCommandHandler(cmd *cobra.Command, args []string) error {
} }
ctx := context.Background() ctx := context.Background()
return tracker.Tracker.SendEvent(ctx, event)
t, err := tracker.NewTracker()
if err != nil {
return err
}
return t.SendEvent(ctx, event)
} }
//EventCommand reports an event to analytics // EventCommand reports an event to analytics
func EventCommand() *cobra.Command { func EventCommand() *cobra.Command {
eventCmd := &cobra.Command{ eventCmd := &cobra.Command{
Use: "event", Use: "event",
+6 -2
View File
@@ -17,14 +17,18 @@ limitations under the License.
package main package main
import ( import (
"log" "go.uber.org/zap"
"github.com/fission/fission/cmd/reporter/app" "github.com/fission/fission/cmd/reporter/app"
"github.com/fission/fission/pkg/utils/loggerfactory"
) )
func main() { func main() {
logger := loggerfactory.GetLogger()
defer logger.Sync()
err := app.App().Execute() err := app.App().Execute()
if err != nil { if err != nil {
log.Fatal(err) logger.Error("error occurred during analytics reporting", zap.Error(err))
} }
} }
+11 -12
View File
@@ -1,10 +1,9 @@
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.5.0 controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null creationTimestamp: null
name: canaryconfigs.fission.io name: canaryconfigs.fission.io
spec: spec:
@@ -22,10 +21,14 @@ spec:
description: CanaryConfig is for canary deployment of two functions. description: CanaryConfig is for canary deployment of two functions.
properties: properties:
apiVersion: 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 type: string
kind: 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 type: string
metadata: metadata:
type: object type: object
@@ -33,13 +36,15 @@ spec:
description: CanaryConfigSpec defines the canary configuration spec description: CanaryConfigSpec defines the canary configuration spec
properties: properties:
duration: duration:
description: 'Weight increment interval, string representation of time.Duration, ex : 1m, 2h, 2d (default: "2m")' description: 'Weight increment interval, string representation of
time.Duration, ex : 1m, 2h, 2d (default: "2m")'
type: string type: string
failureType: failureType:
description: FailureType refers to the type of failure description: FailureType refers to the type of failure
type: string type: string
failurethreshold: failurethreshold:
description: Threshold in percentage beyond which the new version of the function is considered unstable description: Threshold in percentage beyond which the new version
of the function is considered unstable
type: integer type: integer
newfunction: newfunction:
description: New version of the function description: New version of the function
@@ -73,9 +78,3 @@ spec:
type: object type: object
served: true served: true
storage: true storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+46 -25
View File
@@ -1,10 +1,9 @@
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.5.0 controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null creationTimestamp: null
name: httptriggers.fission.io name: httptriggers.fission.io
spec: spec:
@@ -19,21 +18,28 @@ spec:
- name: v1 - name: v1
schema: schema:
openAPIV3Schema: openAPIV3Schema:
description: HTTPTrigger is the trigger invokes user functions when receiving HTTP requests. description: HTTPTrigger is the trigger invokes user functions when receiving
HTTP requests.
properties: properties:
apiVersion: 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 type: string
kind: 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 type: string
metadata: metadata:
type: object type: object
spec: spec:
description: HTTPTriggerSpec is for router to expose user functions at the given URL path. description: HTTPTriggerSpec is for router to expose user functions at
the given URL path.
properties: properties:
createingress: createingress:
description: If CreateIngress is true, router will create an ingress definition. description: If CreateIngress is true, router will create an ingress
definition.
type: boolean type: boolean
functionref: functionref:
description: FunctionReference is a reference to the target function. description: FunctionReference is a reference to the target function.
@@ -41,46 +47,64 @@ spec:
functionweights: functionweights:
additionalProperties: additionalProperties:
type: integer 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 nullable: true
type: object type: object
name: name:
description: Name of the function. description: Name of the function.
type: string type: string
type: 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 type: string
required: required:
- name - name
- type - type
type: object type: object
host: 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 type: string
ingressconfig: 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: properties:
annotations: annotations:
additionalProperties: additionalProperties:
type: string type: string
description: Annotations will be added to metadata when creating Ingress. description: Annotations will be added to metadata when creating
Ingress.
nullable: true nullable: true
type: object type: object
host: 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 type: string
path: 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 type: string
tls: 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: string
type: object type: object
keepPrefix: 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 type: boolean
method: 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 type: string
methods: methods:
description: HTTP methods to access a function description: HTTP methods to access a function
@@ -88,10 +112,13 @@ spec:
type: string type: string
type: array type: array
prefix: 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 type: string
relativeurl: relativeurl:
description: RelativeURL is the exposed URL for external client to access a function with. description: RelativeURL is the exposed URL for external client to
access a function with.
type: string type: string
required: required:
- functionref - functionref
@@ -104,9 +131,3 @@ spec:
storage: true storage: true
subresources: subresources:
status: {} status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+20 -14
View File
@@ -1,10 +1,9 @@
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.5.0 controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null creationTimestamp: null
name: kuberneteswatchtriggers.fission.io name: kuberneteswatchtriggers.fission.io
spec: spec:
@@ -19,13 +18,18 @@ spec:
- name: v1 - name: v1
schema: schema:
openAPIV3Schema: openAPIV3Schema:
description: KubernetesWatchTrigger watches kubernetes resource events and invokes functions. description: KubernetesWatchTrigger watches kubernetes resource events and
invokes functions.
properties: properties:
apiVersion: 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 type: string
kind: 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 type: string
metadata: metadata:
type: object type: object
@@ -33,19 +37,27 @@ spec:
description: KubernetesWatchTriggerSpec defines spec of KuberenetesWatchTrigger description: KubernetesWatchTriggerSpec defines spec of KuberenetesWatchTrigger
properties: properties:
functionref: 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: properties:
functionweights: functionweights:
additionalProperties: additionalProperties:
type: integer 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 nullable: true
type: object type: object
name: name:
description: Name of the function. description: Name of the function.
type: string type: string
type: 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 type: string
required: required:
- name - name
@@ -74,9 +86,3 @@ spec:
storage: true storage: true
subresources: subresources:
status: {} status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
File diff suppressed because it is too large Load Diff
+39 -25
View File
@@ -1,10 +1,9 @@
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.5.0 controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null creationTimestamp: null
name: packages.fission.io name: packages.fission.io
spec: spec:
@@ -24,44 +23,56 @@ spec:
description: Package Think of these as function-level images. description: Package Think of these as function-level images.
properties: properties:
apiVersion: 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 type: string
kind: 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 type: string
metadata: metadata:
type: object type: object
spec: spec:
description: PackageSpec includes source/deploy archives and the reference of environment to build the package. description: PackageSpec includes source/deploy archives and the reference
of environment to build the package.
properties: properties:
buildcmd: buildcmd:
description: BuildCommand is a custom build command that builder used to build the source archive. description: BuildCommand is a custom build command that builder used
to build the source archive.
type: string type: string
deployment: deployment:
description: Deployment is the deployable archive that environment runtime used to run user function. description: Deployment is the deployable archive that environment
runtime used to run user function.
properties: properties:
checksum: 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: properties:
sum: sum:
type: string type: string
type: 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: string
type: object type: object
literal: literal:
description: Literal contents of the package. Can be used for encoding packages below TODO (256 KB?) size. description: Literal contents of the package. Can be used for
encoding packages below TODO (256 KB?) size.
format: byte format: byte
type: string type: string
type: 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 type: string
url: url:
description: URL references a package. description: URL references a package.
type: string type: string
type: object type: object
environment: environment:
description: Environment is a reference to the environment for building source archive. description: Environment is a reference to the environment for building
source archive.
properties: properties:
name: name:
type: string type: string
@@ -72,23 +83,30 @@ spec:
- namespace - namespace
type: object type: object
source: 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: properties:
checksum: 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: properties:
sum: sum:
type: string type: string
type: 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: string
type: object type: object
literal: literal:
description: Literal contents of the package. Can be used for encoding packages below TODO (256 KB?) size. description: Literal contents of the package. Can be used for
encoding packages below TODO (256 KB?) size.
format: byte format: byte
type: string type: string
type: 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 type: string
url: url:
description: URL references a package. description: URL references a package.
@@ -104,11 +122,13 @@ spec:
description: BuildLog stores build log during the compilation. description: BuildLog stores build log during the compilation.
type: string type: string
buildstatus: buildstatus:
default: Pending default: pending
description: BuildStatus is the package build status. description: BuildStatus is the package build status.
type: string type: string
lastUpdateTimestamp: 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 format: date-time
nullable: true nullable: true
type: string type: string
@@ -119,9 +139,3 @@ spec:
type: object type: object
served: true served: true
storage: true storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+18 -13
View File
@@ -1,10 +1,9 @@
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.5.0 controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null creationTimestamp: null
name: timetriggers.fission.io name: timetriggers.fission.io
spec: spec:
@@ -22,15 +21,20 @@ spec:
description: TimeTrigger invokes functions based on given cron schedule. description: TimeTrigger invokes functions based on given cron schedule.
properties: properties:
apiVersion: 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 type: string
kind: 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 type: string
metadata: metadata:
type: object type: object
spec: spec:
description: TimeTriggerSpec invokes the specific function at a time or times specified by a cron string. description: TimeTriggerSpec invokes the specific function at a time or
times specified by a cron string.
properties: properties:
cron: cron:
description: Cron schedule description: Cron schedule
@@ -41,14 +45,21 @@ spec:
functionweights: functionweights:
additionalProperties: additionalProperties:
type: integer 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 nullable: true
type: object type: object
name: name:
description: Name of the function. description: Name of the function.
type: string type: string
type: 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 type: string
required: required:
- name - name
@@ -66,9 +77,3 @@ spec:
storage: true storage: true
subresources: subresources:
status: {} status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
-7
View File
@@ -1,7 +0,0 @@
module.exports = async (context) => {
return {
status: 200,
body: "hello, world!\n"
};
}
+73 -82
View File
@@ -1,131 +1,123 @@
module github.com/fission/fission module github.com/fission/fission
go 1.18 go 1.19
require ( require (
contrib.go.opencensus.io/exporter/jaeger v0.2.1 github.com/Shopify/sarama v1.36.0
github.com/Shopify/sarama v1.32.0
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/dustin/go-humanize v1.0.0 github.com/dustin/go-humanize v1.0.0
github.com/emicklei/go-restful v2.15.0+incompatible github.com/emicklei/go-restful-openapi/v2 v2.9.0
github.com/emicklei/go-restful-openapi v1.4.1 github.com/emicklei/go-restful/v3 v3.9.0
github.com/fatih/color v1.13.0 github.com/fatih/color v1.13.0
github.com/fsnotify/fsnotify v1.5.1 github.com/fsnotify/fsnotify v1.5.4
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-git/v5 v5.4.2 github.com/go-git/go-git/v5 v5.4.2
github.com/go-openapi/spec v0.20.4 github.com/go-openapi/spec v0.20.7
github.com/golang-jwt/jwt/v4 v4.3.0 github.com/golang-jwt/jwt/v4 v4.4.2
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/graymeta/stow v0.2.7 github.com/graymeta/stow v0.2.8
github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-retryablehttp v0.7.1 github.com/hashicorp/go-retryablehttp v0.7.1
github.com/imdario/mergo v0.3.12 github.com/imdario/mergo v0.3.13
github.com/influxdata/influxdb v1.9.6 github.com/influxdata/influxdb v1.10.0
github.com/mholt/archiver/v3 v3.5.1 github.com/mholt/archiver/v3 v3.5.1
github.com/minio/minio-go v6.0.14+incompatible github.com/minio/minio-go v6.0.14+incompatible
github.com/ory/dockertest v3.3.5+incompatible github.com/ory/dockertest v3.3.5+incompatible
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.1 github.com/prometheus/client_golang v1.13.0
github.com/prometheus/common v0.32.1 github.com/prometheus/common v0.37.0
github.com/robfig/cron v1.2.0 github.com/robfig/cron v1.2.0
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/spf13/cobra v1.4.0 github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.8.0
github.com/wcharczuk/go-chart v2.0.1+incompatible github.com/wcharczuk/go-chart v2.0.1+incompatible
go.opencensus.io v0.23.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0 go.opentelemetry.io/contrib/propagators/autoprop v0.34.0
go.opentelemetry.io/contrib/propagators/aws v1.4.0 go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/contrib/propagators/b3 v1.4.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0
go.opentelemetry.io/contrib/propagators/jaeger v1.4.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0
go.opentelemetry.io/contrib/propagators/ot v1.4.0 go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/trace v1.9.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 go.uber.org/zap v1.23.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1 golang.org/x/net v0.0.0-20220812174116-3211cb980234
go.opentelemetry.io/otel/sdk v1.4.1 google.golang.org/grpc v1.48.0
go.opentelemetry.io/otel/trace v1.4.1 k8s.io/api v0.25.0
go.uber.org/zap v1.21.0 k8s.io/apiextensions-apiserver v0.25.0
golang.org/x/net v0.0.0-20220225172249-27dd8689420f k8s.io/apimachinery v0.25.0
google.golang.org/grpc v1.45.0 k8s.io/client-go v0.25.0
k8s.io/api v0.23.4 k8s.io/metrics v0.25.0
k8s.io/apiextensions-apiserver v0.23.4 sigs.k8s.io/controller-runtime v0.13.0
k8s.io/apimachinery v0.23.4 sigs.k8s.io/yaml v1.3.0
k8s.io/client-go v0.23.4
k8s.io/metrics v0.23.4
sigs.k8s.io/controller-runtime v0.10.2
) )
require ( require (
cloud.google.com/go v0.99.0 // indirect cloud.google.com/go v0.99.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // 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 v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // 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/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect github.com/andybalholm/brotli v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.42.34 // indirect github.com/aws/aws-sdk-go v1.42.34 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/blend/go-sdk v1.20220212.5 // indirect github.com/blend/go-sdk v1.20220112.5 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/continuity v0.2.2 // indirect github.com/containerd/continuity v0.2.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units 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/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/eapache/go-resiliency v1.2.0 // 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-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect github.com/eapache/queue v1.1.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-ini/ini v1.66.4 // indirect github.com/go-ini/ini v1.66.4 // indirect
github.com/go-logr/logr v1.2.2 // indirect github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.2.0 // indirect github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.15 // indirect github.com/go-openapi/swag v0.19.15 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // 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.2 // indirect
github.com/golang/snappy v0.0.4 // indirect github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.7 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.0 // indirect github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.14.4 // indirect github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect github.com/klauspost/pgzip v1.2.5 // indirect
github.com/lib/pq v1.10.4 // indirect github.com/lib/pq v1.10.4 // indirect
github.com/mailru/easyjson v0.7.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect
@@ -136,50 +128,49 @@ require (
github.com/moby/spdystream v0.2.0 // indirect github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect github.com/nwaples/rardecode v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.0 // indirect github.com/opencontainers/runc v1.1.2 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pierrec/lz4/v4 v4.1.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect github.com/prometheus/procfs v0.8.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect github.com/sirupsen/logrus v1.8.1 // indirect
github.com/uber/jaeger-client-go v2.28.0+incompatible // indirect
github.com/ulikunitz/xz v0.5.9 // indirect github.com/ulikunitz/xz v0.5.9 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 // indirect go.opentelemetry.io/contrib/propagators/aws v1.9.0 // indirect
go.opentelemetry.io/otel/internal/metric v0.27.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.9.0 // indirect
go.opentelemetry.io/otel/metric v0.27.0 // indirect go.opentelemetry.io/contrib/propagators/jaeger v1.9.0 // indirect
go.opentelemetry.io/proto/otlp v0.12.0 // indirect go.opentelemetry.io/contrib/propagators/ot v1.9.0 // indirect
go.uber.org/atomic v1.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect go.opentelemetry.io/otel/metric v0.31.0 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect go.opentelemetry.io/proto/otlp v0.18.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/sys v0.0.0-20220307203707-22a9840ba4d7 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/api v0.62.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools v2.2.0+incompatible // indirect gotest.tools v2.2.0+incompatible // indirect
k8s.io/klog/v2 v2.30.0 // indirect k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
) )
+178 -392
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -55,11 +55,11 @@ Fix the build if it is not green. DON'T proceed unless build is GREEN!
6. Push this release-x.y.z branch to remote repo. Create a PR and wait for CI passed. 6. Push this release-x.y.z branch to remote repo. Create a PR and wait for CI passed.
7. Now manually merge the release-x.y.z branch into master branch with Git command to prevent the commit SHA from being changed. 7. Now manually merge the release-x.y.z branch into main branch with Git command to prevent the commit SHA from being changed.
`git checkout master && git merge --ff-only release-<VERSION>` `git checkout main && git merge --ff-only release-<VERSION>`
8. Test build from master branch for sanity check and make sure the master build is green 8. Test build from main branch for sanity check and make sure the main build is green
## Updating [Fission Charts](https://github.com/fission/fission-charts) ## Updating [Fission Charts](https://github.com/fission/fission-charts)
@@ -80,7 +80,7 @@ Before you save the release - UNCHECK the "This is a pre-release" checkbox. This
1. Documentation Update 1. Documentation Update
a. Merge documentation PRs that are peer reviewed and get latest master locally. a. Merge documentation PRs that are peer reviewed and get latest main locally.
b. In the repo fission/fission.io change version in version.sh file to latest version (x.y.z) and run build.sh script b. In the repo fission/fission.io change version in version.sh file to latest version (x.y.z) and run build.sh script
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
set -e
set -x
DIR=${GITHUB_WORKSPACE}
MANIFESTDIR=${GITHUB_WORKSPACE}/manifest
CHARTPATH=${GITHUB_WORKSPACE}/charts/fission-all
source $(realpath "${DIR}"/test/init_tools.sh)
doit() {
echo "! $*"
"$@"
}
build_yamls() {
local version=$1
mkdir -p "${MANIFESTDIR}"/yamls
releaseName=fission-$(echo "${version}" | sed 's/\./-/g')
cd $CHARTPATH
doit helm dependency update
cd $GITHUB_WORKSPACE
echo "Release name", "$releaseName"
cmdprefix="helm template ${releaseName} ${CHARTPATH} --namespace fission --validate"
# for minikube and other environments that don't support LoadBalancer
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true,serviceType=NodePort,routerServiceType=NodePort"
echo "$command"
$command >"$MANIFESTDIR/yamls/fission-all-${version}"-minikube.yaml
# for environments that support LoadBalancer
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true"
echo "$command"
$command >"$MANIFESTDIR/yamls/fission-all-${version}".yaml
# for OpenShift
command="$cmdprefix --set analytics=false,analyticsNonHelmInstall=true,logger.enableSecurityContext=true"
echo "$command"
$command >"$MANIFESTDIR/yamls/fission-all-${version}"-openshift.yaml
}
version=$1
if [ -z "$version" ]; then
echo "Release version not mentioned"
exit 1
fi
echo "Current version for release: $version"
build_yamls "$version"
+16
View File
@@ -0,0 +1,16 @@
if ! command -v dashboard-linter >/dev/null 2>&1; then
echo "dashboard-linter is not installed"
exit 1;
fi
BASE_PATH=$(pwd)
if [[ -z "$BASE_PATH" ]] ; then
BASE_PATH=$(GITHUB_WORKSPACE)
fi
DASHBOARD_PATH="$BASE_PATH/charts/fission-all/dashboards/*"
for f in $DASHBOARD_PATH
do
dashboard-linter lint --strict --verbose $f
done
+1 -1
View File
@@ -1,2 +1,2 @@
Install Guide: https://fission.io/docs/installation/ Install Guide: https://fission.io/docs/installation/
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md Full Changelog: https://github.com/fission/fission/blob/main/CHANGELOG.md
+9 -5
View File
@@ -22,8 +22,8 @@ check_commands() {
# Ensure we're on the master branch # Ensure we're on the master branch
check_branch() { check_branch() {
curr_branch=$(git rev-parse --abbrev-ref HEAD) curr_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$curr_branch" != "master" ]; then if [ "$curr_branch" != "main" ]; then
echo "Not on master branch." echo "Not on main branch."
exit 1 exit 1
fi fi
echo "check_branch == PASSED" echo "check_branch == PASSED"
@@ -39,14 +39,17 @@ check_clean() {
} }
check_github_token() { check_github_token() {
if [ ! -f "$HOME"/.github-token ]; then if [ ! -f "$HOME"/.github-token ] && [ -z "$GITHUB_TOKEN" ]; then
echo "Error finding github access token at ${HOME}/.github-token" echo "Error finding github access token at ${HOME}/.github-token or in GITHUB_TOKEN envvar"
exit 1 exit 1
fi fi
echo "check_github_token == PASSED" echo "check_github_token == PASSED"
} }
export GITHUB_TOKEN=$(cat ~/.github-token) # Read token from file if not set as envvar
if [ -z "$GITHUB_TOKEN"]; then
export GITHUB_TOKEN=$(cat ~/.github-token)
fi
version=$1 version=$1
if [ -z "$version" ]; then if [ -z "$version" ]; then
@@ -66,6 +69,7 @@ check_github_token
export GORELEASER_CURRENT_TAG=$version export GORELEASER_CURRENT_TAG=$version
echo "Release version $GORELEASER_CURRENT_TAG " echo "Release version $GORELEASER_CURRENT_TAG "
echo "DOCKER_CLI_EXPERIMENTAL $DOCKER_CLI_EXPERIMENTAL"
goreleaser release goreleaser release
echo "############ DONE #############" echo "############ DONE #############"
+5
View File
@@ -66,6 +66,11 @@ const (
StrategyTypeExecution = "execution" StrategyTypeExecution = "execution"
) )
const (
RuntimePodSpecConfigmap = "runtime-podspec-patch"
BuilderPodSpecConfigmap = "builder-podspec-patch"
)
const ( const (
SharedVolumeUserfunc = "userfunc" SharedVolumeUserfunc = "userfunc"
SharedVolumePackages = "packages" SharedVolumePackages = "packages"
-1
View File
@@ -21,7 +21,6 @@ limitations under the License.
// +k8s:defaulter-gen=TypeMeta // +k8s:defaulter-gen=TypeMeta
// +groupName=fission.io // +groupName=fission.io
// +groupGoName=core // +groupGoName=core
//
package v1 package v1
const ( const (
+2 -2
View File
@@ -304,7 +304,7 @@ type (
// is ready for deploy instead of setting "none" in build status. // is ready for deploy instead of setting "none" in build status.
// BuildStatus is the package build status. // BuildStatus is the package build status.
// +kubebuilder:default:="Pending" // +kubebuilder:default:="pending"
BuildStatus BuildStatus `json:"buildstatus,omitempty"` BuildStatus BuildStatus `json:"buildstatus,omitempty"`
// BuildLog stores build log during the compilation. // BuildLog stores build log during the compilation.
@@ -883,7 +883,7 @@ type (
} }
) )
//IsEmpty checks if the archive byte and litreal are of length 0 // IsEmpty checks if the archive byte and litreal are of length 0
func (a Archive) IsEmpty() bool { func (a Archive) IsEmpty() bool {
return len(a.Literal) == 0 && len(a.URL) == 0 return len(a.Literal) == 0 && len(a.URL) == 0
} }
+26 -19
View File
@@ -38,8 +38,8 @@ import (
const ( const (
// supported environment variables // supported environment variables
envSrcPkg = "SRC_PKG" envSrcPkg string = "SRC_PKG"
envDeployPkg = "DEPLOY_PKG" envDeployPkg string = "DEPLOY_PKG"
) )
type ( type (
@@ -114,16 +114,27 @@ func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
} }
builder.logger.Info("builder received request", zap.Any("request", req)) builder.logger.Info("builder received request", zap.Any("request", req))
builder.logger.Info("starting build") builder.logger.Debug("starting build")
srcPkgPath := filepath.Join(builder.sharedVolumePath, req.SrcPkgFilename) srcPkgPath := filepath.Join(builder.sharedVolumePath, req.SrcPkgFilename)
deployPkgFilename := fmt.Sprintf("%v-%v", req.SrcPkgFilename, strings.ToLower(uniuri.NewLen(6))) deployPkgFilename := fmt.Sprintf("%s-%s", req.SrcPkgFilename, strings.ToLower(uniuri.NewLen(6)))
deployPkgPath := filepath.Join(builder.sharedVolumePath, deployPkgFilename) deployPkgPath := filepath.Join(builder.sharedVolumePath, deployPkgFilename)
var buildArgs []string
buildCmd := req.BuildCommand buildCmd := req.BuildCommand
if len(buildCmd) == 0 { if len(buildCmd) == 0 {
// use default build command // use default build command
buildCmd = "/build" buildCmd = "/build"
} else {
// split executable command and arguments
args := strings.Split(buildCmd, " ")
buildCmd = args[0] // get the executable command, executable command will always be on Zero index
// get all the arguments
for i := 1; i < len(args); i++ {
buildArgs = append(buildArgs, args[i])
}
} }
buildLogs, err := builder.build(buildCmd, srcPkgPath, deployPkgPath) buildLogs, err := builder.build(buildCmd, buildArgs, srcPkgPath, deployPkgPath)
if err != nil { if err != nil {
e := "error building source package" e := "error building source package"
builder.logger.Error(e, zap.Error(err)) builder.logger.Error(e, zap.Error(err))
@@ -146,7 +157,7 @@ func (builder *Builder) reply(w http.ResponseWriter, pkgFilename string, buildLo
rBody, err := json.Marshal(resp) rBody, err := json.Marshal(resp)
if err != nil { if err != nil {
e := errors.Wrap(err, "error encoding response body") e := errors.Wrap(err, "error encoding response body")
rBody = []byte(fmt.Sprintf(`{"buildLogs": "%v"}`, e.Error())) rBody = []byte(fmt.Sprintf(`{"buildLogs": "%s"}`, e.Error()))
statusCode = http.StatusInternalServerError statusCode = http.StatusInternalServerError
} }
@@ -163,8 +174,8 @@ func (builder *Builder) reply(w http.ResponseWriter, pkgFilename string, buildLo
} }
} }
func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath string) (string, error) { func (builder *Builder) build(command string, args []string, srcPkgPath string, deployPkgPath string) (string, error) {
cmd := exec.Command(command) cmd := exec.Command(command, args...)
fi, err := os.Stat(srcPkgPath) fi, err := os.Stat(srcPkgPath)
if err != nil { if err != nil {
@@ -178,8 +189,8 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
// set env variables for build command // set env variables for build command
cmd.Env = append(os.Environ(), cmd.Env = append(os.Environ(),
fmt.Sprintf("%v=%v", envSrcPkg, srcPkgPath), fmt.Sprintf("%s=%s", envSrcPkg, srcPkgPath),
fmt.Sprintf("%v=%v", envDeployPkg, deployPkgPath), fmt.Sprintf("%s=%s", envDeployPkg, deployPkgPath),
) )
stdout, err := cmd.StdoutPipe() stdout, err := cmd.StdoutPipe()
@@ -192,12 +203,8 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
return "", errors.Wrap(err, "error creating stderr pipe for cmd") return "", errors.Wrap(err, "error creating stderr pipe for cmd")
} }
var buildLogs string
fmt.Printf("\n=== Build Logs ===")
// Init logs // Init logs
fmt.Printf("command=%v\n", command) builder.logger.Info("building source package", zap.String("command", command), zap.Strings("args", args), zap.Strings("env", cmd.Env))
fmt.Printf("env=%v\n", cmd.Env)
out := io.MultiReader(stdout, stderr) out := io.MultiReader(stdout, stderr)
scanner := bufio.NewScanner(out) scanner := bufio.NewScanner(out)
@@ -206,12 +213,14 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
if err != nil { if err != nil {
return "", errors.Wrap(err, "error starting cmd") return "", errors.Wrap(err, "error starting cmd")
} }
fmt.Printf("========= START =========\n")
defer fmt.Printf("========= END ===========\n")
var buildLogs string
// Runtime logs // Runtime logs
for scanner.Scan() { for scanner.Scan() {
output := scanner.Text() output := scanner.Text()
fmt.Println(output) fmt.Println(output)
buildLogs += fmt.Sprintf("%v\n", output) buildLogs += fmt.Sprintf("%s\n", output)
} }
if err := scanner.Err(); err != nil { if err := scanner.Err(); err != nil {
@@ -226,7 +235,5 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
fmt.Println(cmdErr) fmt.Println(cmdErr)
return buildLogs, cmdErr return buildLogs, cmdErr
} }
fmt.Printf("==================\n")
return buildLogs, nil return buildLogs, nil
} }
+171
View File
@@ -0,0 +1,171 @@
/*
Copyright 2022 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 builder
import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
func TestBuilder(t *testing.T) {
logger := loggerfactory.GetLogger()
dir, err := os.MkdirTemp("/tmp", "fission-builder-test")
if err != nil {
t.Fatal(err)
}
builder := MakeBuilder(logger, dir)
// Test VersionHandler
t.Run("VersionHandler", func(t *testing.T) {
t.Run("should return version", func(t *testing.T) {
w := &httptest.ResponseRecorder{}
r := &http.Request{}
builder.VersionHandler(w, r)
if w.Result().StatusCode != http.StatusOK {
t.Errorf("expected status code %d, got %d", http.StatusOK, w.Result().StatusCode)
}
if w.Result().Body == nil {
t.Error("expected body, got nil")
}
})
})
// Test BuildHandler
t.Run("BuildHandler", func(t *testing.T) {
for _, test := range []struct {
name string
buildRequest *PackageBuildRequest
expected *PackageBuildResponse
status int
}{
{
name: "should work with build command without argument",
buildRequest: &PackageBuildRequest{
SrcPkgFilename: "test",
BuildCommand: "ls",
},
expected: &PackageBuildResponse{
ArtifactFilename: "test",
BuildLogs: "",
},
status: http.StatusOK,
},
{
name: "should work with build command with argument",
buildRequest: &PackageBuildRequest{
SrcPkgFilename: "test1",
BuildCommand: "ls -la",
},
expected: &PackageBuildResponse{
ArtifactFilename: "test1",
BuildLogs: "",
},
status: http.StatusOK,
},
{
name: "should fail with argument and pipe",
buildRequest: &PackageBuildRequest{
SrcPkgFilename: "test2",
BuildCommand: "ps -ef | grep fission",
},
expected: &PackageBuildResponse{
ArtifactFilename: "test2",
BuildLogs: "",
},
status: http.StatusInternalServerError,
},
{
name: "should fail with invalid build command",
buildRequest: &PackageBuildRequest{
SrcPkgFilename: "test3",
BuildCommand: "lsalas -la",
},
expected: &PackageBuildResponse{
ArtifactFilename: "test3",
BuildLogs: "",
},
status: http.StatusInternalServerError,
},
{
name: "should fail with valid command and invalid argument",
buildRequest: &PackageBuildRequest{
SrcPkgFilename: "test3",
BuildCommand: "ls --la",
},
expected: &PackageBuildResponse{
ArtifactFilename: "test3",
BuildLogs: "",
},
status: http.StatusInternalServerError,
},
} {
t.Run(test.name, func(t *testing.T) {
srcFile, err := os.Create(dir + "/" + test.buildRequest.SrcPkgFilename)
if err != nil {
t.Fatal(err)
}
defer srcFile.Close()
body, err := json.Marshal(test.buildRequest)
if err != nil {
t.Fatal(err)
}
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPost, "/", bytes.NewReader(body))
builder.Handler(w, r)
resp := w.Result()
if resp.StatusCode != test.status {
t.Errorf("expected status code %d, got %d", test.status, resp.StatusCode)
}
body, err = io.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
var buildResp PackageBuildResponse
err = json.Unmarshal(body, &buildResp)
if err != nil {
t.Fatal(err)
}
if test.status == http.StatusOK {
if strings.Contains(buildResp.BuildLogs, "error") {
t.Errorf("expected build logs to not contain error, got %s", buildResp.BuildLogs)
}
artifacts := strings.Split(buildResp.ArtifactFilename, "-")
if len(artifacts) != 2 {
t.Errorf("expected artifact filename to be of the form <pkgname>-<build-id>, got %s", buildResp.ArtifactFilename)
}
if artifacts[0] != test.expected.ArtifactFilename {
t.Errorf("expected artifact filename to be %s, got %s", test.expected.ArtifactFilename, artifacts[0])
}
} else {
if !strings.Contains(buildResp.BuildLogs, "error") {
t.Errorf("expected build logs to contain error, got %s", buildResp.BuildLogs)
}
}
})
}
})
}
+1 -9
View File
@@ -26,7 +26,6 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/net/context/ctxhttp" "golang.org/x/net/context/ctxhttp"
@@ -34,7 +33,6 @@ import (
"github.com/fission/fission/pkg/builder" "github.com/fission/fission/pkg/builder"
ferror "github.com/fission/fission/pkg/error" ferror "github.com/fission/fission/pkg/error"
otelUtils "github.com/fission/fission/pkg/utils/otel" otelUtils "github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/tracing"
) )
type ( type (
@@ -46,13 +44,7 @@ type (
) )
func MakeClient(logger *zap.Logger, builderUrl string) *Client { func MakeClient(logger *zap.Logger, builderUrl string) *Client {
var hc *http.Client hc := &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}
if tracing.TracingEnabled(logger) {
hc = &http.Client{Transport: &ochttp.Transport{}}
} else {
hc = &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}
}
return &Client{ return &Client{
logger: logger.Named("builder_client"), logger: logger.Named("builder_client"),
url: strings.TrimSuffix(builderUrl, "/"), url: strings.TrimSuffix(builderUrl, "/"),
+16 -1
View File
@@ -22,11 +22,15 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
k8sInformers "k8s.io/client-go/informers" k8sInformers "k8s.io/client-go/informers"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/crd" "github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/executor/util"
fetcherConfig "github.com/fission/fission/pkg/fetcher/config" fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions" genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
"github.com/fission/fission/pkg/utils"
) )
// Start the buildermgr service. // Start the buildermgr service.
@@ -48,7 +52,18 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string, envBui
return errors.Wrap(err, "error making fetcher config") return errors.Wrap(err, "error making fetcher config")
} }
envWatcher := makeEnvironmentWatcher(bmLogger, fissionClient, kubernetesClient, fetcherConfig, envBuilderNamespace) var podSpecPatch *apiv1.PodSpec
namespace, err := utils.GetCurrentNamespace()
if err != nil {
logger.Warn("Current namespace not found %v", zap.Error(err))
} else {
podSpecPatch, err = util.GetSpecFromConfigMap(ctx, kubernetesClient, fv1.BuilderPodSpecConfigmap, namespace)
if err != nil {
logger.Warn("Either configmap is not found or error reading data %v", zap.Error(err))
}
}
envWatcher := makeEnvironmentWatcher(bmLogger, fissionClient, kubernetesClient, fetcherConfig, envBuilderNamespace, podSpecPatch)
go envWatcher.watchEnvironments() go envWatcher.watchEnvironments()
k8sInformerFactory := k8sInformers.NewSharedInformerFactory(kubernetesClient, time.Minute*30) k8sInformerFactory := k8sInformers.NewSharedInformerFactory(kubernetesClient, time.Minute*30)
+14 -1
View File
@@ -87,6 +87,7 @@ type (
fetcherConfig *fetcherConfig.Config fetcherConfig *fetcherConfig.Config
builderImagePullPolicy apiv1.PullPolicy builderImagePullPolicy apiv1.PullPolicy
useIstio bool useIstio bool
podSpecPatch *apiv1.PodSpec
} }
) )
@@ -95,7 +96,8 @@ func makeEnvironmentWatcher(
fissionClient versioned.Interface, fissionClient versioned.Interface,
kubernetesClient kubernetes.Interface, kubernetesClient kubernetes.Interface,
fetcherConfig *fetcherConfig.Config, fetcherConfig *fetcherConfig.Config,
builderNamespace string) *environmentWatcher { builderNamespace string,
podSpecPatch *apiv1.PodSpec) *environmentWatcher {
useIstio := false useIstio := false
enableIstio := os.Getenv("ENABLE_ISTIO") enableIstio := os.Getenv("ENABLE_ISTIO")
@@ -119,6 +121,7 @@ func makeEnvironmentWatcher(
builderImagePullPolicy: builderImagePullPolicy, builderImagePullPolicy: builderImagePullPolicy,
useIstio: useIstio, useIstio: useIstio,
fetcherConfig: fetcherConfig, fetcherConfig: fetcherConfig,
podSpecPatch: podSpecPatch,
} }
go envWatcher.service() go envWatcher.service()
@@ -503,6 +506,16 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
}, },
} }
if envw.podSpecPatch != nil {
updatedPodSpec, err := util.MergePodSpec(&pod.Spec, envw.podSpecPatch)
if err == nil {
pod.Spec = *updatedPodSpec
} else {
envw.logger.Warn("Failed to merge the specs: %v", zap.Error(err))
}
}
pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec)) pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec))
deployment := &appsv1.Deployment{ deployment := &appsv1.Deployment{
+4 -4
View File
@@ -199,7 +199,7 @@ func (canaryCfgMgr *canaryConfigMgr) processCanaryConfig(ctx *context.Context, c
zap.String("name", canaryConfig.ObjectMeta.Name), zap.String("name", canaryConfig.ObjectMeta.Name),
zap.String("namespace", canaryConfig.ObjectMeta.Namespace), zap.String("namespace", canaryConfig.ObjectMeta.Namespace),
zap.String("version", canaryConfig.ObjectMeta.ResourceVersion)) zap.String("version", canaryConfig.ObjectMeta.ResourceVersion))
canaryCfgMgr.RollForwardOrBack(canaryConfig, quit, ticker) canaryCfgMgr.RollForwardOrBack(*ctx, canaryConfig, quit, ticker)
case <-quit: case <-quit:
// we're done processing this canary config either because the new function receives 100% of the traffic // we're done processing this canary config either because the new function receives 100% of the traffic
@@ -221,7 +221,7 @@ func (canaryCfgMgr *canaryConfigMgr) processCanaryConfig(ctx *context.Context, c
} }
} }
func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(canaryConfig *fv1.CanaryConfig, quit chan struct{}, ticker *time.Ticker) { func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(ctx context.Context, canaryConfig *fv1.CanaryConfig, quit chan struct{}, ticker *time.Ticker) {
// handle race between delete event and notification on ticker.C // handle race between delete event and notification on ticker.C
_, err := canaryCfgMgr.canaryCfgCancelFuncMap.lookup(&canaryConfig.ObjectMeta) _, err := canaryCfgMgr.canaryCfgCancelFuncMap.lookup(&canaryConfig.ObjectMeta)
if err != nil { if err != nil {
@@ -233,7 +233,7 @@ func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(canaryConfig *fv1.CanaryC
} }
// get the http trigger object associated with this canary config // get the http trigger object associated with this canary config
triggerObj, err := canaryCfgMgr.fissionClient.CoreV1().HTTPTriggers(canaryConfig.ObjectMeta.Namespace).Get(context.TODO(), canaryConfig.Spec.Trigger, metav1.GetOptions{}) triggerObj, err := canaryCfgMgr.fissionClient.CoreV1().HTTPTriggers(canaryConfig.ObjectMeta.Namespace).Get(ctx, canaryConfig.Spec.Trigger, metav1.GetOptions{})
if err != nil { if err != nil {
// if the http trigger is not found, then give up processing this config. // if the http trigger is not found, then give up processing this config.
if k8serrors.IsNotFound(err) { if k8serrors.IsNotFound(err) {
@@ -286,7 +286,7 @@ func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(canaryConfig *fv1.CanaryC
methods = append(methods, triggerObj.Spec.Method) methods = append(methods, triggerObj.Spec.Method)
} }
} }
failurePercent, err := canaryCfgMgr.promClient.GetFunctionFailurePercentage(urlPath, methods, failurePercent, err := canaryCfgMgr.promClient.GetFunctionFailurePercentage(ctx, urlPath, methods,
canaryConfig.Spec.NewFunction, canaryConfig.ObjectMeta.Namespace, canaryConfig.Spec.WeightIncrementDuration) canaryConfig.Spec.NewFunction, canaryConfig.ObjectMeta.Namespace, canaryConfig.Spec.WeightIncrementDuration)
if err != nil { if err != nil {
// silently ignore. wait for next window to increment weight // silently ignore. wait for next window to increment weight
+11 -11
View File
@@ -51,11 +51,11 @@ func MakePrometheusClient(logger *zap.Logger, prometheusSvc string) (*Prometheus
}, nil }, nil
} }
func (promApiClient *PrometheusApiClient) GetFunctionFailurePercentage(path string, methods []string, funcName, funcNs string, window string) (float64, error) { func (promApiClient *PrometheusApiClient) GetFunctionFailurePercentage(ctx context.Context, path string, methods []string, funcName, funcNs string, window string) (float64, error) {
var reqs, failedReqs float64 var reqs, failedReqs float64
// first get a total count of requests to this url in a time window // first get a total count of requests to this url in a time window
for _, method := range methods { for _, method := range methods {
mreqs, err := promApiClient.GetRequestsToFuncInWindow(path, method, funcName, funcNs, window) mreqs, err := promApiClient.GetRequestsToFuncInWindow(ctx, path, method, funcName, funcNs, window)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@@ -68,7 +68,7 @@ func (promApiClient *PrometheusApiClient) GetFunctionFailurePercentage(path stri
// next, get a total count of errored out requests to this function in the same window // next, get a total count of errored out requests to this function in the same window
for _, method := range methods { for _, method := range methods {
mfailedReqs, err := promApiClient.GetTotalFailedRequestsToFuncInWindow(funcName, funcNs, path, method, window) mfailedReqs, err := promApiClient.GetTotalFailedRequestsToFuncInWindow(ctx, funcName, funcNs, path, method, window)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@@ -85,18 +85,18 @@ func (PrometheusApiClient *PrometheusApiClient) getFunctionQueryLabels(functionN
return fmt.Sprintf("function_name=\"%s\",function_namespace=\"%s\",path=\"%s\",method=\"%s\"", functionName, functionNamespace, path, method) return fmt.Sprintf("function_name=\"%s\",function_namespace=\"%s\",path=\"%s\",method=\"%s\"", functionName, functionNamespace, path, method)
} }
func (promApiClient *PrometheusApiClient) GetRequestsToFuncInWindow(path string, method string, funcName string, funcNs string, window string) (float64, error) { func (promApiClient *PrometheusApiClient) GetRequestsToFuncInWindow(ctx context.Context, path string, method string, funcName string, funcNs string, window string) (float64, error) {
queryLabels := promApiClient.getFunctionQueryLabels(funcName, funcNs, path, method) queryLabels := promApiClient.getFunctionQueryLabels(funcName, funcNs, path, method)
queryString := fmt.Sprintf("fission_function_calls_total{%s}[%v]", queryLabels, window) queryString := fmt.Sprintf("fission_function_calls_total{%s}[%v]", queryLabels, window)
reqs, err := promApiClient.executeQuery(queryString) reqs, err := promApiClient.executeQuery(ctx, queryString)
if err != nil { if err != nil {
return 0, errors.Wrapf(err, "error executing query: %s", queryString) return 0, errors.Wrapf(err, "error executing query: %s", queryString)
} }
queryString = fmt.Sprintf("fission_function_calls_total{%s} offset %v", queryLabels, window) queryString = fmt.Sprintf("fission_function_calls_total{%s} offset %v", queryLabels, window)
reqsInPrevWindow, err := promApiClient.executeQuery(queryString) reqsInPrevWindow, err := promApiClient.executeQuery(ctx, queryString)
if err != nil { if err != nil {
return 0, errors.Wrapf(err, "error executing query: %s", queryString) return 0, errors.Wrapf(err, "error executing query: %s", queryString)
} }
@@ -111,18 +111,18 @@ func (promApiClient *PrometheusApiClient) GetRequestsToFuncInWindow(path string,
return reqsInCurrentWindow, nil return reqsInCurrentWindow, nil
} }
func (promApiClient *PrometheusApiClient) GetTotalFailedRequestsToFuncInWindow(funcName string, funcNs string, path string, method string, window string) (float64, error) { func (promApiClient *PrometheusApiClient) GetTotalFailedRequestsToFuncInWindow(ctx context.Context, funcName string, funcNs string, path string, method string, window string) (float64, error) {
queryLabels := promApiClient.getFunctionQueryLabels(funcName, funcNs, path, method) queryLabels := promApiClient.getFunctionQueryLabels(funcName, funcNs, path, method)
queryString := fmt.Sprintf("fission_function_errors_total{%s}[%v]", queryLabels, window) queryString := fmt.Sprintf("fission_function_errors_total{%s}[%v]", queryLabels, window)
failedRequests, err := promApiClient.executeQuery(queryString) failedRequests, err := promApiClient.executeQuery(ctx, queryString)
if err != nil { if err != nil {
return 0, errors.Wrapf(err, "error executing query: %s", queryString) return 0, errors.Wrapf(err, "error executing query: %s", queryString)
} }
queryString = fmt.Sprintf("fission_function_errors_total{%s} offset %v", queryLabels, window) queryString = fmt.Sprintf("fission_function_errors_total{%s} offset %v", queryLabels, window)
failedReqsInPrevWindow, err := promApiClient.executeQuery(queryString) failedReqsInPrevWindow, err := promApiClient.executeQuery(ctx, queryString)
if err != nil { if err != nil {
return 0, errors.Wrapf(err, "error executing query: %s", queryString) return 0, errors.Wrapf(err, "error executing query: %s", queryString)
} }
@@ -137,10 +137,10 @@ func (promApiClient *PrometheusApiClient) GetTotalFailedRequestsToFuncInWindow(f
return failedReqsInCurrentWindow, nil return failedReqsInCurrentWindow, nil
} }
func (promApiClient *PrometheusApiClient) executeQuery(queryString string) (float64, error) { func (promApiClient *PrometheusApiClient) executeQuery(ctx context.Context, queryString string) (float64, error) {
promApiClient.logger.Debug("executing prometheus query", zap.String("query", queryString)) promApiClient.logger.Debug("executing prometheus query", zap.String("query", queryString))
val, warn, err := promApiClient.client.Query(context.Background(), queryString, time.Now()) val, warn, err := promApiClient.client.Query(ctx, queryString, time.Now())
if err != nil { if err != nil {
return 0, errors.Wrapf(err, "error querying prometheus") return 0, errors.Wrapf(err, "error querying prometheus")
} }
+2 -9
View File
@@ -24,7 +24,6 @@ import (
"strings" "strings"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap" "go.uber.org/zap"
apiv1 "k8s.io/api/core/v1" apiv1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors" kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -270,14 +269,8 @@ func (api *API) GetHandler() http.Handler {
return r return r
} }
func (api *API) Serve(ctx context.Context, port int, openTracingEnabled bool) { func (api *API) Serve(ctx context.Context, port int) {
var handler http.Handler handler := otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
if openTracingEnabled {
handler = &ochttp.Handler{Handler: api.GetHandler()}
} else {
handler = otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
}
go metrics.ServeMetrics(ctx, api.logger) go metrics.ServeMetrics(ctx, api.logger)
httpserver.StartServer(ctx, api.logger, "controller", fmt.Sprintf("%d", port), handler) httpserver.StartServer(ctx, api.logger, "controller", fmt.Sprintf("%d", port), handler)
} }
+144 -20
View File
@@ -31,7 +31,6 @@ import (
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -41,6 +40,7 @@ import (
"github.com/fission/fission/pkg/crd" "github.com/fission/fission/pkg/crd"
ferror "github.com/fission/fission/pkg/error" ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/fission-cli/cmd" "github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/utils/loggerfactory"
) )
var ( var (
@@ -130,7 +130,10 @@ func TestFunctionApi(t *testing.T) {
testFunc.ObjectMeta.Name = "bar" testFunc.ObjectMeta.Name = "bar"
m2, err := g.Client().V1().Function().Create(testFunc) m2, err := g.Client().V1().Function().Create(testFunc)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().Function().Delete(m2)) defer func() {
err := g.Client().V1().Function().Delete(m2)
panicIf(err)
}()
funcs, err := g.Client().V1().Function().List(testNS) funcs, err := g.Client().V1().Function().List(testNS)
panicIf(err) panicIf(err)
@@ -174,7 +177,10 @@ func TestHTTPTriggerApi(t *testing.T) {
m, err := g.Client().V1().HTTPTrigger().Create(testTrigger) m, err := g.Client().V1().HTTPTrigger().Create(testTrigger)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().HTTPTrigger().Delete(m)) defer func() {
err := g.Client().V1().HTTPTrigger().Delete(m)
panicIf(err)
}()
_, err = g.Client().V1().HTTPTrigger().Create(testTrigger) _, err = g.Client().V1().HTTPTrigger().Create(testTrigger)
assertNameReuseFailure(err, "httptrigger") assertNameReuseFailure(err, "httptrigger")
@@ -199,13 +205,111 @@ func TestHTTPTriggerApi(t *testing.T) {
testTrigger.Spec.RelativeURL = "/hi2" testTrigger.Spec.RelativeURL = "/hi2"
m2, err := g.Client().V1().HTTPTrigger().Create(testTrigger) m2, err := g.Client().V1().HTTPTrigger().Create(testTrigger)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().HTTPTrigger().Delete(m2)) defer func() {
err = g.Client().V1().HTTPTrigger().Delete(m2)
panicIf(err)
}()
ts, err := g.Client().V1().HTTPTrigger().List(testNS) ts, err := g.Client().V1().HTTPTrigger().List(testNS)
panicIf(err) panicIf(err)
assert(len(ts) == 2, fmt.Sprintf("created two triggers, but found %v", len(ts))) 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",
},
},
},
}
_, err := g.Client().V1().Function().Create(testFunc)
panicIf(err)
defer func() {
panicIf(err)
}()
testFunc.Name = "foo2"
_, err = g.Client().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",
},
},
}
m, err := g.Client().V1().HTTPTrigger().Create(testTrigger)
panicIf(err)
defer panicIf(g.Client().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 := g.Client().V1().HTTPTrigger().Create(testTrigger2)
if err != nil {
t.Fatal()
}
defer func() {
if m2 != nil {
err := g.Client().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) { func TestEnvironmentApi(t *testing.T) {
testEnv := &fv1.Environment{ testEnv := &fv1.Environment{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
@@ -228,7 +332,10 @@ func TestEnvironmentApi(t *testing.T) {
m, err := g.Client().V1().Environment().Create(testEnv) m, err := g.Client().V1().Environment().Create(testEnv)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().Environment().Delete(m)) defer func() {
err := g.Client().V1().Environment().Delete(m)
panicIf(err)
}()
_, err = g.Client().V1().Environment().Create(testEnv) _, err = g.Client().V1().Environment().Create(testEnv)
assertNameReuseFailure(err, "environment") assertNameReuseFailure(err, "environment")
@@ -247,7 +354,10 @@ func TestEnvironmentApi(t *testing.T) {
m2, err := g.Client().V1().Environment().Create(testEnv) m2, err := g.Client().V1().Environment().Create(testEnv)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().Environment().Delete(m2)) defer func() {
err := g.Client().V1().Environment().Delete(m2)
panicIf(err)
}()
ts, err := g.Client().V1().Environment().List(testNS) ts, err := g.Client().V1().Environment().List(testNS)
panicIf(err) panicIf(err)
@@ -277,7 +387,10 @@ func TestWatchApi(t *testing.T) {
m, err := g.Client().V1().KubeWatcher().Create(testWatch) m, err := g.Client().V1().KubeWatcher().Create(testWatch)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().KubeWatcher().Delete(m)) defer func() {
err := g.Client().V1().KubeWatcher().Delete(m)
panicIf(err)
}()
_, err = g.Client().V1().KubeWatcher().Create(testWatch) _, err = g.Client().V1().KubeWatcher().Create(testWatch)
assertNameReuseFailure(err, "watch") assertNameReuseFailure(err, "watch")
@@ -292,7 +405,10 @@ func TestWatchApi(t *testing.T) {
testWatch.ObjectMeta.Name = "yyy" testWatch.ObjectMeta.Name = "yyy"
m2, err := g.Client().V1().KubeWatcher().Create(testWatch) m2, err := g.Client().V1().KubeWatcher().Create(testWatch)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().KubeWatcher().Delete(m2)) defer func() {
err := g.Client().V1().KubeWatcher().Delete(m2)
panicIf(err)
}()
ws, err := g.Client().V1().KubeWatcher().List(testNS) ws, err := g.Client().V1().KubeWatcher().List(testNS)
panicIf(err) panicIf(err)
@@ -318,7 +434,10 @@ func TestTimeTriggerApi(t *testing.T) {
m, err := g.Client().V1().TimeTrigger().Create(testTrigger) m, err := g.Client().V1().TimeTrigger().Create(testTrigger)
panicIf(err) panicIf(err)
defer panicIf(g.Client().V1().TimeTrigger().Delete(m)) defer func() {
err := g.Client().V1().TimeTrigger().Delete(m)
panicIf(err)
}()
_, err = g.Client().V1().TimeTrigger().Create(testTrigger) _, err = g.Client().V1().TimeTrigger().Create(testTrigger)
assertNameReuseFailure(err, "trigger") assertNameReuseFailure(err, "trigger")
@@ -348,10 +467,15 @@ func TestTimeTriggerApi(t *testing.T) {
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
flag.Parse() flag.Parse()
ctx, cancel := context.WithCancel(context.Background())
logger := loggerfactory.GetLogger()
// skip test if no cluster available for testing // skip test if no cluster available for testing
kubeconfig := os.Getenv("KUBECONFIG") kubeconfig := os.Getenv("KUBECONFIG")
if len(kubeconfig) == 0 { if len(kubeconfig) == 0 {
log.Println("Skipping test, no kubernetes cluster") log.Println("Skipping test, no kubernetes cluster")
cancel()
return return
} }
@@ -362,22 +486,14 @@ func TestMain(m *testing.M) {
id, err := uuid.NewV4() id, err := uuid.NewV4()
panicIf(err) panicIf(err)
testNS = id.String() testNS = id.String()
_, err = kubeClient.CoreV1().Namespaces().Create(context.TODO(), &v1.Namespace{ _, err = kubeClient.CoreV1().Namespaces().Create(ctx, &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: testNS, Name: testNS,
}, },
}, metav1.CreateOptions{}) }, metav1.CreateOptions{})
panicIf(err) panicIf(err)
defer panicIf(kubeClient.CoreV1().Namespaces().Delete(context.TODO(), testNS, metav1.DeleteOptions{}))
config := zap.NewDevelopmentConfig() go Start(ctx, logger, 8888, true)
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
panicIf(err)
ctx := context.Background()
go Start(ctx, logger, 8888, true, true)
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
@@ -400,5 +516,13 @@ func TestMain(m *testing.M) {
_, err = io.ReadAll(resp.Body) _, err = io.ReadAll(resp.Body)
panicIf(err) panicIf(err)
os.Exit(m.Run()) exitVal := m.Run()
logger.Info("Deleting test namespace", zap.String("namespace", testNS))
gracePeriod := int64(0)
err = kubeClient.CoreV1().Namespaces().Delete(context.TODO(), 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)
} }
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"go.uber.org/zap" "go.uber.org/zap"
+2 -2
View File
@@ -24,7 +24,7 @@ import (
"github.com/fission/fission/pkg/crd" "github.com/fission/fission/pkg/crd"
) )
func Start(ctx context.Context, logger *zap.Logger, port int, unitTestFlag bool, openTracingEnabled bool) { func Start(ctx context.Context, logger *zap.Logger, port int, unitTestFlag bool) {
cLogger := logger.Named("controller") cLogger := logger.Named("controller")
fc, kc, apiExtClient, _, err := crd.MakeFissionClient() fc, kc, apiExtClient, _, err := crd.MakeFissionClient()
@@ -51,5 +51,5 @@ func Start(ctx context.Context, logger *zap.Logger, port int, unitTestFlag bool,
if err != nil { if err != nil {
cLogger.Fatal("failed to start controller", zap.Error(err)) cLogger.Fatal("failed to start controller", zap.Error(err))
} }
api.Serve(ctx, port, openTracingEnabled) api.Serve(ctx, port)
} }
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"go.uber.org/zap" "go.uber.org/zap"
+5 -5
View File
@@ -28,8 +28,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/pkg/errors" "github.com/pkg/errors"
@@ -332,21 +332,21 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
} }
// get the pod with highest resource version // get the pod with highest resource version
err = getContainerLog(a.kubernetesClient, w, f, &pods[0]) err = getContainerLog(r.Context(), a.kubernetesClient, w, f, &pods[0])
if err != nil { if err != nil {
a.respondWithError(w, errors.Wrapf(err, "error getting container logs")) a.respondWithError(w, errors.Wrapf(err, "error getting container logs"))
return return
} }
} }
func getContainerLog(kubernetesClient kubernetes.Interface, w http.ResponseWriter, fn *fv1.Function, pod *apiv1.Pod) error { func getContainerLog(ctx context.Context, kubernetesClient kubernetes.Interface, w http.ResponseWriter, fn *fv1.Function, pod *apiv1.Pod) error {
seq := strings.Repeat("=", 35) seq := strings.Repeat("=", 35)
for _, container := range pod.Spec.Containers { for _, container := range pod.Spec.Containers {
podLogOpts := apiv1.PodLogOptions{Container: container.Name} // Only the env container, not fetcher podLogOpts := apiv1.PodLogOptions{Container: container.Name} // Only the env container, not fetcher
podLogsReq := kubernetesClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.ObjectMeta.Name, &podLogOpts) podLogsReq := kubernetesClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.ObjectMeta.Name, &podLogOpts)
podLogs, err := podLogsReq.Stream(context.Background()) podLogs, err := podLogsReq.Stream(ctx)
if err != nil { if err != nil {
return errors.Wrapf(err, "error streaming pod log") return errors.Wrapf(err, "error streaming pod log")
} }
+3 -3
View File
@@ -24,8 +24,8 @@ import (
"net/http" "net/http"
"sort" "sort"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -134,7 +134,7 @@ func (a *API) checkHTTPTriggerDuplicates(ctx context.Context, t *fv1.HTTPTrigger
continue continue
} }
urlMatch := false urlMatch := false
if ht.Spec.RelativeURL == t.Spec.RelativeURL || (ht.Spec.Prefix != nil && t.Spec.Prefix != nil && *ht.Spec.Prefix != "" && *ht.Spec.Prefix == *t.Spec.Prefix) { if (ht.Spec.RelativeURL != "" && ht.Spec.RelativeURL == t.Spec.RelativeURL) || (ht.Spec.Prefix != nil && t.Spec.Prefix != nil && *ht.Spec.Prefix != "" && *ht.Spec.Prefix == *t.Spec.Prefix) {
urlMatch = true urlMatch = true
} }
methodMatch := false methodMatch := false
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+2 -2
View File
@@ -19,8 +19,8 @@ package controller
import ( import (
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
) )
+2 -2
View File
@@ -23,8 +23,8 @@ import (
"net/http" "net/http"
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"go.uber.org/zap" "go.uber.org/zap"
) )
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/robfig/cron" "github.com/robfig/cron"
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/emicklei/go-restful" restfulspec "github.com/emicklei/go-restful-openapi/v2"
restfulspec "github.com/emicklei/go-restful-openapi" restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
"github.com/gorilla/mux" "github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+3 -10
View File
@@ -28,7 +28,6 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap" "go.uber.org/zap"
fv1 "github.com/fission/fission/pkg/apis/core/v1" fv1 "github.com/fission/fission/pkg/apis/core/v1"
@@ -77,7 +76,7 @@ func (executor *Executor) getServiceForFunctionAPI(w http.ResponseWriter, r *htt
if err == nil { if err == nil {
// if a pod is already serving request then it already exists else validated // if a pod is already serving request then it already exists else validated
logger.Debug("from cache", zap.Int("active", active)) logger.Debug("from cache", zap.Int("active", active))
if active > 1 || et.IsValid(ctx, fsvc) { if et.IsValid(ctx, fsvc) {
// Cached, return svc address // Cached, return svc address
logger.Debug("served from cache", zap.String("name", fsvc.Name), zap.String("address", fsvc.Address)) logger.Debug("served from cache", zap.String("name", fsvc.Name), zap.String("address", fsvc.Address))
executor.writeResponse(w, fsvc.Address, fn.ObjectMeta.Name) executor.writeResponse(w, fsvc.Address, fn.ObjectMeta.Name)
@@ -263,14 +262,8 @@ func (executor *Executor) GetHandler() http.Handler {
} }
// Serve starts an HTTP server. // Serve starts an HTTP server.
func (executor *Executor) Serve(ctx context.Context, port int, openTracingEnabled bool) { func (executor *Executor) Serve(ctx context.Context, port int) {
var handler http.Handler handler := otelUtils.GetHandlerWithOTEL(executor.GetHandler(), "fission-executor", otelUtils.UrlsToIgnore("/healthz"))
if openTracingEnabled {
handler = &ochttp.Handler{Handler: executor.GetHandler()}
} else {
handler = otelUtils.GetHandlerWithOTEL(executor.GetHandler(), "fission-executor", otelUtils.UrlsToIgnore("/healthz"))
}
httpserver.StartServer(ctx, executor.logger, "executor", fmt.Sprintf("%d", port), handler) httpserver.StartServer(ctx, executor.logger, "executor", fmt.Sprintf("%d", port), handler)
} }
-6
View File
@@ -27,13 +27,11 @@ import (
"github.com/hashicorp/go-retryablehttp" "github.com/hashicorp/go-retryablehttp"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap" "go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1" fv1 "github.com/fission/fission/pkg/apis/core/v1"
ferror "github.com/fission/fission/pkg/error" ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/utils/tracing"
) )
type ( type (
@@ -57,10 +55,6 @@ type (
// MakeClient initializes and returns a Client instance. // MakeClient initializes and returns a Client instance.
func MakeClient(logger *zap.Logger, executorURL string) *Client { func MakeClient(logger *zap.Logger, executorURL string) *Client {
hc := retryablehttp.NewClient() hc := retryablehttp.NewClient()
if tracing.TracingEnabled(logger) {
hc.HTTPClient.Transport = &ochttp.Transport{Base: hc.HTTPClient.Transport}
}
c := &Client{ c := &Client{
logger: logger.Named("executor_client"), logger: logger.Named("executor_client"),
executorURL: strings.TrimSuffix(executorURL, "/"), executorURL: strings.TrimSuffix(executorURL, "/"),
+1 -1
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
+1 -1
View File
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
+16 -4
View File
@@ -28,6 +28,7 @@ import (
"github.com/dchest/uniuri" "github.com/dchest/uniuri"
"github.com/pkg/errors" "github.com/pkg/errors"
"go.uber.org/zap" "go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
k8sInformers "k8s.io/client-go/informers" k8sInformers "k8s.io/client-go/informers"
k8sCache "k8s.io/client-go/tools/cache" k8sCache "k8s.io/client-go/tools/cache"
@@ -252,7 +253,7 @@ func (executor *Executor) getFunctionServiceFromCache(ctx context.Context, fn *f
// StartExecutor Starts executor and the executor components such as Poolmgr, // StartExecutor Starts executor and the executor components such as Poolmgr,
// deploymgr and potential future executor types // deploymgr and potential future executor types
func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace string, envBuilderNamespace string, port int, openTracingEnabled bool) error { func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace string, envBuilderNamespace string, port int) error {
fissionClient, kubernetesClient, _, metricsClient, err := crd.MakeFissionClient() fissionClient, kubernetesClient, _, metricsClient, err := crd.MakeFissionClient()
if err != nil { if err != nil {
return errors.Wrap(err, "failed to get kubernetes client") return errors.Wrap(err, "failed to get kubernetes client")
@@ -270,6 +271,17 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
executorInstanceID := strings.ToLower(uniuri.NewLen(8)) executorInstanceID := strings.ToLower(uniuri.NewLen(8))
var podSpecPatch *apiv1.PodSpec
namespace, err := utils.GetCurrentNamespace()
if err != nil {
logger.Warn("Current namespace not found %s", zap.Error(err))
} else {
podSpecPatch, err = util.GetSpecFromConfigMap(ctx, kubernetesClient, fv1.RuntimePodSpecConfigmap, namespace)
if err != nil {
logger.Warn("Either configmap is not found or error reading data %v", zap.Error(err))
}
}
logger.Info("Starting executor", zap.String("instanceID", executorInstanceID)) logger.Info("Starting executor", zap.String("instanceID", executorInstanceID))
informerFactory := genInformer.NewSharedInformerFactory(fissionClient, time.Minute*30) informerFactory := genInformer.NewSharedInformerFactory(fissionClient, time.Minute*30)
@@ -288,7 +300,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient, metricsClient, fissionClient, kubernetesClient, metricsClient,
functionNamespace, fetcherConfig, executorInstanceID, functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, pkgInformer, envInformer, funcInformer, pkgInformer, envInformer,
gpmPodInformer, gpmRsInformer) gpmPodInformer, gpmRsInformer, podSpecPatch)
if err != nil { if err != nil {
return errors.Wrap(err, "pool manager creation failed") return errors.Wrap(err, "pool manager creation failed")
} }
@@ -304,7 +316,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient, fissionClient, kubernetesClient,
functionNamespace, fetcherConfig, executorInstanceID, functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, envInformer, funcInformer, envInformer,
ndmDeplInformer, ndmSvcInformer) ndmDeplInformer, ndmSvcInformer, podSpecPatch)
if err != nil { if err != nil {
return errors.Wrap(err, "new deploy manager creation failed") return errors.Wrap(err, "new deploy manager creation failed")
} }
@@ -371,7 +383,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
} }
go reaper.CleanupRoleBindings(ctx, logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30) go reaper.CleanupRoleBindings(ctx, logger, kubernetesClient, fissionClient, functionNamespace, envBuilderNamespace, time.Minute*30)
go metrics.ServeMetrics(ctx, logger) go metrics.ServeMetrics(ctx, logger)
go api.Serve(ctx, port, openTracingEnabled) go api.Serve(ctx, port)
return nil return nil
} }
+1 -1
View File
@@ -174,7 +174,7 @@ func TestExecutor(t *testing.T) {
// create poolmgr // create poolmgr
port := 9999 port := 9999
ctx := context.Background() ctx := context.Background()
err = StartExecutor(ctx, logger, functionNs, "fission-builder", port, true) err = StartExecutor(ctx, logger, functionNs, "fission-builder", port)
if err != nil { if err != nil {
log.Panicf("failed to start poolmgr: %v", err) log.Panicf("failed to start poolmgr: %v", err)
} }
@@ -34,6 +34,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
k8sTypes "k8s.io/apimachinery/pkg/types" k8sTypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1" appsinformers "k8s.io/client-go/informers/apps/v1"
coreinformers "k8s.io/client-go/informers/core/v1" coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
@@ -141,7 +142,7 @@ func (caaf *Container) Run(ctx context.Context) {
if ok := k8sCache.WaitForCacheSync(ctx.Done(), caaf.deplListerSynced, caaf.svcListerSynced); !ok { if ok := k8sCache.WaitForCacheSync(ctx.Done(), caaf.deplListerSynced, caaf.svcListerSynced); !ok {
caaf.logger.Fatal("failed to wait for caches to sync") caaf.logger.Fatal("failed to wait for caches to sync")
} }
go caaf.idleObjectReaper() go caaf.idleObjectReaper(ctx)
} }
// GetTypeName returns the executor type name. // GetTypeName returns the executor type name.
@@ -168,7 +169,7 @@ func (caaf *Container) GetFuncSvc(ctx context.Context, fn *fv1.Function) (*fscac
// GetFuncSvcFromCache returns a function service from cache; error otherwise. // GetFuncSvcFromCache returns a function service from cache; error otherwise.
func (caaf *Container) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) { func (caaf *Container) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
otelUtils.SpanTrackEvent(ctx, "GetFuncSvcFromCache", otelUtils.GetAttributesForFunction(fn)...) otelUtils.SpanTrackEvent(ctx, "GetFuncSvcFromCache", otelUtils.GetAttributesForFunction(fn)...)
return caaf.fsCache.GetByFunction(&fn.ObjectMeta) return caaf.fsCache.GetByFunctionUID(fn.UID)
} }
// DeleteFuncSvcFromCache deletes a function service from cache. // DeleteFuncSvcFromCache deletes a function service from cache.
@@ -703,73 +704,71 @@ func (caaf *Container) updateStatus(fn *fv1.Function, err error, message string)
} }
// idleObjectReaper reaps objects after certain idle time // idleObjectReaper reaps objects after certain idle time
func (caaf *Container) idleObjectReaper() { func (caaf *Container) idleObjectReaper(ctx context.Context) {
ctx := context.Background() // calling function doIdleObjectReaper() repeatedly at given interval of time
wait.UntilWithContext(ctx, caaf.doIdleObjectReaper, time.Second*5)
}
pollSleep := 5 * time.Second func (caaf *Container) doIdleObjectReaper(ctx context.Context) {
for { funcSvcs, err := caaf.fsCache.ListOld(time.Second * 5)
time.Sleep(pollSleep) if err != nil {
caaf.logger.Error("error reaping idle pods", zap.Error(err))
return
}
funcSvcs, err := caaf.fsCache.ListOld(pollSleep) for i := range funcSvcs {
if err != nil { fsvc := funcSvcs[i]
caaf.logger.Error("error reaping idle pods", zap.Error(err))
if fsvc.Executor != fv1.ExecutorTypeContainer {
continue continue
} }
for i := range funcSvcs { fn, err := caaf.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{})
fsvc := funcSvcs[i] if err != nil {
// CaaF manager handles the function delete event and clean cache/kubeobjs itself,
if fsvc.Executor != fv1.ExecutorTypeContainer { // so we ignore the not found error for functions with CaaF executor type here.
if k8sErrs.IsNotFound(err) && fsvc.Executor == fv1.ExecutorTypeContainer {
continue continue
} }
caaf.logger.Error("error getting function", zap.Error(err), zap.String("function", fsvc.Function.Name))
fn, err := caaf.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{}) continue
if err != nil {
// CaaF manager handles the function delete event and clean cache/kubeobjs itself,
// so we ignore the not found error for functions with CaaF executor type here.
if k8sErrs.IsNotFound(err) && fsvc.Executor == fv1.ExecutorTypeContainer {
continue
}
caaf.logger.Error("error getting function", zap.Error(err), zap.String("function", fsvc.Function.Name))
continue
}
idlePodReapTime := caaf.defaultIdlePodReapTime
if fn.Spec.IdleTimeout != nil {
idlePodReapTime = time.Duration(*fn.Spec.IdleTimeout) * time.Second
}
if time.Since(fsvc.Atime) < idlePodReapTime {
continue
}
go func() {
deployObj := getDeploymentObj(fsvc.KubernetesObjects)
if deployObj == nil {
caaf.logger.Error("error finding function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
currentDeploy, err := caaf.kubernetesClient.AppsV1().
Deployments(deployObj.Namespace).Get(ctx, deployObj.Name, metav1.GetOptions{})
if err != nil {
caaf.logger.Error("error getting function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
minScale := int32(fn.Spec.InvokeStrategy.ExecutionStrategy.MinScale)
// do nothing if the current replicas is already lower than minScale
if *currentDeploy.Spec.Replicas <= minScale {
return
}
err = caaf.scaleDeployment(ctx, deployObj.Namespace, deployObj.Name, minScale)
if err != nil {
caaf.logger.Error("error scaling down function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
}
}()
} }
idlePodReapTime := caaf.defaultIdlePodReapTime
if fn.Spec.IdleTimeout != nil {
idlePodReapTime = time.Duration(*fn.Spec.IdleTimeout) * time.Second
}
if time.Since(fsvc.Atime) < idlePodReapTime {
continue
}
go func() {
deployObj := getDeploymentObj(fsvc.KubernetesObjects)
if deployObj == nil {
caaf.logger.Error("error finding function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
currentDeploy, err := caaf.kubernetesClient.AppsV1().
Deployments(deployObj.Namespace).Get(ctx, deployObj.Name, metav1.GetOptions{})
if err != nil {
caaf.logger.Error("error getting function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
minScale := int32(fn.Spec.InvokeStrategy.ExecutionStrategy.MinScale)
// do nothing if the current replicas is already lower than minScale
if *currentDeploy.Spec.Replicas <= minScale {
return
}
err = caaf.scaleDeployment(ctx, deployObj.Namespace, deployObj.Name, minScale)
if err != nil {
caaf.logger.Error("error scaling down function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
}
}()
} }
} }
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
@@ -249,7 +249,7 @@ func (deploy *NewDeploy) getDeploymentSpec(ctx context.Context, fn *fv1.Function
Env: []apiv1.EnvVar{ Env: []apiv1.EnvVar{
{ {
Name: fv1.ResourceVersionCount, Name: fv1.ResourceVersionCount,
Value: fmt.Sprintf("%v", rvCount), Value: fmt.Sprintf("%d", rvCount),
}, },
}, },
// https://istio.io/docs/setup/kubernetes/additional-setup/requirements/ // https://istio.io/docs/setup/kubernetes/additional-setup/requirements/
@@ -278,6 +278,16 @@ func (deploy *NewDeploy) getDeploymentSpec(ctx context.Context, fn *fv1.Function
}, },
} }
if deploy.podSpecPatch != nil {
updatedPodSpec, err := util.MergePodSpec(&pod.Spec, deploy.podSpecPatch)
if err == nil {
pod.Spec = *updatedPodSpec
} else {
deploy.logger.Warn("Failed to merge the specs: %v", zap.Error(err))
}
}
pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec)) pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec))
deployment := &appsv1.Deployment{ deployment := &appsv1.Deployment{
@@ -35,6 +35,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
k8sTypes "k8s.io/apimachinery/pkg/types" k8sTypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1" appsinformers "k8s.io/client-go/informers/apps/v1"
coreinformers "k8s.io/client-go/informers/core/v1" coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
@@ -86,6 +87,8 @@ type (
svcListerSynced k8sCache.InformerSynced svcListerSynced k8sCache.InformerSynced
hpaops *hpautils.HpaOperations hpaops *hpautils.HpaOperations
podSpecPatch *apiv1.PodSpec
} }
) )
@@ -101,6 +104,7 @@ func MakeNewDeploy(
envInformer finformerv1.EnvironmentInformer, envInformer finformerv1.EnvironmentInformer,
deplInformer appsinformers.DeploymentInformer, deplInformer appsinformers.DeploymentInformer,
svcInformer coreinformers.ServiceInformer, svcInformer coreinformers.ServiceInformer,
podSpecPatch *apiv1.PodSpec,
) (executortype.ExecutorType, error) { ) (executortype.ExecutorType, error) {
enableIstio := false enableIstio := false
if len(os.Getenv("ENABLE_ISTIO")) > 0 { if len(os.Getenv("ENABLE_ISTIO")) > 0 {
@@ -129,6 +133,8 @@ func MakeNewDeploy(
defaultIdlePodReapTime: 2 * time.Minute, defaultIdlePodReapTime: 2 * time.Minute,
hpaops: hpautils.NewHpaOperations(logger, kubernetesClient, instanceID), hpaops: hpautils.NewHpaOperations(logger, kubernetesClient, instanceID),
podSpecPatch: podSpecPatch,
} }
nd.deplLister = deplInformer.Lister() nd.deplLister = deplInformer.Lister()
@@ -164,7 +170,7 @@ func (deploy *NewDeploy) GetFuncSvc(ctx context.Context, fn *fv1.Function) (*fsc
// GetFuncSvcFromCache returns a function service from cache; error otherwise. // GetFuncSvcFromCache returns a function service from cache; error otherwise.
func (deploy *NewDeploy) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) { func (deploy *NewDeploy) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
otelUtils.SpanTrackEvent(ctx, "GetFuncSvcFromCache") otelUtils.SpanTrackEvent(ctx, "GetFuncSvcFromCache")
return deploy.fsCache.GetByFunction(&fn.ObjectMeta) return deploy.fsCache.GetByFunctionUID(fn.UID)
} }
// DeleteFuncSvcFromCache deletes a function service from cache. // DeleteFuncSvcFromCache deletes a function service from cache.
@@ -258,13 +264,13 @@ func (deploy *NewDeploy) RefreshFuncPods(ctx context.Context, logger *zap.Logger
// Ideally there should be only one deployment but for now we rely on label/selector to ensure that condition // Ideally there should be only one deployment but for now we rely on label/selector to ensure that condition
for _, deployment := range dep.Items { for _, deployment := range dep.Items {
rvCount, err := referencedResourcesRVSum(ctx, deploy.kubernetesClient, deployment.Namespace, f.Spec.Secrets, f.Spec.ConfigMaps) rvCount, err := referencedResourcesRVSum(ctx, deploy.kubernetesClient, f.ObjectMeta.Namespace, f.Spec.Secrets, f.Spec.ConfigMaps)
if err != nil { if err != nil {
return err return err
} }
patch := fmt.Sprintf(`{"spec" : {"template": {"spec":{"containers":[{"name": "%s", "env":[{"name": "%s", "value": "%v"}]}]}}}}`, patch := fmt.Sprintf(`{"spec" : {"template": {"spec":{"containers":[{"name": "%s", "image": "%s", "env":[{"name": "%s", "value": "%d"}]}]}}}}`,
f.ObjectMeta.Name, fv1.ResourceVersionCount, rvCount) env.ObjectMeta.Name, env.Spec.Runtime.Image, fv1.ResourceVersionCount, rvCount)
_, err = deploy.kubernetesClient.AppsV1().Deployments(deployment.ObjectMeta.Namespace).Patch(ctx, deployment.ObjectMeta.Name, _, err = deploy.kubernetesClient.AppsV1().Deployments(deployment.ObjectMeta.Namespace).Patch(ctx, deployment.ObjectMeta.Name,
k8sTypes.StrategicMergePatchType, k8sTypes.StrategicMergePatchType,
@@ -588,6 +594,7 @@ func (deploy *NewDeploy) updateFunction(ctx context.Context, oldFn *fv1.Function
if oldFn.Spec.Environment != newFn.Spec.Environment || if oldFn.Spec.Environment != newFn.Spec.Environment ||
oldFn.Spec.Package.PackageRef != newFn.Spec.Package.PackageRef || oldFn.Spec.Package.PackageRef != newFn.Spec.Package.PackageRef ||
oldFn.Spec.Package.FunctionName != newFn.Spec.Package.FunctionName { oldFn.Spec.Package.FunctionName != newFn.Spec.Package.FunctionName {
deploy.logger.Debug("deployment changed", zap.String("msg", "deployment changed"))
deployChanged = true deployChanged = true
} }
@@ -761,88 +768,87 @@ func (deploy *NewDeploy) updateStatus(fn *fv1.Function, err error, message strin
// idleObjectReaper reaps objects after certain idle time // idleObjectReaper reaps objects after certain idle time
func (deploy *NewDeploy) idleObjectReaper(ctx context.Context) { func (deploy *NewDeploy) idleObjectReaper(ctx context.Context) {
pollSleep := 5 * time.Second // calling function doIdleObjectReaper() repeatedly at given interval of time
for { wait.UntilWithContext(ctx, deploy.doIdleObjectReaper, time.Second*5)
time.Sleep(pollSleep) }
envs, err := deploy.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{}) func (deploy *NewDeploy) doIdleObjectReaper(ctx context.Context) {
if err != nil { envs, err := deploy.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
deploy.logger.Fatal("failed to get environment list", zap.Error(err)) if err != nil {
} deploy.logger.Fatal("failed to get environment list", zap.Error(err))
}
envList := make(map[k8sTypes.UID]struct{}) envList := make(map[k8sTypes.UID]struct{})
for _, env := range envs.Items { for _, env := range envs.Items {
envList[env.ObjectMeta.UID] = struct{}{} envList[env.ObjectMeta.UID] = struct{}{}
} }
funcSvcs, err := deploy.fsCache.ListOld(pollSleep) funcSvcs, err := deploy.fsCache.ListOld(time.Second * 5)
if err != nil { if err != nil {
deploy.logger.Error("error reaping idle pods", zap.Error(err)) deploy.logger.Error("error reaping idle pods", zap.Error(err))
return
}
for i := range funcSvcs {
fsvc := funcSvcs[i]
if fsvc.Executor != fv1.ExecutorTypeNewdeploy {
continue continue
} }
for i := range funcSvcs { // For function with the environment that no longer exists, executor
fsvc := funcSvcs[i] // scales down the deployment as usual and prints log to notify user.
if _, ok := envList[fsvc.Environment.ObjectMeta.UID]; !ok {
if fsvc.Executor != fv1.ExecutorTypeNewdeploy { deploy.logger.Warn("function environment no longer exists",
continue zap.String("environment", fsvc.Environment.ObjectMeta.Name),
} zap.String("function", fsvc.Name))
// For function with the environment that no longer exists, executor
// scales down the deployment as usual and prints log to notify user.
if _, ok := envList[fsvc.Environment.ObjectMeta.UID]; !ok {
deploy.logger.Warn("function environment no longer exists",
zap.String("environment", fsvc.Environment.ObjectMeta.Name),
zap.String("function", fsvc.Name))
}
fn, err := deploy.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{})
if err != nil {
// Newdeploy manager handles the function delete event and clean cache/kubeobjs itself,
// so we ignore the not found error for functions with newdeploy executor type here.
if k8sErrs.IsNotFound(err) && fsvc.Executor == fv1.ExecutorTypeNewdeploy {
continue
}
deploy.logger.Error("error getting function", zap.Error(err), zap.String("function", fsvc.Function.Name))
continue
}
idlePodReapTime := deploy.defaultIdlePodReapTime
if fn.Spec.IdleTimeout != nil {
idlePodReapTime = time.Duration(*fn.Spec.IdleTimeout) * time.Second
}
if time.Since(fsvc.Atime) < idlePodReapTime {
continue
}
go func() {
deployObj := getDeploymentObj(fsvc.KubernetesObjects)
if deployObj == nil {
deploy.logger.Error("error finding function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
currentDeploy, err := deploy.kubernetesClient.AppsV1().
Deployments(deployObj.Namespace).Get(ctx, deployObj.Name, metav1.GetOptions{})
if err != nil {
deploy.logger.Error("error getting function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
minScale := int32(fn.Spec.InvokeStrategy.ExecutionStrategy.MinScale)
// do nothing if the current replicas is already lower than minScale
if *currentDeploy.Spec.Replicas <= minScale {
return
}
err = deploy.scaleDeployment(ctx, deployObj.Namespace, deployObj.Name, minScale)
if err != nil {
deploy.logger.Error("error scaling down function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
}
}()
} }
fn, err := deploy.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{})
if err != nil {
// Newdeploy manager handles the function delete event and clean cache/kubeobjs itself,
// so we ignore the not found error for functions with newdeploy executor type here.
if k8sErrs.IsNotFound(err) && fsvc.Executor == fv1.ExecutorTypeNewdeploy {
continue
}
deploy.logger.Error("error getting function", zap.Error(err), zap.String("function", fsvc.Function.Name))
continue
}
idlePodReapTime := deploy.defaultIdlePodReapTime
if fn.Spec.IdleTimeout != nil {
idlePodReapTime = time.Duration(*fn.Spec.IdleTimeout) * time.Second
}
if time.Since(fsvc.Atime) < idlePodReapTime {
continue
}
go func() {
deployObj := getDeploymentObj(fsvc.KubernetesObjects)
if deployObj == nil {
deploy.logger.Error("error finding function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
currentDeploy, err := deploy.kubernetesClient.AppsV1().
Deployments(deployObj.Namespace).Get(ctx, deployObj.Name, metav1.GetOptions{})
if err != nil {
deploy.logger.Error("error getting function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
return
}
minScale := int32(fn.Spec.InvokeStrategy.ExecutionStrategy.MinScale)
// do nothing if the current replicas is already lower than minScale
if *currentDeploy.Spec.Replicas <= minScale {
return
}
err = deploy.scaleDeployment(ctx, deployObj.Namespace, deployObj.Name, minScale)
if err != nil {
deploy.logger.Error("error scaling down function deployment", zap.Error(err), zap.String("function", fsvc.Function.Name))
}
}()
} }
} }

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