Compare commits

...
59 Commits
Author SHA1 Message Date
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
Ankit ChawlaandGitHub ed1e4a5cf0 Updated keda image versions (#2433) 2022-05-24 12:51:02 +05:30
Sanket SudakeandGitHub 3cf7dc89b9 Update helm chart version to v1.16.0 (#2432)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-05-24 12:34:21 +05:30
Sanket SudakeandGitHub 69c1aab14a Update changelog for 1.16.0-rc2 (#2427)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-05-11 15:23:21 +05:30
228 changed files with 22740 additions and 6124 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. -->
<pre>
$ fission --version
$ fission version
$ kubectl version
</pre>
+9 -10
View File
@@ -3,14 +3,14 @@ name: Code Scanning
on:
push:
branches:
- master
- main
paths:
- '**.go'
- go.mod
- go.sum
pull_request:
branches:
- master
- main
paths:
- '**.go'
- go.mod
@@ -25,19 +25,18 @@ jobs:
steps:
- 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:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: "go.mod"
cache: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: go
- 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:
push:
branches:
- master
- main
paths:
- '**.go'
- "**.go"
- go.mod
- go.sum
pull_request:
branches:
- master
- main
paths:
- '**.go'
- "**.go"
- go.mod
- go.sum
workflow_dispatch:
env:
GOLANGCI_LINT_VERSION: v1.49.0
GOLANGCI_LINT_TIMEOUT: 5m
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- 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:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: "go.mod"
cache: true
- name: Verify dependencies
run: |
go mod verify
go mod download
LINT_VERSION=1.45.0
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
tar xz --strip-components 1 --wildcards \*/golangci-lint
mkdir -p bin && mv golangci-lint bin/
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
- name: Run checks
- name: Detect git changes
if: always()
run: |
STATUS=0
assert-nothing-changed() {
local diff
"$@" >/dev/null || return 1
if ! diff="$(git diff -U1 --color --exit-code)"; then
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
git checkout -- .
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
if [[ $(git diff --stat) != '' ]]; then
echo -e '❌ \033[0;31m. Fix lint changes.\033[0m'
git diff --color
exit 1
else
echo '✔ No issues detected. Have a nice day :-)'
fi
- name: Run unit tests
run: ./hack/runtests.sh
+17 -19
View File
@@ -3,7 +3,7 @@ name: Fission CI
on:
push:
branches:
- master
- main
paths:
- "**.go"
- "charts/**"
@@ -12,7 +12,7 @@ on:
- go.sum
pull_request:
branches:
- master
- main
paths:
- "**.go"
- "charts/**"
@@ -21,6 +21,10 @@ on:
- go.sum
workflow_dispatch:
env:
HELM_VERSION: v3.9.0
KIND_VERSION: v0.14.0
jobs:
# Job to run change detection
integration-test:
@@ -28,40 +32,34 @@ jobs:
strategy:
fail-fast: false
matrix:
kindversion: ["v1.19.11", "v1.20.7", "v1.21.1"]
kindversion: ["v1.19.16", "v1.20.15", "v1.21.12"]
os: [ubuntu-latest]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.18.1
go-version-file: "go.mod"
cache: true
- name: Checkout sources
uses: actions/checkout@v2.3.4
- name: Checkout sources
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3
with:
repository: fission/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
uses: Azure/setup-helm@v1
uses: Azure/setup-helm@v3
with:
version: v3.3.4
version: ${{ env.HELM_VERSION }}
- name: Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
image: kindest/node:${{ matrix.kindversion }}
version: v0.11.1
version: ${{ env.KIND_VERSION }}
config: kind.yaml
- name: Configuring and testing the Installation
+62
View File
@@ -0,0 +1,62 @@
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: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release
env:
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:
push:
branches:
- master
- main
paths:
- '**.go'
- 'charts/**'
- 'test/**'
- "**.go"
- "charts/**"
- "test/**"
- go.mod
- go.sum
pull_request:
branches:
- master
- main
paths:
- '**.go'
- 'charts/**'
- 'test/**'
- "**.go"
- "charts/**"
- "test/**"
- go.mod
- go.sum
workflow_dispatch:
env:
HELM_VERSION: v3.9.0
KIND_VERSION: v0.14.0
jobs:
upgrade-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
kindimage : [ 'kindest/node:v1.19.11' ]
os: [ ubuntu-latest ]
kindimage: ["kindest/node:v1.19.16"]
os: [ubuntu-latest]
steps:
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.18.1
- name: Checkout action sources
uses: actions/checkout@v3
- name: Checkout action sources
uses: actions/checkout@v2.3.4
- name: Setup go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Helm
uses: Azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Setup Helm
uses: Azure/setup-helm@v1
with:
version: v3.3.4
- name: Setup Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
image: ${{ matrix.kindimage }}
version: ${{ env.KIND_VERSION }}
- name: Setup Kind Clutser
uses: engineerd/setup-kind@v0.5.0
with:
image: ${{ matrix.kindimage }}
version: v0.11.1
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
- name: Setup kubectl & fetch node information
run: |
kubectl cluster-info --context kind-kind
kubectl get nodes
kubectl get storageclasses.storage.k8s.io
- name: Setup kubectl & fetch node information
run: |
kubectl cluster-info --context kind-kind
kubectl get nodes
kubectl get storageclasses.storage.k8s.io
- name: Dump system info
run: |
source ./test/upgrade_test/fission_objects.sh dump_system_info
- name: Dump system info
run: |
source ./test/upgrade_test/fission_objects.sh dump_system_info
- name: Install and configure previous stable fission
run: |
source ./test/upgrade_test/fission_objects.sh install_stable_release \
&& create_fission_objects \
&& test_fission_objects
- name: Install and configure previous stable fission
run: |
source ./test/upgrade_test/fission_objects.sh install_stable_release \
&& create_fission_objects \
&& test_fission_objects
- name: Upgrade fission to latest
run: |
source ./test/upgrade_test/fission_objects.sh build_docker_images \
&& kind_image_load \
&& install_current_release \
&& install_fission_cli
- name: Upgrade fission to latest
run: |
source ./test/upgrade_test/fission_objects.sh build_docker_images \
&& kind_image_load \
&& install_current_release \
&& install_fission_cli
- name: Test previously created fission objects with new release
run: |
source ./test/upgrade_test/fission_objects.sh test_fission_objects
- name: Test previously created fission objects with new release
run: |
source ./test/upgrade_test/fission_objects.sh test_fission_objects
- name: Collect Fission Dump
if: ${{ always() }}
run: |
command -v fission && fission support dump
- name: Collect Fission Dump
if: ${{ always() }}
run: |
command -v fission && fission support dump
- name: Archive fission dump
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: fission-dump
path: fission-dump/*.zip
retention-days: 5
- name: Archive fission dump
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: fission-dump
path: fission-dump/*.zip
retention-days: 5
+2
View File
@@ -33,3 +33,5 @@ local/
build/
dist/
manifest/
.vscode/
coverage.txt
-4
View File
@@ -1,16 +1,13 @@
linters:
enable:
# Default linter
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
# Additional linters
- gofmt
- goimports
@@ -22,7 +19,6 @@ linters:
# - dogsled
# - dupl
# - gosec
# - ifshort
# - nilerr
# - prealloc
# - revive
+3 -4
View File
@@ -8,7 +8,6 @@ release:
header: |
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
Install Guide: https://fission.io/docs/installation/
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md
extra_files:
- glob: ./manifest/charts/*
- glob: ./manifest/yamls/*
@@ -27,9 +26,9 @@ builds:
- -X github.com/fission/fission/pkg/info.BuildDate={{.Date}}
- -X github.com/fission/fission/pkg/info.Version={{.Tag}}
gcflags:
- all=-trimpath={{.Env.PWD}}
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
asmflags:
- all=-trimpath={{.Env.PWD}}
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
env:
- CGO_ENABLED=0
goos:
@@ -258,7 +257,7 @@ docker_manifests:
- fission/reporter:latest-arm64
- fission/reporter:latest-armv7
changelog:
skip: true
skip: false
archives:
- id: fission
builds:
+1 -1
View File
@@ -1,7 +1,7 @@
pull_request_rules:
- name: Automatic merge on approval
conditions:
- base=master
- base=main
- "#approved-reviews-by>=1"
- label=ready-to-merge
- label!=hold-off-merging
+66 -1
View File
@@ -1,5 +1,70 @@
# 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)
[Full Changelog](https://github.com/fission/fission/compare/v1.16.0-rc1...v1.16.0-rc2)
**Merged pull requests:**
- Added service monitors for components whose metrics are exposed [\#2424](https://github.com/fission/fission/pull/2424) ([blackfly19](https://github.com/blackfly19))
- Add support for custom metrics for HPA [\#2423](https://github.com/fission/fission/pull/2423) ([sanketsudake](https://github.com/sanketsudake))
- Migrate HPA v1 to v2beta2 [\#2421](https://github.com/fission/fission/pull/2421) ([sanketsudake](https://github.com/sanketsudake))
- feat: 🎸 add runtime-env flags to the env update cmd [\#2420](https://github.com/fission/fission/pull/2420) ([AetheWu](https://github.com/AetheWu))
- Use Clientset interface instead of type for Fission/kubernetes clients [\#2416](https://github.com/fission/fission/pull/2416) ([sanketsudake](https://github.com/sanketsudake))
- Fix namespace used in speciallized pod cleanup [\#2415](https://github.com/fission/fission/pull/2415) ([sanketsudake](https://github.com/sanketsudake))
- Add http retries in executor client with go-retryablehttp [\#2414](https://github.com/fission/fission/pull/2414) ([sanketsudake](https://github.com/sanketsudake))
- Check active request before decrease in functionCache [\#2413](https://github.com/fission/fission/pull/2413) ([sanketsudake](https://github.com/sanketsudake))
- Removed demo, documentations & updated Readme [\#2411](https://github.com/fission/fission/pull/2411) ([techmaharaj](https://github.com/techmaharaj))
- Created separate file for authmiddleware fn [\#2410](https://github.com/fission/fission/pull/2410) ([blackfly19](https://github.com/blackfly19))
- Use common httpserver across fission [\#2409](https://github.com/fission/fission/pull/2409) ([sanketsudake](https://github.com/sanketsudake))
- Optimize port forward in fission CLI by waiting on ready channel [\#2405](https://github.com/fission/fission/pull/2405) ([sanketsudake](https://github.com/sanketsudake))
- Remove deprecated Fission Azure Storage Queue connector [\#2404](https://github.com/fission/fission/pull/2404) ([sanketsudake](https://github.com/sanketsudake))
- Remove deprecated Fission Nats connector [\#2403](https://github.com/fission/fission/pull/2403) ([sanketsudake](https://github.com/sanketsudake))
- Avoid tapservice call to executor with empty URL [\#2402](https://github.com/fission/fission/pull/2402) ([sanketsudake](https://github.com/sanketsudake))
- Added metrics for fission mqtrigger and optimizations in trigger subscriptions [\#2399](https://github.com/fission/fission/pull/2399) ([blackfly19](https://github.com/blackfly19))
- Prometheus metrics improvements [\#2398](https://github.com/fission/fission/pull/2398) ([blackfly19](https://github.com/blackfly19))
- Go version 1.18 update [\#2395](https://github.com/fission/fission/pull/2395) ([sanketsudake](https://github.com/sanketsudake))
- Fixing gcp connector name typo [\#2393](https://github.com/fission/fission/pull/2393) ([blackfly19](https://github.com/blackfly19))
- Upgraded alpine version to 3.15 [\#2391](https://github.com/fission/fission/pull/2391) ([blackfly19](https://github.com/blackfly19))
- Fixed poolmgr pod naming error [\#2385](https://github.com/fission/fission/pull/2385) ([blackfly19](https://github.com/blackfly19))
- Go1.17 [\#2381](https://github.com/fission/fission/pull/2381) ([sanketsudake](https://github.com/sanketsudake))
- Upgraded archiver [\#2378](https://github.com/fission/fission/pull/2378) ([blackfly19](https://github.com/blackfly19))
- Refactoring prometheus metrics and labels [\#2375](https://github.com/fission/fission/pull/2375) ([sanketsudake](https://github.com/sanketsudake))
- \[helm chart\] Remove prometheus chart dependency from Fission [\#2371](https://github.com/fission/fission/pull/2371) ([sanketsudake](https://github.com/sanketsudake))
- \[helm chart\] fission deployments resources [\#2370](https://github.com/fission/fission/pull/2370) ([carlosrmendes](https://github.com/carlosrmendes))
- feature: Added commandline flags to set env var on the runtime and builder containers [\#2369](https://github.com/fission/fission/pull/2369) ([praddy26](https://github.com/praddy26))
- Added imagepullsecrets to helm [\#2364](https://github.com/fission/fission/pull/2364) ([blackfly19](https://github.com/blackfly19))
## [v1.16.0-rc1](https://github.com/fission/fission/tree/v1.16.0-rc1) (2022-02-12)
[Full Changelog](https://github.com/fission/fission/compare/v1.15.1...v1.16.0-rc1)
@@ -239,7 +304,7 @@
- For fixing staticcheck issue [\#1652](https://github.com/fission/fission/pull/1652) ([vishal-biyani](https://github.com/vishal-biyani))
- Allow user to override nats-streaming image [\#1645](https://github.com/fission/fission/pull/1645) ([funkypenguin](https://github.com/funkypenguin))
- Allow user to define busybox image [\#1643](https://github.com/fission/fission/pull/1643) ([funkypenguin](https://github.com/funkypenguin))
- Python env changes for pip3 [\#1633](https://github.com/fission/fission/pull/1633) ([agiwalpooja20](https://github.com/agiwalpooja20))
- Python env changes for pip3 [\#1633](https://github.com/fission/fission/pull/1633) ([agiwalpooja20-zz](https://github.com/agiwalpooja20-zz))
- S3 backend for storage service [\#1629](https://github.com/fission/fission/pull/1629) ([vishal-biyani](https://github.com/vishal-biyani))
- Fixing verify-staticcheck.sh [\#1622](https://github.com/fission/fission/pull/1622) ([rajalokan](https://github.com/rajalokan))
- Added support for setting bodyParser limit param via environment variable [\#1618](https://github.com/fission/fission/pull/1618) ([therahulbhati](https://github.com/therahulbhati))
+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
code-checks:
hack/verify-gofmt.sh
hack/verify-govet.sh
hack/verify-staticcheck.sh
golangci-lint run
# run basic check scripts
test-run: code-checks
@@ -64,8 +62,11 @@ codegen:
@./hack/update-codegen.sh
### CRDs
generate-crds:
controller-gen crd:trivialVersions=false,preserveUnknownFields=false \
controller-gen-install:
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 \
output:crd:artifacts:config=crds/v1
@@ -89,7 +90,10 @@ generate-swagger-doc:
generate-cli-docs:
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 --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
+18 -2
View File
@@ -5,7 +5,7 @@
</p>
<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">
</a>
<a href="https://github.com/fission/fission/releases">
@@ -20,7 +20,7 @@
<a href="https://github.com/fission/fission/graphs/contributors">
<img alt="Fission contributors" src="https://img.shields.io/github/contributors/fission/fission">
</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">
</a>
<br>
@@ -60,6 +60,7 @@ Table of Contents
- [Getting Started](#getting-started)
- [Learn More](#learn-more)
- [Contributing](#contributing)
- [Who is using Fission?](#who-is-using-fission)
- [Sponsors](#sponsors)
- [License](#license)
@@ -108,6 +109,21 @@ aggregation &mdash; also helps with ops on your Fission deployment.
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
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
name: fission-all
version: v1.16.0-rc2
appVersion: v1.16.0-rc2
version: v1.17.0-rc2
appVersion: v1.17.0-rc2
description: Fission is a fast serverless framework for Kubernetes.
home: https://fission.io/
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
value: "{{ .Values.openTelemetry.propagators }}"
{{- 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/port: "8080"
spec:
{{- if .Values.buildermgr.securityContext.enabled }}
securityContext: {{- omit .Values.buildermgr.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: buildermgr
image: {{ include "fission-bundleImage" . | quote }}
@@ -52,7 +55,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }}
- name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
ports:
- 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/port: "8080"
spec:
{{- if .Values.controller.securityContext.enabled }}
securityContext: {{- omit .Values.controller.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: controller
image: {{ include "fission-bundleImage" . | quote }}
@@ -39,7 +42,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.controller.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
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: {{ $.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/port: "8080"
spec:
{{- if .Values.executor.securityContext.enabled }}
securityContext: {{- omit .Values.executor.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: executor
image: {{ include "fission-bundleImage" . | quote }}
@@ -56,7 +59,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }}
- name: HELM_RELEASE_NAME
value: {{ .Release.Name | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.executor.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
@@ -118,8 +118,6 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OPENTRACING_ENABLED
value: {{ .Values.openTracing.enabled | default false | quote }}
command: ["/fission-bundle"]
args: ["--logger"]
volumeMounts:
@@ -161,8 +159,6 @@ spec:
key: password
- name: LOG_PATH
value: /var/log/fission/*.log
- name: OPENTRACING_ENABLED
value: {{ .Values.openTracing.enabled | default false | quote }}
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
@@ -15,6 +15,9 @@ spec:
labels:
svc: kubewatcher
spec:
{{- if .Values.kubewatcher.securityContext.enabled }}
securityContext: {{- omit .Values.kubewatcher.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: kubewatcher
image: {{ include "fission-bundleImage" . | quote }}
@@ -26,7 +29,6 @@ spec:
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.kubewatcher.resources | nindent 10 }}
@@ -33,6 +33,9 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
ports:
- containerPort: 8080
name: metrics
env:
- name: MESSAGE_QUEUE_TYPE
value: kafka
@@ -44,7 +47,6 @@ spec:
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
# TLS authentication is TLS with authentication (2 way)
# 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 }}"
- name: STAN_IMAGE
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
value: "{{ .Values.mqt_keda.connector_images.gcp_pubsub.image }}:{{ .Values.mqt_keda.connector_images.gcp_pubsub.tag }}"
- name: REDIS_IMAGE
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 }}
resources:
{{- toYaml .Values.mqt_keda.resources | nindent 10 }}
@@ -28,6 +28,9 @@ spec:
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
{{- if .Values.router.securityContext.enabled }}
securityContext: {{- omit .Values.router.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: router
image: {{ include "fission-bundleImage" . | quote }}
@@ -80,7 +83,6 @@ spec:
value: {{ .Values.pprof.enabled | quote }}
- name: DISPLAY_ACCESS_LOG
value: {{ .Values.router.displayAccessLog | default false | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.router.resources | nindent 10 }}
@@ -6,6 +6,10 @@ metadata:
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
@@ -22,6 +22,9 @@ spec:
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
spec:
{{- if .Values.storagesvc.securityContext.enabled }}
securityContext: {{- omit .Values.storagesvc.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: storagesvc
image: {{ include "fission-bundleImage" . | quote }}
@@ -33,8 +36,12 @@ spec:
args: ["--storageServicePort", "8000", "--storageType", "local"]
{{- end }}
env:
- name: PRUNE_ENABLED
value: "{{.Values.storagesvc.archivePruner.enabled}}"
{{- if .Values.storagesvc.archivePruner.enabled }}
- name: PRUNE_INTERVAL
value: "{{.Values.pruneInterval}}"
value: "{{.Values.storagesvc.archivePruner.interval}}"
{{- end }}
- name: DEBUG_ENV
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
@@ -53,7 +60,6 @@ spec:
- name: STORAGE_S3_REGION
value: {{ .Values.persistence.s3.region }}
{{- end }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.storagesvc.resources | nindent 10 }}
@@ -5,7 +5,11 @@ metadata:
name: storagesvc-monitor
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
{{- end }}
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
@@ -15,6 +15,9 @@ spec:
labels:
svc: timer
spec:
{{- if .Values.timer.securityContext.enabled }}
securityContext: {{- omit .Values.timer.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: timer
image: {{ include "fission-bundleImage" . | quote }}
@@ -26,7 +29,6 @@ spec:
value: {{ .Values.debugEnv | quote }}
- name: PPROF_ENABLED
value: {{ .Values.pprof.enabled | quote }}
{{- include "opentracing.envs" . | indent 8 }}
{{- include "opentelemtry.envs" . | indent 8 }}
resources:
{{- toYaml .Values.timer.resources | nindent 10 }}
+181 -29
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.
## Keep it empty for using latest tag.
##
imageTag: v1.16.0-rc2
imageTag: v1.17.0-rc2
## 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: fission/fetcher
## imageTag represents the tag of the image of the fetcher component.
imageTag: v1.16.0-rc2
imageTag: v1.17.0-rc2
## Fetcher is only for to downloading or uploading archive.
## Normally, you don't need to change the value here, unless necessary.
@@ -143,6 +143,18 @@ executor:
##
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:
@@ -248,6 +260,18 @@ router:
##
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.
##
buildermgr:
@@ -262,6 +286,18 @@ buildermgr:
##
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.
## 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: {}
## 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:
@@ -291,6 +339,18 @@ kubewatcher:
##
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.
##
storagesvc:
@@ -305,6 +365,24 @@ storagesvc:
##
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
## It sends a request to router to invoke the function.
##
@@ -320,6 +398,18 @@ timer:
##
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:
@@ -362,11 +452,33 @@ kafka:
##
# version: "0.11.2.0"
# The following components expose Prometheus metrics and have servicemonitors in this chart (disabled by default)
# Controller, router, executor, storage svc
serviceMonitor:
enabled: false
##namespace in which you want to deploy servicemonitor
##
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.
##
@@ -389,7 +501,9 @@ persistence:
# accessKeyId: <awsAccessKeyId>
# secretAccessKey: <awsSecretAccessKey>
# region: <awsRegion>
## For Minio and other s3 compatible storage systems set endPoint property
# endPoint: <s3StorageUrl>
## A manually managed Persistent Volume Claim name
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
@@ -483,7 +597,6 @@ busyboxImage: busybox
## This interval configures the frequency at which it runs inside the storagesvc pod.
## The value is in minutes.
##
pruneInterval: 60
preUpgradeChecks:
## Run pre-install/pre-upgrade checks if true
@@ -494,7 +607,7 @@ preUpgradeChecks:
image: fission/pre-upgrade-checks
## pre-install/pre-upgrade checks image version
##
imageTag: v1.16.0-rc2
imageTag: v1.17.0-rc2
## Fission post-install/post-upgrade reporting live in this image
##
@@ -550,23 +663,6 @@ authentication:
##
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
## 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_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.
## See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration
##
tracesSampler: "parentbased_traceidratio"
## Each Sampler type defines its own expected input, if any.
@@ -607,6 +704,8 @@ openTelemetry:
## jaeger - Jaeger uber-trace-id header
## xray - AWS X-Ray (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"
@@ -617,25 +716,28 @@ mqt_keda:
connector_images:
kafka:
image: fission/keda-kafka-http-connector
tag: v0.9
tag: v0.11
rabbitmq:
image: fission/keda-rabbitmq-http-connector
tag: v0.8
tag: v0.10
awskinesis:
image: fission/keda-aws-kinesis-http-connector
tag: v0.8
tag: v0.10
aws_sqs:
image: fission/keda-aws-sqs-http-connector
tag: v0.8
tag: v0.10
nats_steaming:
image: fission/keda-nats-streaming-http-connector
tag: v0.9
tag: v0.12
nats_jetstream:
image: fission/keda-nats-jetstream-http-connector
tag: v0.2
gcp_pubsub:
image: fission/keda-gcp-pubsub-http-connector
tag: v0.3
tag: v0.5
redis:
image: fission/keda-redis-http-connector
tag: v0.1
tag: v0.3
## Pod resources as:
## resources:
@@ -652,3 +754,53 @@ mqt_keda:
##
pprof:
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
COPY builder /builder
ENTRYPOINT ["/builder"]
+1 -1
View File
@@ -38,7 +38,7 @@ func main() {
if os.IsNotExist(err) {
err = os.MkdirAll(shareVolume, os.ModeDir|0700)
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
COPY fetcher /
ENTRYPOINT ["/fetcher"]
+8 -24
View File
@@ -25,14 +25,12 @@ import (
"os"
"sync/atomic"
"go.opencensus.io/plugin/ochttp"
"go.opentelemetry.io/otel"
"go.uber.org/zap"
"github.com/fission/fission/pkg/fetcher"
"github.com/fission/fission/pkg/utils/httpserver"
otelUtils "github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/tracing"
)
var (
@@ -41,7 +39,6 @@ var (
func Run(ctx context.Context, logger *zap.Logger) {
flag.Usage = fetcherUsage
collectorEndpoint := flag.String("jaeger-collector-endpoint", "", "")
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")
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 {
go func() {
if err := tracing.RegisterTraceExporter(logger, *collectorEndpoint, "Fission-Fetcher"); err != nil {
logger.Fatal("could not register trace exporter", zap.Error(err), zap.String("collector_endpoint", *collectorEndpoint))
}
}()
} 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)
}
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")
@@ -129,12 +118,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
logger.Info("fetcher ready to receive requests")
var handler http.Handler
if openTracingEnabled {
handler = &ochttp.Handler{Handler: mux}
} else {
handler = otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
}
handler := otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
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
COPY 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/profile"
"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) {
controller.Start(ctx, logger, port, false, openTracingEnabled)
func runController(ctx context.Context, logger *zap.Logger, port int) {
controller.Start(ctx, logger, port, false)
}
func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string, openTracingEnabled bool) {
router.Start(ctx, logger, port, executorUrl, openTracingEnabled)
func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string) {
router.Start(ctx, logger, port, executorUrl)
}
func runExecutor(ctx context.Context, logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string, openTracingEnabled bool) error {
return executor.StartExecutor(ctx, logger, functionNamespace, envBuilderNamespace, port, openTracingEnabled)
func runExecutor(ctx context.Context, logger *zap.Logger, port int, functionNamespace, envBuilderNamespace string) error {
return executor.StartExecutor(ctx, logger, functionNamespace, envBuilderNamespace, port)
}
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)
}
func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage, openTracingEnabled bool) error {
return storagesvc.Start(ctx, logger, storage, port, openTracingEnabled)
func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage) error {
return storagesvc.Start(ctx, logger, storage, port)
}
func runBuilderMgr(ctx context.Context, logger *zap.Logger, storageSvcUrl string, envBuilderNamespace string) error {
@@ -210,22 +209,13 @@ Options:
return
}
openTracingEnabled := tracing.TracingEnabled(logger)
if openTracingEnabled {
err = tracing.RegisterTraceExporter(logger, os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT"), getServiceName(arguments))
if err != nil {
logger.Error("failed to register trace exporter", zap.Error(err), zap.Any("argument", arguments))
return
}
} 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)
}
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")
@@ -237,21 +227,21 @@ Options:
if arguments["--controllerPort"] != nil {
port := getPort(logger, arguments["--controllerPort"])
runController(ctx, logger, port, openTracingEnabled)
runController(ctx, logger, port)
logger.Error("controller exited")
return
}
if arguments["--routerPort"] != nil {
port := getPort(logger, arguments["--routerPort"])
runRouter(ctx, logger, port, executorUrl, openTracingEnabled)
runRouter(ctx, logger, port, executorUrl)
logger.Error("router exited")
return
}
if arguments["--executorPort"] != nil {
port := getPort(logger, arguments["--executorPort"])
err = runExecutor(ctx, logger, port, functionNs, envBuilderNs, openTracingEnabled)
err = runExecutor(ctx, logger, port, functionNs, envBuilderNs)
if err != nil {
logger.Error("executor exited", zap.Error(err))
return
@@ -314,7 +304,7 @@ Options:
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
storage = storagesvc.NewLocalStorage("/fission")
}
err := runStorageSvc(ctx, logger, port, storage, openTracingEnabled)
err := runStorageSvc(ctx, logger, port, storage)
if err != nil {
logger.Error("storage service exited", zap.Error(err))
return
+3 -2
View File
@@ -22,6 +22,7 @@ import (
wrapper "github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/cobra/helptemplate"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/fission-cli/cmd/archive"
"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/environment"
@@ -61,7 +62,7 @@ func App() *cobra.Command {
func(input cli.Input) error {
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
cmd.SetClientset(client.MakeFakeClientset(nil))
} else {
@@ -91,7 +92,7 @@ func App() *cobra.Command {
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("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("Deploy Strategies Commands", canaryconfig.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
COPY 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
COPY 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 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
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()
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 {
eventCmd := &cobra.Command{
Use: "event",
+6 -2
View File
@@ -17,14 +17,18 @@ limitations under the License.
package main
import (
"log"
"go.uber.org/zap"
"github.com/fission/fission/cmd/reporter/app"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
func main() {
logger := loggerfactory.GetLogger()
defer logger.Sync()
err := app.App().Execute()
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
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: canaryconfigs.fission.io
spec:
@@ -22,10 +21,14 @@ spec:
description: CanaryConfig is for canary deployment of two functions.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@@ -33,13 +36,15 @@ spec:
description: CanaryConfigSpec defines the canary configuration spec
properties:
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
failureType:
description: FailureType refers to the type of failure
type: string
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
newfunction:
description: New version of the function
@@ -73,9 +78,3 @@ spec:
type: object
served: 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
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: httptriggers.fission.io
spec:
@@ -19,21 +18,28 @@ spec:
- name: v1
schema:
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:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: 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:
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
functionref:
description: FunctionReference is a reference to the target function.
@@ -41,46 +47,64 @@ spec:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function name as key and its weight as the value. This is for canary upgrade purpose.
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is by name or selector. For now, the only supported reference type is by "name". Future reference types: * Function by label or annotation * Branch or tag of a versioned function * A "rolling upgrade" from one version of a function to another Available value: - name - function-weights'
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
type: string
required:
- name
- type
type: object
host:
description: 'TODO: remove this field since we have IngressConfig already Deprecated: the original idea of this field is not for setting Ingress. Since we have IngressConfig now, remove Host after couple releases.'
description: 'TODO: remove this field since we have IngressConfig
already Deprecated: the original idea of this field is not for setting
Ingress. Since we have IngressConfig now, remove Host after couple
releases.'
type: string
ingressconfig:
description: 'TODO: make IngressConfig an independent Fission resource IngressConfig for router to set up Ingress.'
description: 'TODO: make IngressConfig an independent Fission resource
IngressConfig for router to set up Ingress.'
properties:
annotations:
additionalProperties:
type: string
description: Annotations will be added to metadata when creating Ingress.
description: Annotations will be added to metadata when creating
Ingress.
nullable: true
type: object
host:
description: Host is for ingress controller to apply rules. If host is empty or "*", the rule applies to all inbound HTTP traffic.
description: Host is for ingress controller to apply rules. If
host is empty or "*", the rule applies to all inbound HTTP traffic.
type: string
path:
description: Path is for path matching. The format of path depends on what ingress controller you used.
description: Path is for path matching. The format of path depends
on what ingress controller you used.
type: string
tls:
description: TLS is for user to specify a Secret that contains TLS key and certificate. The domain name in the key and crt must match the value of Host field.
description: TLS is for user to specify a Secret that contains
TLS key and certificate. The domain name in the key and crt
must match the value of Host field.
type: string
type: object
keepPrefix:
description: When function is exposed with Prefix based path, keepPrefix decides whether to keep or trim prefix in URL while invoking function.
description: When function is exposed with Prefix based path, keepPrefix
decides whether to keep or trim prefix in URL while invoking function.
type: boolean
method:
description: Use Methods instead of Method. This field is going to be deprecated in a future release HTTP method to access a function.
description: Use Methods instead of Method. This field is going to
be deprecated in a future release HTTP method to access a function.
type: string
methods:
description: HTTP methods to access a function
@@ -88,10 +112,13 @@ spec:
type: string
type: array
prefix:
description: 'Prefix with which functions are exposed. NOTE: Prefix takes precedence over URL/RelativeURL. Note that it does not treat slashes specially ("/foobar/" will be matched by the prefix "/foobar").'
description: 'Prefix with which functions are exposed. NOTE: Prefix
takes precedence over URL/RelativeURL. Note that it does not treat
slashes specially ("/foobar/" will be matched by the prefix "/foobar").'
type: string
relativeurl:
description: RelativeURL is the exposed URL for external client to access a function with.
description: RelativeURL is the exposed URL for external client to
access a function with.
type: string
required:
- functionref
@@ -104,9 +131,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+20 -14
View File
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: kuberneteswatchtriggers.fission.io
spec:
@@ -19,13 +18,18 @@ spec:
- name: v1
schema:
openAPIV3Schema:
description: KubernetesWatchTrigger watches kubernetes resource events and invokes functions.
description: KubernetesWatchTrigger watches kubernetes resource events and
invokes functions.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
@@ -33,19 +37,27 @@ spec:
description: KubernetesWatchTriggerSpec defines spec of KuberenetesWatchTrigger
properties:
functionref:
description: The reference to a function for kubewatcher to invoke with when receiving events.
description: The reference to a function for kubewatcher to invoke
with when receiving events.
properties:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function name as key and its weight as the value. This is for canary upgrade purpose.
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is by name or selector. For now, the only supported reference type is by "name". Future reference types: * Function by label or annotation * Branch or tag of a versioned function * A "rolling upgrade" from one version of a function to another Available value: - name - function-weights'
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
type: string
required:
- name
@@ -74,9 +86,3 @@ spec:
storage: true
subresources:
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
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: packages.fission.io
spec:
@@ -24,44 +23,56 @@ spec:
description: Package Think of these as function-level images.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
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:
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
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:
checksum:
description: Checksum ensures the integrity of packages referenced by URL. Ignored for literals.
description: Checksum ensures the integrity of packages referenced
by URL. Ignored for literals.
properties:
sum:
type: string
type:
description: ChecksumType specifies the checksum algorithm, such as sha256, used for a checksum.
description: ChecksumType specifies the checksum algorithm,
such as sha256, used for a checksum.
type: string
type: object
literal:
description: Literal contents of the package. Can be used for 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
type: string
type:
description: 'Type defines how the package is specified: literal or URL. Available value: - literal - url'
description: 'Type defines how the package is specified: literal
or URL. Available value: - literal - url'
type: string
url:
description: URL references a package.
type: string
type: object
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:
name:
type: string
@@ -72,23 +83,30 @@ spec:
- namespace
type: object
source:
description: Source is the archive contains source code and dependencies file. If the package status is in PENDING state, builder manager will then notify builder to compile source and save the result as deployable archive.
description: Source is the archive contains source code and dependencies
file. If the package status is in PENDING state, builder manager
will then notify builder to compile source and save the result as
deployable archive.
properties:
checksum:
description: Checksum ensures the integrity of packages referenced by URL. Ignored for literals.
description: Checksum ensures the integrity of packages referenced
by URL. Ignored for literals.
properties:
sum:
type: string
type:
description: ChecksumType specifies the checksum algorithm, such as sha256, used for a checksum.
description: ChecksumType specifies the checksum algorithm,
such as sha256, used for a checksum.
type: string
type: object
literal:
description: Literal contents of the package. Can be used for 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
type: string
type:
description: 'Type defines how the package is specified: literal or URL. Available value: - literal - url'
description: 'Type defines how the package is specified: literal
or URL. Available value: - literal - url'
type: string
url:
description: URL references a package.
@@ -104,11 +122,13 @@ spec:
description: BuildLog stores build log during the compilation.
type: string
buildstatus:
default: Pending
default: pending
description: BuildStatus is the package build status.
type: string
lastUpdateTimestamp:
description: LastUpdateTimestamp will store the timestamp the package was last updated metav1.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. https://github.com/kubernetes/apimachinery/blob/44bd77c24ef93cd3a5eb6fef64e514025d10d44e/pkg/apis/meta/v1/time.go#L26-L35
description: LastUpdateTimestamp will store the timestamp the package
was last updated metav1.Time is a wrapper around time.Time which
supports correct marshaling to YAML and JSON. https://github.com/kubernetes/apimachinery/blob/44bd77c24ef93cd3a5eb6fef64e514025d10d44e/pkg/apis/meta/v1/time.go#L26-L35
format: date-time
nullable: true
type: string
@@ -119,9 +139,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+18 -13
View File
@@ -1,10 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: timetriggers.fission.io
spec:
@@ -22,15 +21,20 @@ spec:
description: TimeTrigger invokes functions based on given cron schedule.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TimeTriggerSpec invokes the specific function at a time or times specified by a cron string.
description: TimeTriggerSpec invokes the specific function at a time or
times specified by a cron string.
properties:
cron:
description: Cron schedule
@@ -41,14 +45,21 @@ spec:
functionweights:
additionalProperties:
type: integer
description: Function Reference by weight. this map contains function name as key and its weight as the value. This is for canary upgrade purpose.
description: Function Reference by weight. this map contains function
name as key and its weight as the value. This is for canary
upgrade purpose.
nullable: true
type: object
name:
description: Name of the function.
type: string
type:
description: 'Type indicates whether this function reference is by name or selector. For now, the only supported reference type is by "name". Future reference types: * Function by label or annotation * Branch or tag of a versioned function * A "rolling upgrade" from one version of a function to another Available value: - name - function-weights'
description: 'Type indicates whether this function reference is
by name or selector. For now, the only supported reference type
is by "name". Future reference types: * Function by label or
annotation * Branch or tag of a versioned function * A "rolling
upgrade" from one version of a function to another Available
value: - name - function-weights'
type: string
required:
- name
@@ -66,9 +77,3 @@ spec:
storage: true
subresources:
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
go 1.18
go 1.19
require (
contrib.go.opencensus.io/exporter/jaeger v0.2.1
github.com/Shopify/sarama v1.32.0
github.com/Shopify/sarama v1.36.0
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/dustin/go-humanize v1.0.0
github.com/emicklei/go-restful v2.15.0+incompatible
github.com/emicklei/go-restful-openapi v1.4.1
github.com/emicklei/go-restful-openapi/v2 v2.9.0
github.com/emicklei/go-restful/v3 v3.9.0
github.com/fatih/color v1.13.0
github.com/fsnotify/fsnotify v1.5.1
github.com/ghodss/yaml v1.0.0
github.com/fsnotify/fsnotify v1.5.4
github.com/go-git/go-git/v5 v5.4.2
github.com/go-openapi/spec v0.20.4
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/go-openapi/spec v0.20.7
github.com/golang-jwt/jwt/v4 v4.4.2
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-retryablehttp v0.7.1
github.com/imdario/mergo v0.3.12
github.com/influxdata/influxdb v1.9.6
github.com/imdario/mergo v0.3.13
github.com/influxdata/influxdb v1.10.0
github.com/mholt/archiver/v3 v3.5.1
github.com/minio/minio-go v6.0.14+incompatible
github.com/ory/dockertest v3.3.5+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/common v0.32.1
github.com/prometheus/client_golang v1.13.0
github.com/prometheus/common v0.37.0
github.com/robfig/cron v1.2.0
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/spf13/cobra v1.4.0
github.com/spf13/cobra v1.5.0
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
go.opencensus.io v0.23.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.29.0
go.opentelemetry.io/contrib/propagators/aws v1.4.0
go.opentelemetry.io/contrib/propagators/b3 v1.4.0
go.opentelemetry.io/contrib/propagators/jaeger v1.4.0
go.opentelemetry.io/contrib/propagators/ot v1.4.0
go.opentelemetry.io/otel v1.4.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1
go.opentelemetry.io/otel/sdk v1.4.1
go.opentelemetry.io/otel/trace v1.4.1
go.uber.org/zap v1.21.0
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
google.golang.org/grpc v1.45.0
k8s.io/api v0.23.4
k8s.io/apiextensions-apiserver v0.23.4
k8s.io/apimachinery v0.23.4
k8s.io/client-go v0.23.4
k8s.io/metrics v0.23.4
sigs.k8s.io/controller-runtime v0.10.2
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0
go.opentelemetry.io/contrib/propagators/autoprop v0.34.0
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0
go.opentelemetry.io/otel/sdk v1.9.0
go.opentelemetry.io/otel/trace v1.9.0
go.uber.org/zap v1.23.0
golang.org/x/net v0.0.0-20220812174116-3211cb980234
google.golang.org/grpc v1.48.0
k8s.io/api v0.25.0
k8s.io/apiextensions-apiserver v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/client-go v0.25.0
k8s.io/metrics v0.25.0
sigs.k8s.io/controller-runtime v0.13.0
sigs.k8s.io/yaml v1.3.0
)
require (
cloud.google.com/go v0.99.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // 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/andybalholm/brotli v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.42.34 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blend/go-sdk v1.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/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/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/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/eapache/go-resiliency v1.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/queue v1.1.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/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/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/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/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/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/googleapis/gnostic v0.5.5 // 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/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/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config 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/lib/pq v1.10.4 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
@@ -136,50 +128,49 @@ require (
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.0 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.8 // indirect
github.com/opencontainers/runc v1.1.2 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pmezard/go-difflib v1.0.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/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // 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/xanzy/ssh-agent v0.3.0 // 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/otel/internal/metric v0.27.0 // indirect
go.opentelemetry.io/otel/metric v0.27.0 // indirect
go.opentelemetry.io/proto/otlp v0.12.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
go.opentelemetry.io/contrib/propagators/aws v1.9.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.9.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.9.0 // indirect
go.opentelemetry.io/contrib/propagators/ot v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // 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/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220307203707-22a9840ba4d7 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
google.golang.org/api v0.62.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools v2.2.0+incompatible // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
+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.
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)
@@ -80,7 +80,7 @@ Before you save the release - UNCHECK the "This is a pre-release" checkbox. This
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
+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/
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
check_branch() {
curr_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$curr_branch" != "master" ]; then
echo "Not on master branch."
if [ "$curr_branch" != "main" ]; then
echo "Not on main branch."
exit 1
fi
echo "check_branch == PASSED"
@@ -39,14 +39,17 @@ check_clean() {
}
check_github_token() {
if [ ! -f "$HOME"/.github-token ]; then
echo "Error finding github access token at ${HOME}/.github-token"
if [ ! -f "$HOME"/.github-token ] && [ -z "$GITHUB_TOKEN" ]; then
echo "Error finding github access token at ${HOME}/.github-token or in GITHUB_TOKEN envvar"
exit 1
fi
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
if [ -z "$version" ]; then
@@ -66,6 +69,7 @@ check_github_token
export GORELEASER_CURRENT_TAG=$version
echo "Release version $GORELEASER_CURRENT_TAG "
echo "DOCKER_CLI_EXPERIMENTAL $DOCKER_CLI_EXPERIMENTAL"
goreleaser release
echo "############ DONE #############"
+5
View File
@@ -66,6 +66,11 @@ const (
StrategyTypeExecution = "execution"
)
const (
RuntimePodSpecConfigmap = "runtime-podspec-patch"
BuilderPodSpecConfigmap = "builder-podspec-patch"
)
const (
SharedVolumeUserfunc = "userfunc"
SharedVolumePackages = "packages"
-1
View File
@@ -21,7 +21,6 @@ limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +groupName=fission.io
// +groupGoName=core
//
package v1
const (
+2 -2
View File
@@ -304,7 +304,7 @@ type (
// is ready for deploy instead of setting "none" in build status.
// BuildStatus is the package build status.
// +kubebuilder:default:="Pending"
// +kubebuilder:default:="pending"
BuildStatus BuildStatus `json:"buildstatus,omitempty"`
// 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 {
return len(a.Literal) == 0 && len(a.URL) == 0
}
+26 -19
View File
@@ -38,8 +38,8 @@ import (
const (
// supported environment variables
envSrcPkg = "SRC_PKG"
envDeployPkg = "DEPLOY_PKG"
envSrcPkg string = "SRC_PKG"
envDeployPkg string = "DEPLOY_PKG"
)
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("starting build")
builder.logger.Debug("starting build")
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)
var buildArgs []string
buildCmd := req.BuildCommand
if len(buildCmd) == 0 {
// use default build command
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 {
e := "error building source package"
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)
if err != nil {
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
}
@@ -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) {
cmd := exec.Command(command)
func (builder *Builder) build(command string, args []string, srcPkgPath string, deployPkgPath string) (string, error) {
cmd := exec.Command(command, args...)
fi, err := os.Stat(srcPkgPath)
if err != nil {
@@ -178,8 +189,8 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
// set env variables for build command
cmd.Env = append(os.Environ(),
fmt.Sprintf("%v=%v", envSrcPkg, srcPkgPath),
fmt.Sprintf("%v=%v", envDeployPkg, deployPkgPath),
fmt.Sprintf("%s=%s", envSrcPkg, srcPkgPath),
fmt.Sprintf("%s=%s", envDeployPkg, deployPkgPath),
)
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")
}
var buildLogs string
fmt.Printf("\n=== Build Logs ===")
// Init logs
fmt.Printf("command=%v\n", command)
fmt.Printf("env=%v\n", cmd.Env)
builder.logger.Info("building source package", zap.String("command", command), zap.Strings("args", args), zap.Strings("env", cmd.Env))
out := io.MultiReader(stdout, stderr)
scanner := bufio.NewScanner(out)
@@ -206,12 +213,14 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
if err != nil {
return "", errors.Wrap(err, "error starting cmd")
}
fmt.Printf("========= START =========\n")
defer fmt.Printf("========= END ===========\n")
var buildLogs string
// Runtime logs
for scanner.Scan() {
output := scanner.Text()
fmt.Println(output)
buildLogs += fmt.Sprintf("%v\n", output)
buildLogs += fmt.Sprintf("%s\n", output)
}
if err := scanner.Err(); err != nil {
@@ -226,7 +235,5 @@ func (builder *Builder) build(command string, srcPkgPath string, deployPkgPath s
fmt.Println(cmdErr)
return buildLogs, cmdErr
}
fmt.Printf("==================\n")
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"
"github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.uber.org/zap"
"golang.org/x/net/context/ctxhttp"
@@ -34,7 +33,6 @@ import (
"github.com/fission/fission/pkg/builder"
ferror "github.com/fission/fission/pkg/error"
otelUtils "github.com/fission/fission/pkg/utils/otel"
"github.com/fission/fission/pkg/utils/tracing"
)
type (
@@ -46,13 +44,7 @@ type (
)
func MakeClient(logger *zap.Logger, builderUrl string) *Client {
var hc *http.Client
if tracing.TracingEnabled(logger) {
hc = &http.Client{Transport: &ochttp.Transport{}}
} else {
hc = &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}
}
hc := &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}
return &Client{
logger: logger.Named("builder_client"),
url: strings.TrimSuffix(builderUrl, "/"),
+16 -1
View File
@@ -22,11 +22,15 @@ import (
"github.com/pkg/errors"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
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/executor/util"
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
"github.com/fission/fission/pkg/utils"
)
// 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")
}
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()
k8sInformerFactory := k8sInformers.NewSharedInformerFactory(kubernetesClient, time.Minute*30)
+14 -1
View File
@@ -87,6 +87,7 @@ type (
fetcherConfig *fetcherConfig.Config
builderImagePullPolicy apiv1.PullPolicy
useIstio bool
podSpecPatch *apiv1.PodSpec
}
)
@@ -95,7 +96,8 @@ func makeEnvironmentWatcher(
fissionClient versioned.Interface,
kubernetesClient kubernetes.Interface,
fetcherConfig *fetcherConfig.Config,
builderNamespace string) *environmentWatcher {
builderNamespace string,
podSpecPatch *apiv1.PodSpec) *environmentWatcher {
useIstio := false
enableIstio := os.Getenv("ENABLE_ISTIO")
@@ -119,6 +121,7 @@ func makeEnvironmentWatcher(
builderImagePullPolicy: builderImagePullPolicy,
useIstio: useIstio,
fetcherConfig: fetcherConfig,
podSpecPatch: podSpecPatch,
}
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))
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("namespace", canaryConfig.ObjectMeta.Namespace),
zap.String("version", canaryConfig.ObjectMeta.ResourceVersion))
canaryCfgMgr.RollForwardOrBack(canaryConfig, quit, ticker)
canaryCfgMgr.RollForwardOrBack(*ctx, canaryConfig, quit, ticker)
case <-quit:
// 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
_, err := canaryCfgMgr.canaryCfgCancelFuncMap.lookup(&canaryConfig.ObjectMeta)
if err != nil {
@@ -233,7 +233,7 @@ func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(canaryConfig *fv1.CanaryC
}
// 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 the http trigger is not found, then give up processing this config.
if k8serrors.IsNotFound(err) {
@@ -286,7 +286,7 @@ func (canaryCfgMgr *canaryConfigMgr) RollForwardOrBack(canaryConfig *fv1.CanaryC
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)
if err != nil {
// 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
}
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
// first get a total count of requests to this url in a time window
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 {
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
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 {
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)
}
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)
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 {
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
}
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 {
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
}
@@ -111,18 +111,18 @@ func (promApiClient *PrometheusApiClient) GetRequestsToFuncInWindow(path string,
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)
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 {
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
}
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 {
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
}
@@ -137,10 +137,10 @@ func (promApiClient *PrometheusApiClient) GetTotalFailedRequestsToFuncInWindow(f
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))
val, warn, err := promApiClient.client.Query(context.Background(), queryString, time.Now())
val, warn, err := promApiClient.client.Query(ctx, queryString, time.Now())
if err != nil {
return 0, errors.Wrapf(err, "error querying prometheus")
}
+2 -9
View File
@@ -24,7 +24,6 @@ import (
"strings"
"github.com/gorilla/mux"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -270,14 +269,8 @@ func (api *API) GetHandler() http.Handler {
return r
}
func (api *API) Serve(ctx context.Context, port int, openTracingEnabled bool) {
var handler http.Handler
if openTracingEnabled {
handler = &ochttp.Handler{Handler: api.GetHandler()}
} else {
handler = otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
}
func (api *API) Serve(ctx context.Context, port int) {
handler := otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
go metrics.ServeMetrics(ctx, api.logger)
httpserver.StartServer(ctx, api.logger, "controller", fmt.Sprintf("%d", port), handler)
}
+144 -20
View File
@@ -31,7 +31,6 @@ import (
uuid "github.com/satori/go.uuid"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -41,6 +40,7 @@ import (
"github.com/fission/fission/pkg/crd"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
var (
@@ -130,7 +130,10 @@ func TestFunctionApi(t *testing.T) {
testFunc.ObjectMeta.Name = "bar"
m2, err := g.Client().V1().Function().Create(testFunc)
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)
panicIf(err)
@@ -174,7 +177,10 @@ func TestHTTPTriggerApi(t *testing.T) {
m, err := g.Client().V1().HTTPTrigger().Create(testTrigger)
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)
assertNameReuseFailure(err, "httptrigger")
@@ -199,13 +205,111 @@ func TestHTTPTriggerApi(t *testing.T) {
testTrigger.Spec.RelativeURL = "/hi2"
m2, err := g.Client().V1().HTTPTrigger().Create(testTrigger)
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)
panicIf(err)
assert(len(ts) == 2, fmt.Sprintf("created two triggers, but found %v", len(ts)))
}
func createFissionFnForMultipleTrigger() {
testFunc := &fv1.Function{
ObjectMeta: metav1.ObjectMeta{
Name: "foo1",
Namespace: testNS,
},
Spec: fv1.FunctionSpec{
Environment: fv1.EnvironmentReference{
Name: "nodejs",
Namespace: testNS,
},
Package: fv1.FunctionPackageRef{
FunctionName: "xxx",
PackageRef: fv1.PackageRef{
Namespace: testNS,
Name: "xxx",
ResourceVersion: "12345",
},
},
},
}
_, 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) {
testEnv := &fv1.Environment{
ObjectMeta: metav1.ObjectMeta{
@@ -228,7 +332,10 @@ func TestEnvironmentApi(t *testing.T) {
m, err := g.Client().V1().Environment().Create(testEnv)
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)
assertNameReuseFailure(err, "environment")
@@ -247,7 +354,10 @@ func TestEnvironmentApi(t *testing.T) {
m2, err := g.Client().V1().Environment().Create(testEnv)
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)
panicIf(err)
@@ -277,7 +387,10 @@ func TestWatchApi(t *testing.T) {
m, err := g.Client().V1().KubeWatcher().Create(testWatch)
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)
assertNameReuseFailure(err, "watch")
@@ -292,7 +405,10 @@ func TestWatchApi(t *testing.T) {
testWatch.ObjectMeta.Name = "yyy"
m2, err := g.Client().V1().KubeWatcher().Create(testWatch)
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)
panicIf(err)
@@ -318,7 +434,10 @@ func TestTimeTriggerApi(t *testing.T) {
m, err := g.Client().V1().TimeTrigger().Create(testTrigger)
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)
assertNameReuseFailure(err, "trigger")
@@ -348,10 +467,15 @@ func TestTimeTriggerApi(t *testing.T) {
func TestMain(m *testing.M) {
flag.Parse()
ctx, cancel := context.WithCancel(context.Background())
logger := loggerfactory.GetLogger()
// skip test if no cluster available for testing
kubeconfig := os.Getenv("KUBECONFIG")
if len(kubeconfig) == 0 {
log.Println("Skipping test, no kubernetes cluster")
cancel()
return
}
@@ -362,22 +486,14 @@ func TestMain(m *testing.M) {
id, err := uuid.NewV4()
panicIf(err)
testNS = id.String()
_, err = kubeClient.CoreV1().Namespaces().Create(context.TODO(), &v1.Namespace{
_, err = kubeClient.CoreV1().Namespaces().Create(ctx, &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: testNS,
},
}, metav1.CreateOptions{})
panicIf(err)
defer panicIf(kubeClient.CoreV1().Namespaces().Delete(context.TODO(), testNS, metav1.DeleteOptions{}))
config := zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
logger, err := config.Build()
panicIf(err)
ctx := context.Background()
go Start(ctx, logger, 8888, true, true)
go Start(ctx, logger, 8888, true)
time.Sleep(5 * time.Second)
@@ -400,5 +516,13 @@ func TestMain(m *testing.M) {
_, err = io.ReadAll(resp.Body)
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"
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"go.uber.org/zap"
+2 -2
View File
@@ -24,7 +24,7 @@ import (
"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")
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 {
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"
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"go.uber.org/zap"
+5 -5
View File
@@ -28,8 +28,8 @@ import (
"strconv"
"strings"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"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
err = getContainerLog(a.kubernetesClient, w, f, &pods[0])
err = getContainerLog(r.Context(), a.kubernetesClient, w, f, &pods[0])
if err != nil {
a.respondWithError(w, errors.Wrapf(err, "error getting container logs"))
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)
for _, container := range pod.Spec.Containers {
podLogOpts := apiv1.PodLogOptions{Container: container.Name} // Only the env container, not fetcher
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 {
return errors.Wrapf(err, "error streaming pod log")
}
+3 -3
View File
@@ -24,8 +24,8 @@ import (
"net/http"
"sort"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -134,7 +134,7 @@ func (a *API) checkHTTPTriggerDuplicates(ctx context.Context, t *fv1.HTTPTrigger
continue
}
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
}
methodMatch := false
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io"
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+2 -2
View File
@@ -19,8 +19,8 @@ package controller
import (
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
)
+2 -2
View File
@@ -23,8 +23,8 @@ import (
"net/http"
"github.com/dustin/go-humanize"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"net/http/httputil"
"net/url"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"go.uber.org/zap"
)
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io"
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
"github.com/robfig/cron"
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"io"
"net/http"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
restful "github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
"github.com/gorilla/mux"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+3 -10
View File
@@ -28,7 +28,6 @@ import (
"github.com/gorilla/mux"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap"
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 a pod is already serving request then it already exists else validated
logger.Debug("from cache", zap.Int("active", active))
if active > 1 || et.IsValid(ctx, fsvc) {
if et.IsValid(ctx, fsvc) {
// Cached, return svc address
logger.Debug("served from cache", zap.String("name", fsvc.Name), zap.String("address", fsvc.Address))
executor.writeResponse(w, fsvc.Address, fn.ObjectMeta.Name)
@@ -263,14 +262,8 @@ func (executor *Executor) GetHandler() http.Handler {
}
// Serve starts an HTTP server.
func (executor *Executor) Serve(ctx context.Context, port int, openTracingEnabled bool) {
var handler http.Handler
if openTracingEnabled {
handler = &ochttp.Handler{Handler: executor.GetHandler()}
} else {
handler = otelUtils.GetHandlerWithOTEL(executor.GetHandler(), "fission-executor", otelUtils.UrlsToIgnore("/healthz"))
}
func (executor *Executor) Serve(ctx context.Context, port int) {
handler := otelUtils.GetHandlerWithOTEL(executor.GetHandler(), "fission-executor", otelUtils.UrlsToIgnore("/healthz"))
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/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/utils/tracing"
)
type (
@@ -57,10 +55,6 @@ type (
// MakeClient initializes and returns a Client instance.
func MakeClient(logger *zap.Logger, executorURL string) *Client {
hc := retryablehttp.NewClient()
if tracing.TracingEnabled(logger) {
hc.HTTPClient.Transport = &ochttp.Transport{Base: hc.HTTPClient.Transport}
}
c := &Client{
logger: logger.Named("executor_client"),
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 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
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 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
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/pkg/errors"
"go.uber.org/zap"
apiv1 "k8s.io/api/core/v1"
k8sInformers "k8s.io/client-go/informers"
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,
// 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()
if err != nil {
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))
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))
informerFactory := genInformer.NewSharedInformerFactory(fissionClient, time.Minute*30)
@@ -288,7 +300,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient, metricsClient,
functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, pkgInformer, envInformer,
gpmPodInformer, gpmRsInformer)
gpmPodInformer, gpmRsInformer, podSpecPatch)
if err != nil {
return errors.Wrap(err, "pool manager creation failed")
}
@@ -304,7 +316,7 @@ func StartExecutor(ctx context.Context, logger *zap.Logger, functionNamespace st
fissionClient, kubernetesClient,
functionNamespace, fetcherConfig, executorInstanceID,
funcInformer, envInformer,
ndmDeplInformer, ndmSvcInformer)
ndmDeplInformer, ndmSvcInformer, podSpecPatch)
if err != nil {
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 metrics.ServeMetrics(ctx, logger)
go api.Serve(ctx, port, openTracingEnabled)
go api.Serve(ctx, port)
return nil
}
+1 -1
View File
@@ -174,7 +174,7 @@ func TestExecutor(t *testing.T) {
// create poolmgr
port := 9999
ctx := context.Background()
err = StartExecutor(ctx, logger, functionNs, "fission-builder", port, true)
err = StartExecutor(ctx, logger, functionNs, "fission-builder", port)
if err != nil {
log.Panicf("failed to start poolmgr: %v", err)
}
@@ -34,6 +34,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
k8sTypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1"
coreinformers "k8s.io/client-go/informers/core/v1"
"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 {
caaf.logger.Fatal("failed to wait for caches to sync")
}
go caaf.idleObjectReaper()
go caaf.idleObjectReaper(ctx)
}
// 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.
func (caaf *Container) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
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.
@@ -703,73 +704,71 @@ func (caaf *Container) updateStatus(fn *fv1.Function, err error, message string)
}
// idleObjectReaper reaps objects after certain idle time
func (caaf *Container) idleObjectReaper() {
ctx := context.Background()
func (caaf *Container) idleObjectReaper(ctx context.Context) {
// calling function doIdleObjectReaper() repeatedly at given interval of time
wait.UntilWithContext(ctx, caaf.doIdleObjectReaper, time.Second*5)
}
pollSleep := 5 * time.Second
for {
time.Sleep(pollSleep)
func (caaf *Container) doIdleObjectReaper(ctx context.Context) {
funcSvcs, err := caaf.fsCache.ListOld(time.Second * 5)
if err != nil {
caaf.logger.Error("error reaping idle pods", zap.Error(err))
return
}
funcSvcs, err := caaf.fsCache.ListOld(pollSleep)
if err != nil {
caaf.logger.Error("error reaping idle pods", zap.Error(err))
for i := range funcSvcs {
fsvc := funcSvcs[i]
if fsvc.Executor != fv1.ExecutorTypeContainer {
continue
}
for i := range funcSvcs {
fsvc := funcSvcs[i]
if fsvc.Executor != fv1.ExecutorTypeContainer {
fn, err := caaf.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{})
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
}
fn, err := caaf.fissionClient.CoreV1().Functions(fsvc.Function.Namespace).Get(ctx, fsvc.Function.Name, metav1.GetOptions{})
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))
}
}()
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))
}
}()
}
}
@@ -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 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
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 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
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{
{
Name: fv1.ResourceVersionCount,
Value: fmt.Sprintf("%v", rvCount),
Value: fmt.Sprintf("%d", rvCount),
},
},
// 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))
deployment := &appsv1.Deployment{
@@ -35,6 +35,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
k8sTypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1"
coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes"
@@ -86,6 +87,8 @@ type (
svcListerSynced k8sCache.InformerSynced
hpaops *hpautils.HpaOperations
podSpecPatch *apiv1.PodSpec
}
)
@@ -101,6 +104,7 @@ func MakeNewDeploy(
envInformer finformerv1.EnvironmentInformer,
deplInformer appsinformers.DeploymentInformer,
svcInformer coreinformers.ServiceInformer,
podSpecPatch *apiv1.PodSpec,
) (executortype.ExecutorType, error) {
enableIstio := false
if len(os.Getenv("ENABLE_ISTIO")) > 0 {
@@ -129,6 +133,8 @@ func MakeNewDeploy(
defaultIdlePodReapTime: 2 * time.Minute,
hpaops: hpautils.NewHpaOperations(logger, kubernetesClient, instanceID),
podSpecPatch: podSpecPatch,
}
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.
func (deploy *NewDeploy) GetFuncSvcFromCache(ctx context.Context, fn *fv1.Function) (*fscache.FuncSvc, error) {
otelUtils.SpanTrackEvent(ctx, "GetFuncSvcFromCache")
return deploy.fsCache.GetByFunction(&fn.ObjectMeta)
return deploy.fsCache.GetByFunctionUID(fn.UID)
}
// 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
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 {
return err
}
patch := fmt.Sprintf(`{"spec" : {"template": {"spec":{"containers":[{"name": "%s", "env":[{"name": "%s", "value": "%v"}]}]}}}}`,
f.ObjectMeta.Name, fv1.ResourceVersionCount, rvCount)
patch := fmt.Sprintf(`{"spec" : {"template": {"spec":{"containers":[{"name": "%s", "image": "%s", "env":[{"name": "%s", "value": "%d"}]}]}}}}`,
env.ObjectMeta.Name, env.Spec.Runtime.Image, fv1.ResourceVersionCount, rvCount)
_, err = deploy.kubernetesClient.AppsV1().Deployments(deployment.ObjectMeta.Namespace).Patch(ctx, deployment.ObjectMeta.Name,
k8sTypes.StrategicMergePatchType,
@@ -588,6 +594,7 @@ func (deploy *NewDeploy) updateFunction(ctx context.Context, oldFn *fv1.Function
if oldFn.Spec.Environment != newFn.Spec.Environment ||
oldFn.Spec.Package.PackageRef != newFn.Spec.Package.PackageRef ||
oldFn.Spec.Package.FunctionName != newFn.Spec.Package.FunctionName {
deploy.logger.Debug("deployment changed", zap.String("msg", "deployment changed"))
deployChanged = true
}
@@ -761,88 +768,87 @@ func (deploy *NewDeploy) updateStatus(fn *fv1.Function, err error, message strin
// idleObjectReaper reaps objects after certain idle time
func (deploy *NewDeploy) idleObjectReaper(ctx context.Context) {
pollSleep := 5 * time.Second
for {
time.Sleep(pollSleep)
// calling function doIdleObjectReaper() repeatedly at given interval of time
wait.UntilWithContext(ctx, deploy.doIdleObjectReaper, time.Second*5)
}
envs, err := deploy.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
if err != nil {
deploy.logger.Fatal("failed to get environment list", zap.Error(err))
}
func (deploy *NewDeploy) doIdleObjectReaper(ctx context.Context) {
envs, err := deploy.fissionClient.CoreV1().Environments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
if err != nil {
deploy.logger.Fatal("failed to get environment list", zap.Error(err))
}
envList := make(map[k8sTypes.UID]struct{})
for _, env := range envs.Items {
envList[env.ObjectMeta.UID] = struct{}{}
}
envList := make(map[k8sTypes.UID]struct{})
for _, env := range envs.Items {
envList[env.ObjectMeta.UID] = struct{}{}
}
funcSvcs, err := deploy.fsCache.ListOld(pollSleep)
if err != nil {
deploy.logger.Error("error reaping idle pods", zap.Error(err))
funcSvcs, err := deploy.fsCache.ListOld(time.Second * 5)
if err != nil {
deploy.logger.Error("error reaping idle pods", zap.Error(err))
return
}
for i := range funcSvcs {
fsvc := funcSvcs[i]
if fsvc.Executor != fv1.ExecutorTypeNewdeploy {
continue
}
for i := range funcSvcs {
fsvc := funcSvcs[i]
if fsvc.Executor != fv1.ExecutorTypeNewdeploy {
continue
}
// 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))
}
}()
// 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))
}
}()
}
}
@@ -0,0 +1,254 @@
package newdeploy
import (
"context"
"fmt"
"os"
"testing"
"time"
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes/fake"
k8sCache "k8s.io/client-go/tools/cache"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/executor/util"
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
fClient "github.com/fission/fission/pkg/generated/clientset/versioned/fake"
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
const (
defaultNamespace string = "default"
functionNamespace string = "fission-function"
envName string = "newdeploy-test-env"
functionName string = "newdeploy-test-func"
configmapName string = "newdeploy-test-configmap"
)
func runInformers(ctx context.Context, informers []k8sCache.SharedIndexInformer) {
// Run all informers
for _, informer := range informers {
go informer.Run(ctx.Done())
}
}
func TestRefreshFuncPods(t *testing.T) {
os.Setenv("DEBUG_ENV", "true")
logger := loggerfactory.GetLogger()
kubernetesClient := fake.NewSimpleClientset()
fissionClient := fClient.NewSimpleClientset()
informerFactory := genInformer.NewSharedInformerFactory(fissionClient, time.Minute*30)
funcInformer := informerFactory.Core().V1().Functions()
envInformer := informerFactory.Core().V1().Environments()
newDeployInformerFactory, err := utils.GetInformerFactoryByExecutor(kubernetesClient, fv1.ExecutorTypeNewdeploy, time.Minute*30)
if err != nil {
t.Fatalf("Error creating informer factory: %s", err)
}
deployInformer := newDeployInformerFactory.Apps().V1().Deployments()
svcInformer := newDeployInformerFactory.Core().V1().Services()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err = BuildConfigMap(ctx, kubernetesClient, functionNamespace, fv1.RuntimePodSpecConfigmap, map[string]string{})
if err != nil {
t.Fatalf("Error building configmap: %s", err)
}
podSpecPatch, err := util.GetSpecFromConfigMap(ctx, kubernetesClient, fv1.RuntimePodSpecConfigmap, functionNamespace)
if err != nil {
t.Fatalf("Error creating pod spec: %s", err)
}
fetcherConfig, err := fetcherConfig.MakeFetcherConfig("/userfunc")
if err != nil {
t.Fatalf("Error creating fetcher config: %s", err)
}
executor, err := MakeNewDeploy(logger, fissionClient, kubernetesClient, functionNamespace, fetcherConfig, "test",
funcInformer, envInformer, deployInformer, svcInformer, podSpecPatch)
if err != nil {
t.Fatalf("new deploy manager creation failed: %s", err)
}
ndm := executor.(*NewDeploy)
go ndm.Run(ctx)
t.Log("New deploy manager started")
runInformers(ctx, []k8sCache.SharedIndexInformer{
envInformer.Informer(),
funcInformer.Informer(),
deployInformer.Informer(),
svcInformer.Informer(),
})
t.Log("Informers required for new deploy manager started")
if ok := k8sCache.WaitForCacheSync(ctx.Done(), ndm.deplListerSynced, ndm.svcListerSynced); !ok {
t.Fatal("Timed out waiting for caches to sync")
}
envSpec := &fv1.Environment{
ObjectMeta: metav1.ObjectMeta{
Name: envName,
Namespace: defaultNamespace,
UID: "83c82da2-81e9-4ebd-867e-f383e65e603f",
},
Spec: fv1.EnvironmentSpec{
Version: 1,
Runtime: fv1.Runtime{
Image: "gcr.io/xyz",
},
},
}
_, err = fissionClient.CoreV1().Environments(defaultNamespace).Create(ctx, envSpec, metav1.CreateOptions{})
if err != nil {
t.Fatalf("creating environment failed : %s", err)
}
envRes, err := fissionClient.CoreV1().Environments(defaultNamespace).Get(ctx, envName, metav1.GetOptions{})
if err != nil {
t.Fatalf("Error getting environment: %s", err)
}
assert.Equal(t, envRes.ObjectMeta.Name, envName)
funcUID, err := uuid.NewV4()
if err != nil {
t.Fatal(err)
}
funcSpec := fv1.Function{
ObjectMeta: metav1.ObjectMeta{
Name: functionName,
Namespace: defaultNamespace,
UID: types.UID(funcUID.String()),
},
Spec: fv1.FunctionSpec{
Environment: fv1.EnvironmentReference{
Name: envName,
Namespace: defaultNamespace,
},
InvokeStrategy: fv1.InvokeStrategy{
ExecutionStrategy: fv1.ExecutionStrategy{
ExecutorType: fv1.ExecutorTypeNewdeploy,
},
},
},
}
_, err = fissionClient.CoreV1().Functions(defaultNamespace).Create(ctx, &funcSpec, metav1.CreateOptions{})
if err != nil {
t.Fatalf("creating function failed : %s", err)
}
funcRes, err := fissionClient.CoreV1().Functions(defaultNamespace).Get(ctx, functionName, metav1.GetOptions{})
if err != nil {
t.Fatalf("Error getting function: %s", err)
}
assert.Equal(t, funcRes.ObjectMeta.Name, functionName)
ctx2, cancel2 := context.WithCancel(context.Background())
wait.Until(func() {
t.Log("Checking for deployment")
ret, err := kubernetesClient.AppsV1().Deployments(functionNamespace).List(ctx2, metav1.ListOptions{})
if err != nil {
t.Fatalf("Error getting deployment: %s", err)
}
if len(ret.Items) > 0 {
t.Log("Deployment created", ret.Items[0].Name)
cancel2()
}
}, time.Second*2, ctx2.Done())
err = BuildConfigMap(ctx, kubernetesClient, defaultNamespace, configmapName, map[string]string{
"test-key": "test-value",
})
if err != nil {
t.Fatalf("Error building configmap: %s", err)
}
t.Log("Adding configmap to function")
funcRes.Spec.ConfigMaps = []fv1.ConfigMapReference{
{
Name: configmapName,
Namespace: defaultNamespace,
},
}
_, err = fissionClient.CoreV1().Functions(defaultNamespace).Update(ctx, funcRes, metav1.UpdateOptions{})
if err != nil {
t.Fatalf("Error updating function: %s", err)
}
funcRes, err = fissionClient.CoreV1().Functions(defaultNamespace).Get(ctx, functionName, metav1.GetOptions{})
if err != nil {
t.Fatalf("Error getting function: %s", err)
}
assert.Greater(t, len(funcRes.Spec.ConfigMaps), 0)
err = ndm.RefreshFuncPods(ctx, logger, *funcRes)
if err != nil {
t.Fatalf("Error refreshing function pods: %s", err)
}
funcLabels := ndm.getDeployLabels(funcRes.ObjectMeta, envRes.ObjectMeta)
dep, err := kubernetesClient.AppsV1().Deployments(metav1.NamespaceAll).List(ctx, metav1.ListOptions{
LabelSelector: labels.Set(funcLabels).AsSelector().String(),
})
if err != nil {
t.Fatalf("Error getting deployment: %s", err)
}
assert.Equal(t, len(dep.Items), 1)
cm, err := kubernetesClient.CoreV1().ConfigMaps(defaultNamespace).Get(ctx, configmapName, metav1.GetOptions{})
if err != nil {
t.Fatalf("Error getting configmap: %s", err)
}
assert.Equal(t, cm.ObjectMeta.Name, configmapName)
updatedDepl := dep.Items[0]
resourceVersionMatch := false
assert.Equal(t, len(updatedDepl.Spec.Template.Spec.Containers), 2)
for _, v := range updatedDepl.Spec.Template.Spec.Containers {
if v.Name == envName {
assert.Greater(t, len(v.Env), 0)
for _, env := range v.Env {
if env.Name == fv1.ResourceVersionCount {
assert.Equal(t, env.Value, cm.ObjectMeta.ResourceVersion)
resourceVersionMatch = true
}
}
}
}
assert.True(t, resourceVersionMatch)
}
func FakeResourceVersion() string {
return fmt.Sprint(time.Now().Nanosecond())[:6]
}
func BuildConfigMap(ctx context.Context, kubernetesClient *fake.Clientset, namespace, name string, data map[string]string) error {
testConfigMap := apiv1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
ResourceVersion: FakeResourceVersion(),
},
Data: data,
}
_, err := kubernetesClient.CoreV1().ConfigMaps(namespace).Create(ctx, &testConfigMap, metav1.CreateOptions{})
return err
}

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