Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82e1ff76a5 | ||
|
|
e7cfb06afa | ||
|
|
d9d9d226d3 | ||
|
|
bcd1872ffa | ||
|
|
0bd3a5957b | ||
|
|
a450dfebc7 | ||
|
|
5f90095470 | ||
|
|
eb865e137f | ||
|
|
b7819fda76 | ||
|
|
0e2883d0c6 | ||
|
|
a8322b5ed2 | ||
|
|
43dc34ee8f | ||
|
|
0300051e7c | ||
|
|
b8cb98510f | ||
|
|
20e0f6af45 | ||
|
|
50b061527e | ||
|
|
22b30cf92f | ||
|
|
e0c7a80fe0 | ||
|
|
87cfb2fb20 | ||
|
|
ebdce4c0ed | ||
|
|
4ebdb077b5 | ||
|
|
2eb14db055 | ||
|
|
776dec14b7 | ||
|
|
320b1dd5a9 | ||
|
|
a6ecd0496f | ||
|
|
7f3a003200 | ||
|
|
8b1f0ba0b9 | ||
|
|
84631f03c5 | ||
|
|
e506ba2326 | ||
|
|
c5171cf014 | ||
|
|
757b84f952 | ||
|
|
0e89f8af41 | ||
|
|
7403598df9 | ||
|
|
322d3a21b0 | ||
|
|
aa9a2142b8 | ||
|
|
ed64644d10 | ||
|
|
45d6132ffd | ||
|
|
b26e28e733 | ||
|
|
2b13af0a5e | ||
|
|
6cc6498844 | ||
|
|
313ceef1ed | ||
|
|
9e275e7ced | ||
|
|
3ee30cf4f1 | ||
|
|
0ea24b399d | ||
|
|
aea8e0a470 | ||
|
|
ba13d1fd79 | ||
|
|
8ec6f313a4 | ||
|
|
0b4b78ff21 | ||
|
|
52f0b47273 | ||
|
|
df4a121d77 | ||
|
|
f839142530 | ||
|
|
b58525263e | ||
|
|
46c99e382f | ||
|
|
268fee7f94 | ||
|
|
caffed92f4 | ||
|
|
2fd44174ce | ||
|
|
7119380716 | ||
|
|
5eed09a8fc | ||
|
|
3e253c2ee4 | ||
|
|
8d70da4d8e | ||
|
|
2853498a98 | ||
|
|
b6bd921ac1 | ||
|
|
5d97ea7762 | ||
|
|
fb60a14ecc | ||
|
|
38ec6528e3 | ||
|
|
7d7f532c46 | ||
|
|
14e829f6a4 | ||
|
|
703613a475 | ||
|
|
0bbb5c5f38 | ||
|
|
d8aa5b7374 | ||
|
|
f44983f02a | ||
|
|
9f0bb6d11f | ||
|
|
a8157e94a9 | ||
|
|
cd23fc6f63 | ||
|
|
40678800e6 | ||
|
|
6acb59f979 | ||
|
|
4bce904c96 | ||
|
|
54b67b5171 | ||
|
|
96b07bf9a8 | ||
|
|
b156625997 | ||
|
|
6cf15f6cec | ||
|
|
3f0e4f5e81 | ||
|
|
1358aa2a81 | ||
|
|
f0aaef203e | ||
|
|
77d24fc544 | ||
|
|
a083ba3de5 | ||
|
|
6a50eac9eb | ||
|
|
b954eedff7 | ||
|
|
0247627494 | ||
|
|
158c40a7af | ||
|
|
699011e18e | ||
|
|
e7dc87843a | ||
|
|
e67c3b7945 | ||
|
|
36ed2e44aa | ||
|
|
38779b9318 | ||
|
|
7058130c3b | ||
|
|
9644477d08 | ||
|
|
87cac28cad | ||
|
|
238cfd854b | ||
|
|
f7cc0ac32d | ||
|
|
d8108c6742 | ||
|
|
d5eafded1a | ||
|
|
48e8acedfb | ||
|
|
11a2fdbdab | ||
|
|
0aa1a12cdc | ||
|
|
f37c5ee102 | ||
|
|
59267e3a6b | ||
|
|
82c0fbaeda | ||
|
|
2d70c9d65f | ||
|
|
c43f6fe9c0 | ||
|
|
36f318186b | ||
|
|
fe7f1b07c9 | ||
|
|
352090d092 | ||
|
|
db2b0ad4a0 | ||
|
|
4b76ec9057 | ||
|
|
15857b02d9 | ||
|
|
9bdac9a334 | ||
|
|
2f8ad16639 | ||
|
|
687a84a2d6 | ||
|
|
2db9db0b38 | ||
|
|
2bf00025ed | ||
|
|
b8f746cb98 | ||
|
|
93869d3bc8 | ||
|
|
5d580e01aa | ||
|
|
1f41de9991 | ||
|
|
5cdecefc49 | ||
|
|
21bccdaecf | ||
|
|
cf55fbecea | ||
|
|
b80437b78c | ||
|
|
11baffc92c | ||
|
|
ce49eb3e18 | ||
|
|
bf19e2fae2 | ||
|
|
26f964886e | ||
|
|
cb3a765495 | ||
|
|
7203cbf846 | ||
|
|
0b9d4c6f5a | ||
|
|
c6beb29f5a | ||
|
|
13abb2e905 | ||
|
|
54db275dc2 | ||
|
|
0159802497 | ||
|
|
90d781ca2d | ||
|
|
1732d9f4b0 | ||
|
|
8de5a5b0f3 | ||
|
|
35276a503b | ||
|
|
c6c811ea76 | ||
|
|
f2baa17131 | ||
|
|
a34840b0a7 | ||
|
|
06b52e3631 | ||
|
|
19858521fd | ||
|
|
4c4b574d07 | ||
|
|
9b978cf2fd | ||
|
|
ef05e242e4 | ||
|
|
156c1ac2e6 | ||
|
|
ade2daa013 | ||
|
|
6a84cee1d8 | ||
|
|
b95e317a20 |
@@ -0,0 +1,62 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: docker
|
||||
directories:
|
||||
- /cmd/builder
|
||||
- /cmd/fetcher
|
||||
- /cmd/fission-bundle
|
||||
- /cmd/preupgradechecks
|
||||
- /cmd/reporter
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
exclude-paths:
|
||||
- "test/**"
|
||||
groups:
|
||||
docker-images:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: gomod
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
exclude-paths:
|
||||
- "test/**"
|
||||
groups:
|
||||
go-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: helm
|
||||
directory: /charts/fission-all
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
helm-charts:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
exclude-paths:
|
||||
- "test/**"
|
||||
groups:
|
||||
npm-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
@@ -4,39 +4,47 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**.go'
|
||||
- go.mod
|
||||
- go.sum
|
||||
- '!dependabot/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**.go'
|
||||
- go.mod
|
||||
- go.sum
|
||||
schedule:
|
||||
- cron: "0 0 * * 0"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: fission-codeql-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read # for github/codeql-action/init to get workflow details
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/analyze to upload SARIF results
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
|
||||
uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
|
||||
with:
|
||||
languages: go
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
|
||||
uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Dependency Review Action
|
||||
#
|
||||
# This Action will scan dependency manifest files that change as part of a Pull Request,
|
||||
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
|
||||
# Once installed, if the workflow run is marked as required,
|
||||
# PRs introducing known-vulnerable packages will be blocked from merging.
|
||||
#
|
||||
# Source repository: https://github.com/actions/dependency-review-action
|
||||
name: 'Dependency Review'
|
||||
on: [pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: fission-dependency-review-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
|
||||
@@ -11,25 +11,27 @@ on:
|
||||
- main
|
||||
paths:
|
||||
- 'charts/fission-all/dashboards/**.json'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint-dashboards:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
|
||||
- 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
|
||||
|
||||
@@ -15,22 +15,36 @@ on:
|
||||
- "**.go"
|
||||
- go.mod
|
||||
- go.sum
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
GOLANGCI_LINT_VERSION: v1.55.2
|
||||
GOLANGCI_LINT_VERSION: v2.6.2
|
||||
GOLANGCI_LINT_TIMEOUT: 5m
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: fission-lint-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
||||
runs-on: ubuntu-24.04
|
||||
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
@@ -41,8 +55,9 @@ jobs:
|
||||
go mod download
|
||||
|
||||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
|
||||
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
|
||||
with:
|
||||
skip-cache: true
|
||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
|
||||
|
||||
@@ -61,8 +76,8 @@ jobs:
|
||||
run: ./hack/runtests.sh
|
||||
|
||||
- name: Upload Coverage report to CodeCov
|
||||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: unittests
|
||||
file: ./coverage.txt
|
||||
|
||||
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '!dependabot/**'
|
||||
paths:
|
||||
- "**.go"
|
||||
- "charts/**"
|
||||
@@ -19,12 +20,19 @@ on:
|
||||
- "test/**"
|
||||
- go.mod
|
||||
- go.sum
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
HELM_VERSION: v3.13.0
|
||||
KIND_VERSION: v0.23.0
|
||||
HELM_VERSION: v4.0.1
|
||||
KIND_VERSION: v0.30.0
|
||||
KIND_CLUSTER_NAME: kind
|
||||
SKAFFOLD_VERSION: v2.17.0
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: fission-ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Job to run change detection
|
||||
@@ -34,31 +42,36 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
kindversion: ["v1.25.16", "v1.27.13", "v1.30.0"]
|
||||
os: [ubuntu-latest]
|
||||
kindversion: ["v1.28.15", "v1.32.8", "v1.34.0"]
|
||||
os: [ubuntu-24.04]
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
repository: fission/examples
|
||||
path: examples
|
||||
|
||||
- name: Helm installation
|
||||
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
uses: Azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: Kind Cluster
|
||||
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
||||
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
|
||||
with:
|
||||
node_image: kindest/node:${{ matrix.kindversion }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
@@ -79,14 +92,15 @@ jobs:
|
||||
|
||||
- name: Install Skaffold
|
||||
run: |
|
||||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.0.3/skaffold-linux-amd64
|
||||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/${{ env.SKAFFOLD_VERSION }}/skaffold-linux-amd64
|
||||
sudo install skaffold /usr/local/bin/
|
||||
skaffold version
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
|
||||
with:
|
||||
install-only: true
|
||||
version: "~> v2"
|
||||
|
||||
- name: Setup Prometheus Stack
|
||||
run: |
|
||||
@@ -144,7 +158,7 @@ jobs:
|
||||
- name: Archive fission dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ failure() || cancelled() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: fission-dump/*.zip
|
||||
@@ -153,7 +167,7 @@ jobs:
|
||||
- name: Archive prometheus dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: /tmp/prometheus/*
|
||||
@@ -162,7 +176,7 @@ jobs:
|
||||
- name: Archive kind logs
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: kind-logs/*
|
||||
@@ -176,31 +190,36 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
kindversion: ["v1.19.16"]
|
||||
os: [ubuntu-latest]
|
||||
kindversion: ["v1.31.12"]
|
||||
os: [ubuntu-24.04]
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
repository: fission/examples
|
||||
path: examples
|
||||
|
||||
- name: Helm installation
|
||||
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
uses: Azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: Kind Cluster
|
||||
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
||||
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
|
||||
with:
|
||||
node_image: kindest/node:${{ matrix.kindversion }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
@@ -221,14 +240,15 @@ jobs:
|
||||
|
||||
- name: Install Skaffold
|
||||
run: |
|
||||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.0.3/skaffold-linux-amd64
|
||||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/${{ env.SKAFFOLD_VERSION }}/skaffold-linux-amd64
|
||||
sudo install skaffold /usr/local/bin/
|
||||
skaffold version
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
|
||||
with:
|
||||
install-only: true
|
||||
version: "~> v2"
|
||||
|
||||
- name: Setup Prometheus Stack
|
||||
run: |
|
||||
@@ -289,26 +309,26 @@ jobs:
|
||||
- name: Archive fission dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ failure() || cancelled() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: fission-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: fission-dump/*.zip
|
||||
retention-days: 5
|
||||
|
||||
- name: Archive prometheus dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: prom-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: /tmp/prometheus/*
|
||||
retention-days: 5
|
||||
|
||||
- name: Archive kind logs
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: kind-logs-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: kind-logs/*
|
||||
retention-days: 5
|
||||
+138
-28
@@ -6,36 +6,52 @@ on:
|
||||
- v2.**
|
||||
|
||||
env:
|
||||
KIND_VERSION: v0.23.0
|
||||
KIND_NODE_IMAGE_TAG: v1.25.16
|
||||
KIND_VERSION: v0.30.0
|
||||
KIND_NODE_IMAGE_TAG: v1.28.15
|
||||
KIND_CLUSTER_NAME: kind
|
||||
COSIGN_VERSION: v3.0.3
|
||||
|
||||
jobs:
|
||||
create-draft-release:
|
||||
runs-on: ubuntu-latest
|
||||
name: Create Draft Release with Goreleaser
|
||||
outputs:
|
||||
ghcr_images: ${{ steps.image.outputs.ghcr_images }}
|
||||
version: ${{ steps.get_version.outputs.VERSION }}
|
||||
permissions:
|
||||
contents: write # for goreleaser/goreleaser-action to create a GitHub release
|
||||
packages: write # for goreleaser/goreleaser-action to upload artifacts to GitHub Packages
|
||||
id-token: write # for cosign to sign the image and binary
|
||||
attestations: write # for goreleaser/goreleaser-action to upload attestations
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
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\//}
|
||||
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
|
||||
with:
|
||||
install-only: true
|
||||
version: "~> v2"
|
||||
|
||||
- name: Kind Clutser
|
||||
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
||||
- name: Kind Cluster
|
||||
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
|
||||
with:
|
||||
node_image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
@@ -43,34 +59,27 @@ jobs:
|
||||
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to docker.io
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
|
||||
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
|
||||
with:
|
||||
cosign-release: "v2.2.1"
|
||||
cosign-release: ${{ env.COSIGN_VERSION }}
|
||||
|
||||
- name: Check cosign install!
|
||||
run: cosign version
|
||||
|
||||
- name: Write cosign signing key to disk
|
||||
run: 'echo "$KEY" > cosign.key'
|
||||
shell: bash
|
||||
env:
|
||||
KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
|
||||
- uses: anchore/sbom-action/download-syft@43a17d6e7add2b5535efe4dcae9952337c479a93 #v0.20.11
|
||||
|
||||
- name: Generate yaml for manifest, Minikube and Openshift installation
|
||||
run: ${GITHUB_WORKSPACE}/hack/build-yaml.sh $VERSION
|
||||
@@ -79,14 +88,115 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
id: goreleaser
|
||||
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
|
||||
with:
|
||||
version: latest
|
||||
version: "~> v2"
|
||||
args: release
|
||||
env:
|
||||
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
|
||||
GORELEASER_CURRENT_TAG: ${{ steps.get_version.outputs.VERSION }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||
|
||||
#ToDo - Verify and upload releases
|
||||
# Attest binary artifacts
|
||||
# https://goreleaser.com/customization/attestations/
|
||||
- name: Attest binary artifacts
|
||||
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
|
||||
with:
|
||||
subject-checksums: ./dist/checksums.txt
|
||||
|
||||
- name: Image digest
|
||||
id: image
|
||||
env:
|
||||
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image_and_digest=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Docker Image") | {name, "digest": (.extra.Digest // .extra.Checksum)} | select(.digest) | {name} + {digest} | join("@") | sub("^sha256:";"")' | grep -v latest)
|
||||
ghcr_images=$(echo "${image_and_digest}" | grep ghcr.io | jq -R -s -c '
|
||||
split("\n")
|
||||
| map(select(. != ""))
|
||||
| map(
|
||||
split("@")
|
||||
| {
|
||||
"image": .[0] | split(":")[0],
|
||||
"checksum": .[1]
|
||||
}
|
||||
)')
|
||||
echo "ghcr_images=$ghcr_images" >> "$GITHUB_OUTPUT"
|
||||
|
||||
image-sbom-provenance-ghcr:
|
||||
name: Create SBOM & Provenance for container images
|
||||
# Goreleaser does not support generating SBOM for container images.
|
||||
needs: [create-draft-release]
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
matrix:
|
||||
include: ${{ fromJson(needs.create-draft-release.outputs.ghcr_images) }}
|
||||
permissions:
|
||||
actions: write
|
||||
id-token: write
|
||||
packages: write
|
||||
attestations: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run Trivy in fs mode to generate SBOM
|
||||
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
|
||||
with:
|
||||
scan-type: "fs"
|
||||
format: "spdx-json"
|
||||
output: "sbom.spdx.json"
|
||||
- name: Attest SBOM for image
|
||||
uses: actions/attest-sbom@4651f806c01d8637787e274ac3bdf724ef169f34 # v3.0.0
|
||||
with:
|
||||
sbom-path: sbom.spdx.json
|
||||
subject-name: ${{ fromJson(toJson(matrix)).image }}
|
||||
subject-digest: ${{ fromJson(toJson(matrix)).checksum }}
|
||||
push-to-registry: true
|
||||
- name: Attest provenance for image
|
||||
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
|
||||
with:
|
||||
subject-name: ${{ fromJson(toJson(matrix)).image }}
|
||||
subject-digest: ${{ fromJson(toJson(matrix)).checksum }}
|
||||
push-to-registry: true
|
||||
|
||||
image-provenance-verification-with-cosign:
|
||||
name: Verify Image Provenance
|
||||
needs: [create-draft-release, image-sbom-provenance-ghcr]
|
||||
strategy:
|
||||
matrix:
|
||||
include: ${{ fromJson(needs.create-draft-release.outputs.ghcr_images) }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions: read-all
|
||||
steps:
|
||||
- name: Login
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
|
||||
with:
|
||||
cosign-release: ${{ env.COSIGN_VERSION }}
|
||||
|
||||
- name: Verify image
|
||||
env:
|
||||
IMAGE: ${{ fromJson(toJson(matrix)).image }}
|
||||
DIGEST: ${{ fromJson(toJson(matrix)).checksum }}
|
||||
run: |
|
||||
echo "Verifying $IMAGE@$DIGEST"
|
||||
cosign verify-attestation \
|
||||
--type https://slsa.dev/provenance/v1 \
|
||||
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
|
||||
--certificate-identity-regexp '^https://github.com/fission/fission/.github/workflows/release.yaml@refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(?:-rc[0-9]+)?$' \
|
||||
$IMAGE@$DIGEST
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||
# by a third-party and are governed by separate terms of service, privacy
|
||||
# policy, and support documentation.
|
||||
|
||||
name: Scorecard supply-chain security
|
||||
on:
|
||||
# For Branch-Protection check. Only the default branch is supported. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||
branch_protection_rule:
|
||||
# To guarantee Maintained check is occasionally updated. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||
schedule:
|
||||
- cron: '41 18 * * 0'
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecard analysis
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Needed to publish results and get a badge (see publish_results below).
|
||||
id-token: write
|
||||
# Uncomment the permissions below if installing in a private repository.
|
||||
# contents: read
|
||||
# actions: read
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||
# - you are installing Scorecard on a *private* repository
|
||||
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
|
||||
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||
|
||||
# Public repositories:
|
||||
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||
# - Allows the repository to include the Scorecard badge.
|
||||
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories:
|
||||
# - `publish_results` will always be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v3.pre.node20
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '!dependabot/**'
|
||||
paths:
|
||||
- "**.go"
|
||||
- "charts/**"
|
||||
@@ -19,13 +20,19 @@ on:
|
||||
- "test/**"
|
||||
- go.mod
|
||||
- go.sum
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
HELM_VERSION: v3.13.0
|
||||
KIND_VERSION: v0.23.0
|
||||
HELM_VERSION: v3.19.0
|
||||
KIND_VERSION: v0.30.0
|
||||
KIND_CLUSTER_NAME: kind
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: fission-upgrade-test-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
upgrade-test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -33,34 +40,40 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
kindimage: ["kindest/node:v1.25.16"]
|
||||
os: [ubuntu-latest]
|
||||
kindversion: ["v1.31.12"]
|
||||
os: [ubuntu-24.04]
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout action sources
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
||||
- name: Setup Helm
|
||||
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
uses: Azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: Setup Kind Clutser
|
||||
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
||||
- name: Setup Kind Cluster
|
||||
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
|
||||
with:
|
||||
node_image: ${{ matrix.kindimage }}
|
||||
node_image: kindest/node:${{ matrix.kindversion }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
|
||||
with:
|
||||
install-only: true
|
||||
version: "~> v2"
|
||||
|
||||
- name: Setup kubectl & fetch node information
|
||||
run: |
|
||||
@@ -105,7 +118,7 @@ jobs:
|
||||
|
||||
- name: Archive fission dump
|
||||
if: ${{ failure() || cancelled() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: fission-dump/*.zip
|
||||
@@ -113,7 +126,7 @@ jobs:
|
||||
|
||||
- name: Archive kind logs
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: kind-logs/*
|
||||
|
||||
+43
-27
@@ -1,35 +1,51 @@
|
||||
version: "2"
|
||||
linters:
|
||||
enable:
|
||||
# Default linter
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- unused
|
||||
# Additional linters
|
||||
- gofmt
|
||||
- goimports
|
||||
- misspell
|
||||
- nakedret
|
||||
- unconvert
|
||||
- promlinter
|
||||
# Enable in future
|
||||
# - bodyclose
|
||||
# - dogsled
|
||||
# - dupl
|
||||
# - gosec
|
||||
# - nilerr
|
||||
# - prealloc
|
||||
# - revive
|
||||
# - unparam
|
||||
# - wrapcheck
|
||||
# - gocritic
|
||||
linters-settings:
|
||||
errcheck:
|
||||
ignore: go.uber.org/zap:Sync
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
local: github.com/fission/fission
|
||||
- unconvert
|
||||
- unused
|
||||
- staticcheck
|
||||
settings:
|
||||
errcheck:
|
||||
exclude-functions:
|
||||
- (*go.uber.org/zap.Logger).Sync
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
rules:
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: "QF1008"
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: "QF1001"
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: "QF1003"
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
settings:
|
||||
goimports:
|
||||
local-prefixes:
|
||||
- github.com/fission/fission
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
||||
+118
-367
@@ -1,9 +1,14 @@
|
||||
version: 2
|
||||
|
||||
env:
|
||||
- GHCR_REPO=ghcr.io/fission
|
||||
|
||||
project_name: fission
|
||||
release:
|
||||
github:
|
||||
owner: fission
|
||||
name: fission
|
||||
prerelease: true
|
||||
prerelease: "true"
|
||||
draft: true
|
||||
header: |
|
||||
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
|
||||
@@ -16,7 +21,7 @@ before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}"
|
||||
version_template: "{{ .Tag }}"
|
||||
builds:
|
||||
- &build-linux
|
||||
id: builder
|
||||
@@ -36,9 +41,6 @@ builds:
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- arm
|
||||
goarm:
|
||||
- 7
|
||||
binary: builder
|
||||
dir: ./cmd/builder
|
||||
- <<: *build-linux
|
||||
@@ -60,12 +62,6 @@ builds:
|
||||
ignore:
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
goarm: 7
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
goarm: 7
|
||||
- <<: *build-linux
|
||||
id: pre-upgrade-checks
|
||||
binary: pre-upgrade-checks
|
||||
@@ -74,379 +70,134 @@ builds:
|
||||
id: reporter
|
||||
binary: reporter
|
||||
dir: ./cmd/reporter
|
||||
dockers:
|
||||
- &docker-amd64
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
ids:
|
||||
- builder
|
||||
image_templates:
|
||||
- "fission/builder:latest-amd64"
|
||||
- "fission/builder:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/fission/builder:latest-amd64"
|
||||
- "ghcr.io/fission/builder:{{ .Tag }}-amd64"
|
||||
dockers_v2:
|
||||
- id: builder
|
||||
tags:
|
||||
- latest
|
||||
- "{{ .Tag }}"
|
||||
images:
|
||||
- "{{ .Env.GHCR_REPO }}/builder"
|
||||
labels:
|
||||
org.opencontainers.image.description: "The builder assists in building the fission function source code for deployment."
|
||||
org.opencontainers.image.source: "{{.GitURL}}"
|
||||
org.opencontainers.image.created: "{{.Date}}"
|
||||
org.opencontainers.image.revision: "{{.FullCommit}}"
|
||||
org.opencontainers.image.version: "{{.Tag}}"
|
||||
org.opencontainers.image.authors: "The Fission Authors https://fission.io/"
|
||||
org.opencontainers.image.vendor: "Fission"
|
||||
org.opencontainers.image.url: "https://fission.io/"
|
||||
dockerfile: cmd/builder/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-amd64
|
||||
ids:
|
||||
- fetcher
|
||||
image_templates:
|
||||
- "fission/fetcher:latest-amd64"
|
||||
- "fission/fetcher:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/fission/fetcher:latest-amd64"
|
||||
- "ghcr.io/fission/fetcher:{{ .Tag }}-amd64"
|
||||
- id: fetcher
|
||||
tags:
|
||||
- latest
|
||||
- "{{ .Tag }}"
|
||||
images:
|
||||
- "{{ .Env.GHCR_REPO }}/fetcher"
|
||||
labels:
|
||||
org.opencontainers.image.description: "Fetcher is a lightweight component used by environment and builder pods. Fetcher helps in fetch and upload of source/deployment packages and specializing environments."
|
||||
org.opencontainers.image.source: "{{.GitURL}}"
|
||||
org.opencontainers.image.created: "{{.Date}}"
|
||||
org.opencontainers.image.revision: "{{.FullCommit}}"
|
||||
org.opencontainers.image.version: "{{.Tag}}"
|
||||
org.opencontainers.image.authors: "The Fission Authors https://fission.io/"
|
||||
org.opencontainers.image.vendor: "Fission"
|
||||
org.opencontainers.image.url: "https://fission.io/"
|
||||
dockerfile: cmd/fetcher/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-amd64
|
||||
ids:
|
||||
- fission-bundle
|
||||
image_templates:
|
||||
- "fission/fission-bundle:latest-amd64"
|
||||
- "fission/fission-bundle:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/fission/fission-bundle:latest-amd64"
|
||||
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-amd64"
|
||||
- id: fission-bundle
|
||||
tags:
|
||||
- latest
|
||||
- "{{ .Tag }}"
|
||||
images:
|
||||
- "{{ .Env.GHCR_REPO }}/fission-bundle"
|
||||
labels:
|
||||
org.opencontainers.image.description: "fission-bundle is a component which is a single binary for all components. Most server side components running on server side are fission-bundle binary wrapped in container and used with different arguments."
|
||||
org.opencontainers.image.source: "{{.GitURL}}"
|
||||
org.opencontainers.image.created: "{{.Date}}"
|
||||
org.opencontainers.image.revision: "{{.FullCommit}}"
|
||||
org.opencontainers.image.version: "{{.Tag}}"
|
||||
org.opencontainers.image.authors: "The Fission Authors https://fission.io/"
|
||||
org.opencontainers.image.vendor: "Fission"
|
||||
org.opencontainers.image.url: "https://fission.io/"
|
||||
dockerfile: cmd/fission-bundle/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-amd64
|
||||
ids:
|
||||
- pre-upgrade-checks
|
||||
image_templates:
|
||||
- "fission/pre-upgrade-checks:latest-amd64"
|
||||
- "fission/pre-upgrade-checks:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:latest-amd64"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-amd64"
|
||||
- id: pre-upgrade-checks
|
||||
tags:
|
||||
- latest
|
||||
- "{{ .Tag }}"
|
||||
images:
|
||||
- "{{ .Env.GHCR_REPO }}/pre-upgrade-checks"
|
||||
labels:
|
||||
org.opencontainers.image.description: "Preupgradechecks ensures that Fission is ready for the targeted version upgrade by performing checks beforehand."
|
||||
org.opencontainers.image.source: "{{.GitURL}}"
|
||||
org.opencontainers.image.created: "{{.Date}}"
|
||||
org.opencontainers.image.revision: "{{.FullCommit}}"
|
||||
org.opencontainers.image.version: "{{.Tag}}"
|
||||
org.opencontainers.image.authors: "The Fission Authors https://fission.io/"
|
||||
org.opencontainers.image.vendor: "Fission"
|
||||
org.opencontainers.image.url: "https://fission.io/"
|
||||
dockerfile: cmd/preupgradechecks/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-amd64
|
||||
ids:
|
||||
- reporter
|
||||
image_templates:
|
||||
- "fission/reporter:latest-amd64"
|
||||
- "fission/reporter:{{ .Tag }}-amd64"
|
||||
- "ghcr.io/fission/reporter:latest-amd64"
|
||||
- "ghcr.io/fission/reporter:{{ .Tag }}-amd64"
|
||||
- id: reporter
|
||||
tags:
|
||||
- latest
|
||||
- "{{ .Tag }}"
|
||||
images:
|
||||
- "{{ .Env.GHCR_REPO }}/reporter"
|
||||
labels:
|
||||
org.opencontainers.image.description: "The reporter gathers information that assists in improving fission."
|
||||
org.opencontainers.image.source: "{{.GitURL}}"
|
||||
org.opencontainers.image.created: "{{.Date}}"
|
||||
org.opencontainers.image.revision: "{{.FullCommit}}"
|
||||
org.opencontainers.image.version: "{{.Tag}}"
|
||||
org.opencontainers.image.authors: "The Fission Authors https://fission.io/"
|
||||
org.opencontainers.image.vendor: "Fission"
|
||||
org.opencontainers.image.url: "https://fission.io/"
|
||||
dockerfile: cmd/reporter/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- &docker-arm64
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
ids:
|
||||
- builder
|
||||
image_templates:
|
||||
- "fission/builder:latest-arm64"
|
||||
- "fission/builder:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/fission/builder:latest-arm64"
|
||||
- "ghcr.io/fission/builder:{{ .Tag }}-arm64"
|
||||
dockerfile: cmd/builder/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-arm64
|
||||
ids:
|
||||
- fetcher
|
||||
image_templates:
|
||||
- "fission/fetcher:latest-arm64"
|
||||
- "fission/fetcher:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/fission/fetcher:latest-arm64"
|
||||
- "ghcr.io/fission/fetcher:{{ .Tag }}-arm64"
|
||||
dockerfile: cmd/fetcher/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-arm64
|
||||
ids:
|
||||
- fission-bundle
|
||||
image_templates:
|
||||
- "fission/fission-bundle:latest-arm64"
|
||||
- "fission/fission-bundle:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/fission/fission-bundle:latest-arm64"
|
||||
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-arm64"
|
||||
dockerfile: cmd/fission-bundle/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-arm64
|
||||
ids:
|
||||
- pre-upgrade-checks
|
||||
image_templates:
|
||||
- "fission/pre-upgrade-checks:latest-arm64"
|
||||
- "fission/pre-upgrade-checks:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:latest-arm64"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-arm64"
|
||||
dockerfile: cmd/preupgradechecks/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-arm64
|
||||
ids:
|
||||
- reporter
|
||||
image_templates:
|
||||
- "fission/reporter:latest-arm64"
|
||||
- "fission/reporter:{{ .Tag }}-arm64"
|
||||
- "ghcr.io/fission/reporter:latest-arm64"
|
||||
- "ghcr.io/fission/reporter:{{ .Tag }}-arm64"
|
||||
dockerfile: cmd/reporter/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- &docker-armv7
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm
|
||||
goarm: 7
|
||||
ids:
|
||||
- builder
|
||||
image_templates:
|
||||
- "fission/builder:latest-armv7"
|
||||
- "fission/builder:{{ .Tag }}-armv7"
|
||||
- "ghcr.io/fission/builder:latest-armv7"
|
||||
- "ghcr.io/fission/builder:{{ .Tag }}-armv7"
|
||||
dockerfile: cmd/builder/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-armv7
|
||||
ids:
|
||||
- fetcher
|
||||
image_templates:
|
||||
- "fission/fetcher:latest-armv7"
|
||||
- "fission/fetcher:{{ .Tag }}-armv7"
|
||||
- "ghcr.io/fission/fetcher:latest-armv7"
|
||||
- "ghcr.io/fission/fetcher:{{ .Tag }}-armv7"
|
||||
dockerfile: cmd/fetcher/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-armv7
|
||||
ids:
|
||||
- fission-bundle
|
||||
image_templates:
|
||||
- "fission/fission-bundle:latest-armv7"
|
||||
- "fission/fission-bundle:{{ .Tag }}-armv7"
|
||||
- "ghcr.io/fission/fission-bundle:latest-armv7"
|
||||
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-armv7"
|
||||
dockerfile: cmd/fission-bundle/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-armv7
|
||||
ids:
|
||||
- pre-upgrade-checks
|
||||
image_templates:
|
||||
- "fission/pre-upgrade-checks:latest-armv7"
|
||||
- "fission/pre-upgrade-checks:{{ .Tag }}-armv7"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:latest-armv7"
|
||||
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-armv7"
|
||||
dockerfile: cmd/preupgradechecks/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
- <<: *docker-armv7
|
||||
ids:
|
||||
- reporter
|
||||
image_templates:
|
||||
- "fission/reporter:latest-armv7"
|
||||
- "fission/reporter:{{ .Tag }}-armv7"
|
||||
- "ghcr.io/fission/reporter:latest-armv7"
|
||||
- "ghcr.io/fission/reporter:{{ .Tag }}-armv7"
|
||||
dockerfile: cmd/reporter/Dockerfile
|
||||
build_flag_templates:
|
||||
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Tag}}"
|
||||
docker_manifests:
|
||||
- name_template: ghcr.io/fission/builder:{{ .Tag }}
|
||||
image_templates:
|
||||
- ghcr.io/fission/builder:{{ .Tag }}-amd64
|
||||
- ghcr.io/fission/builder:{{ .Tag }}-arm64
|
||||
- ghcr.io/fission/builder:{{ .Tag }}-armv7
|
||||
- name_template: fission/builder:{{ .Tag }}
|
||||
image_templates:
|
||||
- fission/builder:{{ .Tag }}-amd64
|
||||
- fission/builder:{{ .Tag }}-arm64
|
||||
- fission/builder:{{ .Tag }}-armv7
|
||||
- name_template: ghcr.io/fission/fetcher:{{ .Tag }}
|
||||
image_templates:
|
||||
- ghcr.io/fission/fetcher:{{ .Tag }}-amd64
|
||||
- ghcr.io/fission/fetcher:{{ .Tag }}-arm64
|
||||
- ghcr.io/fission/fetcher:{{ .Tag }}-armv7
|
||||
- name_template: fission/fetcher:{{ .Tag }}
|
||||
image_templates:
|
||||
- fission/fetcher:{{ .Tag }}-amd64
|
||||
- fission/fetcher:{{ .Tag }}-arm64
|
||||
- fission/fetcher:{{ .Tag }}-armv7
|
||||
- name_template: ghcr.io/fission/fission-bundle:{{ .Tag }}
|
||||
image_templates:
|
||||
- ghcr.io/fission/fission-bundle:{{ .Tag }}-amd64
|
||||
- ghcr.io/fission/fission-bundle:{{ .Tag }}-arm64
|
||||
- ghcr.io/fission/fission-bundle:{{ .Tag }}-armv7
|
||||
- name_template: fission/fission-bundle:{{ .Tag }}
|
||||
image_templates:
|
||||
- fission/fission-bundle:{{ .Tag }}-amd64
|
||||
- fission/fission-bundle:{{ .Tag }}-arm64
|
||||
- fission/fission-bundle:{{ .Tag }}-armv7
|
||||
- name_template: ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}
|
||||
image_templates:
|
||||
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-amd64
|
||||
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-arm64
|
||||
- ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-armv7
|
||||
- name_template: fission/pre-upgrade-checks:{{ .Tag }}
|
||||
image_templates:
|
||||
- fission/pre-upgrade-checks:{{ .Tag }}-amd64
|
||||
- fission/pre-upgrade-checks:{{ .Tag }}-arm64
|
||||
- fission/pre-upgrade-checks:{{ .Tag }}-armv7
|
||||
- name_template: ghcr.io/fission/reporter:{{ .Tag }}
|
||||
image_templates:
|
||||
- ghcr.io/fission/reporter:{{ .Tag }}-amd64
|
||||
- ghcr.io/fission/reporter:{{ .Tag }}-arm64
|
||||
- ghcr.io/fission/reporter:{{ .Tag }}-armv7
|
||||
- name_template: fission/reporter:{{ .Tag }}
|
||||
image_templates:
|
||||
- fission/reporter:{{ .Tag }}-amd64
|
||||
- fission/reporter:{{ .Tag }}-arm64
|
||||
- fission/reporter:{{ .Tag }}-armv7
|
||||
- name_template: ghcr.io/fission/builder:latest
|
||||
image_templates:
|
||||
- ghcr.io/fission/builder:latest-amd64
|
||||
- ghcr.io/fission/builder:latest-arm64
|
||||
- ghcr.io/fission/builder:latest-armv7
|
||||
- name_template: fission/builder:latest
|
||||
image_templates:
|
||||
- fission/builder:latest-amd64
|
||||
- fission/builder:latest-arm64
|
||||
- fission/builder:latest-armv7
|
||||
- name_template: ghcr.io/fission/fetcher:latest
|
||||
image_templates:
|
||||
- ghcr.io/fission/fetcher:latest-amd64
|
||||
- ghcr.io/fission/fetcher:latest-arm64
|
||||
- ghcr.io/fission/fetcher:latest-armv7
|
||||
- name_template: fission/fetcher:latest
|
||||
image_templates:
|
||||
- fission/fetcher:latest-amd64
|
||||
- fission/fetcher:latest-arm64
|
||||
- fission/fetcher:latest-armv7
|
||||
- name_template: ghcr.io/fission/fission-bundle:latest
|
||||
image_templates:
|
||||
- ghcr.io/fission/fission-bundle:latest-amd64
|
||||
- ghcr.io/fission/fission-bundle:latest-arm64
|
||||
- ghcr.io/fission/fission-bundle:latest-armv7
|
||||
- name_template: fission/fission-bundle:latest
|
||||
image_templates:
|
||||
- fission/fission-bundle:latest-amd64
|
||||
- fission/fission-bundle:latest-arm64
|
||||
- fission/fission-bundle:latest-armv7
|
||||
- name_template: ghcr.io/fission/pre-upgrade-checks:latest
|
||||
image_templates:
|
||||
- ghcr.io/fission/pre-upgrade-checks:latest-amd64
|
||||
- ghcr.io/fission/pre-upgrade-checks:latest-arm64
|
||||
- ghcr.io/fission/pre-upgrade-checks:latest-armv7
|
||||
- name_template: fission/pre-upgrade-checks:latest
|
||||
image_templates:
|
||||
- fission/pre-upgrade-checks:latest-amd64
|
||||
- fission/pre-upgrade-checks:latest-arm64
|
||||
- fission/pre-upgrade-checks:latest-armv7
|
||||
- name_template: ghcr.io/fission/reporter:latest
|
||||
image_templates:
|
||||
- ghcr.io/fission/reporter:latest-amd64
|
||||
- ghcr.io/fission/reporter:latest-arm64
|
||||
- ghcr.io/fission/reporter:latest-armv7
|
||||
- name_template: fission/reporter:latest
|
||||
image_templates:
|
||||
- fission/reporter:latest-amd64
|
||||
- fission/reporter:latest-arm64
|
||||
- fission/reporter:latest-armv7
|
||||
changelog:
|
||||
skip: false
|
||||
disable: true
|
||||
archives:
|
||||
- id: fission
|
||||
builds:
|
||||
ids:
|
||||
- fission-cli
|
||||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
format: binary
|
||||
formats:
|
||||
- binary
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
algorithm: sha256
|
||||
docker_digest:
|
||||
name_template: "docker-digests.txt"
|
||||
|
||||
# signs the checksum file
|
||||
# https://goreleaser.com/customization/sign
|
||||
signs:
|
||||
- cmd: cosign
|
||||
artifacts: all
|
||||
stdin: '{{ .Env.COSIGN_PWD }}'
|
||||
output: true
|
||||
args:
|
||||
- sign-blob
|
||||
- '--key=cosign.key'
|
||||
- '--output-certificate=${certificate}'
|
||||
- '--output-signature=${signature}'
|
||||
- '${artifact}'
|
||||
- '--yes' # needed for cosign 2.0.0+
|
||||
- id: cosign-binary
|
||||
env:
|
||||
- COSIGN_EXPERIMENTAL=1
|
||||
signature: "${artifact}.sig.bundle"
|
||||
cmd: cosign
|
||||
artifacts: all
|
||||
args:
|
||||
- sign-blob
|
||||
- "--bundle=${signature}"
|
||||
- "${artifact}"
|
||||
- "--yes" # needed for cosign 2.0.0+
|
||||
|
||||
# signs our docker image
|
||||
# https://goreleaser.com/customization/docker_sign
|
||||
docker_signs:
|
||||
- cmd: cosign
|
||||
artifacts: all
|
||||
stdin: '{{ .Env.COSIGN_PWD }}'
|
||||
output: true
|
||||
args:
|
||||
- 'sign'
|
||||
- '--key=cosign.key'
|
||||
- '${artifact}'
|
||||
- '--yes' # needed for cosign 2.0.0+
|
||||
- cmd: cosign
|
||||
env:
|
||||
- COSIGN_EXPERIMENTAL=1
|
||||
artifacts: all
|
||||
args:
|
||||
- sign
|
||||
- "${artifact}"
|
||||
- "--yes" # needed for cosign 2.0.0+
|
||||
|
||||
sboms:
|
||||
- artifacts: archive
|
||||
id: archive
|
||||
- artifacts: source
|
||||
id: source
|
||||
- artifacts: binary
|
||||
id: binary
|
||||
- artifacts: package
|
||||
id: package
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
repos:
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.16.3
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.52.2
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
||||
rev: 3.0.0
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
@@ -59,23 +59,20 @@ install-fission-cli:
|
||||
mv dist/fission-cli_$(GOOS)_$(GOARCH)_v1/fission$(FISSION-CLI-SUFFIX) /usr/local/bin/fission
|
||||
|
||||
### Codegen
|
||||
codegen: controller-gen-install
|
||||
codegen:
|
||||
@./hack/update-codegen.sh
|
||||
$(GOPATH)/bin/controller-gen object:headerFile="hack/boilerplate.txt" paths="./..."
|
||||
go tool controller-gen object:headerFile="hack/boilerplate.txt" paths="./..."
|
||||
|
||||
### CRDs
|
||||
controller-gen-install:
|
||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
|
||||
|
||||
generate-crds: controller-gen-install
|
||||
$(GOPATH)/bin/controller-gen crd \
|
||||
generate-crds:
|
||||
go tool controller-gen crd \
|
||||
paths=./pkg/apis/core/v1 \
|
||||
output:crd:artifacts:config=crds/v1
|
||||
|
||||
### Webhook generation: it generates webhook configs with help of kubebuilder:webhook tag
|
||||
generate-webhooks: controller-gen-install
|
||||
$(GOPATH)/bin/controller-gen webhook \
|
||||
paths=./pkg/apis/core/v1 \
|
||||
generate-webhooks:
|
||||
go tool controller-gen webhook \
|
||||
paths=./pkg/webhook \
|
||||
output:dir=charts/fission-all/templates/webhook-server
|
||||
|
||||
|
||||
@@ -99,12 +96,9 @@ generate-swagger-doc:
|
||||
generate-cli-docs:
|
||||
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
|
||||
|
||||
install-crd-ref-docs:
|
||||
go install github.com/elastic/crd-ref-docs@v0.0.12
|
||||
|
||||
generate-crd-ref-docs: install-crd-ref-docs
|
||||
generate-crd-ref-docs:
|
||||
# crd-ref-docs: https://github.com/elastic/crd-ref-docs
|
||||
$(GOPATH)/bin/crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown
|
||||
go tool crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown
|
||||
cp tools/crd-ref-docs/header.md crd_docs.md
|
||||
cat out.md >> crd_docs.md && rm out.md
|
||||
mv crd_docs.md ../fission.io/content/en/docs/reference/crd-reference.md
|
||||
@@ -118,6 +112,7 @@ skaffold-prebuild:
|
||||
@cp -v cmd/fission-bundle/Dockerfile dist/fission-bundle_linux_amd64_v1/Dockerfile
|
||||
@cp -v cmd/reporter/Dockerfile dist/reporter_linux_amd64_v1/Dockerfile
|
||||
@cp -v cmd/preupgradechecks/Dockerfile dist/pre-upgrade-checks_linux_amd64_v1/Dockerfile
|
||||
@find dist/ -name 'Dockerfile' -exec sed -i.bak 's|$$TARGETPLATFORM/||g' {} +; find dist/ -name 'Dockerfile.bak' -delete
|
||||
|
||||
skaffold-deploy: skaffold-prebuild
|
||||
skaffold run -p $(SKAFFOLD_PROFILE)
|
||||
@@ -128,10 +123,3 @@ release:
|
||||
@./hack/release.sh $(VERSION)
|
||||
@./hack/release-tag.sh $(VERSION)
|
||||
@./hack/changelog.sh
|
||||
|
||||
## Envtest
|
||||
install-envtest:
|
||||
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
|
||||
|
||||
setup-envtest:
|
||||
setup-envtest -p path use 1.23.x
|
||||
|
||||
@@ -36,12 +36,19 @@
|
||||
<a href="https://github.com/fission/fission">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/fission/fission?style=social">
|
||||
</a>
|
||||
<a href="https://scorecard.dev/viewer/?uri=github.com/fission/fission">
|
||||
<image alt="OpenSSF Scorecard" src="https://api.scorecard.dev/projects/github.com/fission/fission/badge">
|
||||
</a>
|
||||
<a href="https://www.bestpractices.dev/projects/4986">
|
||||
<img src="https://www.bestpractices.dev/projects/4986/badge">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
--------------
|
||||
|
||||
Fission is a fast serverless framework for Kubernetes with a focus on
|
||||
developer productivity and high performance.
|
||||
Fission is an open-source, Kubernetes-native serverless framework that simplifies the deployment of functions and applications on Kubernetes. With Fission, developers can easily create and deploy serverless functions that can be triggered by a variety of events, such as HTTP requests, messages from a message queue, or scheduled tasks.
|
||||
|
||||
Fission provides a simple, easy-to-use interface for developers to create serverless functions in their language of choice, without having to worry about the underlying infrastructure. The framework also offers automatic scaling, so functions can scale up or down based on demand, without any additional configuration.
|
||||
|
||||
Fission operates on _just the code_: Docker and Kubernetes are
|
||||
abstracted away under normal operation, though you can use both to
|
||||
@@ -87,7 +94,7 @@ aggregation — also helps with ops on your Fission deployment.
|
||||
|
||||
```bash
|
||||
# Add the stock NodeJS env to your Fission deployment
|
||||
$ fission env create --name nodejs --image fission/node-env
|
||||
$ fission env create --name nodejs --image ghcr.io/fission/node-env
|
||||
|
||||
# Create a function with a javascript one-liner that prints "hello world"
|
||||
$ fission function create --name hello --env nodejs --code https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js
|
||||
|
||||
+4
-4
@@ -6,12 +6,12 @@ Please refer using [latest stable release](https://github.com/fission/fission/re
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| >=1.14.x | :white_check_mark: |
|
||||
| < 1.14.0 | :x: |
|
||||
| >=1.20.x | :white_check_mark: |
|
||||
| < 1.20.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please send the details to both of us:
|
||||
|
||||
- Sanket Sudake sanket@infracloud.io
|
||||
- Vishal Biyani vishal@infracloud.io
|
||||
- Sanket Sudake sanket[at]infracloud.io
|
||||
- Vishal Biyani vishal[at]infracloud.io
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
apiVersion: v2
|
||||
name: fission-all
|
||||
version: v1.20.2
|
||||
appVersion: v1.20.2
|
||||
version: 1.22.0
|
||||
appVersion: v1.22.0
|
||||
description: Fission is a fast serverless framework for Kubernetes.
|
||||
kubeVersion: ">=1.23.0-0"
|
||||
kubeVersion: ">=1.28.0-0"
|
||||
home: https://fission.io/
|
||||
icon: https://fission.io/images/fission-logo-white.svg
|
||||
sources:
|
||||
@@ -21,7 +21,6 @@ maintainers:
|
||||
email: vishal@infracloud.io
|
||||
- name: Sanket Sudake
|
||||
email: sanket@infracloud.io
|
||||
engine: gotpl
|
||||
type: application
|
||||
annotations:
|
||||
artifacthub.io/signKey: |
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.23+
|
||||
- Kubernetes 1.28+
|
||||
- Helm 3+
|
||||
|
||||
## Get Repo Info
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{{ template "deprecationWarnings" . }}
|
||||
|
||||
1. Install the client CLI.
|
||||
|
||||
Mac:
|
||||
@@ -18,7 +20,7 @@ Windows:
|
||||
{{- end }}
|
||||
|
||||
# Create an environment
|
||||
$ fission env create --name nodejs --image fission/node-env --namespace {{ .Values.defaultNamespace }}
|
||||
$ fission env create --name nodejs --image ghcr.io/fission/node-env --namespace {{ .Values.defaultNamespace }}
|
||||
|
||||
# Get a hello world
|
||||
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- define "deprecationWarnings" -}}
|
||||
{{- $deprecations := list -}}
|
||||
|
||||
{{- if .Values.builderNamespace -}}
|
||||
{{- $deprecations = append $deprecations "The 'builderNamespace' parameter is deprecated and will be removed in future release." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.functionNamespace -}}
|
||||
{{- $deprecations = append $deprecations "The 'functionNamespace' parameter is deprecated and will be removed in future release." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.disableOwnerReference -}}
|
||||
{{- $deprecations = append $deprecations "The 'disableOwnerReference' flag is temporary addition and will be removed in future release." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $deprecations -}}
|
||||
{{- range $deprecations }}
|
||||
{{- printf "WARNING: %s" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -354,6 +354,8 @@ rules:
|
||||
# TODO: Kept for future in case preupgrade needs any permissions in the future
|
||||
rules: []
|
||||
{{- end }}
|
||||
# TODO: Currently, router needs ingress related permissions only.
|
||||
# In future if router's permissions are modified then check the configured namespace.
|
||||
{{- define "router-kuberules" }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
|
||||
@@ -37,38 +37,37 @@ auth:
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
This template generates the image name for the deployment depending on the value of "repository" field in values.yaml file.
|
||||
Helper template to construct image names with repository and tag
|
||||
*/}}
|
||||
{{- define "fission-bundleImage" -}}
|
||||
{{- if .Values.repository -}}
|
||||
{{- if eq .Values.imageTag "" -}}
|
||||
{{ .Values.repository }}/{{ .Values.image }}
|
||||
{{- else -}}
|
||||
{{ .Values.repository }}/{{ .Values.image }}:{{ .Values.imageTag }}
|
||||
{{- end }}
|
||||
{{- define "imageWithTag" -}}
|
||||
{{- $repository := index . 0 -}}
|
||||
{{- $image := index . 1 -}}
|
||||
{{- $tag := index . 2 -}}
|
||||
{{- if $repository -}}
|
||||
{{- printf "%s/%s%s" $repository $image (ne $tag "" | ternary (printf ":%s" $tag) "") -}}
|
||||
{{- else -}}
|
||||
{{- if eq .Values.imageTag "" -}}
|
||||
{{ .Values.image }}
|
||||
{{- else -}}
|
||||
{{ .Values.image }}:{{ .Values.imageTag }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- printf "%s%s" $image (ne $tag "" | ternary (printf ":%s" $tag) "") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "fission-bundleImage" -}}
|
||||
{{- $args := list .Values.repository .Values.image .Values.imageTag -}}
|
||||
{{- include "imageWithTag" $args -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "reporterImage" -}}
|
||||
{{- if .Values.repository -}}
|
||||
{{- if eq .Values.imageTag "" -}}
|
||||
{{ .Values.repository }}/{{ .Values.postInstallReportImage }}
|
||||
{{- else -}}
|
||||
{{ .Values.repository }}/{{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
|
||||
{{- end }}
|
||||
{{- else -}}
|
||||
{{- if eq .Values.imageTag "" -}}
|
||||
{{ .Values.postInstallReportImage }}
|
||||
{{- else -}}
|
||||
{{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $args := list .Values.repository .Values.postInstallReportImage .Values.imageTag -}}
|
||||
{{- include "imageWithTag" $args -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "fetcherImage" -}}
|
||||
{{- $args := list (.Values.fetcher.repository | default .Values.repository) .Values.fetcher.image .Values.fetcher.imageTag -}}
|
||||
{{- include "imageWithTag" $args -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "preUpgradeChecksImage" -}}
|
||||
{{- $args := list (.Values.preUpgradeChecks.repository | default .Values.repository) .Values.preUpgradeChecks.image .Values.preUpgradeChecks.imageTag -}}
|
||||
{{- include "imageWithTag" $args -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "opentelemtry.envs" }}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}-{{ .Chart.Version }}
|
||||
name: {{ template "fullname" . }}-{{ .Chart.Version }}-post-install
|
||||
labels:
|
||||
# The "release" convention makes it easy to tie a release to all of the
|
||||
# Kubernetes resources that were created as part of that release.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}-{{ .Chart.Version }}
|
||||
name: {{ template "fullname" . }}-{{ .Chart.Version }}-post-upgrade
|
||||
labels:
|
||||
# The "release" convention makes it easy to tie a release to all of the
|
||||
# Kubernetes resources that were created as part of that release.
|
||||
|
||||
@@ -30,11 +30,7 @@ spec:
|
||||
args: ["--builderMgr", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
{{- if eq .Values.fetcher.imageTag "" }}
|
||||
value: "{{ .Values.fetcher.image }}"
|
||||
{{- else }}
|
||||
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
|
||||
{{- end }}
|
||||
value: {{ include "fetcherImage" . | quote }}
|
||||
- name: FETCHER_IMAGE_PULL_POLICY
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: BUILDER_IMAGE_PULL_POLICY
|
||||
@@ -51,6 +47,8 @@ spec:
|
||||
value: {{ .Values.fetcher.resource.mem.limits | quote }}
|
||||
- name: DEBUG_ENV
|
||||
value: {{ .Values.debugEnv | quote }}
|
||||
- name: DISABLE_OWNER_REFERENCES
|
||||
value: {{ .Values.disableOwnerReference | quote }}
|
||||
- name: PPROF_ENABLED
|
||||
value: {{ .Values.pprof.enabled | quote }}
|
||||
- name: HELM_RELEASE_NAME
|
||||
|
||||
@@ -30,11 +30,7 @@ spec:
|
||||
args: ["--executorPort", "8888"]
|
||||
env:
|
||||
- name: FETCHER_IMAGE
|
||||
{{- if eq .Values.fetcher.imageTag "" }}
|
||||
value: "{{ .Values.fetcher.image }}"
|
||||
{{- else }}
|
||||
value: "{{ .Values.fetcher.image }}:{{ .Values.fetcher.imageTag }}"
|
||||
{{- end }}
|
||||
value: {{ include "fetcherImage" . | quote }}
|
||||
- name: FETCHER_IMAGE_PULL_POLICY
|
||||
value: "{{ .Values.pullPolicy }}"
|
||||
- name: RUNTIME_IMAGE_PULL_POLICY
|
||||
@@ -76,6 +72,8 @@ spec:
|
||||
value: {{ .Values.executor.serviceAccountCheck.enabled | quote }}
|
||||
- name: SERVICEACCOUNT_CHECK_INTERVAL
|
||||
value: {{ .Values.executor.serviceAccountCheck.interval | quote }}
|
||||
- name: DISABLE_OWNER_REFERENCES
|
||||
value: {{ .Values.disableOwnerReference | quote }}
|
||||
{{- end}}
|
||||
{{- include "fission-resource-namespace.envs" . | indent 8 }}
|
||||
{{- include "kube_client.envs" . | indent 8 }}
|
||||
|
||||
@@ -118,6 +118,7 @@ spec:
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: spec.nodeName
|
||||
{{- include "fission-resource-namespace.envs" . | indent 12 }}
|
||||
command: ["/fission-bundle"]
|
||||
args: ["--logger"]
|
||||
volumeMounts:
|
||||
@@ -127,10 +128,8 @@ spec:
|
||||
- name: docker-log
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
{{- if .Values.logger.enableSecurityContext }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
{{- toYaml .Values.logger.securityContext | nindent 12 }}
|
||||
- name: fluentbit
|
||||
{{- if .Values.repository }}
|
||||
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
|
||||
|
||||
@@ -28,11 +28,7 @@ spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: pre-upgrade-job
|
||||
{{- if .Values.preUpgradeChecks.imageTag }}
|
||||
image: {{ .Values.preUpgradeChecks.image }}:{{ .Values.preUpgradeChecks.imageTag }}
|
||||
{{- else }}
|
||||
image: {{ .Values.preUpgradeChecks.image }}
|
||||
{{- end }}
|
||||
image: {{ include "preUpgradeChecksImage" . | quote }}
|
||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||
command: [ "/pre-upgrade-checks" ]
|
||||
env:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "router") .) }}
|
||||
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Release.Namespace "component" "router") .) }}
|
||||
|
||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
||||
{{- range $namespace := $.Values.additionalFissionNamespaces }}
|
||||
|
||||
@@ -12,6 +12,12 @@ spec:
|
||||
matchLabels:
|
||||
svc: storagesvc
|
||||
application: fission-storage
|
||||
strategy:
|
||||
type: {{ .Values.storagesvc.deploymentStrategy.type }}
|
||||
{{- if eq .Values.storagesvc.deploymentStrategy.type "RollingUpdate" }}
|
||||
rollingUpdate:
|
||||
{{- toYaml .Values.storagesvc.deploymentStrategy.rollingUpdate | nindent 6}}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
@@ -113,7 +119,7 @@ spec:
|
||||
priorityClassName: {{ .Values.priorityClassName }}
|
||||
{{- end }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraCoreComponentPodConfig }}
|
||||
|
||||
@@ -38,6 +38,8 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
resources:
|
||||
{{- toYaml .Values.webhook.resources | nindent 10 }}
|
||||
volumes:
|
||||
- name: serving-certs
|
||||
secret:
|
||||
|
||||
@@ -25,13 +25,13 @@ 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.20.2
|
||||
imageTag: v1.22.0
|
||||
|
||||
## pullPolicy represents the pull policy to use for images in the chart.
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
## imageppullsecrets
|
||||
## imagepullsecrets
|
||||
imagePullSecrets: []
|
||||
|
||||
## priorityClassName represents the priority class name to use for Fission components.
|
||||
@@ -67,16 +67,20 @@ defaultNamespace: default
|
||||
## if builderNamespace is set to empty then builder resources will be created in the same namespace as the Fission resources.
|
||||
## This is different from the release namespace.
|
||||
##
|
||||
## Note: This parameter is deprecated and will be removed in future fission releases.
|
||||
##
|
||||
builderNamespace: ""
|
||||
|
||||
## functionNamespace represents the namespace in which Fission Function resources will be created.
|
||||
## if functionNamespace is set to empty then function resources will be created in the same namespace as the Fission resources.
|
||||
## This is different from the release namespace.
|
||||
##
|
||||
## Note: This parameter is deprecated and will be removed in future fission releases.
|
||||
##
|
||||
functionNamespace: ""
|
||||
|
||||
## Fission will watch the following namespaces along with the `defaultNamespace` for fission custom resources.
|
||||
## additionalFissionNamespaces:
|
||||
## additionalFissionNamespaces:
|
||||
## - namespace1
|
||||
## - namespace2
|
||||
## - namespace3
|
||||
@@ -88,6 +92,16 @@ additionalFissionNamespaces: []
|
||||
##
|
||||
createNamespace: true
|
||||
|
||||
## disableOwnerReference decides to set OwnerReference to K8s resources like deployment, services, hpa etc. created by Fission.
|
||||
## If set to true, the K8s resources created by Fission will not have OwnerReference set.
|
||||
## Set to false if you want to add OwnerReference to K8s resources created by Fission.
|
||||
##
|
||||
## Set to true if you are using cross namespace meaning `builderNamespace` and `functionNamespace` are set.
|
||||
##
|
||||
## Note: This flag is temporary addition and would be removed in future fission releases.
|
||||
##
|
||||
disableOwnerReference: false
|
||||
|
||||
## enableIstio indicates whether to enable istio integration.
|
||||
##
|
||||
enableIstio: false
|
||||
@@ -103,10 +117,14 @@ kubernetesClientBurst: 500
|
||||
## fetcher helps in fetching function source code/build and uploading it when function is invoked.
|
||||
##
|
||||
fetcher:
|
||||
## repository represents the repository of the fetcher component.
|
||||
##
|
||||
## By default, it is empty, which means global repository will be used.
|
||||
repository: ""
|
||||
## image represents the image of the fetcher component.
|
||||
image: fission/fetcher
|
||||
## imageTag represents the tag of the image of the fetcher component.
|
||||
imageTag: v1.20.2
|
||||
imageTag: v1.22.0
|
||||
|
||||
## Fetcher is only for to downloading or uploading archive.
|
||||
## Normally, you don't need to change the value here, unless necessary.
|
||||
@@ -145,7 +163,7 @@ executor:
|
||||
## This is applicable to Pool Manager executor type only.
|
||||
##
|
||||
podReadyTimeout: 300s
|
||||
|
||||
|
||||
## Pod resources as:
|
||||
## resources:
|
||||
## limits:
|
||||
@@ -318,7 +336,7 @@ router:
|
||||
runAsGroup: 10001
|
||||
|
||||
## The builder manager watches the package & environments CRD changes and manages the builds of function source code.
|
||||
##
|
||||
##
|
||||
buildermgr:
|
||||
## Pod resources as:
|
||||
## resources:
|
||||
@@ -344,7 +362,7 @@ buildermgr:
|
||||
runAsGroup: 10001
|
||||
|
||||
## webhook is the component that validates API calls.
|
||||
## It contains validation and mutation for functions, triggers, environments, Kubernetes event watches, etc.
|
||||
## It contains validation and mutation for functions, triggers, environments, Kubernetes event watches, etc.
|
||||
##
|
||||
webhook:
|
||||
## Pod resources as:
|
||||
@@ -421,6 +439,16 @@ storagesvc:
|
||||
##
|
||||
resources: {}
|
||||
|
||||
## Deployment strategy defaults to RollingUpdate but use Recreate if new pods fail to
|
||||
## attach to the volume until the old pod has released it.
|
||||
## deploymentStrategy:
|
||||
## type: Recreate
|
||||
deploymentStrategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
|
||||
## Archive pruner removes archives from storage which are not referenced by any package.
|
||||
archivePruner:
|
||||
enabled: true
|
||||
@@ -523,7 +551,7 @@ serviceMonitor:
|
||||
# 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
|
||||
@@ -559,7 +587,7 @@ persistence:
|
||||
# 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
|
||||
@@ -620,11 +648,22 @@ logger:
|
||||
|
||||
## Fluent-bit writes/reads it’s own sqlite database to record a history of tracked
|
||||
## files and a state of offsets, this is very useful to resume a state if the ser-
|
||||
## vice is restarted. For Kubernetes environment with constraints like OpenShift,
|
||||
## vice is restarted.
|
||||
##
|
||||
## For Kubernetes environment with constraints like OpenShift,
|
||||
## the containers are limited to write hostPath volume. Hence, we have to enable
|
||||
## security context and set privileged to true.
|
||||
##
|
||||
enableSecurityContext: false
|
||||
## The user ID in runAsUser should have access to the `/var/log` and
|
||||
## `/var/lib/docker/containers` directories on your host.
|
||||
## On many hosts, this user might be root ,i.e., `runAsUser: 0`.
|
||||
## Although it is recommended not to use root user for security reasons.
|
||||
##
|
||||
## The `/var/log` and `/var/lib/docker/containers` directories on host are mounted
|
||||
## to logger container with volumeType `HostPath`.
|
||||
securityContext: {}
|
||||
# privileged: true
|
||||
# runAsUser: 0
|
||||
|
||||
## Enable PodSecurityPolicies to allow privileged container
|
||||
## Only required in some clusters and when enableSecurityContext is true
|
||||
@@ -658,12 +697,16 @@ preUpgradeChecks:
|
||||
## Run pre-install/pre-upgrade checks if true
|
||||
##
|
||||
enabled: true
|
||||
## Repository for pre-install/pre-upgrade checks image
|
||||
## By default it uses the global repository
|
||||
##
|
||||
repository: ""
|
||||
## pre-install/pre-upgrade checks live in this image
|
||||
##
|
||||
image: fission/pre-upgrade-checks
|
||||
## pre-install/pre-upgrade checks image version
|
||||
##
|
||||
imageTag: v1.20.2
|
||||
imageTag: v1.22.0
|
||||
|
||||
## Fission post-install/post-upgrade reporting live in this image
|
||||
##
|
||||
@@ -731,12 +774,12 @@ authentication:
|
||||
## jwtSigningKey is the signing key used for
|
||||
## signing the JWT token
|
||||
##
|
||||
jwtSigningKey:
|
||||
jwtSigningKey:
|
||||
## jwtExpiryTime is the JWT expiry time
|
||||
## in seconds
|
||||
## default '120'
|
||||
##
|
||||
jwtExpiryTime:
|
||||
jwtExpiryTime:
|
||||
## jwtIssuer is the issuer of JWT
|
||||
## default 'fission'
|
||||
##
|
||||
@@ -795,28 +838,28 @@ mqt_keda:
|
||||
connector_images:
|
||||
kafka:
|
||||
image: ghcr.io/fission/keda-kafka-http-connector
|
||||
tag: v0.13
|
||||
tag: v0.17
|
||||
rabbitmq:
|
||||
image: ghcr.io/fission/keda-rabbitmq-http-connector
|
||||
tag: v0.11
|
||||
tag: v0.15
|
||||
awskinesis:
|
||||
image: ghcr.io/fission/keda-aws-kinesis-http-connector
|
||||
tag: v0.11
|
||||
tag: v0.15
|
||||
aws_sqs:
|
||||
image: ghcr.io/fission/keda-aws-sqs-http-connector
|
||||
tag: v0.12
|
||||
tag: v0.16
|
||||
nats_steaming:
|
||||
image: ghcr.io/fission/keda-nats-streaming-http-connector
|
||||
tag: v0.14
|
||||
tag: v0.18
|
||||
nats_jetstream:
|
||||
image: ghcr.io/fission/keda-nats-jetstream-http-connector
|
||||
tag: v0.5
|
||||
tag: v0.9
|
||||
gcp_pubsub:
|
||||
image: ghcr.io/fission/keda-gcp-pubsub-http-connector
|
||||
tag: v0.7
|
||||
tag: v0.11
|
||||
redis:
|
||||
image: ghcr.io/fission/keda-redis-http-connector
|
||||
tag: v0.4
|
||||
tag: v0.8
|
||||
|
||||
## Pod resources as:
|
||||
## resources:
|
||||
@@ -841,7 +884,7 @@ 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:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
COPY builder /builder
|
||||
FROM cgr.dev/chainguard/static:latest@sha256:a301031ffd4ed67f35ca7fa6cf3dad9937b5fa47d7493955a18d9b4ca5412d1a
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/builder /builder
|
||||
ENTRYPOINT ["/builder"]
|
||||
|
||||
@@ -32,6 +32,7 @@ func Run(ctx context.Context, logger *zap.Logger, mgr manager.Interface, shareVo
|
||||
builder := builder.MakeBuilder(logger, shareVolume)
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", builder.Handler)
|
||||
mux.HandleFunc("/clean", builder.Clean)
|
||||
mux.HandleFunc("/version", builder.VersionHandler)
|
||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
COPY fetcher /
|
||||
FROM cgr.dev/chainguard/static:latest@sha256:a301031ffd4ed67f35ca7fa6cf3dad9937b5fa47d7493955a18d9b4ca5412d1a
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/fetcher /
|
||||
ENTRYPOINT ["/fetcher"]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
COPY fission-bundle /
|
||||
FROM cgr.dev/chainguard/static:latest@sha256:a301031ffd4ed67f35ca7fa6cf3dad9937b5fa47d7493955a18d9b4ca5412d1a
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/fission-bundle /
|
||||
ENTRYPOINT ["/fission-bundle"]
|
||||
|
||||
+181
-176
@@ -21,9 +21,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
docopt "github.com/docopt/docopt-go"
|
||||
"go.uber.org/zap"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||
cnwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
@@ -48,120 +46,38 @@ import (
|
||||
"github.com/fission/fission/pkg/webhook"
|
||||
)
|
||||
|
||||
// runWebhook starts admission webhook server
|
||||
func runWebhook(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, port int) error {
|
||||
return webhook.Start(ctx, clientGen, logger, cnwebhook.Options{
|
||||
Port: port,
|
||||
})
|
||||
// Command line arguments
|
||||
type CommandLineArgs struct {
|
||||
// Flags
|
||||
canaryConfig bool
|
||||
kubewatcher bool
|
||||
timer bool
|
||||
mqt bool
|
||||
mqt_keda bool
|
||||
builderMgr bool
|
||||
showVersion bool
|
||||
logger bool
|
||||
|
||||
// Port values
|
||||
webhookPort int
|
||||
routerPort int
|
||||
executorPort int
|
||||
storageServicePort int
|
||||
|
||||
// URL values
|
||||
executorUrl string
|
||||
routerUrl string
|
||||
storageSvcUrl string
|
||||
|
||||
// Other configurations
|
||||
storageType string
|
||||
}
|
||||
|
||||
func runCanaryConfigServer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) error {
|
||||
return canaryconfigmgr.StartCanaryServer(ctx, clientGen, logger, mgr, false)
|
||||
}
|
||||
|
||||
func runRouter(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, executorUrl string) error {
|
||||
return router.Start(ctx, clientGen, logger, mgr, port, eclient.MakeClient(logger, executorUrl))
|
||||
}
|
||||
|
||||
func runExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int) error {
|
||||
return executor.StartExecutor(ctx, clientGen, logger, mgr, port)
|
||||
}
|
||||
|
||||
func runKubeWatcher(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||
return kubewatcher.Start(ctx, clientGen, logger, mgr, routerUrl)
|
||||
}
|
||||
|
||||
func runTimer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||
return timer.Start(ctx, clientGen, logger, mgr, routerUrl)
|
||||
}
|
||||
|
||||
func runMessageQueueMgr(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||
return mqtrigger.Start(ctx, clientGen, logger, mgr, routerUrl)
|
||||
}
|
||||
|
||||
// KEDA based MessageQueue Trigger Manager
|
||||
func runMQManager(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerURL string) error {
|
||||
return mqt.StartScalerManager(ctx, clientGen, logger, mgr, routerURL)
|
||||
}
|
||||
|
||||
func runStorageSvc(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, storage storagesvc.Storage) error {
|
||||
return storagesvc.Start(ctx, clientGen, logger, storage, mgr, port)
|
||||
}
|
||||
|
||||
func runBuilderMgr(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, storageSvcUrl string) error {
|
||||
return buildermgr.Start(ctx, clientGen, logger, mgr, storageSvcUrl)
|
||||
}
|
||||
|
||||
func runLogger(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger) error {
|
||||
return functionLogger.Start(ctx, clientGen, logger)
|
||||
}
|
||||
|
||||
func getPort(logger *zap.Logger, portArg interface{}) int {
|
||||
portArgStr := portArg.(string)
|
||||
port, err := strconv.Atoi(portArgStr)
|
||||
if err != nil {
|
||||
logger.Fatal("invalid port number", zap.Error(err), zap.String("port", portArgStr))
|
||||
}
|
||||
return port
|
||||
}
|
||||
|
||||
func getStringArgWithDefault(arg interface{}, defaultValue string) string {
|
||||
if arg != nil {
|
||||
return arg.(string)
|
||||
} else {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
func getServiceName(arguments map[string]interface{}) string {
|
||||
serviceName := "Fission-Unknown"
|
||||
|
||||
if arguments["--routerPort"] != nil {
|
||||
serviceName = "Fission-Router"
|
||||
} else if arguments["--executorPort"] != nil {
|
||||
serviceName = "Fission-Executor"
|
||||
} else if arguments["--kubewatcher"] == true {
|
||||
serviceName = "Fission-KubeWatcher"
|
||||
} else if arguments["--timer"] == true {
|
||||
serviceName = "Fission-Timer"
|
||||
} else if arguments["--mqt"] == true {
|
||||
serviceName = "Fission-MessageQueueTrigger"
|
||||
} else if arguments["--builderMgr"] == true {
|
||||
serviceName = "Fission-BuilderMgr"
|
||||
} else if arguments["--storageServicePort"] != nil {
|
||||
serviceName = "Fission-StorageSvc"
|
||||
} else if arguments["--mqt_keda"] == true {
|
||||
serviceName = "Fission-Keda-MQTrigger"
|
||||
}
|
||||
|
||||
return serviceName
|
||||
}
|
||||
|
||||
func exitWithSync(logger *zap.Logger) {
|
||||
// Ignore error, safe to ignore as per https://github.com/uber-go/zap/issues/328
|
||||
_ = logger.Sync()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
|
||||
var err error
|
||||
|
||||
// From https://github.com/containous/traefik/pull/1817/files
|
||||
// Tell glog to log into STDERR. Otherwise, we risk
|
||||
// certain kinds of API errors getting logged into a directory not
|
||||
// available in a `FROM scratch` Docker container, causing glog to abort
|
||||
// hard with an exit code > 0.
|
||||
// TODO: fix the lint error. Error checking here is causing all components to crash with error "logtostderr not found"
|
||||
flag.Set("logtostderr", "true") //nolint: errcheck
|
||||
|
||||
usage := `fission-bundle: Package of all fission microservices: router, executor.
|
||||
// Usage information
|
||||
const usageText string = `fission-bundle: Package of all fission microservices: router, executor.
|
||||
|
||||
Use it to start one or more of the fission servers:
|
||||
|
||||
|
||||
Pool manager maintains a pool of generalized function containers, and
|
||||
specializes them on-demand. Executor must be run from a pod in a
|
||||
Kubernetes cluster.
|
||||
@@ -198,142 +114,231 @@ Options:
|
||||
--storageServicePort=<port> Port that the storage service should listen on.
|
||||
--executorUrl=<url> Executor URL. Not required if --executorPort is specified.
|
||||
--routerUrl=<url> Router URL.
|
||||
--etcdUrl=<etcdUrl> Etcd URL.
|
||||
--storageSvcUrl=<url> StorageService URL.
|
||||
--filePath=<filePath> Directory to store functions in.
|
||||
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
|
||||
--kubewatcher Start Kubernetes events watcher.
|
||||
--timer Start Timer.
|
||||
--mqt Start message queue trigger.
|
||||
--mqt_keda Start message queue trigger of kind KEDA
|
||||
--builderMgr Start builder manager.
|
||||
--version Print version information
|
||||
`
|
||||
logger := loggerfactory.GetLogger()
|
||||
defer exitWithSync(logger)
|
||||
--version Print version information`
|
||||
|
||||
ctx := signals.SetupSignalHandler()
|
||||
profile.ProfileIfEnabled(ctx, logger, mgr)
|
||||
func main() {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
|
||||
version := fmt.Sprintf("Fission Bundle Version: %s", info.BuildInfo().String())
|
||||
arguments, err := docopt.ParseArgs(usage, nil, version)
|
||||
if err != nil {
|
||||
logger.Error("failed to parse arguments", zap.Error(err))
|
||||
return
|
||||
// Set up command line parsing
|
||||
args := setupCommandLineArgs()
|
||||
|
||||
// Handle version request specially - exit after printing
|
||||
if args.showVersion {
|
||||
fmt.Printf("Fission Bundle Version: %s\n", info.BuildInfo().String())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
shutdown, err := otel.InitProvider(ctx, logger, getServiceName(arguments))
|
||||
// Initialize logger
|
||||
logger := loggerfactory.GetLogger()
|
||||
defer func() {
|
||||
// Ignore error, safe to ignore as per https://github.com/uber-go/zap/issues/328
|
||||
_ = logger.Sync()
|
||||
}()
|
||||
|
||||
// Set up signal handling for graceful shutdown
|
||||
ctx := signals.SetupSignalHandler()
|
||||
|
||||
// Enable profiling if configured
|
||||
profile.ProfileIfEnabled(ctx, logger, mgr)
|
||||
|
||||
// Initialize OpenTelemetry
|
||||
serviceName := getServiceNameFromArgs(args)
|
||||
shutdown, err := otel.InitProvider(ctx, logger, serviceName)
|
||||
if err != nil {
|
||||
logger.Error("error initializing provider for OTLP", zap.Error(err), zap.Any("argument", arguments))
|
||||
logger.Error("error initializing provider for OTLP", zap.Error(err))
|
||||
return
|
||||
}
|
||||
if shutdown != nil {
|
||||
defer shutdown(ctx)
|
||||
}
|
||||
|
||||
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
|
||||
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
|
||||
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
|
||||
// Initialize client generator
|
||||
clientGen := crd.NewClientGenerator()
|
||||
|
||||
if arguments["--webhookPort"] != nil {
|
||||
port := getPort(logger, arguments["--webhookPort"])
|
||||
err = runWebhook(ctx, clientGen, logger, port)
|
||||
// Start the appropriate service based on command line arguments
|
||||
startRequestedService(ctx, args, clientGen, logger, mgr)
|
||||
|
||||
<-ctx.Done()
|
||||
logger.Error("exiting")
|
||||
}
|
||||
|
||||
// setupCommandLineArgs parses command line arguments and returns them
|
||||
func setupCommandLineArgs() *CommandLineArgs {
|
||||
args := &CommandLineArgs{}
|
||||
|
||||
// Override the default usage function
|
||||
flag.Usage = func() {
|
||||
fmt.Println(usageText)
|
||||
}
|
||||
|
||||
// Tell glog to log into STDERR
|
||||
flag.Set("logtostderr", "true") //nolint: errcheck
|
||||
|
||||
// Define flags
|
||||
flag.BoolVar(&args.canaryConfig, "canaryConfig", false, "Start canary config server")
|
||||
flag.BoolVar(&args.kubewatcher, "kubewatcher", false, "Start Kubernetes events watcher")
|
||||
flag.BoolVar(&args.timer, "timer", false, "Start Timer")
|
||||
flag.BoolVar(&args.mqt, "mqt", false, "Start message queue trigger")
|
||||
flag.BoolVar(&args.mqt_keda, "mqt_keda", false, "Start message queue trigger of kind KEDA")
|
||||
flag.BoolVar(&args.builderMgr, "builderMgr", false, "Start builder manager")
|
||||
flag.BoolVar(&args.showVersion, "version", false, "Print version information")
|
||||
flag.BoolVar(&args.logger, "logger", false, "Start logger")
|
||||
|
||||
// Port flags
|
||||
flag.IntVar(&args.webhookPort, "webhookPort", 0, "Port that the webhook should listen on")
|
||||
flag.IntVar(&args.routerPort, "routerPort", 0, "Port that the router should listen on")
|
||||
flag.IntVar(&args.executorPort, "executorPort", 0, "Port that the executor should listen on")
|
||||
flag.IntVar(&args.storageServicePort, "storageServicePort", 0, "Port that the storage service should listen on")
|
||||
|
||||
// URL flags
|
||||
flag.StringVar(&args.executorUrl, "executorUrl", "http://executor.fission", "Executor URL")
|
||||
flag.StringVar(&args.routerUrl, "routerUrl", "http://router.fission", "Router URL")
|
||||
flag.StringVar(&args.storageSvcUrl, "storageSvcUrl", "http://storagesvc.fission", "StorageService URL")
|
||||
|
||||
// Other configuration flags
|
||||
flag.StringVar(&args.storageType, "storageType", "", "Type of storage to use")
|
||||
|
||||
// Parse flags
|
||||
flag.Parse()
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
// getServiceNameFromArgs determines which service is being started based on command line args
|
||||
func getServiceNameFromArgs(args *CommandLineArgs) string {
|
||||
serviceName := "Fission-Unknown"
|
||||
|
||||
if args.routerPort != 0 {
|
||||
serviceName = "Fission-Router"
|
||||
} else if args.executorPort != 0 {
|
||||
serviceName = "Fission-Executor"
|
||||
} else if args.kubewatcher {
|
||||
serviceName = "Fission-KubeWatcher"
|
||||
} else if args.timer {
|
||||
serviceName = "Fission-Timer"
|
||||
} else if args.mqt {
|
||||
serviceName = "Fission-MessageQueueTrigger"
|
||||
} else if args.builderMgr {
|
||||
serviceName = "Fission-BuilderMgr"
|
||||
} else if args.storageServicePort != 0 {
|
||||
serviceName = "Fission-StorageSvc"
|
||||
} else if args.mqt_keda {
|
||||
serviceName = "Fission-Keda-MQTrigger"
|
||||
}
|
||||
|
||||
return serviceName
|
||||
}
|
||||
|
||||
// startRequestedService starts the service specified by command line arguments
|
||||
func startRequestedService(ctx context.Context, args *CommandLineArgs, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) {
|
||||
var err error
|
||||
|
||||
// Start the requested service based on command line arguments
|
||||
if args.webhookPort != 0 {
|
||||
err = webhook.Start(ctx, clientGen, logger, cnwebhook.Options{
|
||||
Port: args.webhookPort,
|
||||
})
|
||||
logger.Error("webhook server exited:", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--canaryConfig"] == true {
|
||||
err := runCanaryConfigServer(ctx, clientGen, logger, mgr)
|
||||
if args.canaryConfig {
|
||||
err = canaryconfigmgr.StartCanaryServer(ctx, clientGen, logger, mgr, false)
|
||||
if err != nil {
|
||||
logger.Error("canary config server exited with error: ", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--routerPort"] != nil {
|
||||
port := getPort(logger, arguments["--routerPort"])
|
||||
err = runRouter(ctx, clientGen, logger, mgr, port, executorUrl)
|
||||
if args.routerPort != 0 {
|
||||
err = router.Start(ctx, clientGen, logger, mgr, args.routerPort, eclient.MakeClient(logger, args.executorUrl))
|
||||
if err != nil {
|
||||
logger.Error("router exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--executorPort"] != nil {
|
||||
port := getPort(logger, arguments["--executorPort"])
|
||||
err = runExecutor(ctx, clientGen, logger, mgr, port)
|
||||
if args.executorPort != 0 {
|
||||
err = executor.StartExecutor(ctx, clientGen, logger, mgr, args.executorPort)
|
||||
if err != nil {
|
||||
logger.Error("executor exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--kubewatcher"] == true {
|
||||
err = runKubeWatcher(ctx, clientGen, logger, mgr, routerUrl)
|
||||
if args.kubewatcher {
|
||||
err = kubewatcher.Start(ctx, clientGen, logger, mgr, args.routerUrl)
|
||||
if err != nil {
|
||||
logger.Error("kubewatcher exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--timer"] == true {
|
||||
err = runTimer(ctx, clientGen, logger, mgr, routerUrl)
|
||||
if args.timer {
|
||||
err = timer.Start(ctx, clientGen, logger, mgr, args.routerUrl)
|
||||
if err != nil {
|
||||
logger.Error("timer exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--mqt"] == true {
|
||||
err = runMessageQueueMgr(ctx, clientGen, logger, mgr, routerUrl)
|
||||
if args.mqt {
|
||||
err = mqtrigger.Start(ctx, clientGen, logger, mgr, args.routerUrl)
|
||||
if err != nil {
|
||||
logger.Error("message queue manager exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--mqt_keda"] == true {
|
||||
err = runMQManager(ctx, clientGen, logger, mgr, routerUrl)
|
||||
if args.mqt_keda {
|
||||
err = mqt.StartScalerManager(ctx, clientGen, logger, mgr, args.routerUrl)
|
||||
if err != nil {
|
||||
logger.Error("mqt scaler manager exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--builderMgr"] == true {
|
||||
err = runBuilderMgr(ctx, clientGen, logger, mgr, storageSvcUrl)
|
||||
if args.builderMgr {
|
||||
err = buildermgr.Start(ctx, clientGen, logger, mgr, args.storageSvcUrl)
|
||||
if err != nil {
|
||||
logger.Error("builder manager exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--logger"] == true {
|
||||
err = runLogger(ctx, clientGen, logger)
|
||||
if args.logger {
|
||||
err = functionLogger.Start(ctx, clientGen, logger)
|
||||
if err != nil {
|
||||
logger.Error("logger exited", zap.Error(err))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if arguments["--storageServicePort"] != nil {
|
||||
port := getPort(logger, arguments["--storageServicePort"])
|
||||
if args.storageServicePort != 0 {
|
||||
startStorageService(ctx, args, clientGen, logger, mgr)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var storage storagesvc.Storage
|
||||
// startStorageService initializes and starts the storage service
|
||||
func startStorageService(ctx context.Context, args *CommandLineArgs, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) {
|
||||
var storage storagesvc.Storage
|
||||
|
||||
if arguments["--storageType"] != nil && arguments["--storageType"] == string(storagesvc.StorageTypeS3) {
|
||||
storage = storagesvc.NewS3Storage()
|
||||
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
|
||||
storage = storagesvc.NewLocalStorage("/fission")
|
||||
}
|
||||
err := runStorageSvc(ctx, clientGen, logger, mgr, port, storage)
|
||||
if err != nil {
|
||||
logger.Error("storage service exited", zap.Error(err))
|
||||
return
|
||||
}
|
||||
if args.storageType == string(storagesvc.StorageTypeS3) {
|
||||
storage = storagesvc.NewS3Storage()
|
||||
} else if args.storageType == string(storagesvc.StorageTypeLocal) {
|
||||
storage = storagesvc.NewLocalStorage("/fission")
|
||||
}
|
||||
|
||||
<-ctx.Done()
|
||||
logger.Error("exiting")
|
||||
err := storagesvc.Start(ctx, clientGen, logger, storage, mgr, args.storageServicePort)
|
||||
if err != nil {
|
||||
logger.Error("storage service exited", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,28 +22,30 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
"github.com/fission/fission/pkg/crd"
|
||||
genInformer "github.com/fission/fission/pkg/generated/informers/externalversions"
|
||||
"github.com/fission/fission/pkg/mqtrigger"
|
||||
"github.com/fission/fission/pkg/mqtrigger/factory"
|
||||
"github.com/fission/fission/pkg/mqtrigger/messageQueue"
|
||||
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/kafka"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
"github.com/fission/fission/pkg/utils/manager"
|
||||
)
|
||||
|
||||
func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||
fissionClient, err := clientGen.GetFissionClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get fission client")
|
||||
return fmt.Errorf("failed to get fission client: %w", err)
|
||||
}
|
||||
|
||||
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
return fmt.Errorf("error waiting for CRDs: %w", err)
|
||||
}
|
||||
|
||||
mqType := (fv1.MessageQueueType)(os.Getenv("MESSAGE_QUEUE_TYPE"))
|
||||
@@ -73,11 +75,24 @@ func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *
|
||||
if err != nil {
|
||||
logger.Fatal("failed to connect to remote message queue server", zap.Error(err))
|
||||
}
|
||||
mqtMgr := mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, mq)
|
||||
err = mqtMgr.Run(ctx, mgr)
|
||||
|
||||
finformerFactory := make(map[string]genInformer.SharedInformerFactory, 0)
|
||||
for _, ns := range utils.DefaultNSResolver().FissionResourceNS {
|
||||
finformerFactory[ns] = genInformer.NewFilteredSharedInformerFactory(fissionClient, time.Minute*30, ns, nil)
|
||||
}
|
||||
|
||||
mqtMgr, err := mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, finformerFactory, mq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Start informer factory
|
||||
for _, factory := range finformerFactory {
|
||||
factory.Start(ctx.Done())
|
||||
}
|
||||
|
||||
mqtMgr.Run(ctx, ctx.Done(), mgr)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ limitations under the License.
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||
@@ -65,7 +66,7 @@ func App(clientOptions cmd.ClientOptions) *cobra.Command {
|
||||
// }
|
||||
client, err := cmd.NewClient(clientOptions)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get fission client")
|
||||
return fmt.Errorf("failed to get fission client: %w", err)
|
||||
}
|
||||
cmd.SetClientset(*client)
|
||||
return nil
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
COPY pre-upgrade-checks /
|
||||
FROM cgr.dev/chainguard/static:latest@sha256:a301031ffd4ed67f35ca7fa6cf3dad9937b5fa47d7493955a18d9b4ca5412d1a
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/pre-upgrade-checks /
|
||||
ENTRYPOINT ["/pre-upgrade-checks"]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -12,8 +11,7 @@ import (
|
||||
func TestPreUpgradeTaskClient(t *testing.T) {
|
||||
f := framework.NewFramework()
|
||||
defer f.Logger().Sync()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
err := f.Start(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
COPY reporter /
|
||||
FROM cgr.dev/chainguard/static:latest@sha256:a301031ffd4ed67f35ca7fa6cf3dad9937b5fa47d7493955a18d9b4ca5412d1a
|
||||
ARG TARGETPLATFORM
|
||||
COPY $TARGETPLATFORM/reporter /
|
||||
ENTRYPOINT ["/reporter"]
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.15.0
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: canaryconfigs.fission.io
|
||||
spec:
|
||||
group: fission.io
|
||||
|
||||
+2984
-741
File diff suppressed because it is too large
Load Diff
+1319
-332
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.15.0
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: httptriggers.fission.io
|
||||
spec:
|
||||
group: fission.io
|
||||
@@ -76,14 +76,11 @@ spec:
|
||||
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.
|
||||
type: string
|
||||
ingressconfig:
|
||||
description: |-
|
||||
TODO: make IngressConfig an independent Fission resource
|
||||
IngressConfig for router to set up Ingress.
|
||||
description: IngressConfig for router to set up Ingress.
|
||||
properties:
|
||||
annotations:
|
||||
additionalProperties:
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.15.0
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: kuberneteswatchtriggers.fission.io
|
||||
spec:
|
||||
group: fission.io
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.15.0
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: packages.fission.io
|
||||
spec:
|
||||
group: fission.io
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.15.0
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: timetriggers.fission.io
|
||||
spec:
|
||||
group: fission.io
|
||||
@@ -73,6 +73,17 @@ spec:
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
method:
|
||||
default: POST
|
||||
description: 'HTTP Method for trigger, ex : GET, POST, PUT, DELETE,
|
||||
HEAD (default: "POST")'
|
||||
type: string
|
||||
subpath:
|
||||
default: /
|
||||
description: |-
|
||||
Subpath to trigger a specific route if function
|
||||
internally supports routing, (default: "/")
|
||||
type: string
|
||||
required:
|
||||
- cron
|
||||
- functionref
|
||||
|
||||
+12
-10
@@ -1,13 +1,15 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
commonLabels:
|
||||
group: fission.io
|
||||
resources:
|
||||
- fission.io_canaryconfigs.yaml
|
||||
- fission.io_environments.yaml
|
||||
- fission.io_functions.yaml
|
||||
- fission.io_httptriggers.yaml
|
||||
- fission.io_kuberneteswatchtriggers.yaml
|
||||
- fission.io_messagequeuetriggers.yaml
|
||||
- fission.io_packages.yaml
|
||||
- fission.io_timetriggers.yaml
|
||||
- fission.io_canaryconfigs.yaml
|
||||
- fission.io_environments.yaml
|
||||
- fission.io_functions.yaml
|
||||
- fission.io_httptriggers.yaml
|
||||
- fission.io_kuberneteswatchtriggers.yaml
|
||||
- fission.io_messagequeuetriggers.yaml
|
||||
- fission.io_packages.yaml
|
||||
- fission.io_timetriggers.yaml
|
||||
labels:
|
||||
- includeSelectors: true
|
||||
pairs:
|
||||
group: fission.io
|
||||
|
||||
@@ -1,117 +1,122 @@
|
||||
module github.com/fission/fission
|
||||
|
||||
go 1.22.2
|
||||
go 1.25.5
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.0
|
||||
github.com/IBM/sarama v1.43.2
|
||||
dario.cat/mergo v1.0.2
|
||||
github.com/IBM/sarama v1.46.3
|
||||
github.com/bep/debounce v1.2.1
|
||||
github.com/dchest/uniuri v1.2.0
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||
github.com/dustin/go-humanize v1.0.1
|
||||
github.com/elastic/crd-ref-docs v0.0.12
|
||||
github.com/fatih/color v1.16.0
|
||||
github.com/fsnotify/fsnotify v1.7.0
|
||||
github.com/go-git/go-git/v5 v5.12.0
|
||||
github.com/fatih/color v1.18.0
|
||||
github.com/fsnotify/fsnotify v1.9.0
|
||||
github.com/go-git/go-git/v5 v5.16.4
|
||||
github.com/go-logr/zapr v1.3.0
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
github.com/google/go-cmp v0.7.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/graymeta/stow v0.2.8
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/hashicorp/go-retryablehttp v0.7.5
|
||||
github.com/influxdata/influxdb v1.11.5
|
||||
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.19.0
|
||||
github.com/prometheus/common v0.53.0
|
||||
github.com/hashicorp/go-retryablehttp v0.7.8
|
||||
github.com/influxdata/influxdb v1.12.2
|
||||
github.com/kedacore/keda/v2 v2.18.2
|
||||
github.com/mholt/archives v0.1.5
|
||||
github.com/minio/minio-go/v7 v7.0.97
|
||||
github.com/ory/dockertest/v3 v3.12.0
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
github.com/prometheus/common v0.67.4
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/spf13/pflag v1.0.10
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/wcharczuk/go-chart v2.0.1+incompatible
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0
|
||||
go.opentelemetry.io/contrib/propagators/autoprop v0.51.0
|
||||
go.opentelemetry.io/otel v1.26.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0
|
||||
go.opentelemetry.io/otel/sdk v1.26.0
|
||||
go.opentelemetry.io/otel/trace v1.26.0
|
||||
go.uber.org/zap v1.27.0
|
||||
golang.org/x/net v0.25.0
|
||||
google.golang.org/grpc v1.63.2
|
||||
k8s.io/api v0.30.0
|
||||
k8s.io/apiextensions-apiserver v0.30.0
|
||||
k8s.io/apimachinery v0.30.0
|
||||
k8s.io/client-go v0.30.0
|
||||
k8s.io/code-generator v0.30.0
|
||||
k8s.io/metrics v0.30.0
|
||||
sigs.k8s.io/controller-runtime v0.18.2
|
||||
sigs.k8s.io/controller-tools v0.15.0
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0
|
||||
go.opentelemetry.io/contrib/propagators/autoprop v0.64.0
|
||||
go.opentelemetry.io/otel v1.39.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
|
||||
go.opentelemetry.io/otel/sdk v1.39.0
|
||||
go.opentelemetry.io/otel/trace v1.39.0
|
||||
go.uber.org/zap v1.27.1
|
||||
golang.org/x/net v0.48.0
|
||||
google.golang.org/grpc v1.77.0
|
||||
k8s.io/api v0.34.3
|
||||
k8s.io/apiextensions-apiserver v0.34.3
|
||||
k8s.io/apimachinery v0.34.3
|
||||
k8s.io/client-go v0.34.3
|
||||
k8s.io/metrics v0.34.3
|
||||
sigs.k8s.io/controller-runtime v0.22.4
|
||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.1
|
||||
sigs.k8s.io/yaml v1.6.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
||||
github.com/andybalholm/brotli v1.0.4 // indirect
|
||||
github.com/aws/aws-sdk-go v1.42.34 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.1.6 // indirect
|
||||
github.com/STARRY-S/zip v0.2.3 // indirect
|
||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.7 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/blend/go-sdk v1.20220112.5 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/bodgit/plumbing v1.3.0 // indirect
|
||||
github.com/bodgit/sevenzip v1.6.1 // indirect
|
||||
github.com/bodgit/windows v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/containerd/continuity v0.2.2 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 // 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.6.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/containerd/continuity v0.4.5 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.5.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/docker/cli v27.4.1+incompatible // indirect
|
||||
github.com/docker/docker v28.1.1+incompatible // indirect
|
||||
github.com/docker/go-connections v0.5.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
|
||||
github.com/eapache/go-resiliency v1.7.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||
github.com/elastic/crd-ref-docs v0.2.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
|
||||
github.com/expr-lang/expr v1.17.6 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
||||
github.com/go-ini/ini v1.66.4 // indirect
|
||||
github.com/go-logr/logr v1.4.1 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.6.2 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/gobuffalo/flect v1.0.2 // indirect
|
||||
github.com/goccy/go-yaml v1.11.3 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/gobuffalo/flect v1.0.3 // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // 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.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/huandu/xstrings v1.3.3 // indirect
|
||||
github.com/imdario/mergo v0.3.11 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
@@ -123,69 +128,100 @@ require (
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.17.8 // indirect
|
||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||
github.com/lib/pq v1.10.4 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/klauspost/compress v1.18.1 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mikelolasagasti/xz v1.0.1 // indirect
|
||||
github.com/minio/crc64nvme v1.1.0 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/minlz v1.0.1 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/moby/spdystream v0.2.0 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/spdystream v0.5.0 // indirect
|
||||
github.com/moby/sys/user v0.3.0 // indirect
|
||||
github.com/moby/term v0.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
github.com/nwaples/rardecode v1.1.0 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.2.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.12 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0 // indirect
|
||||
github.com/opencontainers/runc v1.2.8 // indirect
|
||||
github.com/philhofer/fwd v1.2.0 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.22 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.2 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/procfs v0.17.0 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/skeema/knownhosts v1.2.2 // indirect
|
||||
github.com/ulikunitz/xz v0.5.9 // indirect
|
||||
github.com/sergi/go-diff v1.4.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/skeema/knownhosts v1.3.1 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.8 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/tinylib/msgp v1.3.0 // indirect
|
||||
github.com/ulikunitz/xz v0.5.15 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/aws v1.26.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/b3 v1.26.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/jaeger v1.26.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/ot v1.26.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.26.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/aws v1.39.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/b3 v1.39.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/jaeger v1.39.0 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/ot v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.39.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 // indirect
|
||||
golang.org/x/image v0.10.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/oauth2 v0.18.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/term v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.20.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/image v0.18.0 // indirect
|
||||
golang.org/x/mod v0.30.0 // indirect
|
||||
golang.org/x/oauth2 v0.33.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/term v0.38.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/tools v0.39.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools v2.2.0+incompatible // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
|
||||
k8s.io/klog/v2 v2.120.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
k8s.io/code-generator v0.34.3 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
|
||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
|
||||
knative.dev/pkg v0.0.0-20250326102644-9f3e60a9244c // indirect
|
||||
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20250211091558-894df3a7e664 // indirect
|
||||
sigs.k8s.io/controller-tools v0.19.0 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
)
|
||||
|
||||
tool (
|
||||
github.com/elastic/crd-ref-docs
|
||||
k8s.io/code-generator
|
||||
sigs.k8s.io/controller-runtime/tools/setup-envtest
|
||||
sigs.k8s.io/controller-tools/cmd/controller-gen
|
||||
)
|
||||
|
||||
replace k8s.io/code-generator => github.com/fission/code-generator v0.18.0-alpha.1.0.20250914164041-5cd640227cd4
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
if ! command -v dashboard-linter >/dev/null 2>&1; then
|
||||
echo "dashboard-linter is not installed"
|
||||
echo "Installing dashboard-linter..."
|
||||
go install github.com/grafana/dashboard-linter@latest
|
||||
exit 1;
|
||||
fi
|
||||
BASE_PATH=$(pwd)
|
||||
|
||||
+1
-2
@@ -28,8 +28,7 @@ set +x
|
||||
# for codecov
|
||||
echo "" > coverage.txt
|
||||
|
||||
make install-envtest
|
||||
KUBEBUILDER_ASSETS=$(setup-envtest -p path use 1.23.x)
|
||||
KUBEBUILDER_ASSETS=$(go tool setup-envtest -p path use 1.30.x)
|
||||
export KUBEBUILDER_ASSETS
|
||||
|
||||
# The executor unit test only works with NodePort-type services for
|
||||
|
||||
@@ -3,11 +3,18 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
CODEGEN_PKG_VERSION=$(go list -m -f '{{.Replace.Version}}' k8s.io/code-generator)
|
||||
if [ -z "$CODEGEN_PKG_VERSION" ]; then
|
||||
echo "Error: could not determine code-generator version from go.mod"
|
||||
echo "Received output: '$CODEGEN_PKG_VERSION'"
|
||||
exit 1
|
||||
fi
|
||||
GOPATH=$(go env GOPATH)
|
||||
GOMODCACHEPATH=$(go env GOMODCACHE)
|
||||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(
|
||||
cd "${SCRIPT_ROOT}"
|
||||
ls -d -1 ${SCRIPT_ROOT}/../code-generator 2>/dev/null || echo $GOPATH/pkg/mod/k8s.io/code-generator@v0.30.0
|
||||
echo ${GOMODCACHEPATH}/github.com/fission/code-generator@${CODEGEN_PKG_VERSION}
|
||||
)}
|
||||
OUTDIR="${SCRIPT_ROOT}/pkg/generated"
|
||||
|
||||
|
||||
@@ -167,3 +167,7 @@ const (
|
||||
ConfigMaps = "configmaps"
|
||||
Secrets = "secrets"
|
||||
)
|
||||
|
||||
const (
|
||||
BuilderContainerName = "builder"
|
||||
)
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var environmentlog = loggerfactory.GetLogger().Named("environment-resource")
|
||||
|
||||
func (r *Environment) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// Admission webhooks can be added by adding tag: kubebuilder:webhook:path=/mutate-fission-io-v1-environment,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=environments,verbs=create;update,versions=v1,name=menvironment.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &Environment{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *Environment) Default() {
|
||||
environmentlog.Debug("default", zap.String("name", r.Name))
|
||||
}
|
||||
|
||||
// user: change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-environment,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=environments,verbs=create,versions=v1,name=venvironment.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &Environment{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Environment) ValidateCreate() (admission.Warnings, error) {
|
||||
environmentlog.Debug("validate create", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("Environment", err)
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Environment) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
environmentlog.Debug("validate update", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Environment) ValidateDelete() (admission.Warnings, error) {
|
||||
environmentlog.Debug("validate delete", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var functionlog = loggerfactory.GetLogger().Named("function-resource")
|
||||
|
||||
func (r *Function) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// Admission webhooks can be added by adding tag: kubebuilder:webhook:path=/mutate-fission-io-v1-function,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=functions,verbs=create;update,versions=v1,name=mfunction.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &Function{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *Function) Default() {
|
||||
}
|
||||
|
||||
// user change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-function,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=functions,verbs=create;update,versions=v1,name=vfunction.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &Function{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Function) ValidateCreate() (admission.Warnings, error) {
|
||||
functionlog.Debug("validate create", zap.String("name", r.Name))
|
||||
|
||||
for _, cnfMap := range r.Spec.ConfigMaps {
|
||||
if cnfMap.Namespace != r.ObjectMeta.Namespace {
|
||||
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
}
|
||||
for _, secret := range r.Spec.Secrets {
|
||||
if secret.Namespace != r.ObjectMeta.Namespace {
|
||||
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
}
|
||||
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Function) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
functionlog.Debug("validate update", zap.String("name", r.Name))
|
||||
|
||||
for _, cnfMap := range r.Spec.ConfigMaps {
|
||||
if cnfMap.Namespace != r.ObjectMeta.Namespace {
|
||||
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
}
|
||||
for _, secret := range r.Spec.Secrets {
|
||||
if secret.Namespace != r.ObjectMeta.Namespace {
|
||||
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
}
|
||||
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
return nil, AggregateValidationErrors("Function", err)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Function) ValidateDelete() (admission.Warnings, error) {
|
||||
functionlog.Debug("validate delete", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var httptriggerlog = loggerfactory.GetLogger().Named("httptrigger-resource")
|
||||
|
||||
func (r *HTTPTrigger) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// Admission webhooks can be added by adding tag: kubebuilder:webhook:path=/mutate-fission-io-v1-httptrigger,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=httptriggers,verbs=create;update,versions=v1,name=mhttptrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &HTTPTrigger{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *HTTPTrigger) Default() {
|
||||
httptriggerlog.Debug("default", zap.String("name", r.Name))
|
||||
}
|
||||
|
||||
// user change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-httptrigger,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=httptriggers,verbs=create;update,versions=v1,name=vhttptrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &HTTPTrigger{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (t *HTTPTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||
httptriggerlog.Debug("validate create", zap.String("name", t.Name))
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("HTTPTrigger", err)
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *HTTPTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
httptriggerlog.Debug("validate update", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("HTTPTrigger", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *HTTPTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||
httptriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var kuberneteswatchtriggerlog = loggerfactory.GetLogger().Named("kuberneteswatchtrigger-resource")
|
||||
|
||||
func (r *KubernetesWatchTrigger) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// Admission webhooks can be added by adding tag: kubebuilder:webhook:path=/mutate-fission-io-v1-kuberneteswatchtrigger,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=kuberneteswatchtriggers,verbs=create;update,versions=v1,name=mkuberneteswatchtrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &KubernetesWatchTrigger{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *KubernetesWatchTrigger) Default() {
|
||||
kuberneteswatchtriggerlog.Debug("default", zap.String("name", r.Name))
|
||||
}
|
||||
|
||||
// user: change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-kuberneteswatchtrigger,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=kuberneteswatchtriggers,verbs=create,versions=v1,name=vkuberneteswatchtrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &KubernetesWatchTrigger{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *KubernetesWatchTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||
kuberneteswatchtriggerlog.Debug("validate create", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("Watch", err)
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *KubernetesWatchTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
// WATCH UPDATE NOT IMPLEMENTED
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *KubernetesWatchTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||
kuberneteswatchtriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var packagelog = loggerfactory.GetLogger().Named("package-resource")
|
||||
|
||||
func (r *Package) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
//+kubebuilder:webhook:path=/mutate-fission-io-v1-package,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=packages,verbs=create;update,versions=v1,name=mpackage.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &Package{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *Package) Default() {
|
||||
packagelog.Debug("default", zap.String("name", r.Name))
|
||||
if r.Status.BuildStatus == "" {
|
||||
if !r.Spec.Deployment.IsEmpty() {
|
||||
// deployment package exists
|
||||
r.Status.BuildStatus = BuildStatusNone
|
||||
} else if !r.Spec.Source.IsEmpty() {
|
||||
// source package with no deployment is a pending build
|
||||
r.Status.BuildStatus = BuildStatusPending
|
||||
} else {
|
||||
r.Status.BuildStatus = BuildStatusFailed // empty package
|
||||
r.Status.BuildLog = "Both source and deployment are empty"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// user change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-package,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=packages,verbs=create;update,versions=v1,name=vpackage.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &Package{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Package) ValidateCreate() (admission.Warnings, error) {
|
||||
packagelog.Debug("validate create", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("Package", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Ensure size limits
|
||||
if len(r.Spec.Source.Literal) > int(ArchiveLiteralSizeLimit) {
|
||||
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
||||
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
||||
return nil, err
|
||||
}
|
||||
if len(r.Spec.Deployment.Literal) > int(ArchiveLiteralSizeLimit) {
|
||||
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
||||
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Package) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
packagelog.Debug("validate update", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("Package", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *Package) ValidateDelete() (admission.Warnings, error) {
|
||||
packagelog.Debug("validate delete", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
Copyright 2022.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
ferror "github.com/fission/fission/pkg/error"
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var timetriggerlog = loggerfactory.GetLogger().Named("timetrigger-resource")
|
||||
|
||||
func (r *TimeTrigger) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// Admission webhooks can be added by adding tag: kubebuilder:webhook:path=/mutate-fission-io-v1-timetrigger,mutating=true,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=timetriggers,verbs=create;update,versions=v1,name=mtimetrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Defaulter = &TimeTrigger{}
|
||||
|
||||
// Default implements webhook.Defaulter so a webhook will be registered for the type
|
||||
func (r *TimeTrigger) Default() {
|
||||
timetriggerlog.Debug("default", zap.String("name", r.Name))
|
||||
}
|
||||
|
||||
// user change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
|
||||
//+kubebuilder:webhook:path=/validate-fission-io-v1-timetrigger,mutating=false,failurePolicy=fail,sideEffects=None,groups=fission.io,resources=timetriggers,verbs=create;update,versions=v1,name=vtimetrigger.fission.io,admissionReviewVersions=v1
|
||||
|
||||
var _ webhook.Validator = &TimeTrigger{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *TimeTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||
timetriggerlog.Debug("validate create", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("TimeTrigger", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = IsValidCronSpec(r.Spec.Cron)
|
||||
if err != nil {
|
||||
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *TimeTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
timetriggerlog.Debug("validate update", zap.String("name", r.Name))
|
||||
err := r.Validate()
|
||||
if err != nil {
|
||||
err = AggregateValidationErrors("TimeTrigger", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = IsValidCronSpec(r.Spec.Cron)
|
||||
if err != nil {
|
||||
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *TimeTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||
timetriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||
return nil, nil
|
||||
}
|
||||
@@ -821,6 +821,17 @@ type (
|
||||
|
||||
// The reference to function
|
||||
FunctionReference `json:"functionref"`
|
||||
|
||||
// HTTP Method for trigger, ex : GET, POST, PUT, DELETE, HEAD (default: "POST")
|
||||
// +kubebuilder:default:="POST"
|
||||
// +optional
|
||||
Method string `json:"method,omitempty"`
|
||||
|
||||
// Subpath to trigger a specific route if function
|
||||
// internally supports routing, (default: "/")
|
||||
// +kubebuilder:default:="/"
|
||||
// +optional
|
||||
Subpath string `json:"subpath,omitempty"`
|
||||
}
|
||||
// FailureType refers to the type of failure
|
||||
FailureType string
|
||||
|
||||
@@ -599,7 +599,7 @@ func (e *Environment) Validate() error {
|
||||
|
||||
if e.Spec.Runtime.PodSpec != nil {
|
||||
for _, container := range e.Spec.Runtime.PodSpec.Containers {
|
||||
if container.Command == nil && container.Image == e.Spec.Runtime.Image && container.Name != e.ObjectMeta.Name {
|
||||
if container.Command == nil && container.Image == e.Spec.Runtime.Image && container.Name != e.Name {
|
||||
result = multierror.Append(result, errors.New("container with image same as runtime image in podspec, must have name same as environment name"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ package v1
|
||||
import (
|
||||
"k8s.io/api/autoscaling/v2"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
|
||||
@@ -428,6 +428,8 @@ var map_TimeTriggerSpec = map[string]string{
|
||||
"": "TimeTriggerSpec invokes the specific function at a time or times specified by a cron string.",
|
||||
"cron": "Cron schedule",
|
||||
"functionref": "The reference to function",
|
||||
"method": "HTTP Method for trigger, ex : GET, POST, PUT, DELETE, HEAD (default: \"POST\")",
|
||||
"subpath": "Subpath to trigger a specific route if function internally supports routing, (default: \"/\")",
|
||||
}
|
||||
|
||||
func (TimeTriggerSpec) SwaggerDoc() map[string]string {
|
||||
|
||||
+51
-9
@@ -31,10 +31,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/fission/fission/pkg/info"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
otelUtils "github.com/fission/fission/pkg/utils/otel"
|
||||
)
|
||||
|
||||
@@ -121,9 +121,19 @@ func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
|
||||
logger.Info("builder received request", zap.Any("request", req))
|
||||
|
||||
logger.Debug("starting build")
|
||||
srcPkgPath := filepath.Join(builder.sharedVolumePath, req.SrcPkgFilename)
|
||||
srcPkgPath, err := utils.SanitizeFilePath(filepath.Join(builder.sharedVolumePath, req.SrcPkgFilename), builder.sharedVolumePath)
|
||||
if err != nil {
|
||||
logger.Error(err.Error(), zap.String("filename", req.SrcPkgFilename))
|
||||
builder.reply(r.Context(), w, "", err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
deployPkgFilename := fmt.Sprintf("%s-%s", req.SrcPkgFilename, strings.ToLower(uniuri.NewLen(6)))
|
||||
deployPkgPath := filepath.Join(builder.sharedVolumePath, deployPkgFilename)
|
||||
deployPkgPath, err := utils.SanitizeFilePath(filepath.Join(builder.sharedVolumePath, deployPkgFilename), builder.sharedVolumePath)
|
||||
if err != nil {
|
||||
logger.Error(err.Error(), zap.String("filename", req.SrcPkgFilename))
|
||||
builder.reply(r.Context(), w, "", err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
var buildArgs []string
|
||||
buildCmd := req.BuildCommand
|
||||
@@ -154,6 +164,38 @@ func (builder *Builder) Handler(w http.ResponseWriter, r *http.Request) {
|
||||
builder.reply(r.Context(), w, deployPkgFilename, buildLogs, http.StatusOK)
|
||||
}
|
||||
|
||||
func (builder *Builder) Clean(w http.ResponseWriter, r *http.Request) {
|
||||
logger := otelUtils.LoggerWithTraceID(r.Context(), builder.logger)
|
||||
|
||||
if r.Method != "DELETE" {
|
||||
e := "method not allowed"
|
||||
logger.Error(e, zap.String("http_method", r.Method))
|
||||
builder.reply(r.Context(), w, "", fmt.Sprintf("%s: %s", e, r.Method), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsed := time.Since(startTime)
|
||||
logger.Info("clean request complete", zap.Duration("elapsed_time", elapsed))
|
||||
}()
|
||||
|
||||
srcPkgFilename := r.URL.Query().Get("name")
|
||||
srcPkgPath := filepath.Join(builder.sharedVolumePath, srcPkgFilename)
|
||||
|
||||
logger.Info("builder received clean request", zap.Any("source_package", srcPkgFilename))
|
||||
|
||||
err := utils.DeleteOldPackages(srcPkgPath, envSrcPkg)
|
||||
if err != nil {
|
||||
e := "error deleting src package after build"
|
||||
logger.Error(e, zap.Error(err))
|
||||
builder.reply(r.Context(), w, srcPkgFilename, "", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
builder.reply(r.Context(), w, srcPkgFilename, "", http.StatusOK)
|
||||
}
|
||||
|
||||
func (builder *Builder) reply(ctx context.Context, w http.ResponseWriter, pkgFilename string, buildLogs string, statusCode int) {
|
||||
logger := otelUtils.LoggerWithTraceID(ctx, builder.logger)
|
||||
resp := PackageBuildResponse{
|
||||
@@ -163,7 +205,7 @@ func (builder *Builder) reply(ctx context.Context, w http.ResponseWriter, pkgFil
|
||||
|
||||
rBody, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
e := errors.Wrap(err, "error encoding response body")
|
||||
e := fmt.Errorf("error encoding response body: %w", err)
|
||||
rBody = []byte(fmt.Sprintf(`{"buildLogs": "%s"}`, e.Error()))
|
||||
statusCode = http.StatusInternalServerError
|
||||
}
|
||||
@@ -204,12 +246,12 @@ func (builder *Builder) build(ctx context.Context, command string, args []string
|
||||
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error creating stdout pipe for cmd")
|
||||
return "", fmt.Errorf("error creating stdout pipe for cmd: %w", err)
|
||||
}
|
||||
|
||||
stderr, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error creating stderr pipe for cmd")
|
||||
return "", fmt.Errorf("error creating stderr pipe for cmd: %w", err)
|
||||
}
|
||||
|
||||
// Init logs
|
||||
@@ -220,7 +262,7 @@ func (builder *Builder) build(ctx context.Context, command string, args []string
|
||||
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error starting cmd")
|
||||
return "", fmt.Errorf("error starting cmd: %w", err)
|
||||
}
|
||||
fmt.Printf("========= START =========\n")
|
||||
defer fmt.Printf("========= END ===========\n")
|
||||
@@ -233,14 +275,14 @@ func (builder *Builder) build(ctx context.Context, command string, args []string
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
scanErr := errors.Wrap(err, "error reading cmd output")
|
||||
scanErr := fmt.Errorf("error reading cmd output: %w", err)
|
||||
fmt.Println(scanErr)
|
||||
return buildLogs, scanErr
|
||||
}
|
||||
|
||||
err = cmd.Wait()
|
||||
if err != nil {
|
||||
cmdErr := errors.Wrapf(err, "error waiting for cmd %q", command)
|
||||
cmdErr := fmt.Errorf("error waiting for cmd %q: %w", command, err)
|
||||
fmt.Println(cmdErr)
|
||||
return buildLogs, cmdErr
|
||||
}
|
||||
|
||||
@@ -168,4 +168,50 @@ func TestBuilder(t *testing.T) {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// Test CleanHandler
|
||||
t.Run("CleanHandler", func(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
srcPkgFilename string
|
||||
handler func(w http.ResponseWriter, r *http.Request)
|
||||
status int
|
||||
}{
|
||||
{
|
||||
name: "should fail deleting src pkg: invalid shared volume path",
|
||||
srcPkgFilename: "test2",
|
||||
handler: func(w http.ResponseWriter, r *http.Request) {
|
||||
builder.Clean(w, r)
|
||||
},
|
||||
status: http.StatusInternalServerError,
|
||||
},
|
||||
{
|
||||
name: "should fail deleting src pkg: method not allowed",
|
||||
srcPkgFilename: "test3",
|
||||
handler: func(w http.ResponseWriter, r *http.Request) {
|
||||
builder.Handler(w, r)
|
||||
},
|
||||
status: http.StatusMethodNotAllowed,
|
||||
},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
_, err := os.MkdirTemp(dir, test.srcPkgFilename)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
srcFile, err := os.Create(dir + "/" + test.srcPkgFilename)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer srcFile.Close()
|
||||
w := httptest.NewRecorder()
|
||||
r := httptest.NewRequest(http.MethodDelete, "/clean/"+test.srcPkgFilename, http.NoBody)
|
||||
test.handler(w, r)
|
||||
resp := w.Result()
|
||||
if resp.StatusCode != test.status {
|
||||
t.Errorf("expected status code %d, got %d", test.status, resp.StatusCode)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,11 +20,12 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-retryablehttp"
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
@@ -37,6 +38,7 @@ import (
|
||||
type (
|
||||
ClientInterface interface {
|
||||
Build(context.Context, *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error)
|
||||
Clean(context.Context, string) error
|
||||
}
|
||||
|
||||
client struct {
|
||||
@@ -57,32 +59,62 @@ func MakeClient(logger *zap.Logger, builderUrl string) ClientInterface {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *client) getCleanUrl(srcPkgFilename string) string {
|
||||
return c.url + "/clean" + "?name=" + srcPkgFilename
|
||||
}
|
||||
|
||||
func (c *client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error) {
|
||||
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
|
||||
|
||||
body, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error marshaling json")
|
||||
return nil, fmt.Errorf("error marshaling json: %w", err)
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Post(ctx, c.httpClient.StandardClient(), c.url, "application/json", bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("error sending request: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
rBody, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
logger.Error("error reading resp body", zap.Error(err))
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("error reading response body: %w", err)
|
||||
}
|
||||
|
||||
pkgBuildResp := builder.PackageBuildResponse{}
|
||||
err = json.Unmarshal(rBody, &pkgBuildResp)
|
||||
if err != nil {
|
||||
logger.Error("error parsing resp body", zap.Error(err))
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("error parsing response body: %w", err)
|
||||
}
|
||||
|
||||
return &pkgBuildResp, ferror.MakeErrorFromHTTP(resp)
|
||||
}
|
||||
|
||||
func (c *client) Clean(ctx context.Context, srcPkgFilename string) error {
|
||||
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
|
||||
|
||||
req, err := http.NewRequest(http.MethodDelete, c.getCleanUrl(srcPkgFilename), http.NoBody)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating http request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Do(ctx, c.httpClient.StandardClient(), req)
|
||||
if err != nil {
|
||||
logger.Error("error sending clean request", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == http.StatusMethodNotAllowed {
|
||||
return nil
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return ferror.MakeErrorFromHTTP(resp)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ package buildermgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -38,21 +38,21 @@ func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *
|
||||
|
||||
fissionClient, err := clientGen.GetFissionClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get fission client")
|
||||
return fmt.Errorf("failed to get fission client: %w", err)
|
||||
}
|
||||
kubernetesClient, err := clientGen.GetKubernetesClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get kubernetes client")
|
||||
return fmt.Errorf("failed to get kubernetes client: %w", err)
|
||||
}
|
||||
|
||||
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
return fmt.Errorf("error waiting for CRDs: %w", err)
|
||||
}
|
||||
|
||||
fetcherConfig, err := fetcherConfig.MakeFetcherConfig("/packages")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error making fetcher config")
|
||||
return fmt.Errorf("error making fetcher config: %w", err)
|
||||
}
|
||||
|
||||
podSpecPatch, err := util.GetSpecFromConfigMap(fv1.BuilderPodSpecPath)
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -55,10 +54,19 @@ func buildPackage(ctx context.Context, logger *zap.Logger, fissionClient version
|
||||
return nil, e, ferror.MakeError(http.StatusInternalServerError, e)
|
||||
}
|
||||
|
||||
svcName := fmt.Sprintf("%v-%v.%v", env.ObjectMeta.Name, env.ObjectMeta.ResourceVersion, envBuilderNamespace)
|
||||
srcPkgFilename := fmt.Sprintf("%v-%v", pkg.ObjectMeta.Name, strings.ToLower(uniuri.NewLen(6)))
|
||||
fetcherC := fetcherClient.MakeClient(logger, fmt.Sprintf("http://%v:8000", svcName))
|
||||
builderC := builderClient.MakeClient(logger, fmt.Sprintf("http://%v:8001", svcName))
|
||||
svcName := fmt.Sprintf("%s-%s.%s", env.Name, env.ResourceVersion, envBuilderNamespace)
|
||||
srcPkgFilename := fmt.Sprintf("%s-%s", pkg.Name, strings.ToLower(uniuri.NewLen(6)))
|
||||
fetcherC := fetcherClient.MakeClient(logger, fmt.Sprintf("http://%s:8000", svcName))
|
||||
builderC := builderClient.MakeClient(logger, fmt.Sprintf("http://%s:8001", svcName))
|
||||
|
||||
defer func() {
|
||||
logger.Info("cleaning src pkg from builder storage", zap.String("source_package", srcPkgFilename))
|
||||
errC := cleanPackage(ctx, builderC, srcPkgFilename)
|
||||
if errC != nil {
|
||||
m := "error cleaning src pkg from builder storage"
|
||||
logger.Error(m, zap.Error(errC))
|
||||
}
|
||||
}()
|
||||
|
||||
fetchReq := &fetcher.FunctionFetchRequest{
|
||||
FetchType: fv1.FETCH_SOURCE,
|
||||
@@ -121,6 +129,15 @@ func buildPackage(ctx context.Context, logger *zap.Logger, fissionClient version
|
||||
return uploadResp, buildResp.BuildLogs, nil
|
||||
}
|
||||
|
||||
func cleanPackage(ctx context.Context, builderClient builderClient.ClientInterface, srcPkgFileName string) error {
|
||||
err := builderClient.Clean(ctx, srcPkgFileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func updatePackage(ctx context.Context, logger *zap.Logger, fissionClient versioned.Interface,
|
||||
pkg *fv1.Package, status fv1.BuildStatus, buildLogs string,
|
||||
uploadResp *fetcher.ArchiveUploadResponse) (*fv1.Package, error) {
|
||||
@@ -144,7 +161,7 @@ func updatePackage(ctx context.Context, logger *zap.Logger, fissionClient versio
|
||||
if err != nil {
|
||||
e := "error updating package"
|
||||
logger.Error(e, zap.Error(err))
|
||||
return nil, errors.Wrap(err, e)
|
||||
return nil, fmt.Errorf("%s: %w", e, err)
|
||||
}
|
||||
|
||||
// return resource version for function to update function package ref
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
@@ -73,6 +74,7 @@ type (
|
||||
useIstio bool
|
||||
podSpecPatch *apiv1.PodSpec
|
||||
envWatchInformer map[string]k8sCache.SharedIndexInformer
|
||||
enableOwnerReferences bool
|
||||
}
|
||||
)
|
||||
|
||||
@@ -107,6 +109,7 @@ func makeEnvironmentWatcher(
|
||||
fetcherConfig: fetcherConfig,
|
||||
podSpecPatch: podSpecPatch,
|
||||
envWatchInformer: utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.EnvironmentResource),
|
||||
enableOwnerReferences: utils.IsOwnerReferencesEnabled(),
|
||||
}
|
||||
|
||||
err := envWatcher.EnvWatchEventHandlers(ctx)
|
||||
@@ -324,11 +327,22 @@ func (envw *environmentWatcher) getBuilderServiceList(ctx context.Context, sel m
|
||||
func (envw *environmentWatcher) createBuilderService(ctx context.Context, env *fv1.Environment, ns string) (*apiv1.Service, error) {
|
||||
name := fmt.Sprintf("%v-%v", env.ObjectMeta.Name, env.ObjectMeta.ResourceVersion)
|
||||
sel := envw.getLabels(env.ObjectMeta.Name, ns, env.ObjectMeta.ResourceVersion)
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if envw.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(env, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Environment",
|
||||
}),
|
||||
}
|
||||
}
|
||||
service := apiv1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: ns,
|
||||
Name: name,
|
||||
Labels: sel,
|
||||
Namespace: ns,
|
||||
Name: name,
|
||||
Labels: sel,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: apiv1.ServiceSpec{
|
||||
Selector: sel,
|
||||
@@ -389,7 +403,7 @@ func (envw *environmentWatcher) createBuilderDeployment(ctx context.Context, env
|
||||
}
|
||||
|
||||
container, err := util.MergeContainer(&apiv1.Container{
|
||||
Name: "builder",
|
||||
Name: fv1.BuilderContainerName,
|
||||
Image: env.Spec.Builder.Image,
|
||||
ImagePullPolicy: envw.builderImagePullPolicy,
|
||||
TerminationMessagePath: "/dev/termination-log",
|
||||
@@ -435,11 +449,23 @@ func (envw *environmentWatcher) createBuilderDeployment(ctx context.Context, env
|
||||
|
||||
pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec))
|
||||
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if envw.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(env, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Environment",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: ns,
|
||||
Name: name,
|
||||
Labels: sel,
|
||||
Namespace: ns,
|
||||
Name: name,
|
||||
Labels: sel,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: &replicas,
|
||||
|
||||
@@ -461,7 +461,7 @@ func (canaryCfgMgr *canaryConfigMgr) rollback(ctx context.Context, canaryConfig
|
||||
functionWeights[canaryConfig.Spec.NewFunction] = 0
|
||||
functionWeights[canaryConfig.Spec.OldFunction] = 100
|
||||
|
||||
err := canaryCfgMgr.updateHttpTriggerWithRetries(ctx, trigger.ObjectMeta.Name, trigger.ObjectMeta.Namespace, functionWeights)
|
||||
err := canaryCfgMgr.updateHttpTriggerWithRetries(ctx, trigger.Name, trigger.ObjectMeta.Namespace, functionWeights)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -494,7 +494,7 @@ func (canaryCfgMgr *canaryConfigMgr) rollForward(ctx context.Context, canaryConf
|
||||
zap.String("namespace", canaryConfig.ObjectMeta.Namespace),
|
||||
zap.Any("function_weights", functionWeights))
|
||||
|
||||
err := canaryCfgMgr.updateHttpTriggerWithRetries(ctx, trigger.ObjectMeta.Name, trigger.ObjectMeta.Namespace, functionWeights)
|
||||
err := canaryCfgMgr.updateHttpTriggerWithRetries(ctx, trigger.Name, trigger.ObjectMeta.Namespace, functionWeights)
|
||||
return doneProcessingCanaryConfig, err
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ package canaryconfigmgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
@@ -47,7 +47,7 @@ func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode boo
|
||||
// in the future when new optional features are added, we need to add corresponding feature handlers and invoke them here
|
||||
canaryCfgMgr, err := MakeCanaryConfigMgr(ctx, logger, fissionClient, kubeClient, featureConfig.CanaryConfig.PrometheusSvc)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to start canary config manager")
|
||||
return fmt.Errorf("failed to start canary config manager: %w", err)
|
||||
}
|
||||
canaryCfgMgr.Run(ctx, mgr)
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
prometheus "github.com/prometheus/client_golang/api"
|
||||
prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
"github.com/prometheus/common/model"
|
||||
@@ -40,7 +39,7 @@ func MakePrometheusClient(logger *zap.Logger, prometheusSvc string) (*Prometheus
|
||||
|
||||
promApiClient, err := prometheus.NewClient(promApiConfig)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error creating prometheus api client for svc: %s", prometheusSvc)
|
||||
return nil, fmt.Errorf("error creating prometheus api client for svc: %s: %w", prometheusSvc, err)
|
||||
}
|
||||
|
||||
apiQueryClient := prometheusv1.NewAPI(promApiClient)
|
||||
@@ -63,7 +62,7 @@ func (promApiClient *PrometheusApiClient) GetFunctionFailurePercentage(ctx conte
|
||||
}
|
||||
|
||||
if reqs <= 0 {
|
||||
return -1, fmt.Errorf("no requests to this url %v and method %v in the window: %v", path, methods, window)
|
||||
return -1, fmt.Errorf("no requests to this url %s and method %v in the window: %s", path, methods, window)
|
||||
}
|
||||
|
||||
// next, get a total count of errored out requests to this function in the same window
|
||||
@@ -91,14 +90,14 @@ func (promApiClient *PrometheusApiClient) GetRequestsToFuncInWindow(ctx context.
|
||||
|
||||
reqs, err := promApiClient.executeQuery(ctx, queryString)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
|
||||
return 0, fmt.Errorf("error executing query %s: %w", queryString, err)
|
||||
}
|
||||
|
||||
queryString = fmt.Sprintf("fission_function_calls_total{%s} offset %v", queryLabels, window)
|
||||
|
||||
reqsInPrevWindow, err := promApiClient.executeQuery(ctx, queryString)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
|
||||
return 0, fmt.Errorf("error executing query %s: %w", queryString, err)
|
||||
}
|
||||
|
||||
reqsInCurrentWindow := reqs - reqsInPrevWindow
|
||||
@@ -117,14 +116,14 @@ func (promApiClient *PrometheusApiClient) GetTotalFailedRequestsToFuncInWindow(c
|
||||
|
||||
failedRequests, err := promApiClient.executeQuery(ctx, queryString)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
|
||||
return 0, fmt.Errorf("error executing query %s: %w", queryString, err)
|
||||
}
|
||||
|
||||
queryString = fmt.Sprintf("fission_function_errors_total{%s} offset %v", queryLabels, window)
|
||||
|
||||
failedReqsInPrevWindow, err := promApiClient.executeQuery(ctx, queryString)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error executing query: %s", queryString)
|
||||
return 0, fmt.Errorf("error executing query %s: %w", queryString, err)
|
||||
}
|
||||
|
||||
failedReqsInCurrentWindow := failedRequests - failedReqsInPrevWindow
|
||||
@@ -142,7 +141,7 @@ func (promApiClient *PrometheusApiClient) executeQuery(ctx context.Context, quer
|
||||
|
||||
val, warn, err := promApiClient.client.Query(ctx, queryString, time.Now())
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error querying prometheus")
|
||||
return 0, fmt.Errorf("error querying prometheus: %w", err)
|
||||
}
|
||||
|
||||
if warn != nil {
|
||||
|
||||
+4
-4
@@ -21,10 +21,10 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
kedaClient "github.com/kedacore/keda/v2/pkg/generated/clientset/versioned"
|
||||
"go.uber.org/zap"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
"k8s.io/client-go/rest"
|
||||
@@ -47,7 +47,7 @@ type (
|
||||
GetKubernetesClient() (kubernetes.Interface, error)
|
||||
GetApiExtensionsClient() (apiextensionsclient.Interface, error)
|
||||
GetMetricsClient() (metricsclient.Interface, error)
|
||||
GetDynamicClient() (dynamic.Interface, error)
|
||||
GetKedaClient() (kedaClient.Interface, error)
|
||||
}
|
||||
|
||||
ClientGenerator struct {
|
||||
@@ -118,12 +118,12 @@ func (cg *ClientGenerator) GetMetricsClient() (metricsclient.Interface, error) {
|
||||
return metricsclient.NewForConfig(config)
|
||||
}
|
||||
|
||||
func (cg *ClientGenerator) GetDynamicClient() (dynamic.Interface, error) {
|
||||
func (cg *ClientGenerator) GetKedaClient() (kedaClient.Interface, error) {
|
||||
config, err := cg.getRestConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dynamic.NewForConfig(config)
|
||||
return kedaClient.NewForConfig(config)
|
||||
}
|
||||
|
||||
func NewClientGenerator() *ClientGenerator {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package error
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsNotFound(t *testing.T) {
|
||||
errs := map[error]bool{
|
||||
nil: false,
|
||||
MakeError(ErrorNotFound, "someone not found"): true,
|
||||
MakeError(ErrorTooManyRequests, "too many requests"): false,
|
||||
errors.Wrap(MakeError(ErrorNotFound, "someone not found"), "other information"): true,
|
||||
errors.Wrap(MakeError(ErrorTooManyRequests, "too many requests"), "other information"): false,
|
||||
MakeError(ErrorNotFound, "someone not found"): true,
|
||||
MakeError(ErrorTooManyRequests, "too many requests"): false,
|
||||
fmt.Errorf("other information: %w", MakeError(ErrorNotFound, "someone not found")): true,
|
||||
fmt.Errorf("other information: %w", MakeError(ErrorTooManyRequests, "too many requests")): false,
|
||||
}
|
||||
|
||||
for err, want := range errs {
|
||||
@@ -25,9 +25,9 @@ func TestIsNotFound(t *testing.T) {
|
||||
func TestGetHTTPError(t *testing.T) {
|
||||
errs := map[int]error{
|
||||
http.StatusBadRequest: MakeError(ErrorInvalidArgument, ""),
|
||||
http.StatusConflict: errors.Wrap(MakeError(ErrorNameExists, ""), ""),
|
||||
http.StatusNotFound: errors.Wrap(MakeError(ErrorNotFound, ""), ""),
|
||||
http.StatusTooManyRequests: errors.Wrap(MakeError(ErrorTooManyRequests, "too many requests"), "other information"),
|
||||
http.StatusConflict: fmt.Errorf("%w", MakeError(ErrorNameExists, "")),
|
||||
http.StatusNotFound: fmt.Errorf("%w", MakeError(ErrorNotFound, "")),
|
||||
http.StatusTooManyRequests: fmt.Errorf("other information: %w", MakeError(ErrorTooManyRequests, "too many requests")),
|
||||
}
|
||||
for want, err := range errs {
|
||||
code, _ := GetHTTPError(err)
|
||||
|
||||
@@ -20,13 +20,13 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-retryablehttp"
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"go.uber.org/zap"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -80,18 +80,18 @@ func (c *client) GetServiceForFunction(ctx context.Context, fn *fv1.Function) (s
|
||||
|
||||
body, err := json.Marshal(fn)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "could not marshal request body for getting service for function")
|
||||
return "", fmt.Errorf("could not marshal request body for getting service for function: %w", err)
|
||||
}
|
||||
|
||||
req, err := retryablehttp.NewRequestWithContext(ctx, "POST", executorURL, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "could not create request for getting service for function")
|
||||
return "", fmt.Errorf("could not create request for getting service for function: %w", err)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := c.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error posting to getting service for function")
|
||||
return "", fmt.Errorf("error posting to getting service for function: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
@@ -101,7 +101,7 @@ func (c *client) GetServiceForFunction(ctx context.Context, fn *fv1.Function) (s
|
||||
|
||||
svcName, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error reading response body from getting service for function")
|
||||
return "", fmt.Errorf("error reading response body from getting service for function: %w", err)
|
||||
}
|
||||
|
||||
return string(svcName), nil
|
||||
@@ -118,17 +118,17 @@ func (c *client) UnTapService(ctx context.Context, fnMeta metav1.ObjectMeta, exe
|
||||
|
||||
body, err := json.Marshal(tapSvc)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not marshal request body for getting service for function")
|
||||
return fmt.Errorf("could not marshal request body for getting service for function: %w", err)
|
||||
}
|
||||
req, err := retryablehttp.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not create request for untap service for function")
|
||||
return fmt.Errorf("could not create request for untap service for function: %w", err)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := c.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error posting to getting service for function")
|
||||
return fmt.Errorf("error posting to getting service for function: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
@@ -194,7 +194,7 @@ func (c *client) _tapService(ctx context.Context, tapSvcReqs []TapServiceRequest
|
||||
|
||||
req, err := retryablehttp.NewRequestWithContext(ctx, "POST", executorURL, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not create request for tap service request")
|
||||
return fmt.Errorf("could not create request for tap service request: %w", err)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
|
||||
@@ -58,13 +58,18 @@ func ConfigMapEventHandlers(ctx context.Context, logger *zap.Logger, fissionClie
|
||||
oldCm := oldObj.(*apiv1.ConfigMap)
|
||||
newCm := newObj.(*apiv1.ConfigMap)
|
||||
if oldCm.ObjectMeta.ResourceVersion != newCm.ObjectMeta.ResourceVersion {
|
||||
logger.Debug("Configmap changed",
|
||||
zap.String("configmap_name", newCm.ObjectMeta.Name),
|
||||
zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
|
||||
funcs, err := getConfigmapRelatedFuncs(ctx, logger, &newCm.ObjectMeta, fissionClient)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get functions related to configmap", zap.String("configmap_name", newCm.ObjectMeta.Name), zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
|
||||
}
|
||||
|
||||
if len(funcs) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Debug("Configmap changed",
|
||||
zap.String("configmap_name", newCm.ObjectMeta.Name),
|
||||
zap.String("configmap_namespace", newCm.ObjectMeta.Namespace))
|
||||
refreshPods(ctx, logger, funcs, types)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -18,8 +18,8 @@ package cms
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
@@ -72,7 +72,7 @@ func refreshPods(ctx context.Context, logger *zap.Logger, funcs []fv1.Function,
|
||||
if exists {
|
||||
err = et.RefreshFuncPods(ctx, logger, f)
|
||||
} else {
|
||||
err = errors.Errorf("Unknown executor type '%s'", f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType)
|
||||
err = fmt.Errorf("unknown executor type '%s'", f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -57,13 +57,18 @@ func SecretEventHandlers(ctx context.Context, logger *zap.Logger, fissionClient
|
||||
oldS := oldObj.(*apiv1.Secret)
|
||||
newS := newObj.(*apiv1.Secret)
|
||||
if oldS.ObjectMeta.ResourceVersion != newS.ObjectMeta.ResourceVersion {
|
||||
logger.Debug("Secret changed",
|
||||
zap.String("configmap_name", newS.ObjectMeta.Name),
|
||||
zap.String("configmap_namespace", newS.ObjectMeta.Namespace))
|
||||
funcs, err := getSecretRelatedFuncs(ctx, logger, &newS.ObjectMeta, fissionClient)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get functions related to secret", zap.String("secret_name", newS.ObjectMeta.Name), zap.String("secret_namespace", newS.ObjectMeta.Namespace))
|
||||
}
|
||||
|
||||
if len(funcs) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Debug("Secret changed",
|
||||
zap.String("secret_name", newS.ObjectMeta.Name),
|
||||
zap.String("secret_namespace", newS.ObjectMeta.Namespace))
|
||||
refreshPods(ctx, logger, funcs, types)
|
||||
}
|
||||
},
|
||||
|
||||
+21
-24
@@ -26,7 +26,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
k8sCache "k8s.io/client-go/tools/cache"
|
||||
|
||||
@@ -155,12 +154,11 @@ func (executor *Executor) serveCreateFuncServices(ctx context.Context) {
|
||||
// create a waitgroup for other requests for
|
||||
// the same function to wait on
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
executor.fsCreateWg.Store(fnkeyUR, wg)
|
||||
|
||||
// launch a goroutine for each request, to parallelize
|
||||
// the specialization of different functions
|
||||
go func() {
|
||||
wg.Go(func() {
|
||||
// Control overall specialization time by setting function
|
||||
// specialization time to context. The reason not to use
|
||||
// context from router requests is because a request maybe
|
||||
@@ -189,8 +187,7 @@ func (executor *Executor) serveCreateFuncServices(ctx context.Context) {
|
||||
err: err,
|
||||
}
|
||||
executor.fsCreateWg.Delete(fnkeyUR)
|
||||
wg.Done()
|
||||
}()
|
||||
})
|
||||
} else {
|
||||
// There's an existing request for this function, wait for it to finish
|
||||
go func() {
|
||||
@@ -213,7 +210,7 @@ func (executor *Executor) serveCreateFuncServices(ctx context.Context) {
|
||||
// It normally happened if there are multiple requests are
|
||||
// waiting for the same function and executor failed to cre-
|
||||
// ate service for function.
|
||||
err = errors.Wrapf(err, "error getting service for function %s", fnName)
|
||||
err = fmt.Errorf("error getting service for function %s: %w", fnName, err)
|
||||
req.respChan <- &createFuncServiceResponse{
|
||||
funcSvc: fsvc,
|
||||
err: err,
|
||||
@@ -233,7 +230,7 @@ func (executor *Executor) createServiceForFunction(ctx context.Context, fn *fv1.
|
||||
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
e, ok := executor.executorTypes[t]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("Unknown executor type '%s'", t)
|
||||
return nil, fmt.Errorf("unknown executor type '%s'", t)
|
||||
}
|
||||
|
||||
fsvc, fsvcErr := e.GetFuncSvc(ctx, fn)
|
||||
@@ -243,7 +240,7 @@ func (executor *Executor) createServiceForFunction(ctx context.Context, fn *fv1.
|
||||
zap.Error(fsvcErr),
|
||||
zap.String("function_name", fn.ObjectMeta.Name),
|
||||
zap.String("function_namespace", fn.ObjectMeta.Namespace))
|
||||
fsvcErr = errors.Wrap(fsvcErr, fmt.Sprintf("[%s] %s", fn.ObjectMeta.Name, e))
|
||||
fsvcErr = fmt.Errorf("[%s] %s: %w", fn.ObjectMeta.Name, e, fsvcErr)
|
||||
}
|
||||
|
||||
return fsvc, fsvcErr
|
||||
@@ -254,7 +251,7 @@ func (executor *Executor) getFunctionServiceFromCache(ctx context.Context, fn *f
|
||||
t := fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
e, ok := executor.executorTypes[t]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("Unknown executor type '%s'", t)
|
||||
return nil, fmt.Errorf("unknown executor type '%s'", t)
|
||||
}
|
||||
return e.GetFuncSvcFromCache(ctx, fn)
|
||||
}
|
||||
@@ -265,11 +262,11 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
|
||||
fissionClient, err := clientGen.GetFissionClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error making the fission client")
|
||||
return fmt.Errorf("error making the fission client: %w", err)
|
||||
}
|
||||
kubernetesClient, err := clientGen.GetKubernetesClient()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error making the kube client")
|
||||
return fmt.Errorf("error making the kube client: %w", err)
|
||||
}
|
||||
metricsClient, err := clientGen.GetMetricsClient()
|
||||
if err != nil {
|
||||
@@ -278,12 +275,12 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
|
||||
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error waiting for CRDs")
|
||||
return fmt.Errorf("error waiting for CRDs: %w", err)
|
||||
}
|
||||
|
||||
fetcherConfig, err := fetcherConfig.MakeFetcherConfig("/userfunc")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Error making fetcher config")
|
||||
return fmt.Errorf("error making fetcher config: %w", err)
|
||||
}
|
||||
|
||||
executorInstanceID := strings.ToLower(uniuri.NewLen(8))
|
||||
@@ -312,7 +309,7 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
finformerFactory,
|
||||
gpmInformerFactory, podSpecPatch)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "pool manager creation failed")
|
||||
return fmt.Errorf("pool manager creation failed: %w", err)
|
||||
}
|
||||
|
||||
executorLabel, err = utils.GetInformerLabelByExecutor(fv1.ExecutorTypeNewdeploy)
|
||||
@@ -327,7 +324,7 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
finformerFactory,
|
||||
ndmInformerFactory, podSpecPatch)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "new deploy manager creation failed")
|
||||
return fmt.Errorf("new deploy manager creation failed: %w", err)
|
||||
}
|
||||
|
||||
executorLabel, err = utils.GetInformerLabelByExecutor(fv1.ExecutorTypeContainer)
|
||||
@@ -341,7 +338,7 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
executorInstanceID, finformerFactory,
|
||||
cnmInformerFactory)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "container manager creation failed")
|
||||
return fmt.Errorf("container manager creation failed: %w", err)
|
||||
}
|
||||
|
||||
executorTypes := make(map[fv1.ExecutorType]executortype.ExecutorType)
|
||||
@@ -353,14 +350,14 @@ func StartExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface,
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
for _, et := range executorTypes {
|
||||
wg.Add(1)
|
||||
go func(et executortype.ExecutorType) {
|
||||
defer wg.Done()
|
||||
if adoptExistingResources {
|
||||
et.AdoptExistingResources(ctx)
|
||||
}
|
||||
et.CleanupOldExecutorObjects(ctx)
|
||||
}(et)
|
||||
wg.Go(func() {
|
||||
func(et executortype.ExecutorType) {
|
||||
if adoptExistingResources {
|
||||
et.AdoptExistingResources(ctx)
|
||||
}
|
||||
et.CleanupOldExecutorObjects(ctx)
|
||||
}(et)
|
||||
})
|
||||
}
|
||||
// set hard timeout for resource adoption
|
||||
// TODO: use context to control the waiting time once kubernetes client supports it.
|
||||
|
||||
@@ -88,6 +88,8 @@ type (
|
||||
|
||||
hpaops *hpautils.HpaOperations
|
||||
objectReaperIntervalSecond time.Duration
|
||||
|
||||
enableOwnerReferences bool
|
||||
}
|
||||
)
|
||||
|
||||
@@ -131,6 +133,8 @@ func MakeContainer(
|
||||
deplListerSynced: make(map[string]k8sCache.InformerSynced),
|
||||
svcLister: make(map[string]corelisters.ServiceLister),
|
||||
svcListerSynced: make(map[string]k8sCache.InformerSynced),
|
||||
|
||||
enableOwnerReferences: utils.IsOwnerReferencesEnabled(),
|
||||
}
|
||||
|
||||
for ns, informerFactory := range cnmInformerFactory {
|
||||
@@ -298,17 +302,14 @@ func (caaf *Container) AdoptExistingResources(ctx context.Context) {
|
||||
for i := range fnList.Items {
|
||||
fn := &fnList.Items[i]
|
||||
if fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType == fv1.ExecutorTypeContainer {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
wg.Go(func() {
|
||||
_, err = caaf.fnCreate(ctx, fn)
|
||||
if err != nil {
|
||||
caaf.logger.Warn("failed to adopt resources for function", zap.Error(err))
|
||||
return
|
||||
}
|
||||
caaf.logger.Info("adopt resources for function", zap.String("function", fn.ObjectMeta.Name))
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +422,7 @@ func (caaf *Container) fnCreate(ctx context.Context, fn *fv1.Function) (*fscache
|
||||
return nil, fmt.Errorf("error creating deployment %s: %w", objName, err)
|
||||
}
|
||||
|
||||
hpa, err := caaf.hpaops.CreateOrGetHpa(ctx, objName, &fn.Spec.InvokeStrategy.ExecutionStrategy, depl, deployLabels, deployAnnotations)
|
||||
hpa, err := caaf.hpaops.CreateOrGetHpa(ctx, fn, objName, &fn.Spec.InvokeStrategy.ExecutionStrategy, depl, deployLabels, deployAnnotations)
|
||||
if err != nil {
|
||||
caaf.logger.Error("error creating HPA", zap.Error(err), zap.String("hpa", objName))
|
||||
go cleanupFunc(ns, objName)
|
||||
@@ -432,27 +433,27 @@ func (caaf *Container) fnCreate(ctx context.Context, fn *fv1.Function) (*fscache
|
||||
{
|
||||
// obj.TypeMeta.Kind does not work hence this, needs investigation and a fix
|
||||
Kind: "deployment",
|
||||
Name: depl.ObjectMeta.Name,
|
||||
APIVersion: depl.TypeMeta.APIVersion,
|
||||
Namespace: depl.ObjectMeta.Namespace,
|
||||
ResourceVersion: depl.ObjectMeta.ResourceVersion,
|
||||
UID: depl.ObjectMeta.UID,
|
||||
Name: depl.Name,
|
||||
APIVersion: depl.APIVersion,
|
||||
Namespace: depl.Namespace,
|
||||
ResourceVersion: depl.ResourceVersion,
|
||||
UID: depl.UID,
|
||||
},
|
||||
{
|
||||
Kind: "service",
|
||||
Name: svc.ObjectMeta.Name,
|
||||
APIVersion: svc.TypeMeta.APIVersion,
|
||||
Namespace: svc.ObjectMeta.Namespace,
|
||||
ResourceVersion: svc.ObjectMeta.ResourceVersion,
|
||||
UID: svc.ObjectMeta.UID,
|
||||
Name: svc.Name,
|
||||
APIVersion: svc.APIVersion,
|
||||
Namespace: svc.Namespace,
|
||||
ResourceVersion: svc.ResourceVersion,
|
||||
UID: svc.UID,
|
||||
},
|
||||
{
|
||||
Kind: "horizontalpodautoscaler",
|
||||
Name: hpa.ObjectMeta.Name,
|
||||
APIVersion: hpa.TypeMeta.APIVersion,
|
||||
Namespace: hpa.ObjectMeta.Namespace,
|
||||
ResourceVersion: hpa.ObjectMeta.ResourceVersion,
|
||||
UID: hpa.ObjectMeta.UID,
|
||||
Name: hpa.Name,
|
||||
APIVersion: hpa.APIVersion,
|
||||
Namespace: hpa.Namespace,
|
||||
ResourceVersion: hpa.ResourceVersion,
|
||||
UID: hpa.UID,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -467,18 +468,18 @@ func (caaf *Container) fnCreate(ctx context.Context, fn *fv1.Function) (*fscache
|
||||
_, err = caaf.fsCache.Add(*fsvc)
|
||||
if err != nil {
|
||||
caaf.logger.Error("error adding function to cache", zap.Error(err), zap.Any("function", fsvc.Function))
|
||||
metrics.ColdStartsError.WithLabelValues(fn.ObjectMeta.Name, fn.ObjectMeta.Namespace).Inc()
|
||||
metrics.ColdStartsError.WithLabelValues(fn.Name, fn.Namespace).Inc()
|
||||
return fsvc, err
|
||||
}
|
||||
|
||||
metrics.ColdStarts.WithLabelValues(fn.ObjectMeta.Name, fn.ObjectMeta.Namespace).Inc()
|
||||
metrics.ColdStarts.WithLabelValues(fn.Name, fn.Namespace).Inc()
|
||||
|
||||
return fsvc, nil
|
||||
}
|
||||
|
||||
func (caaf *Container) updateFunction(ctx context.Context, oldFn *fv1.Function, newFn *fv1.Function) error {
|
||||
|
||||
if oldFn.ObjectMeta.ResourceVersion == newFn.ObjectMeta.ResourceVersion {
|
||||
if oldFn.ResourceVersion == newFn.ResourceVersion {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
k8s_err "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -86,6 +87,7 @@ func (cn *Container) createOrGetDeployment(ctx context.Context, fn *fv1.Function
|
||||
if existingDepl.Annotations[fv1.EXECUTOR_INSTANCEID_LABEL] != cn.instanceID {
|
||||
existingDepl.Annotations = deployment.Annotations
|
||||
existingDepl.Labels = deployment.Labels
|
||||
existingDepl.OwnerReferences = deployment.OwnerReferences
|
||||
existingDepl.Spec.Template.Spec.Containers = deployment.Spec.Template.Spec.Containers
|
||||
existingDepl.Spec.Template.Spec.ServiceAccountName = deployment.Spec.Template.Spec.ServiceAccountName
|
||||
existingDepl.Spec.Template.Spec.TerminationGracePeriodSeconds = deployment.Spec.Template.Spec.TerminationGracePeriodSeconds
|
||||
@@ -263,11 +265,22 @@ func (cn *Container) getDeploymentSpec(ctx context.Context, fn *fv1.Function, ta
|
||||
|
||||
pod.Spec = *(util.ApplyImagePullSecret("", pod.Spec))
|
||||
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if cn.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(fn, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Function",
|
||||
}),
|
||||
}
|
||||
}
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: deployName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
Name: deployName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: &replicas,
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
k8s_err "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -49,11 +50,23 @@ func (cn *Container) createOrGetSvc(ctx context.Context, fn *fv1.Function, deplo
|
||||
return nil, err
|
||||
}
|
||||
logger := otelUtils.LoggerWithTraceID(ctx, cn.logger)
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if cn.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(fn, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Function",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
service := &apiv1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
Name: svcName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: apiv1.ServiceSpec{
|
||||
Ports: []apiv1.ServicePort{
|
||||
@@ -74,6 +87,7 @@ func (cn *Container) createOrGetSvc(ctx context.Context, fn *fv1.Function, deplo
|
||||
if existingSvc.Annotations[fv1.EXECUTOR_INSTANCEID_LABEL] != cn.instanceID {
|
||||
existingSvc.Annotations = service.Annotations
|
||||
existingSvc.Labels = service.Labels
|
||||
existingSvc.OwnerReferences = service.OwnerReferences
|
||||
existingSvc.Spec.Ports = service.Spec.Ports
|
||||
existingSvc.Spec.Selector = service.Spec.Selector
|
||||
existingSvc.Spec.Type = service.Spec.Type
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
k8s_err "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
@@ -61,6 +62,7 @@ func (deploy *NewDeploy) createOrGetDeployment(ctx context.Context, fn *fv1.Func
|
||||
if existingDepl.Annotations[fv1.EXECUTOR_INSTANCEID_LABEL] != deploy.instanceID {
|
||||
existingDepl.Annotations = deployment.Annotations
|
||||
existingDepl.Labels = deployment.Labels
|
||||
existingDepl.OwnerReferences = deployment.OwnerReferences
|
||||
existingDepl.Spec.Template.Spec.Containers = deployment.Spec.Template.Spec.Containers
|
||||
existingDepl.Spec.Template.Spec.ServiceAccountName = deployment.Spec.Template.Spec.ServiceAccountName
|
||||
existingDepl.Spec.Template.Spec.TerminationGracePeriodSeconds = deployment.Spec.Template.Spec.TerminationGracePeriodSeconds
|
||||
@@ -244,11 +246,23 @@ func (deploy *NewDeploy) getDeploymentSpec(ctx context.Context, fn *fv1.Function
|
||||
|
||||
pod.Spec = *(util.ApplyImagePullSecret(env.Spec.ImagePullSecret, pod.Spec))
|
||||
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if deploy.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(fn, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Function",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: deployName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
Name: deployName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: &replicas,
|
||||
@@ -267,10 +281,20 @@ func (deploy *NewDeploy) getDeploymentSpec(ctx context.Context, fn *fv1.Function
|
||||
},
|
||||
}
|
||||
|
||||
// If custom runtime container name - default env name
|
||||
mainContainerName := env.ObjectMeta.Name
|
||||
if env.Spec.Runtime.Container != nil && env.Spec.Runtime.Container.Name != "" && env.Spec.Runtime.PodSpec != nil {
|
||||
if util.DoesContainerExistInPodSpec(env.Spec.Runtime.Container.Name, env.Spec.Runtime.PodSpec) {
|
||||
mainContainerName = env.Spec.Runtime.Container.Name
|
||||
} else {
|
||||
return nil, fmt.Errorf("runtime container %s not found in pod spec", env.Spec.Runtime.Container.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Order of merging is important here - first fetcher, then containers and lastly pod spec
|
||||
err = deploy.fetcherConfig.AddSpecializingFetcherToPodSpec(
|
||||
&deployment.Spec.Template.Spec,
|
||||
env.ObjectMeta.Name,
|
||||
mainContainerName,
|
||||
fn,
|
||||
env,
|
||||
)
|
||||
@@ -323,13 +347,25 @@ func (deploy *NewDeploy) getResources(env *fv1.Environment, fn *fv1.Function) ap
|
||||
return resources
|
||||
}
|
||||
|
||||
func (deploy *NewDeploy) createOrGetSvc(ctx context.Context, deployLabels map[string]string, deployAnnotations map[string]string, svcName string, svcNamespace string) (*apiv1.Service, error) {
|
||||
func (deploy *NewDeploy) createOrGetSvc(ctx context.Context, fn *fv1.Function, deployLabels map[string]string, deployAnnotations map[string]string, svcName string, svcNamespace string) (*apiv1.Service, error) {
|
||||
logger := otelUtils.LoggerWithTraceID(ctx, deploy.logger)
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if deploy.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(fn, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Function",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
service := &apiv1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
Name: svcName,
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
OwnerReferences: ownerReferences,
|
||||
},
|
||||
Spec: apiv1.ServiceSpec{
|
||||
Ports: []apiv1.ServicePort{
|
||||
@@ -351,6 +387,7 @@ func (deploy *NewDeploy) createOrGetSvc(ctx context.Context, deployLabels map[st
|
||||
if existingSvc.Annotations[fv1.EXECUTOR_INSTANCEID_LABEL] != deploy.instanceID {
|
||||
existingSvc.Annotations = service.Annotations
|
||||
existingSvc.Labels = service.Labels
|
||||
existingSvc.OwnerReferences = service.OwnerReferences
|
||||
existingSvc.Spec.Ports = service.Spec.Ports
|
||||
existingSvc.Spec.Selector = service.Spec.Selector
|
||||
existingSvc.Spec.Type = service.Spec.Type
|
||||
|
||||
@@ -92,6 +92,8 @@ type (
|
||||
|
||||
podSpecPatch *apiv1.PodSpec
|
||||
objectReaperIntervalSecond time.Duration
|
||||
|
||||
enableOwnerReferences bool
|
||||
}
|
||||
)
|
||||
|
||||
@@ -139,6 +141,8 @@ func MakeNewDeploy(
|
||||
deplListerSynced: make(map[string]k8sCache.InformerSynced),
|
||||
svcLister: make(map[string]corelisters.ServiceLister),
|
||||
svcListerSynced: make(map[string]k8sCache.InformerSynced),
|
||||
|
||||
enableOwnerReferences: utils.IsOwnerReferencesEnabled(),
|
||||
}
|
||||
|
||||
for ns, informerFactory := range ndmInformerFactory {
|
||||
@@ -318,17 +322,14 @@ func (deploy *NewDeploy) AdoptExistingResources(ctx context.Context) {
|
||||
for i := range fnList.Items {
|
||||
fn := &fnList.Items[i]
|
||||
if fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType == fv1.ExecutorTypeNewdeploy {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
wg.Go(func() {
|
||||
_, err = deploy.fnCreate(ctx, fn)
|
||||
if err != nil {
|
||||
deploy.logger.Warn("failed to adopt resources for function", zap.Error(err))
|
||||
return
|
||||
}
|
||||
deploy.logger.Info("adopt resources for function", zap.String("function", fn.ObjectMeta.Name))
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,7 +452,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
// Since newdeploy waits for pods of deployment to be ready,
|
||||
// change the order of kubeObject creation (create service first,
|
||||
// then deployment) to take advantage of waiting time.
|
||||
svc, err := deploy.createOrGetSvc(ctx, deployLabels, deployAnnotations, objName, ns)
|
||||
svc, err := deploy.createOrGetSvc(ctx, fn, deployLabels, deployAnnotations, objName, ns)
|
||||
if err != nil {
|
||||
deploy.logger.Error("error creating service", zap.Error(err), zap.String("service", objName))
|
||||
go cleanupFunc(context.Background(), ns, objName)
|
||||
@@ -466,7 +467,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
return nil, fmt.Errorf("error creating deployment %s: %w", objName, err)
|
||||
}
|
||||
|
||||
hpa, err := deploy.hpaops.CreateOrGetHpa(ctx, objName, &fn.Spec.InvokeStrategy.ExecutionStrategy, depl, deployLabels, deployAnnotations)
|
||||
hpa, err := deploy.hpaops.CreateOrGetHpa(ctx, fn, objName, &fn.Spec.InvokeStrategy.ExecutionStrategy, depl, deployLabels, deployAnnotations)
|
||||
if err != nil {
|
||||
deploy.logger.Error("error creating HPA", zap.Error(err), zap.String("hpa", objName))
|
||||
go cleanupFunc(context.Background(), ns, objName)
|
||||
@@ -478,7 +479,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
// obj.TypeMeta.Kind does not work hence this, needs investigation and a fix
|
||||
Kind: "deployment",
|
||||
Name: depl.ObjectMeta.Name,
|
||||
APIVersion: depl.TypeMeta.APIVersion,
|
||||
APIVersion: depl.APIVersion,
|
||||
Namespace: depl.ObjectMeta.Namespace,
|
||||
ResourceVersion: depl.ObjectMeta.ResourceVersion,
|
||||
UID: depl.ObjectMeta.UID,
|
||||
@@ -486,7 +487,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
{
|
||||
Kind: "service",
|
||||
Name: svc.ObjectMeta.Name,
|
||||
APIVersion: svc.TypeMeta.APIVersion,
|
||||
APIVersion: svc.APIVersion,
|
||||
Namespace: svc.ObjectMeta.Namespace,
|
||||
ResourceVersion: svc.ObjectMeta.ResourceVersion,
|
||||
UID: svc.ObjectMeta.UID,
|
||||
@@ -494,7 +495,7 @@ func (deploy *NewDeploy) fnCreate(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
{
|
||||
Kind: "horizontalpodautoscaler",
|
||||
Name: hpa.ObjectMeta.Name,
|
||||
APIVersion: hpa.TypeMeta.APIVersion,
|
||||
APIVersion: hpa.APIVersion,
|
||||
Namespace: hpa.ObjectMeta.Namespace,
|
||||
ResourceVersion: hpa.ObjectMeta.ResourceVersion,
|
||||
UID: hpa.ObjectMeta.UID,
|
||||
|
||||
@@ -37,7 +37,7 @@ const (
|
||||
func TestRefreshFuncPods(t *testing.T) {
|
||||
os.Setenv("DEBUG_ENV", "true")
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
t.Cleanup(mgr.Wait)
|
||||
logger := loggerfactory.GetLogger()
|
||||
kubernetesClient := fake.NewSimpleClientset()
|
||||
fissionClient := fClient.NewSimpleClientset()
|
||||
@@ -50,8 +50,7 @@ func TestRefreshFuncPods(t *testing.T) {
|
||||
}
|
||||
ndmInformerFactory := utils.GetInformerFactoryByExecutor(kubernetesClient, executorLabel, time.Minute*30)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
fetcherConfig, err := fetcherConfig.MakeFetcherConfig("/userfunc")
|
||||
if err != nil {
|
||||
|
||||
@@ -19,6 +19,7 @@ package poolmgr
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
@@ -28,7 +29,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
@@ -75,10 +75,11 @@ type (
|
||||
stopReadyPodControllerCh chan struct{}
|
||||
readyPodLister corelisters.PodLister
|
||||
readyPodListerSynced cache.InformerSynced
|
||||
readyPodQueue workqueue.DelayingInterface
|
||||
readyPodQueue workqueue.TypedDelayingInterface[string]
|
||||
poolInstanceID string // small random string to uniquify pod names
|
||||
instanceID string // poolmgr instance id
|
||||
podSpecPatch *apiv1.PodSpec
|
||||
enableOwnerReferences bool
|
||||
// TODO: move this field into fsCache
|
||||
podFSVCMap sync.Map
|
||||
}
|
||||
@@ -131,6 +132,7 @@ func MakeGenericPool(
|
||||
instanceID: instanceID,
|
||||
podFSVCMap: sync.Map{},
|
||||
podSpecPatch: podSpecPatch,
|
||||
enableOwnerReferences: utils.IsOwnerReferencesEnabled(),
|
||||
lock: sync.Mutex{},
|
||||
}
|
||||
|
||||
@@ -263,15 +265,13 @@ func (gp *GenericPool) choosePod(ctx context.Context, newLabels map[string]strin
|
||||
}
|
||||
|
||||
var chosenPod *apiv1.Pod
|
||||
var key string
|
||||
|
||||
otelUtils.SpanTrackEvent(ctx, "waitForPod", otelUtils.MapToAttributes(newLabels)...)
|
||||
item, quit := gp.readyPodQueue.Get()
|
||||
key, quit := gp.readyPodQueue.Get()
|
||||
if quit {
|
||||
logger.Error("readypod controller is not running")
|
||||
return "", nil, errors.New("readypod controller is not running")
|
||||
}
|
||||
key = item.(string)
|
||||
logger.Debug("got key from the queue", zap.String("key", key))
|
||||
namespace, name, err := cache.SplitMetaNamespaceKey(key)
|
||||
if err != nil {
|
||||
@@ -304,21 +304,23 @@ func (gp *GenericPool) choosePod(ctx context.Context, newLabels map[string]strin
|
||||
// Relabel. If the pod already got picked and
|
||||
// modified, this should fail; in that case just
|
||||
// retry.
|
||||
labelPatch, _ := json.Marshal(newLabels)
|
||||
|
||||
// Append executor instance id to pod annotations to
|
||||
// indicate this pod is managed by this executor.
|
||||
annotations := gp.getDeployAnnotations(gp.env)
|
||||
annotationPatch, _ := json.Marshal(annotations)
|
||||
|
||||
patch := fmt.Sprintf(`{"metadata":{"annotations":%v, "labels":%v}}`, string(annotationPatch), string(labelPatch))
|
||||
logger.Info("relabel pod", zap.String("pod", patch))
|
||||
newPod, err := gp.kubernetesClient.CoreV1().Pods(chosenPod.Namespace).Patch(ctx, chosenPod.Name, k8sTypes.StrategicMergePatchType, []byte(patch), metav1.PatchOptions{})
|
||||
patch := map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"annotations": annotations,
|
||||
"labels": newLabels,
|
||||
},
|
||||
}
|
||||
patchBytes, _ := json.Marshal(patch)
|
||||
logger.Info("relabel pod", zap.String("pod", string((patchBytes))))
|
||||
newPod, err := gp.kubernetesClient.CoreV1().Pods(chosenPod.Namespace).Patch(ctx, chosenPod.Name, k8sTypes.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
if err != nil && errors.Is(err, context.Canceled) {
|
||||
// ending retry loop when the request canceled
|
||||
gp.readyPodQueue.Done(key)
|
||||
gp.readyPodQueue.AddAfter(key, expoDelay)
|
||||
return "", nil, errors.Errorf("failed to relabel pod: %s", err)
|
||||
return "", nil, fmt.Errorf("failed to relabel pod: %s", err)
|
||||
} else if err != nil {
|
||||
logger.Error("failed to relabel pod", zap.Error(err), zap.String("pod", chosenPod.Name), zap.Duration("delay", expoDelay))
|
||||
gp.readyPodQueue.Done(key)
|
||||
@@ -333,13 +335,13 @@ func (gp *GenericPool) choosePod(ctx context.Context, newLabels map[string]strin
|
||||
// So we have to check both of them to ensure the patch success.
|
||||
for k, v := range newLabels {
|
||||
if newPod.Labels[k] != v {
|
||||
return "", nil, errors.Errorf("value of necessary labels '%s' mismatch: want '%s', get '%v'",
|
||||
return "", nil, fmt.Errorf("value of necessary labels '%s' mismatch: want '%s', get '%v'",
|
||||
k, v, newPod.Labels[k])
|
||||
}
|
||||
}
|
||||
for k, v := range annotations {
|
||||
if newPod.Annotations[k] != v {
|
||||
return "", nil, errors.Errorf("value of necessary annotations '%s' mismatch: want '%s', get '%v'",
|
||||
return "", nil, fmt.Errorf("value of necessary annotations '%s' mismatch: want '%s', get '%v'",
|
||||
k, v, newPod.Annotations[k])
|
||||
}
|
||||
}
|
||||
@@ -413,7 +415,7 @@ func (gp *GenericPool) specializePod(ctx context.Context, pod *apiv1.Pod, fn *fv
|
||||
// for fetcher we don't need to create a service, just talk to the pod directly
|
||||
podIP := pod.Status.PodIP
|
||||
if len(podIP) == 0 {
|
||||
return errors.Errorf("Pod %s in namespace %s has no IP", pod.ObjectMeta.Name, pod.ObjectMeta.Namespace)
|
||||
return fmt.Errorf("pod %s in namespace %s has no IP", pod.ObjectMeta.Name, pod.ObjectMeta.Namespace)
|
||||
}
|
||||
for _, cm := range fn.Spec.ConfigMaps {
|
||||
_, err := gp.kubernetesClient.CoreV1().ConfigMaps(gp.fnNamespace).Get(ctx, cm.Name, metav1.GetOptions{})
|
||||
@@ -424,7 +426,7 @@ func (gp *GenericPool) specializePod(ctx context.Context, pod *apiv1.Pod, fn *fv
|
||||
zap.String("configmap_namespace", cm.Namespace),
|
||||
zap.String("function_name", fn.ObjectMeta.Name),
|
||||
zap.String("function_namespace", gp.fnNamespace))
|
||||
return fmt.Errorf(fmt.Sprintf("configmap %s must be in same namespace as function namespace", cm.Name))
|
||||
return fmt.Errorf("configmap %s must be in same namespace as function namespace", cm.Name)
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
@@ -439,7 +441,7 @@ func (gp *GenericPool) specializePod(ctx context.Context, pod *apiv1.Pod, fn *fv
|
||||
zap.String("secret_namespace", sec.Namespace),
|
||||
zap.String("function_name", fn.ObjectMeta.Name),
|
||||
zap.String("function_namespace", gp.fnNamespace))
|
||||
return fmt.Errorf(fmt.Sprintf("secret %s must be in same namespace as function namespace", sec.Name))
|
||||
return fmt.Errorf("secret %s must be in same namespace as function namespace", sec.Name)
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
@@ -569,7 +571,7 @@ func (gp *GenericPool) getFuncSvc(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
}
|
||||
if svc.ObjectMeta.Name != svcName {
|
||||
go gp.scheduleDeletePod(context.Background(), pod.ObjectMeta.Name)
|
||||
return nil, errors.Errorf("sanity check failed for svc %s", svc.ObjectMeta.Name)
|
||||
return nil, fmt.Errorf("sanity check failed for svc %s", svc.ObjectMeta.Name)
|
||||
}
|
||||
|
||||
// the fission router isn't in the same namespace, so return a
|
||||
@@ -599,7 +601,7 @@ func (gp *GenericPool) getFuncSvc(ctx context.Context, fn *fv1.Function) (*fscac
|
||||
{
|
||||
Kind: "pod",
|
||||
Name: pod.ObjectMeta.Name,
|
||||
APIVersion: pod.TypeMeta.APIVersion,
|
||||
APIVersion: pod.APIVersion,
|
||||
Namespace: pod.ObjectMeta.Namespace,
|
||||
ResourceVersion: pod.ObjectMeta.ResourceVersion,
|
||||
UID: pod.ObjectMeta.UID,
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
k8sErrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
"github.com/fission/fission/pkg/executor/util"
|
||||
@@ -58,10 +59,22 @@ func getPoolName(env *fv1.Environment) string {
|
||||
func (gp *GenericPool) genDeploymentMeta(env *fv1.Environment) metav1.ObjectMeta {
|
||||
deployLabels := gp.getEnvironmentPoolLabels(env)
|
||||
deployAnnotations := gp.getDeployAnnotations(env)
|
||||
|
||||
var ownerReferences []metav1.OwnerReference
|
||||
if gp.enableOwnerReferences {
|
||||
ownerReferences = []metav1.OwnerReference{
|
||||
*metav1.NewControllerRef(env, schema.GroupVersionKind{
|
||||
Group: "fission.io",
|
||||
Version: "v1",
|
||||
Kind: "Environment",
|
||||
}),
|
||||
}
|
||||
}
|
||||
return metav1.ObjectMeta{
|
||||
Name: getPoolName(env),
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
Name: getPoolName(env),
|
||||
Labels: deployLabels,
|
||||
Annotations: deployAnnotations,
|
||||
OwnerReferences: ownerReferences,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,8 +189,18 @@ func (gp *GenericPool) genDeploymentSpec(env *fv1.Environment) (*appsv1.Deployme
|
||||
Template: pod,
|
||||
}
|
||||
|
||||
// If custom runtime container name - default env name
|
||||
mainContainerName := env.ObjectMeta.Name
|
||||
if env.Spec.Runtime.Container != nil && env.Spec.Runtime.Container.Name != "" && env.Spec.Runtime.PodSpec != nil {
|
||||
if util.DoesContainerExistInPodSpec(env.Spec.Runtime.Container.Name, env.Spec.Runtime.PodSpec) {
|
||||
mainContainerName = env.Spec.Runtime.Container.Name
|
||||
} else {
|
||||
return nil, fmt.Errorf("runtime container %s not found in pod spec", env.Spec.Runtime.Container.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Order of merging is important here - first fetcher, then containers and lastly pod spec
|
||||
err = gp.fetcherConfig.AddFetcherToPodSpec(&deploymentSpec.Template.Spec, env.ObjectMeta.Name)
|
||||
err = gp.fetcherConfig.AddFetcherToPodSpec(&deploymentSpec.Template.Spec, mainContainerName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/fission/fission/pkg/executor/metrics"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.uber.org/zap"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
@@ -47,6 +46,7 @@ import (
|
||||
"github.com/fission/fission/pkg/crd"
|
||||
"github.com/fission/fission/pkg/executor/executortype"
|
||||
"github.com/fission/fission/pkg/executor/fscache"
|
||||
"github.com/fission/fission/pkg/executor/metrics"
|
||||
"github.com/fission/fission/pkg/executor/reaper"
|
||||
executorUtils "github.com/fission/fission/pkg/executor/util"
|
||||
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
||||
@@ -368,9 +368,7 @@ func (gpm *GenericPoolManager) AdoptExistingResources(ctx context.Context) {
|
||||
env := envs.Items[i]
|
||||
|
||||
if getEnvPoolSize(&env) > 0 {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
_, created, err := gpm.getPool(ctx, &env)
|
||||
if err != nil {
|
||||
gpm.logger.Error("adopt pool failed", zap.Error(err))
|
||||
@@ -378,11 +376,11 @@ func (gpm *GenericPoolManager) AdoptExistingResources(ctx context.Context) {
|
||||
if created {
|
||||
gpm.logger.Info("created pool for the environment", zap.String("env", env.ObjectMeta.Name), zap.String("namespace", gpm.nsResolver.ResolveNamespace(gpm.nsResolver.FunctionNamespace)))
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
// create environment map for later use
|
||||
key := fmt.Sprintf("%s/%s", env.ObjectMeta.Namespace, env.ObjectMeta.Name)
|
||||
key := k8sCache.MetaObjectToName(&env.ObjectMeta).String()
|
||||
envMap[key] = env
|
||||
}
|
||||
}
|
||||
@@ -407,10 +405,7 @@ func (gpm *GenericPoolManager) AdoptExistingResources(ctx context.Context) {
|
||||
continue
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
wg.Go(func() {
|
||||
// avoid too many requests arrive Kubernetes API server at the same time.
|
||||
time.Sleep(time.Duration(rand.Intn(30)) * time.Millisecond)
|
||||
|
||||
@@ -458,7 +453,7 @@ func (gpm *GenericPoolManager) AdoptExistingResources(ctx context.Context) {
|
||||
{
|
||||
Kind: "pod",
|
||||
Name: pod.Name,
|
||||
APIVersion: pod.TypeMeta.APIVersion,
|
||||
APIVersion: pod.APIVersion,
|
||||
Namespace: pod.ObjectMeta.Namespace,
|
||||
ResourceVersion: pod.ObjectMeta.ResourceVersion,
|
||||
UID: pod.ObjectMeta.UID,
|
||||
@@ -482,7 +477,7 @@ func (gpm *GenericPoolManager) AdoptExistingResources(ctx context.Context) {
|
||||
|
||||
gpm.logger.Info("adopt function pod",
|
||||
zap.String("pod", pod.Name), zap.Any("labels", pod.Labels), zap.Any("annotations", pod.Annotations))
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +543,7 @@ func (gpm *GenericPoolManager) service() {
|
||||
pool, ok := gpm.pools[key]
|
||||
if !ok {
|
||||
gpm.logger.Error("Could not find pool", zap.String("environment", env.ObjectMeta.Name), zap.String("namespace", env.ObjectMeta.Namespace))
|
||||
return
|
||||
continue
|
||||
}
|
||||
delete(gpm.pools, key)
|
||||
if pool != nil {
|
||||
|
||||
@@ -60,10 +60,10 @@ type (
|
||||
// podListerSynced returns true if the pod store has been synced at least once.
|
||||
podListerSynced map[string]k8sCache.InformerSynced
|
||||
|
||||
envCreateUpdateQueue workqueue.RateLimitingInterface
|
||||
envDeleteQueue workqueue.RateLimitingInterface
|
||||
envCreateUpdateQueue workqueue.TypedRateLimitingInterface[string]
|
||||
envDeleteQueue workqueue.TypedRateLimitingInterface[*fv1.Environment]
|
||||
|
||||
spCleanupPodQueue workqueue.RateLimitingInterface
|
||||
spCleanupPodQueue workqueue.TypedRateLimitingInterface[string]
|
||||
|
||||
gpm *GenericPoolManager
|
||||
}
|
||||
@@ -84,9 +84,9 @@ func NewPoolPodController(ctx context.Context, logger *zap.Logger,
|
||||
envListerSynced: make(map[string]k8sCache.InformerSynced, 0),
|
||||
podLister: make(map[string]corelisters.PodLister),
|
||||
podListerSynced: make(map[string]k8sCache.InformerSynced),
|
||||
envCreateUpdateQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "EnvAddUpdateQueue"),
|
||||
envDeleteQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "EnvDeleteQueue"),
|
||||
spCleanupPodQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "SpecializedPodCleanupQueue"),
|
||||
envCreateUpdateQueue: workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[string](), workqueue.TypedRateLimitingQueueConfig[string]{Name: "EnvAddUpdateQueue"}),
|
||||
envDeleteQueue: workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[*fv1.Environment](), workqueue.TypedRateLimitingQueueConfig[*fv1.Environment]{Name: "EnvDeleteQueue"}),
|
||||
spCleanupPodQueue: workqueue.NewTypedRateLimitingQueueWithConfig(workqueue.DefaultTypedControllerRateLimiter[string](), workqueue.TypedRateLimitingQueueConfig[string]{Name: "SpecializedPodCleanupQueue"}),
|
||||
}
|
||||
if p.enableIstio {
|
||||
for _, factory := range finformerFactory {
|
||||
@@ -337,11 +337,10 @@ func (p *PoolPodController) envCreateUpdateQueueProcessFunc(ctx context.Context)
|
||||
return nil
|
||||
}
|
||||
|
||||
obj, quit := p.envCreateUpdateQueue.Get()
|
||||
key, quit := p.envCreateUpdateQueue.Get()
|
||||
if quit {
|
||||
return true
|
||||
}
|
||||
key := obj.(string)
|
||||
defer p.envCreateUpdateQueue.Done(key)
|
||||
|
||||
namespace, name, err := k8sCache.SplitMetaNamespaceKey(key)
|
||||
@@ -390,17 +389,11 @@ func (p *PoolPodController) envCreateUpdateQueueProcessFunc(ctx context.Context)
|
||||
}
|
||||
|
||||
func (p *PoolPodController) envDeleteQueueProcessFunc(ctx context.Context) bool {
|
||||
obj, quit := p.envDeleteQueue.Get()
|
||||
env, quit := p.envDeleteQueue.Get()
|
||||
if quit {
|
||||
return true
|
||||
}
|
||||
defer p.envDeleteQueue.Done(obj)
|
||||
env, ok := obj.(*fv1.Environment)
|
||||
if !ok {
|
||||
p.logger.Error("unexpected type when deleting env to pool pod controller", zap.Any("obj", obj))
|
||||
p.envDeleteQueue.Forget(obj)
|
||||
return false
|
||||
}
|
||||
defer p.envDeleteQueue.Done(env)
|
||||
p.logger.Debug("env delete request processing")
|
||||
p.gpm.cleanupPool(ctx, env)
|
||||
specializePodLables := getSpecializedPodLabels(env)
|
||||
@@ -408,17 +401,17 @@ func (p *PoolPodController) envDeleteQueueProcessFunc(ctx context.Context) bool
|
||||
podLister, ok := p.podLister[ns]
|
||||
if !ok {
|
||||
p.logger.Error("no pod lister found for namespace", zap.String("namespace", ns))
|
||||
p.envDeleteQueue.Forget(obj)
|
||||
p.envDeleteQueue.Forget(env)
|
||||
return false
|
||||
}
|
||||
specializedPods, err := podLister.Pods(ns).List(labels.SelectorFromSet(specializePodLables))
|
||||
if err != nil {
|
||||
p.logger.Error("failed to list specialized pods", zap.Error(err))
|
||||
p.envDeleteQueue.Forget(obj)
|
||||
p.envDeleteQueue.Forget(env)
|
||||
return false
|
||||
}
|
||||
if len(specializedPods) == 0 {
|
||||
p.envDeleteQueue.Forget(obj)
|
||||
p.envDeleteQueue.Forget(env)
|
||||
return false
|
||||
}
|
||||
p.logger.Info("specialized pods identified for cleanup after env delete", zap.String("env", env.ObjectMeta.Name), zap.String("namespace", env.ObjectMeta.Namespace), zap.Int("count", len(specializedPods)))
|
||||
@@ -433,17 +426,16 @@ func (p *PoolPodController) envDeleteQueueProcessFunc(ctx context.Context) bool
|
||||
}
|
||||
p.spCleanupPodQueue.Add(key)
|
||||
}
|
||||
p.envDeleteQueue.Forget(obj)
|
||||
p.envDeleteQueue.Forget(env)
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *PoolPodController) spCleanupPodQueueProcessFunc(ctx context.Context) bool {
|
||||
maxRetries := 3
|
||||
obj, quit := p.spCleanupPodQueue.Get()
|
||||
key, quit := p.spCleanupPodQueue.Get()
|
||||
if quit {
|
||||
return true
|
||||
}
|
||||
key := obj.(string)
|
||||
defer p.spCleanupPodQueue.Done(key)
|
||||
namespace, name, err := k8sCache.SplitMetaNamespaceKey(key)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,6 @@ limitations under the License.
|
||||
package poolmgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -39,9 +38,8 @@ import (
|
||||
|
||||
func TestPoolPodControllerPodCleanup(t *testing.T) {
|
||||
mgr := manager.New()
|
||||
defer mgr.Wait()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
t.Cleanup(mgr.Wait)
|
||||
ctx := t.Context()
|
||||
logger := loggerfactory.GetLogger()
|
||||
kubernetesClient := fake.NewSimpleClientset()
|
||||
fissionClient := fClient.NewSimpleClientset()
|
||||
|
||||
@@ -33,7 +33,9 @@ func (gp *GenericPool) setupReadyPodController() error {
|
||||
// avoid concurrent access to gp.deployment
|
||||
gp.lock.Lock()
|
||||
defer gp.lock.Unlock()
|
||||
gp.readyPodQueue = workqueue.NewDelayingQueue()
|
||||
gp.readyPodQueue = workqueue.NewTypedDelayingQueueWithConfig(workqueue.TypedDelayingQueueConfig[string]{
|
||||
Name: "readyPodQueue",
|
||||
})
|
||||
informerFactory, err := utils.GetInformerFactoryByReadyPod(gp.kubernetesClient, gp.fnNamespace, gp.deployment.Spec.Selector)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.uber.org/zap"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
@@ -292,7 +291,7 @@ func (fsc *FunctionServiceCache) Add(fsvc FuncSvc) (*FuncSvc, error) {
|
||||
if IsNameExistError(err) {
|
||||
err = nil
|
||||
} else {
|
||||
err = errors.Wrap(err, "error caching fsvc")
|
||||
err = fmt.Errorf("error caching fsvc: %w", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -304,7 +303,7 @@ func (fsc *FunctionServiceCache) Add(fsvc FuncSvc) (*FuncSvc, error) {
|
||||
if IsNameExistError(err) {
|
||||
err = nil
|
||||
} else {
|
||||
err = errors.Wrap(err, "error caching fsvc by function uid")
|
||||
err = fmt.Errorf("error caching fsvc by function uid: %w", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -383,10 +382,6 @@ func (fsc *FunctionServiceCache) DeleteFunctionSvc(ctx context.Context, fsvc *Fu
|
||||
}
|
||||
}
|
||||
|
||||
func (fsc *FunctionServiceCache) SetCPUUtilization(key crd.CacheKeyURG, svcHost string, cpuUsage resource.Quantity) {
|
||||
fsc.connFunctionCache.SetCPUUtilization(key, svcHost, cpuUsage)
|
||||
}
|
||||
|
||||
// DeleteOld deletes aged function service entries from cache.
|
||||
func (fsc *FunctionServiceCache) DeleteOld(fsvc *FuncSvc, minAge time.Duration) (bool, error) {
|
||||
if time.Since(fsvc.Atime) < minAge {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package fscache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -157,8 +156,7 @@ func TestFunctionServiceNewCache(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
|
||||
fsc.AddFunc(ctx, *fsvc, 10, fn.GetRetainPods())
|
||||
concurrency := 10
|
||||
|
||||
@@ -306,7 +306,7 @@ func (c *PoolCache) service() {
|
||||
datawriter := bufio.NewWriter(req.dumpWriter)
|
||||
|
||||
writefnSvcGrp := func(svcGrp *funcSvcGroup) error {
|
||||
_, err := datawriter.WriteString(fmt.Sprintf("svc_waiting:%d\tqueue_len:%d", svcGrp.svcWaiting, svcGrp.queue.Len()))
|
||||
_, err := fmt.Fprintf(datawriter, "svc_waiting:%d\tqueue_len:%d", svcGrp.svcWaiting, svcGrp.queue.Len())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -319,8 +319,8 @@ func (c *PoolCache) service() {
|
||||
}
|
||||
|
||||
for addr, fnSvc := range svcGrp.svcs {
|
||||
_, err := datawriter.WriteString(fmt.Sprintf("\tfunction_name:%s\tfn_svc_address:%s\tactive_req:%d\tcurrent_cpu_usage:%v\tcpu_limit:%v\n",
|
||||
fnSvc.val.Function.Name, addr, fnSvc.activeRequests, fnSvc.currentCPUUsage, fnSvc.cpuLimit))
|
||||
_, err := fmt.Fprintf(datawriter, "\tfunction_name:%s\tfn_svc_address:%s\tactive_req:%d\tcurrent_cpu_usage:%v\tcpu_limit:%v\n",
|
||||
fnSvc.val.Function.Name, addr, fnSvc.activeRequests, fnSvc.currentCPUUsage, fnSvc.cpuLimit)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ func checkErr(err error) {
|
||||
}
|
||||
|
||||
func TestPoolCache(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ctx := t.Context()
|
||||
logger := loggerfactory.GetLogger()
|
||||
concurrency := 5
|
||||
requestsPerPod := 2
|
||||
@@ -225,32 +224,33 @@ func TestPoolCacheRequests(t *testing.T) {
|
||||
}
|
||||
for i := 1; i <= tt.requests; i++ {
|
||||
reqno := i
|
||||
wg.Add(1)
|
||||
go func(reqno int) {
|
||||
defer wg.Done()
|
||||
svc, err := p.GetSvcValue(context.Background(), key, tt.rpp, tt.concurrency)
|
||||
if err != nil {
|
||||
code, _ := ferror.GetHTTPError(err)
|
||||
if code == http.StatusNotFound {
|
||||
atomic.AddUint64(&svcCounter, 1)
|
||||
address := fmt.Sprintf("svc-%d", atomic.LoadUint64(&svcCounter))
|
||||
p.SetSvcValue(context.Background(), key, address, &FuncSvc{
|
||||
Name: address,
|
||||
}, resource.MustParse("45m"), tt.rpp, tt.retainPods)
|
||||
wg.Go(func() {
|
||||
func(reqno int) {
|
||||
svc, err := p.GetSvcValue(context.Background(), key, tt.rpp, tt.concurrency)
|
||||
if err != nil {
|
||||
code, _ := ferror.GetHTTPError(err)
|
||||
if code == http.StatusNotFound {
|
||||
atomic.AddUint64(&svcCounter, 1)
|
||||
address := fmt.Sprintf("svc-%d", atomic.LoadUint64(&svcCounter))
|
||||
p.SetSvcValue(context.Background(), key, address, &FuncSvc{
|
||||
Name: address,
|
||||
}, resource.MustParse("45m"), tt.rpp, tt.retainPods)
|
||||
} else {
|
||||
t.Log(reqno, "=>", err)
|
||||
atomic.AddUint64(&failedRequests, 1)
|
||||
}
|
||||
} else {
|
||||
t.Log(reqno, "=>", err)
|
||||
atomic.AddUint64(&failedRequests, 1)
|
||||
if svc == nil {
|
||||
t.Log(reqno, "=>", "svc is nil")
|
||||
atomic.AddUint64(&failedRequests, 1)
|
||||
}
|
||||
// } else {
|
||||
// t.Log(reqno, "=>", svc.Name)
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
if svc == nil {
|
||||
t.Log(reqno, "=>", "svc is nil")
|
||||
atomic.AddUint64(&failedRequests, 1)
|
||||
}
|
||||
// } else {
|
||||
// t.Log(reqno, "=>", svc.Name)
|
||||
// }
|
||||
}
|
||||
}(reqno)
|
||||
}(reqno)
|
||||
})
|
||||
|
||||
if reqno%simultaneous == 0 {
|
||||
wg.Wait()
|
||||
}
|
||||
@@ -262,12 +262,12 @@ func TestPoolCacheRequests(t *testing.T) {
|
||||
|
||||
for i := 0; i < tt.concurrency; i++ {
|
||||
for j := 0; j < tt.rpp; j++ {
|
||||
wg.Add(1)
|
||||
svcno := i
|
||||
go func(svcno int) {
|
||||
defer wg.Done()
|
||||
p.MarkAvailable(key, fmt.Sprintf("svc-%d", svcno+1))
|
||||
}(svcno)
|
||||
wg.Go(func() {
|
||||
func(svcno int) {
|
||||
p.MarkAvailable(key, fmt.Sprintf("svc-%d", svcno+1))
|
||||
}(svcno)
|
||||
})
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
@@ -48,16 +48,14 @@ func TestQueuePushWithConcurrentRequest(t *testing.T) {
|
||||
q := NewQueue()
|
||||
noOfRequests := 20
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(noOfRequests)
|
||||
for i := 0; i < noOfRequests; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
item := &svcWait{
|
||||
svcChannel: make(chan *FuncSvc),
|
||||
ctx: nil,
|
||||
}
|
||||
q.Push(item)
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
@@ -17,8 +17,9 @@ limitations under the License.
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"github.com/fission/fission/pkg/utils/metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/fission/fission/pkg/utils/metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user