Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b57f1f2e7 | ||
|
|
1fe13624f2 | ||
|
|
fdecc98775 | ||
|
|
10852c90a5 | ||
|
|
62f729727a | ||
|
|
95faf60959 | ||
|
|
17fbe42fcc | ||
|
|
f44174debc | ||
|
|
efeb6951dc | ||
|
|
b85ba9e419 | ||
|
|
d23ed572f9 | ||
|
|
e7d6381876 | ||
|
|
57b537f09e | ||
|
|
2e4825def0 | ||
|
|
3fabf64b3c | ||
|
|
2a40b4538c | ||
|
|
27132975c4 | ||
|
|
b099db38d7 | ||
|
|
88039cad63 | ||
|
|
267f7faf18 | ||
|
|
2223081c80 | ||
|
|
2eb2eba88c | ||
|
|
8a17d391c5 | ||
|
|
15e16fcc82 | ||
|
|
7137b39a14 | ||
|
|
fc97b7609b | ||
|
|
c6329ee3db | ||
|
|
7b21fbc199 | ||
|
|
703d757c29 | ||
|
|
c09319ceb3 | ||
|
|
3762ff80f2 | ||
|
|
b43b31884a | ||
|
|
56b49dcee8 | ||
|
|
657aee7cc2 | ||
|
|
44922bce6c | ||
|
|
3bcda55aa8 | ||
|
|
997493351a | ||
|
|
3d77077bc5 | ||
|
|
f955d1182a | ||
|
|
1cbc0ba9ff | ||
|
|
0936c6a2d7 | ||
|
|
f0ec328d24 | ||
|
|
2b1ac28300 | ||
|
|
0fb2096788 | ||
|
|
6e375629e7 | ||
|
|
1133386ce9 | ||
|
|
f99f10134c | ||
|
|
6c431e4d9b | ||
|
|
31c81e132e | ||
|
|
a5f3402dbc | ||
|
|
784bd82ec7 | ||
|
|
cd742a6d18 | ||
|
|
32530ac474 | ||
|
|
117c383fac | ||
|
|
3a1db58066 | ||
|
|
ce42dbc647 | ||
|
|
3840a90b54 | ||
|
|
77d4745242 | ||
|
|
715ef8267e | ||
|
|
b622f13ab6 | ||
|
|
2213ebc637 | ||
|
|
1f138d03fa | ||
|
|
a8e8cfb72d | ||
|
|
963081e096 | ||
|
|
a96b92f41f | ||
|
|
a93e9b4074 | ||
|
|
0de8923ea8 | ||
|
|
1cb18a78a6 | ||
|
|
4ebdb16623 | ||
|
|
3c0c96e98e | ||
|
|
e462f9ab71 | ||
|
|
d025022042 | ||
|
|
c4ed12d9c5 | ||
|
|
d3a615211f | ||
|
|
2b017f810a | ||
|
|
5c3c55d52f | ||
|
|
5db09a899a | ||
|
|
0edf2640b1 |
+3
-5
@@ -1,11 +1,9 @@
|
|||||||
ignore:
|
ignore:
|
||||||
- "charts"
|
- "charts"
|
||||||
- "demos"
|
- "test/"
|
||||||
- "Documentation"
|
|
||||||
- "examples"
|
|
||||||
- "test"
|
|
||||||
- "tools"
|
- "tools"
|
||||||
- "pkg/apis/genclient"
|
- "pkg/generated" # generated code
|
||||||
|
- "pkg/apis/*/*/zz_generated*" # generated code
|
||||||
coverage:
|
coverage:
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
|
|||||||
@@ -25,18 +25,18 @@ jobs:
|
|||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: setup go
|
- name: setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
|
||||||
@@ -19,12 +19,12 @@ jobs:
|
|||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.5
|
go-version-file: "go.mod"
|
||||||
|
|
||||||
- name: Install dashboard linter
|
- name: Install dashboard linter
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -18,19 +18,19 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GOLANGCI_LINT_VERSION: v1.50.1
|
GOLANGCI_LINT_VERSION: v1.55.2
|
||||||
GOLANGCI_LINT_TIMEOUT: 5m
|
GOLANGCI_LINT_TIMEOUT: 5m
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
|
||||||
with:
|
with:
|
||||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||||
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
|
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
run: ./hack/runtests.sh
|
run: ./hack/runtests.sh
|
||||||
|
|
||||||
- name: Upload Coverage report to CodeCov
|
- name: Upload Coverage report to CodeCov
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
token: ${{secrets.CODECOV_TOKEN}}
|
||||||
flags: unittests
|
flags: unittests
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
HELM_VERSION: v3.10.1
|
HELM_VERSION: v3.13.0
|
||||||
KIND_VERSION: v0.17.0
|
KIND_VERSION: v0.20.0
|
||||||
|
KIND_CLUSTER_NAME: kind
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Job to run change detection
|
# Job to run change detection
|
||||||
@@ -33,42 +34,43 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
kindversion: ["v1.19.16", "v1.20.15", "v1.21.14"]
|
kindversion: ["v1.23.17", "v1.25.11", "v1.27.3"]
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: setup go
|
- name: setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
with:
|
with:
|
||||||
repository: fission/examples
|
repository: fission/examples
|
||||||
path: examples
|
path: examples
|
||||||
|
|
||||||
- name: Helm installation
|
- name: Helm installation
|
||||||
uses: Azure/setup-helm@v3
|
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||||
with:
|
with:
|
||||||
version: ${{ env.HELM_VERSION }}
|
version: ${{ env.HELM_VERSION }}
|
||||||
|
|
||||||
- name: Kind Cluster
|
- name: Kind Cluster
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
|
||||||
with:
|
with:
|
||||||
image: kindest/node:${{ matrix.kindversion }}
|
node_image: kindest/node:${{ matrix.kindversion }}
|
||||||
version: ${{ env.KIND_VERSION }}
|
version: ${{ env.KIND_VERSION }}
|
||||||
|
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||||
config: kind.yaml
|
config: kind.yaml
|
||||||
|
|
||||||
- name: Configuring and testing the Installation
|
- name: Configuring and testing the Installation
|
||||||
run: |
|
run: |
|
||||||
kubectl cluster-info --context kind-kind
|
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
sudo apt-get install -y apache2-utils
|
sudo apt-get install -y apache2-utils
|
||||||
kubectl config use-context kind-kind
|
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl config view
|
kubectl config view
|
||||||
|
|
||||||
- name: Helm chart lint
|
- name: Helm chart lint
|
||||||
@@ -82,7 +84,7 @@ jobs:
|
|||||||
skaffold version
|
skaffold version
|
||||||
|
|
||||||
- name: Install GoReleaser
|
- name: Install GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
|
|
||||||
@@ -92,7 +94,7 @@ jobs:
|
|||||||
helm repo update
|
helm repo update
|
||||||
kubectl create ns monitoring
|
kubectl create ns monitoring
|
||||||
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
|
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
|
||||||
--set grafana.enabled=false --set alertmanager.enabled=false
|
--version 45.28.0 --set grafana.enabled=false --set alertmanager.enabled=false
|
||||||
|
|
||||||
- name: Build and Install Fission CLI
|
- name: Build and Install Fission CLI
|
||||||
run: |
|
run: |
|
||||||
@@ -111,7 +113,6 @@ jobs:
|
|||||||
- name: Port-forward fission components
|
- name: Port-forward fission components
|
||||||
run: |
|
run: |
|
||||||
kubectl port-forward svc/router 8888:80 -nfission &
|
kubectl port-forward svc/router 8888:80 -nfission &
|
||||||
kubectl port-forward svc/controller 8889:80 -nfission &
|
|
||||||
|
|
||||||
- name: Get fission version
|
- name: Get fission version
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -132,7 +133,7 @@ jobs:
|
|||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
run: |
|
run: |
|
||||||
kind export logs --name kind kind-logs
|
kind export logs --name ${{ env.KIND_CLUSTER_NAME }} kind-logs
|
||||||
|
|
||||||
- name: Backup prometheus data
|
- name: Backup prometheus data
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -143,7 +144,7 @@ jobs:
|
|||||||
- name: Archive fission dump
|
- name: Archive fission dump
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ failure() || cancelled() }}
|
if: ${{ failure() || cancelled() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||||
path: fission-dump/*.zip
|
path: fission-dump/*.zip
|
||||||
@@ -152,7 +153,7 @@ jobs:
|
|||||||
- name: Archive prometheus dump
|
- name: Archive prometheus dump
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||||
path: /tmp/prometheus/*
|
path: /tmp/prometheus/*
|
||||||
@@ -161,7 +162,7 @@ jobs:
|
|||||||
- name: Archive kind logs
|
- name: Archive kind logs
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||||
path: kind-logs/*
|
path: kind-logs/*
|
||||||
@@ -179,38 +180,39 @@ jobs:
|
|||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: setup go
|
- name: setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
with:
|
with:
|
||||||
repository: fission/examples
|
repository: fission/examples
|
||||||
path: examples
|
path: examples
|
||||||
|
|
||||||
- name: Helm installation
|
- name: Helm installation
|
||||||
uses: Azure/setup-helm@v3
|
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||||
with:
|
with:
|
||||||
version: ${{ env.HELM_VERSION }}
|
version: ${{ env.HELM_VERSION }}
|
||||||
|
|
||||||
- name: Kind Cluster
|
- name: Kind Cluster
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
|
||||||
with:
|
with:
|
||||||
image: kindest/node:${{ matrix.kindversion }}
|
node_image: kindest/node:${{ matrix.kindversion }}
|
||||||
version: ${{ env.KIND_VERSION }}
|
version: ${{ env.KIND_VERSION }}
|
||||||
|
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||||
config: kind.yaml
|
config: kind.yaml
|
||||||
|
|
||||||
- name: Configuring and testing the Installation
|
- name: Configuring and testing the Installation
|
||||||
run: |
|
run: |
|
||||||
kubectl cluster-info --context kind-kind
|
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
sudo apt-get install -y apache2-utils
|
sudo apt-get install -y apache2-utils
|
||||||
kubectl config use-context kind-kind
|
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl config view
|
kubectl config view
|
||||||
|
|
||||||
- name: Helm chart lint
|
- name: Helm chart lint
|
||||||
@@ -224,7 +226,7 @@ jobs:
|
|||||||
skaffold version
|
skaffold version
|
||||||
|
|
||||||
- name: Install GoReleaser
|
- name: Install GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
|
|
||||||
@@ -234,7 +236,7 @@ jobs:
|
|||||||
helm repo update
|
helm repo update
|
||||||
kubectl create ns monitoring
|
kubectl create ns monitoring
|
||||||
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
|
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
|
||||||
--set grafana.enabled=false --set alertmanager.enabled=false
|
--version 45.28.0 --set grafana.enabled=false --set alertmanager.enabled=false
|
||||||
|
|
||||||
- name: Build and Install Fission CLI
|
- name: Build and Install Fission CLI
|
||||||
run: |
|
run: |
|
||||||
@@ -253,7 +255,6 @@ jobs:
|
|||||||
- name: Port-forward fission components
|
- name: Port-forward fission components
|
||||||
run: |
|
run: |
|
||||||
kubectl port-forward svc/router 8888:80 -nfission &
|
kubectl port-forward svc/router 8888:80 -nfission &
|
||||||
kubectl port-forward svc/controller 8889:80 -nfission &
|
|
||||||
|
|
||||||
- name: Get fission version
|
- name: Get fission version
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -288,7 +289,7 @@ jobs:
|
|||||||
- name: Archive fission dump
|
- name: Archive fission dump
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ failure() || cancelled() }}
|
if: ${{ failure() || cancelled() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: fission-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
name: fission-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||||
path: fission-dump/*.zip
|
path: fission-dump/*.zip
|
||||||
@@ -297,7 +298,7 @@ jobs:
|
|||||||
- name: Archive prometheus dump
|
- name: Archive prometheus dump
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: prom-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
name: prom-dump-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||||
path: /tmp/prometheus/*
|
path: /tmp/prometheus/*
|
||||||
@@ -306,7 +307,7 @@ jobs:
|
|||||||
- name: Archive kind logs
|
- name: Archive kind logs
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: kind-logs-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
name: kind-logs-${{ github.run_id }}-${{ github.job_id }}-${{ matrix.kindversion }}
|
||||||
path: kind-logs/*
|
path: kind-logs/*
|
||||||
|
|||||||
@@ -6,20 +6,21 @@ on:
|
|||||||
- v2.**
|
- v2.**
|
||||||
|
|
||||||
env:
|
env:
|
||||||
KIND_VERSION: v0.17.0
|
KIND_VERSION: v0.20.0
|
||||||
KIND_NODE_IMAGE_TAG: v1.19.16
|
KIND_NODE_IMAGE_TAG: v1.23.17
|
||||||
|
KIND_CLUSTER_NAME: kind
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-draft-release:
|
create-draft-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
@@ -29,30 +30,39 @@ jobs:
|
|||||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||||
|
|
||||||
- name: Install GoReleaser
|
- name: Install GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
|
|
||||||
- name: Kind Clutser
|
- name: Kind Clutser
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
|
||||||
with:
|
with:
|
||||||
image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
|
node_image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
|
||||||
version: ${{ env.KIND_VERSION }}
|
version: ${{ env.KIND_VERSION }}
|
||||||
config: kind.yaml
|
config: kind.yaml
|
||||||
|
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||||
|
|
||||||
- name: Docker Login
|
- name: Login to ghcr.io
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to docker.io
|
||||||
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install Cosign
|
- name: Install Cosign
|
||||||
uses: sigstore/cosign-installer@main
|
uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
|
||||||
with:
|
with:
|
||||||
cosign-release: 'v1.12.0'
|
cosign-release: "v2.2.1"
|
||||||
|
|
||||||
- name: Check cosign install!
|
- name: Check cosign install!
|
||||||
run: cosign version
|
run: cosign version
|
||||||
|
|
||||||
@@ -69,7 +79,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release
|
args: release
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
HELM_VERSION: v3.10.1
|
HELM_VERSION: v3.13.0
|
||||||
KIND_VERSION: v0.17.0
|
KIND_VERSION: v0.20.0
|
||||||
|
KIND_CLUSTER_NAME: kind
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
upgrade-test:
|
upgrade-test:
|
||||||
@@ -32,40 +33,41 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
kindimage: ["kindest/node:v1.19.16"]
|
kindimage: ["kindest/node:v1.23.17"]
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action sources
|
- name: Checkout action sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Setup Helm
|
- name: Setup Helm
|
||||||
uses: Azure/setup-helm@v3
|
uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||||
with:
|
with:
|
||||||
version: ${{ env.HELM_VERSION }}
|
version: ${{ env.HELM_VERSION }}
|
||||||
|
|
||||||
- name: Setup Kind Clutser
|
- name: Setup Kind Clutser
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
|
||||||
with:
|
with:
|
||||||
image: ${{ matrix.kindimage }}
|
node_image: ${{ matrix.kindimage }}
|
||||||
version: ${{ env.KIND_VERSION }}
|
version: ${{ env.KIND_VERSION }}
|
||||||
|
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||||
|
|
||||||
- name: Install GoReleaser
|
- name: Install GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
|
|
||||||
- name: Setup kubectl & fetch node information
|
- name: Setup kubectl & fetch node information
|
||||||
run: |
|
run: |
|
||||||
kubectl cluster-info --context kind-kind
|
kubectl cluster-info --context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
kubectl get storageclasses.storage.k8s.io
|
kubectl get storageclasses.storage.k8s.io
|
||||||
kubectl config use-context kind-kind
|
kubectl config use-context kind-${{ env.KIND_CLUSTER_NAME }}
|
||||||
kubectl config set-context --current --namespace=default
|
kubectl config set-context --current --namespace=default
|
||||||
kubectl config view
|
kubectl config view
|
||||||
|
|
||||||
@@ -99,11 +101,11 @@ jobs:
|
|||||||
- name: Kind export logs
|
- name: Kind export logs
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
run: |
|
run: |
|
||||||
kind export logs --name kind kind-logs
|
kind export logs --name ${{ env.KIND_CLUSTER_NAME }} kind-logs
|
||||||
|
|
||||||
- name: Archive fission dump
|
- name: Archive fission dump
|
||||||
if: ${{ failure() || cancelled() }}
|
if: ${{ failure() || cancelled() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||||
path: fission-dump/*.zip
|
path: fission-dump/*.zip
|
||||||
@@ -111,7 +113,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Archive kind logs
|
- name: Archive kind logs
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||||
with:
|
with:
|
||||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||||
path: kind-logs/*
|
path: kind-logs/*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ cmd/reporter/reporter
|
|||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
test/logs/
|
test/logs/
|
||||||
|
test/e2e/cli/fission-dump/
|
||||||
|
|
||||||
# Pycharm IDE
|
# Pycharm IDE
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
+157
@@ -84,8 +84,11 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/builder:latest-amd64"
|
- "fission/builder:latest-amd64"
|
||||||
- "fission/builder:{{ .Tag }}-amd64"
|
- "fission/builder:{{ .Tag }}-amd64"
|
||||||
|
- "ghcr.io/fission/builder:latest-amd64"
|
||||||
|
- "ghcr.io/fission/builder:{{ .Tag }}-amd64"
|
||||||
dockerfile: cmd/builder/Dockerfile
|
dockerfile: cmd/builder/Dockerfile
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
|
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||||
- "--platform=linux/amd64"
|
- "--platform=linux/amd64"
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
@@ -96,28 +99,60 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fetcher:latest-amd64"
|
- "fission/fetcher:latest-amd64"
|
||||||
- "fission/fetcher:{{ .Tag }}-amd64"
|
- "fission/fetcher:{{ .Tag }}-amd64"
|
||||||
|
- "ghcr.io/fission/fetcher:latest-amd64"
|
||||||
|
- "ghcr.io/fission/fetcher:{{ .Tag }}-amd64"
|
||||||
dockerfile: cmd/fetcher/Dockerfile
|
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
|
- <<: *docker-amd64
|
||||||
ids:
|
ids:
|
||||||
- fission-bundle
|
- fission-bundle
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fission-bundle:latest-amd64"
|
- "fission/fission-bundle:latest-amd64"
|
||||||
- "fission/fission-bundle:{{ .Tag }}-amd64"
|
- "fission/fission-bundle:{{ .Tag }}-amd64"
|
||||||
|
- "ghcr.io/fission/fission-bundle:latest-amd64"
|
||||||
|
- "ghcr.io/fission/fission-bundle:{{ .Tag }}-amd64"
|
||||||
dockerfile: cmd/fission-bundle/Dockerfile
|
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
|
- <<: *docker-amd64
|
||||||
ids:
|
ids:
|
||||||
- pre-upgrade-checks
|
- pre-upgrade-checks
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/pre-upgrade-checks:latest-amd64"
|
- "fission/pre-upgrade-checks:latest-amd64"
|
||||||
- "fission/pre-upgrade-checks:{{ .Tag }}-amd64"
|
- "fission/pre-upgrade-checks:{{ .Tag }}-amd64"
|
||||||
|
- "ghcr.io/fission/pre-upgrade-checks:latest-amd64"
|
||||||
|
- "ghcr.io/fission/pre-upgrade-checks:{{ .Tag }}-amd64"
|
||||||
dockerfile: cmd/preupgradechecks/Dockerfile
|
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
|
- <<: *docker-amd64
|
||||||
ids:
|
ids:
|
||||||
- reporter
|
- reporter
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/reporter:latest-amd64"
|
- "fission/reporter:latest-amd64"
|
||||||
- "fission/reporter:{{ .Tag }}-amd64"
|
- "fission/reporter:{{ .Tag }}-amd64"
|
||||||
|
- "ghcr.io/fission/reporter:latest-amd64"
|
||||||
|
- "ghcr.io/fission/reporter:{{ .Tag }}-amd64"
|
||||||
dockerfile: cmd/reporter/Dockerfile
|
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
|
- &docker-arm64
|
||||||
use: buildx
|
use: buildx
|
||||||
goos: linux
|
goos: linux
|
||||||
@@ -127,8 +162,11 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/builder:latest-arm64"
|
- "fission/builder:latest-arm64"
|
||||||
- "fission/builder:{{ .Tag }}-arm64"
|
- "fission/builder:{{ .Tag }}-arm64"
|
||||||
|
- "ghcr.io/fission/builder:latest-arm64"
|
||||||
|
- "ghcr.io/fission/builder:{{ .Tag }}-arm64"
|
||||||
dockerfile: cmd/builder/Dockerfile
|
dockerfile: cmd/builder/Dockerfile
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
|
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||||
- "--platform=linux/arm64"
|
- "--platform=linux/arm64"
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
@@ -139,28 +177,60 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fetcher:latest-arm64"
|
- "fission/fetcher:latest-arm64"
|
||||||
- "fission/fetcher:{{ .Tag }}-arm64"
|
- "fission/fetcher:{{ .Tag }}-arm64"
|
||||||
|
- "ghcr.io/fission/fetcher:latest-arm64"
|
||||||
|
- "ghcr.io/fission/fetcher:{{ .Tag }}-arm64"
|
||||||
dockerfile: cmd/fetcher/Dockerfile
|
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
|
- <<: *docker-arm64
|
||||||
ids:
|
ids:
|
||||||
- fission-bundle
|
- fission-bundle
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fission-bundle:latest-arm64"
|
- "fission/fission-bundle:latest-arm64"
|
||||||
- "fission/fission-bundle:{{ .Tag }}-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
|
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
|
- <<: *docker-arm64
|
||||||
ids:
|
ids:
|
||||||
- pre-upgrade-checks
|
- pre-upgrade-checks
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/pre-upgrade-checks:latest-arm64"
|
- "fission/pre-upgrade-checks:latest-arm64"
|
||||||
- "fission/pre-upgrade-checks:{{ .Tag }}-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
|
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
|
- <<: *docker-arm64
|
||||||
ids:
|
ids:
|
||||||
- reporter
|
- reporter
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/reporter:latest-arm64"
|
- "fission/reporter:latest-arm64"
|
||||||
- "fission/reporter:{{ .Tag }}-arm64"
|
- "fission/reporter:{{ .Tag }}-arm64"
|
||||||
|
- "ghcr.io/fission/reporter:latest-arm64"
|
||||||
|
- "ghcr.io/fission/reporter:{{ .Tag }}-arm64"
|
||||||
dockerfile: cmd/reporter/Dockerfile
|
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
|
- &docker-armv7
|
||||||
use: buildx
|
use: buildx
|
||||||
goos: linux
|
goos: linux
|
||||||
@@ -171,8 +241,11 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/builder:latest-armv7"
|
- "fission/builder:latest-armv7"
|
||||||
- "fission/builder:{{ .Tag }}-armv7"
|
- "fission/builder:{{ .Tag }}-armv7"
|
||||||
|
- "ghcr.io/fission/builder:latest-armv7"
|
||||||
|
- "ghcr.io/fission/builder:{{ .Tag }}-armv7"
|
||||||
dockerfile: cmd/builder/Dockerfile
|
dockerfile: cmd/builder/Dockerfile
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
|
- "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||||
- "--platform=linux/arm/v7"
|
- "--platform=linux/arm/v7"
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
@@ -183,74 +256,156 @@ dockers:
|
|||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fetcher:latest-armv7"
|
- "fission/fetcher:latest-armv7"
|
||||||
- "fission/fetcher:{{ .Tag }}-armv7"
|
- "fission/fetcher:{{ .Tag }}-armv7"
|
||||||
|
- "ghcr.io/fission/fetcher:latest-armv7"
|
||||||
|
- "ghcr.io/fission/fetcher:{{ .Tag }}-armv7"
|
||||||
dockerfile: cmd/fetcher/Dockerfile
|
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
|
- <<: *docker-armv7
|
||||||
ids:
|
ids:
|
||||||
- fission-bundle
|
- fission-bundle
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/fission-bundle:latest-armv7"
|
- "fission/fission-bundle:latest-armv7"
|
||||||
- "fission/fission-bundle:{{ .Tag }}-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
|
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
|
- <<: *docker-armv7
|
||||||
ids:
|
ids:
|
||||||
- pre-upgrade-checks
|
- pre-upgrade-checks
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/pre-upgrade-checks:latest-armv7"
|
- "fission/pre-upgrade-checks:latest-armv7"
|
||||||
- "fission/pre-upgrade-checks:{{ .Tag }}-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
|
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
|
- <<: *docker-armv7
|
||||||
ids:
|
ids:
|
||||||
- reporter
|
- reporter
|
||||||
image_templates:
|
image_templates:
|
||||||
- "fission/reporter:latest-armv7"
|
- "fission/reporter:latest-armv7"
|
||||||
- "fission/reporter:{{ .Tag }}-armv7"
|
- "fission/reporter:{{ .Tag }}-armv7"
|
||||||
|
- "ghcr.io/fission/reporter:latest-armv7"
|
||||||
|
- "ghcr.io/fission/reporter:{{ .Tag }}-armv7"
|
||||||
dockerfile: cmd/reporter/Dockerfile
|
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:
|
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 }}
|
- name_template: fission/builder:{{ .Tag }}
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/builder:{{ .Tag }}-amd64
|
- fission/builder:{{ .Tag }}-amd64
|
||||||
- fission/builder:{{ .Tag }}-arm64
|
- fission/builder:{{ .Tag }}-arm64
|
||||||
- fission/builder:{{ .Tag }}-armv7
|
- 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 }}
|
- name_template: fission/fetcher:{{ .Tag }}
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/fetcher:{{ .Tag }}-amd64
|
- fission/fetcher:{{ .Tag }}-amd64
|
||||||
- fission/fetcher:{{ .Tag }}-arm64
|
- fission/fetcher:{{ .Tag }}-arm64
|
||||||
- fission/fetcher:{{ .Tag }}-armv7
|
- 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 }}
|
- name_template: fission/fission-bundle:{{ .Tag }}
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/fission-bundle:{{ .Tag }}-amd64
|
- fission/fission-bundle:{{ .Tag }}-amd64
|
||||||
- fission/fission-bundle:{{ .Tag }}-arm64
|
- fission/fission-bundle:{{ .Tag }}-arm64
|
||||||
- fission/fission-bundle:{{ .Tag }}-armv7
|
- 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 }}
|
- name_template: fission/pre-upgrade-checks:{{ .Tag }}
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/pre-upgrade-checks:{{ .Tag }}-amd64
|
- fission/pre-upgrade-checks:{{ .Tag }}-amd64
|
||||||
- fission/pre-upgrade-checks:{{ .Tag }}-arm64
|
- fission/pre-upgrade-checks:{{ .Tag }}-arm64
|
||||||
- fission/pre-upgrade-checks:{{ .Tag }}-armv7
|
- 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 }}
|
- name_template: fission/reporter:{{ .Tag }}
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/reporter:{{ .Tag }}-amd64
|
- fission/reporter:{{ .Tag }}-amd64
|
||||||
- fission/reporter:{{ .Tag }}-arm64
|
- fission/reporter:{{ .Tag }}-arm64
|
||||||
- fission/reporter:{{ .Tag }}-armv7
|
- 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
|
- name_template: fission/builder:latest
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/builder:latest-amd64
|
- fission/builder:latest-amd64
|
||||||
- fission/builder:latest-arm64
|
- fission/builder:latest-arm64
|
||||||
- fission/builder:latest-armv7
|
- 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
|
- name_template: fission/fetcher:latest
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/fetcher:latest-amd64
|
- fission/fetcher:latest-amd64
|
||||||
- fission/fetcher:latest-arm64
|
- fission/fetcher:latest-arm64
|
||||||
- fission/fetcher:latest-armv7
|
- 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
|
- name_template: fission/fission-bundle:latest
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/fission-bundle:latest-amd64
|
- fission/fission-bundle:latest-amd64
|
||||||
- fission/fission-bundle:latest-arm64
|
- fission/fission-bundle:latest-arm64
|
||||||
- fission/fission-bundle:latest-armv7
|
- 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
|
- name_template: fission/pre-upgrade-checks:latest
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/pre-upgrade-checks:latest-amd64
|
- fission/pre-upgrade-checks:latest-amd64
|
||||||
- fission/pre-upgrade-checks:latest-arm64
|
- fission/pre-upgrade-checks:latest-arm64
|
||||||
- fission/pre-upgrade-checks:latest-armv7
|
- 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
|
- name_template: fission/reporter:latest
|
||||||
image_templates:
|
image_templates:
|
||||||
- fission/reporter:latest-amd64
|
- fission/reporter:latest-amd64
|
||||||
@@ -281,6 +436,7 @@ signs:
|
|||||||
- '--output-certificate=${certificate}'
|
- '--output-certificate=${certificate}'
|
||||||
- '--output-signature=${signature}'
|
- '--output-signature=${signature}'
|
||||||
- '${artifact}'
|
- '${artifact}'
|
||||||
|
- '--yes' # needed for cosign 2.0.0+
|
||||||
|
|
||||||
# signs our docker image
|
# signs our docker image
|
||||||
# https://goreleaser.com/customization/docker_sign
|
# https://goreleaser.com/customization/docker_sign
|
||||||
@@ -293,3 +449,4 @@ docker_signs:
|
|||||||
- 'sign'
|
- 'sign'
|
||||||
- '--key=cosign.key'
|
- '--key=cosign.key'
|
||||||
- '${artifact}'
|
- '${artifact}'
|
||||||
|
- '--yes' # needed for cosign 2.0.0+
|
||||||
|
|||||||
+4
-4
@@ -8,10 +8,10 @@ pull_request_rules:
|
|||||||
- check-success=CodeQL-Build
|
- check-success=CodeQL-Build
|
||||||
- check-success=CodeQL
|
- check-success=CodeQL
|
||||||
- check-success=lint
|
- check-success=lint
|
||||||
- check-success=upgrade-test (kindest/node:v1.19.11, ubuntu-latest)
|
- check-success=upgrade-test (kindest/node:v1.23.17, ubuntu-latest)
|
||||||
- check-success=integration-test (v1.19.11, ubuntu-latest)
|
- check-success=integration-test (v1.23.17, ubuntu-latest)
|
||||||
- check-success=integration-test (v1.20.7, ubuntu-latest)
|
- check-success=integration-test (v1.25.11, ubuntu-latest)
|
||||||
- check-success=integration-test (v1.21.1, ubuntu-latest)
|
- check-success=integration-test (v1.27.3, ubuntu-latest)
|
||||||
actions:
|
actions:
|
||||||
merge:
|
merge:
|
||||||
method: squash
|
method: squash
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ test-run: code-checks
|
|||||||
|
|
||||||
### Binaries
|
### Binaries
|
||||||
build-fission-cli:
|
build-fission-cli:
|
||||||
@GOOS=$(GOOS) GOARCH=$(GOARCH) GOAMD64=$(GOAMD64) GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --rm-dist --single-target --id fission-cli
|
@GOOS=$(GOOS) GOARCH=$(GOARCH) GOAMD64=$(GOAMD64) GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target --id fission-cli
|
||||||
|
|
||||||
install-fission-cli:
|
install-fission-cli:
|
||||||
# TODO: Fix this hack, replace v1 with GOAMD64
|
# TODO: Fix this hack, replace v1 with GOAMD64
|
||||||
@@ -64,7 +64,7 @@ codegen: controller-gen-install
|
|||||||
|
|
||||||
### CRDs
|
### CRDs
|
||||||
controller-gen-install:
|
controller-gen-install:
|
||||||
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0
|
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
|
||||||
|
|
||||||
generate-crds: controller-gen-install
|
generate-crds: controller-gen-install
|
||||||
controller-gen crd \
|
controller-gen crd \
|
||||||
@@ -99,7 +99,7 @@ generate-cli-docs:
|
|||||||
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
|
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
|
||||||
|
|
||||||
install-crd-ref-docs:
|
install-crd-ref-docs:
|
||||||
go install github.com/elastic/crd-ref-docs@v0.0.8
|
go install github.com/elastic/crd-ref-docs@v0.0.10
|
||||||
|
|
||||||
generate-crd-ref-docs: install-crd-ref-docs
|
generate-crd-ref-docs: install-crd-ref-docs
|
||||||
# crd-ref-docs: https://github.com/elastic/crd-ref-docs
|
# crd-ref-docs: https://github.com/elastic/crd-ref-docs
|
||||||
@@ -111,7 +111,7 @@ generate-crd-ref-docs: install-crd-ref-docs
|
|||||||
all-generators: codegen generate-crds generate-swagger-doc generate-cli-docs generate-crd-ref-docs
|
all-generators: codegen generate-crds generate-swagger-doc generate-cli-docs generate-crd-ref-docs
|
||||||
|
|
||||||
skaffold-prebuild:
|
skaffold-prebuild:
|
||||||
@GOOS=linux GOARCH=amd64 GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --rm-dist --single-target
|
@GOOS=linux GOARCH=amd64 GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target
|
||||||
@cp -v cmd/builder/Dockerfile dist/builder_linux_amd64_v1/Dockerfile
|
@cp -v cmd/builder/Dockerfile dist/builder_linux_amd64_v1/Dockerfile
|
||||||
@cp -v cmd/fetcher/Dockerfile dist/fetcher_linux_amd64_v1/Dockerfile
|
@cp -v cmd/fetcher/Dockerfile dist/fetcher_linux_amd64_v1/Dockerfile
|
||||||
@cp -v cmd/fission-bundle/Dockerfile dist/fission-bundle_linux_amd64_v1/Dockerfile
|
@cp -v cmd/fission-bundle/Dockerfile dist/fission-bundle_linux_amd64_v1/Dockerfile
|
||||||
@@ -127,3 +127,10 @@ release:
|
|||||||
@./hack/release.sh $(VERSION)
|
@./hack/release.sh $(VERSION)
|
||||||
@./hack/release-tag.sh $(VERSION)
|
@./hack/release-tag.sh $(VERSION)
|
||||||
@./hack/changelog.sh
|
@./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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
name: fission-all
|
name: fission-all
|
||||||
version: v1.18.0
|
version: v1.20.0
|
||||||
appVersion: v1.18.0
|
appVersion: v1.20.0
|
||||||
description: Fission is a fast serverless framework for Kubernetes.
|
description: Fission is a fast serverless framework for Kubernetes.
|
||||||
home: https://fission.io/
|
home: https://fission.io/
|
||||||
icon: https://fission.io/images/fission-logo-white.svg
|
icon: https://fission.io/images/fission-logo-white.svg
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Kubernetes 1.19+
|
- Kubernetes 1.23+
|
||||||
- Helm 3+
|
- Helm 3+
|
||||||
|
|
||||||
## Get Repo Info
|
## Get Repo Info
|
||||||
@@ -93,6 +93,25 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
|
|||||||
|
|
||||||
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.
|
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.
|
||||||
|
|
||||||
|
### Upgrade from 1.18.x to 1.20.x
|
||||||
|
|
||||||
|
We have removed controller service from fission-all chart.
|
||||||
|
|
||||||
|
### Upgrade from 1.17.x to 1.18.x
|
||||||
|
|
||||||
|
With 1.18.x, we have major change in the way we are deploying Fission.
|
||||||
|
We have added parameters `defaultNamespace`, `additionalFissionNamespaces`, `functionNamespace` and `builderNamespace` to manage the namespaces.
|
||||||
|
We watch and manage specific namespaces for Fission resources configured via `defaultNamespace` and `additionalFissionNamespaces` parameters.
|
||||||
|
You dont need to worry about `builderNamespace` and `functionNamespace` parameters, unless you want to consider legacy Fission resources.
|
||||||
|
|
||||||
|
Please refer to [core changes](https://fission.io/docs/releases/v1.18.0/#fission-core-changes) for more details.
|
||||||
|
|
||||||
|
### Upgrade from 1.16.x to 1.17.x
|
||||||
|
|
||||||
|
By default, Fission runs with the default security context. This means that it will be run as root. We have added settings in Helm chart for securityContext across all services in Fission. You can enable recommended securityContext settings during Fission installation.
|
||||||
|
|
||||||
|
Please refer to [security context settings](https://fission.io/docs/releases/v1.17.0/#security-context-setting-for-fission-installation) for more details.
|
||||||
|
|
||||||
### Upgrade from 1.15.x to 1.16.x
|
### Upgrade from 1.15.x to 1.16.x
|
||||||
|
|
||||||
If you have been using `prometheus.enabled=true` in your fission-all chart, you will need to deploy the prometheus using prometheus community supported chart.
|
If you have been using `prometheus.enabled=true` in your fission-all chart, you will need to deploy the prometheus using prometheus community supported chart.
|
||||||
|
|||||||
@@ -11,14 +11,20 @@ Windows:
|
|||||||
|
|
||||||
2. You're ready to use Fission!
|
2. You're ready to use Fission!
|
||||||
|
|
||||||
|
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
||||||
|
You can create fission resources in the namespaces "{{ .Values.defaultNamespace }},{{ join "," .Values.additionalFissionNamespaces }}"
|
||||||
|
{{- else }}
|
||||||
|
You can create fission resources in the namespace "{{ .Values.defaultNamespace }}"
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
# Create an environment
|
# Create an environment
|
||||||
$ fission env create --name nodejs --image fission/node-env
|
$ fission env create --name nodejs --image fission/node-env --namespace {{ .Values.defaultNamespace }}
|
||||||
|
|
||||||
# Get a hello world
|
# Get a hello world
|
||||||
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
|
$ curl https://raw.githubusercontent.com/fission/examples/master/nodejs/hello.js > hello.js
|
||||||
|
|
||||||
# Register this function with Fission
|
# Register this function with Fission
|
||||||
$ fission function create --name hello --env nodejs --code hello.js
|
$ fission function create --name hello --env nodejs --code hello.js --namespace {{ .Values.defaultNamespace }}
|
||||||
|
|
||||||
{{- if .Values.authentication.enabled }}
|
{{- if .Values.authentication.enabled }}
|
||||||
|
|
||||||
@@ -29,6 +35,6 @@ Windows:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
# Run this function
|
# Run this function
|
||||||
$ fission function test --name hello
|
$ fission function test --name hello --namespace {{ .Values.defaultNamespace }}
|
||||||
Hello, world!
|
Hello, world!
|
||||||
|
|
||||||
|
|||||||
@@ -15,28 +15,6 @@ rules:
|
|||||||
- patch
|
- patch
|
||||||
- delete
|
- delete
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- define "controller-rules" }}
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- fission.io
|
|
||||||
resources:
|
|
||||||
- canaryconfigs
|
|
||||||
- environments
|
|
||||||
- functions
|
|
||||||
- httptriggers
|
|
||||||
- kuberneteswatchtriggers
|
|
||||||
- messagequeuetriggers
|
|
||||||
- packages
|
|
||||||
- timetriggers
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- update
|
|
||||||
- patch
|
|
||||||
- delete
|
|
||||||
{{- end }}
|
|
||||||
{{- define "executor-rules" }}
|
{{- define "executor-rules" }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
@@ -72,24 +50,6 @@ rules:
|
|||||||
- patch
|
- patch
|
||||||
- delete
|
- delete
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- define "kafka-rules" }}
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- fission.io
|
|
||||||
resources:
|
|
||||||
- environments
|
|
||||||
- functions
|
|
||||||
- messagequeuetriggers
|
|
||||||
- packages
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- update
|
|
||||||
- patch
|
|
||||||
- delete
|
|
||||||
{{- end }}
|
|
||||||
{{- define "keda-rules" }}
|
{{- define "keda-rules" }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
- patch
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- configmaps
|
||||||
|
- secrets
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- apps
|
- apps
|
||||||
resources:
|
resources:
|
||||||
@@ -54,44 +63,6 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- define "controller-kuberules" }}
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- services
|
|
||||||
verbs:
|
|
||||||
- list
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- namespaces
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- pods
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- apiextensions.k8s.io
|
|
||||||
resources:
|
|
||||||
- customresourcedefinitions
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
{{- end }}
|
|
||||||
{{- define "executor-kuberules" }}
|
{{- define "executor-kuberules" }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
@@ -100,7 +71,6 @@ rules:
|
|||||||
- pods
|
- pods
|
||||||
- services
|
- services
|
||||||
- replicationcontrollers
|
- replicationcontrollers
|
||||||
- events
|
|
||||||
verbs:
|
verbs:
|
||||||
- create
|
- create
|
||||||
- delete
|
- delete
|
||||||
@@ -108,6 +78,16 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
- patch
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- patch
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
resources:
|
resources:
|
||||||
@@ -224,54 +204,6 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- define "kafka-kuberules" }}
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
- pods
|
|
||||||
- secrets
|
|
||||||
- services
|
|
||||||
- replicationcontrollers
|
|
||||||
- events
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- delete
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- patch
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- apiGroups:
|
|
||||||
- apps
|
|
||||||
resources:
|
|
||||||
- deployments
|
|
||||||
- deployments/scale
|
|
||||||
- replicasets
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- update
|
|
||||||
- patch
|
|
||||||
- delete
|
|
||||||
- apiGroups:
|
|
||||||
- apiextensions.k8s.io
|
|
||||||
resources:
|
|
||||||
- customresourcedefinitions
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
{{- end }}
|
|
||||||
{{- define "keda-kuberules" }}
|
{{- define "keda-kuberules" }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
@@ -280,7 +212,6 @@ rules:
|
|||||||
- pods
|
- pods
|
||||||
- services
|
- services
|
||||||
- replicationcontrollers
|
- replicationcontrollers
|
||||||
- events
|
|
||||||
verbs:
|
verbs:
|
||||||
- create
|
- create
|
||||||
- delete
|
- delete
|
||||||
@@ -288,6 +219,16 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
- patch
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- patch
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ metadata:
|
|||||||
{{- if eq "canaryconfig" .component }}
|
{{- if eq "canaryconfig" .component }}
|
||||||
{{- include "canaryconfig-kuberules" . }}
|
{{- include "canaryconfig-kuberules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq "controller" .component }}
|
|
||||||
{{- include "controller-kuberules" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if eq "fluentbit" .component }}
|
{{- if eq "fluentbit" .component }}
|
||||||
{{- include "fluentbit-kuberules" . }}
|
{{- include "fluentbit-kuberules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -29,9 +26,6 @@ metadata:
|
|||||||
{{- if eq "kubewatcher" .component }}
|
{{- if eq "kubewatcher" .component }}
|
||||||
{{- include "kubewatcher-kuberules" . }}
|
{{- include "kubewatcher-kuberules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq "kafka" .component }}
|
|
||||||
{{- include "kafka-kuberules" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if eq "keda" .component }}
|
{{- if eq "keda" .component }}
|
||||||
{{- include "keda-kuberules" . }}
|
{{- include "keda-kuberules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -14,18 +14,12 @@ metadata:
|
|||||||
{{- if eq "buildermgr" .component }}
|
{{- if eq "buildermgr" .component }}
|
||||||
{{- include "buildermgr-rules" . }}
|
{{- include "buildermgr-rules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq "controller" .component }}
|
|
||||||
{{- include "controller-rules" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if eq "executor" .component }}
|
{{- if eq "executor" .component }}
|
||||||
{{- include "executor-rules" . }}
|
{{- include "executor-rules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq "kubewatcher" .component }}
|
{{- if eq "kubewatcher" .component }}
|
||||||
{{- include "kubewatcher-rules" . }}
|
{{- include "kubewatcher-rules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq "kafka" .component }}
|
|
||||||
{{- include "kafka-rules" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if eq "keda" .component }}
|
{{- if eq "keda" .component }}
|
||||||
{{- include "keda-rules" . }}
|
{{- include "keda-rules" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -55,6 +55,22 @@ This template generates the image name for the deployment depending on the value
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- 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 }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "opentelemtry.envs" }}
|
{{- define "opentelemtry.envs" }}
|
||||||
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||||
value: "{{ .Values.openTelemetry.otlpCollectorEndpoint }}"
|
value: "{{ .Values.openTelemetry.otlpCollectorEndpoint }}"
|
||||||
@@ -73,6 +89,12 @@ This template generates the image name for the deployment depending on the value
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- define "fission-resource-namespace.envs" }}
|
{{- define "fission-resource-namespace.envs" }}
|
||||||
|
- name: FISSION_BUILDER_NAMESPACE
|
||||||
|
value: "{{ .Values.builderNamespace }}"
|
||||||
|
- name: FISSION_FUNCTION_NAMESPACE
|
||||||
|
value: "{{ .Values.functionNamespace }}"
|
||||||
|
- name: FISSION_DEFAULT_NAMESPACE
|
||||||
|
value: "{{ .Values.defaultNamespace }}"
|
||||||
- name: FISSION_RESOURCE_NAMESPACES
|
- name: FISSION_RESOURCE_NAMESPACES
|
||||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
||||||
value: "{{ .Values.defaultNamespace }},{{ join "," .Values.additionalFissionNamespaces }}"
|
value: "{{ .Values.defaultNamespace }},{{ join "," .Values.additionalFissionNamespaces }}"
|
||||||
|
|||||||
@@ -26,11 +26,7 @@ spec:
|
|||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
containers:
|
containers:
|
||||||
- name: post-install-job
|
- name: post-install-job
|
||||||
{{- if .Values.imageTag }}
|
image: {{ include "reporterImage" . | quote }}
|
||||||
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
|
|
||||||
{{- else }}
|
|
||||||
image: {{ .Values.postInstallReportImage }}
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: [ "/reporter" ]
|
command: [ "/reporter" ]
|
||||||
args: ["event", "-c", "fission-use", "-a", "yaml-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
args: ["event", "-c", "fission-use", "-a", "yaml-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
||||||
|
|||||||
@@ -30,11 +30,7 @@ spec:
|
|||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
containers:
|
containers:
|
||||||
- name: post-install-job
|
- name: post-install-job
|
||||||
{{- if .Values.imageTag }}
|
image: {{ include "reporterImage" . | quote }}
|
||||||
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
|
|
||||||
{{- else }}
|
|
||||||
image: {{ .Values.postInstallReportImage }}
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: [ "/reporter" ]
|
command: [ "/reporter" ]
|
||||||
args: ["event", "-c", "fission-use", "-a", "helm-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
args: ["event", "-c", "fission-use", "-a", "helm-post-install", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
||||||
|
|||||||
@@ -30,11 +30,7 @@ spec:
|
|||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
containers:
|
containers:
|
||||||
- name: post-upgrade-job
|
- name: post-upgrade-job
|
||||||
{{- if .Values.imageTag }}
|
image: {{ include "reporterImage" . | quote }}
|
||||||
image: {{ .Values.postInstallReportImage }}:{{ .Values.imageTag }}
|
|
||||||
{{- else }}
|
|
||||||
image: {{ .Values.postInstallReportImage }}
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
imagePullPolicy: {{ .Values.pullPolicy }}
|
||||||
command: [ "/reporter" ]
|
command: [ "/reporter" ]
|
||||||
args: ["event", "-c", "fission-use", "-a", "helm-post-upgrade", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
args: ["event", "-c", "fission-use", "-a", "helm-post-upgrade", "-l", "{{ .Chart.Name }}-{{ .Chart.Version }}"]
|
||||||
|
|||||||
@@ -39,12 +39,6 @@ spec:
|
|||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: BUILDER_IMAGE_PULL_POLICY
|
- name: BUILDER_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: FISSION_BUILDER_NAMESPACE
|
|
||||||
value: "{{ .Values.builderNamespace }}"
|
|
||||||
- name: FISSION_FUNCTION_NAMESPACE
|
|
||||||
value: "{{ .Values.functionNamespace }}"
|
|
||||||
- name: FISSION_DEFAULT_NAMESPACE
|
|
||||||
value: "{{ .Values.defaultNamespace }}"
|
|
||||||
- name: ENABLE_ISTIO
|
- name: ENABLE_ISTIO
|
||||||
value: "{{ .Values.enableIstio }}"
|
value: "{{ .Values.enableIstio }}"
|
||||||
- name: FETCHER_MINCPU
|
- name: FETCHER_MINCPU
|
||||||
|
|||||||
@@ -5,3 +5,9 @@
|
|||||||
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "buildermgr") $) }}
|
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "buildermgr") $) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.builderNamespace -}}
|
||||||
|
{{ include "fission-role-generator" (merge (dict "namespace" .Values.builderNamespace "component" "buildermgr") $) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.functionNamespace -}}
|
||||||
|
{{ include "fission-role-generator" (merge (dict "namespace" .Values.functionNamespace "component" "buildermgr") $) }}
|
||||||
|
{{- end }}
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
{{- if .Values.controller.enabled }}
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: controller
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
svc: controller
|
|
||||||
application: fission-api
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
svc: controller
|
|
||||||
application: fission-api
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
svc: controller
|
|
||||||
application: fission-api
|
|
||||||
annotations:
|
|
||||||
prometheus.io/scrape: "true"
|
|
||||||
prometheus.io/path: "/metrics"
|
|
||||||
prometheus.io/port: "8080"
|
|
||||||
spec:
|
|
||||||
{{- if .Values.controller.securityContext.enabled }}
|
|
||||||
securityContext: {{- omit .Values.controller.securityContext "enabled" | toYaml | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
containers:
|
|
||||||
- name: controller
|
|
||||||
image: {{ include "fission-bundleImage" . | quote }}
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
|
||||||
command: ["/fission-bundle"]
|
|
||||||
args: ["--controllerPort", "8888"]
|
|
||||||
env:
|
|
||||||
- name: FISSION_DEFAULT_NAMESPACE
|
|
||||||
value: "{{ .Values.defaultNamespace }}"
|
|
||||||
- name: FISSION_BUILDER_NAMESPACE
|
|
||||||
value: "{{ .Values.builderNamespace }}"
|
|
||||||
- name: FISSION_FUNCTION_NAMESPACE
|
|
||||||
value: "{{ .Values.functionNamespace }}"
|
|
||||||
- name: DEBUG_ENV
|
|
||||||
value: {{ .Values.debugEnv | quote }}
|
|
||||||
- name: PPROF_ENABLED
|
|
||||||
value: {{ .Values.pprof.enabled | quote }}
|
|
||||||
{{- include "fission-resource-namespace.envs" . | indent 8 }}
|
|
||||||
- name: POD_NAMESPACE
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
fieldPath: metadata.namespace
|
|
||||||
{{- include "opentelemtry.envs" . | indent 8 }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml .Values.controller.resources | nindent 10 }}
|
|
||||||
{{- if .Values.terminationMessagePath }}
|
|
||||||
terminationMessagePath: {{ .Values.terminationMessagePath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.terminationMessagePolicy }}
|
|
||||||
terminationMessagePolicy: {{ .Values.terminationMessagePolicy }}
|
|
||||||
{{- end }}
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: "/healthz"
|
|
||||||
port: 8888
|
|
||||||
initialDelaySeconds: 1
|
|
||||||
periodSeconds: 1
|
|
||||||
failureThreshold: 30
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: "/healthz"
|
|
||||||
port: 8888
|
|
||||||
initialDelaySeconds: 35
|
|
||||||
periodSeconds: 5
|
|
||||||
volumeMounts:
|
|
||||||
- name: config-volume
|
|
||||||
mountPath: /etc/config/config.yaml
|
|
||||||
subPath: config.yaml
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
name: metrics
|
|
||||||
- containerPort: 8888
|
|
||||||
name: http
|
|
||||||
{{- if .Values.pprof.enabled }}
|
|
||||||
- containerPort: 6060
|
|
||||||
name: pprof
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
serviceAccountName: fission-controller
|
|
||||||
volumes:
|
|
||||||
- name: config-volume
|
|
||||||
configMap:
|
|
||||||
name: feature-config
|
|
||||||
{{- if .Values.priorityClassName }}
|
|
||||||
priorityClassName: {{ .Values.priorityClassName }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.imagePullSecrets }}
|
|
||||||
imagePullSecrets:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.extraCoreComponentPodConfig }}
|
|
||||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
|
||||||
{{- end }}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{{- if .Values.controller.enabled }}
|
|
||||||
{{- include "fission-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "controller") .) }}
|
|
||||||
|
|
||||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
|
||||||
{{- range $namespace := $.Values.additionalFissionNamespaces }}
|
|
||||||
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "controller") $) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "controller") .) }}
|
|
||||||
|
|
||||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
|
||||||
{{- range $namespace := $.Values.additionalFissionNamespaces }}
|
|
||||||
{{ include "kubernetes-role-generator" (merge (dict "namespace" $namespace "component" "controller") $) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.builderNamespace -}}
|
|
||||||
{{ include "kubernetes-role-generator" (merge (dict "namespace" .Values.builderNamespace "component" "controller") $) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.functionNamespace -}}
|
|
||||||
{{ include "kubernetes-role-generator" (merge (dict "namespace" .Values.functionNamespace "component" "controller") $) }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{{- if .Values.controller.enabled }}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: fission-controller
|
|
||||||
namespace: {{ .Release.Namespace }}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{{- if .Values.controller.enabled }}
|
|
||||||
{{- if .Values.serviceMonitor.enabled }}
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: ServiceMonitor
|
|
||||||
metadata:
|
|
||||||
name: controller-monitor
|
|
||||||
{{- if .Values.serviceMonitor.namespace }}
|
|
||||||
namespace: {{ .Values.serviceMonitor.namespace }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.serviceMonitor.additionalServiceMonitorLabels }}
|
|
||||||
labels:
|
|
||||||
{{- toYaml . | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
namespaceSelector:
|
|
||||||
matchNames:
|
|
||||||
- {{ .Release.Namespace }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
svc: controller
|
|
||||||
endpoints:
|
|
||||||
- targetPort: 8080
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{{- if .Values.controller.enabled }}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: controller
|
|
||||||
labels:
|
|
||||||
svc: controller
|
|
||||||
application: fission-api
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.serviceType }}
|
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
targetPort: 8888
|
|
||||||
{{- if eq .Values.serviceType "NodePort" }}
|
|
||||||
nodePort: {{ .Values.controllerPort }}
|
|
||||||
{{- end }}
|
|
||||||
selector:
|
|
||||||
svc: controller
|
|
||||||
{{- end -}}
|
|
||||||
@@ -37,12 +37,6 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
- name: FETCHER_IMAGE_PULL_POLICY
|
- name: FETCHER_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: FISSION_BUILDER_NAMESPACE
|
|
||||||
value: "{{ .Values.builderNamespace }}"
|
|
||||||
- name: FISSION_FUNCTION_NAMESPACE
|
|
||||||
value: "{{ .Values.functionNamespace }}"
|
|
||||||
- name: FISSION_DEFAULT_NAMESPACE
|
|
||||||
value: "{{ .Values.defaultNamespace }}"
|
|
||||||
- name: RUNTIME_IMAGE_PULL_POLICY
|
- name: RUNTIME_IMAGE_PULL_POLICY
|
||||||
value: "{{ .Values.pullPolicy }}"
|
value: "{{ .Values.pullPolicy }}"
|
||||||
- name: ADOPT_EXISTING_RESOURCES
|
- name: ADOPT_EXISTING_RESOURCES
|
||||||
|
|||||||
@@ -5,3 +5,9 @@
|
|||||||
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "executor") $) }}
|
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "executor") $) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.builderNamespace -}}
|
||||||
|
{{ include "fission-role-generator" (merge (dict "namespace" .Values.builderNamespace "component" "executor") $) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.functionNamespace -}}
|
||||||
|
{{ include "fission-role-generator" (merge (dict "namespace" .Values.functionNamespace "component" "executor") $) }}
|
||||||
|
{{- end }}
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
{{- if .Values.kafka.enabled }}
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mqtrigger-kafka
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
svc: mqtrigger
|
|
||||||
messagequeue: kafka
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
svc: mqtrigger
|
|
||||||
messagequeue: kafka
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
svc: mqtrigger
|
|
||||||
messagequeue: kafka
|
|
||||||
annotations:
|
|
||||||
prometheus.io/scrape: "true"
|
|
||||||
prometheus.io/path: "/metrics"
|
|
||||||
prometheus.io/port: "8080"
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mqtrigger
|
|
||||||
{{- if eq .Values.imageTag "" }}
|
|
||||||
image: "{{ .Values.image }}"
|
|
||||||
{{- else }}
|
|
||||||
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.pullPolicy }}
|
|
||||||
command: ["/fission-bundle"]
|
|
||||||
args: ["--mqt", "--routerUrl", "http://router.{{ .Release.Namespace }}"]
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
name: metrics
|
|
||||||
env:
|
|
||||||
- name: MESSAGE_QUEUE_TYPE
|
|
||||||
value: kafka
|
|
||||||
- name: MESSAGE_QUEUE_URL
|
|
||||||
value: "{{.Values.kafka.brokers}}"
|
|
||||||
- name: MESSAGE_QUEUE_KAFKA_VERSION
|
|
||||||
value: "{{.Values.kafka.version}}"
|
|
||||||
- name: DEBUG_ENV
|
|
||||||
value: {{ .Values.debugEnv | quote }}
|
|
||||||
- name: PPROF_ENABLED
|
|
||||||
value: {{ .Values.pprof.enabled | quote }}
|
|
||||||
{{- include "fission-resource-namespace.envs" . | indent 8 }}
|
|
||||||
{{- include "opentelemtry.envs" . | indent 8 }}
|
|
||||||
# TLS authentication is TLS with authentication (2 way)
|
|
||||||
# More info: https://docs.confluent.io/current/kafka/authentication_ssl.html#ssl-overview
|
|
||||||
{{- if .Values.kafka.authentication.tls.enabled }}
|
|
||||||
- name: TLS_ENABLED
|
|
||||||
value: "true"
|
|
||||||
- name: MESSAGE_QUEUE_SECRETS
|
|
||||||
value: /etc/fission/secrets
|
|
||||||
- name: INSECURE_SKIP_VERIFY
|
|
||||||
value: "{{ .Values.kafka.authentication.tls.insecureSkipVerify }}"
|
|
||||||
volumeMounts:
|
|
||||||
- name: kafka-secrets
|
|
||||||
mountPath: /etc/fission/secrets
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.terminationMessagePath }}
|
|
||||||
terminationMessagePath: {{ .Values.terminationMessagePath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.terminationMessagePolicy }}
|
|
||||||
terminationMessagePolicy: {{ .Values.terminationMessagePolicy }}
|
|
||||||
{{- end }}
|
|
||||||
serviceAccountName: fission-kafka
|
|
||||||
{{- if .Values.kafka.authentication.tls.enabled }}
|
|
||||||
volumes:
|
|
||||||
- name: kafka-secrets
|
|
||||||
secret:
|
|
||||||
secretName: mqtrigger-kafka-secrets
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.imagePullSecrets }}
|
|
||||||
imagePullSecrets:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
{{- if .Values.kafka.authentication.tls.enabled }}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: mqtrigger-kafka-secrets
|
|
||||||
labels:
|
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
|
||||||
data:
|
|
||||||
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) }}
|
|
||||||
caCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.caCert) | b64enc }}
|
|
||||||
{{- else }}
|
|
||||||
{{ fail "Invalid chart. CA Certificate not found." }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) }}
|
|
||||||
userCert: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userCert) | b64enc }}
|
|
||||||
{{- else }}
|
|
||||||
{{ fail "Invalid chart. User Certificate not found." }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) }}
|
|
||||||
userKey: {{ .Files.Get (printf "%s" .Values.kafka.authentication.tls.userKey) | b64enc }}
|
|
||||||
{{- else }}
|
|
||||||
{{ fail "Invalid chart. User Key not found." }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.extraCoreComponentPodConfig }}
|
|
||||||
{{ toYaml .Values.extraCoreComponentPodConfig | indent 6 -}}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{{- if .Values.podMonitor.enabled }}
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: PodMonitor
|
|
||||||
metadata:
|
|
||||||
name: mqt-fission-kafka-monitor
|
|
||||||
{{- if .Values.podMonitor.namespace }}
|
|
||||||
namespace: {{ .Values.podMonitor.namespace }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.podMonitor.additionalPodMonitorLabels }}
|
|
||||||
labels:
|
|
||||||
{{- toYaml . | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
namespaceSelector:
|
|
||||||
matchNames:
|
|
||||||
- {{ .Release.Namespace }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
svc: mqtrigger
|
|
||||||
podMetricsEndpoints:
|
|
||||||
- port: "metrics"
|
|
||||||
path: "/metrics"
|
|
||||||
{{- end -}}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{{- include "fission-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "kafka") .) }}
|
|
||||||
|
|
||||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
|
||||||
{{- range $namespace := $.Values.additionalFissionNamespaces }}
|
|
||||||
{{ include "fission-role-generator" (merge (dict "namespace" $namespace "component" "kafka") $) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{{- include "kubernetes-role-generator" (merge (dict "namespace" .Values.defaultNamespace "component" "kafka") .) }}
|
|
||||||
|
|
||||||
{{- if gt (len .Values.additionalFissionNamespaces) 0 }}
|
|
||||||
{{- range $namespace := $.Values.additionalFissionNamespaces }}
|
|
||||||
{{ include "kubernetes-role-generator" (merge (dict "namespace" $namespace "component" "kafka") $) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: fission-kafka
|
|
||||||
namespace: {{ .Release.Namespace }}
|
|
||||||
@@ -12,7 +12,7 @@ metadata:
|
|||||||
application: fission-router
|
application: fission-router
|
||||||
spec:
|
spec:
|
||||||
{{- if not .Values.router.deployAsDaemonSet }}
|
{{- if not .Values.router.deployAsDaemonSet }}
|
||||||
replicas: 1
|
replicas: {{ .Values.router.replicas | default 1 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||||
annotations:
|
annotations:
|
||||||
"helm.sh/hook": pre-install
|
"helm.sh/hook": pre-install,pre-upgrade
|
||||||
data:
|
data:
|
||||||
username: {{ .Values.authentication.authUsername | b64enc | quote }}
|
username: {{ .Values.authentication.authUsername | b64enc | quote }}
|
||||||
password: {{ randAlphaNum 20 | b64enc | quote }}
|
password: {{ randAlphaNum 20 | b64enc | quote }}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
## Fission chart configuration
|
## Fission chart configuration
|
||||||
##
|
##
|
||||||
|
|
||||||
## serviceType to consider while creating Fission Controller service.
|
## serviceType to consider while creating Fission webhook service.
|
||||||
## For minikube/kind, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
|
## For minikube/kind, set this to NodePort, elsewhere use LoadBalancer or ClusterIP.
|
||||||
##
|
##
|
||||||
serviceType: ClusterIP
|
serviceType: ClusterIP
|
||||||
@@ -14,7 +14,7 @@ routerServiceType: LoadBalancer
|
|||||||
## repository represents base repository for images used in the chart.
|
## repository represents base repository for images used in the chart.
|
||||||
## Keep it empty for using existing local image
|
## Keep it empty for using existing local image
|
||||||
##
|
##
|
||||||
repository: index.docker.io
|
repository: ghcr.io
|
||||||
|
|
||||||
## image represents the base image fission-bundle used by multiple Fission components.
|
## image represents the base image fission-bundle used by multiple Fission components.
|
||||||
## We alter arguments to the image to run a particular component.
|
## We alter arguments to the image to run a particular component.
|
||||||
@@ -25,7 +25,7 @@ image: fission/fission-bundle
|
|||||||
## It is also used by the chart to identify version of the few more images apart from fission-bundle.
|
## It is also used by the chart to identify version of the few more images apart from fission-bundle.
|
||||||
## Keep it empty for using latest tag.
|
## Keep it empty for using latest tag.
|
||||||
##
|
##
|
||||||
imageTag: v1.18.0
|
imageTag: v1.20.0
|
||||||
|
|
||||||
## pullPolicy represents the pull policy to use for images in the chart.
|
## pullPolicy represents the pull policy to use for images in the chart.
|
||||||
##
|
##
|
||||||
@@ -53,18 +53,13 @@ terminationMessagePath: /dev/termination-log
|
|||||||
##
|
##
|
||||||
terminationMessagePolicy: File
|
terminationMessagePolicy: File
|
||||||
|
|
||||||
## controllerPort represents the port at which the Fission controller service should be exposed.
|
|
||||||
##
|
|
||||||
controllerPort: 31313
|
|
||||||
|
|
||||||
## routerPort represents the port at which the Fission Router service should be exposed.
|
## routerPort represents the port at which the Fission Router service should be exposed.
|
||||||
##
|
##
|
||||||
routerPort: 31314
|
routerPort: 31314
|
||||||
|
|
||||||
## defaultNamespace represents the namespace in which Fission custom resources will be created by the Fission user.
|
## defaultNamespace represents the namespace in which Fission custom resources will be created by the Fission user.
|
||||||
## This is different from the release namespace.
|
## This is different from the release namespace.
|
||||||
## Please consider setting `singleDefaultNamespace` and `additionalFissionNamespaces` if you want
|
## Please consider setting `additionalFissionNamespaces` if you want more than one namespace to be used for Fission custom resources.
|
||||||
## more than one namespace to be used for Fission custom resources.
|
|
||||||
##
|
##
|
||||||
defaultNamespace: default
|
defaultNamespace: default
|
||||||
|
|
||||||
@@ -104,7 +99,7 @@ fetcher:
|
|||||||
## image represents the image of the fetcher component.
|
## image represents the image of the fetcher component.
|
||||||
image: fission/fetcher
|
image: fission/fetcher
|
||||||
## imageTag represents the tag of the image of the fetcher component.
|
## imageTag represents the tag of the image of the fetcher component.
|
||||||
imageTag: v1.18.0
|
imageTag: v1.20.0
|
||||||
|
|
||||||
## Fetcher is only for to downloading or uploading archive.
|
## Fetcher is only for to downloading or uploading archive.
|
||||||
## Normally, you don't need to change the value here, unless necessary.
|
## Normally, you don't need to change the value here, unless necessary.
|
||||||
@@ -212,6 +207,9 @@ router:
|
|||||||
## deployAsDaemonSet decides whether to deploy router as a DaemonSet or a Deployment.
|
## deployAsDaemonSet decides whether to deploy router as a DaemonSet or a Deployment.
|
||||||
##
|
##
|
||||||
deployAsDaemonSet: false
|
deployAsDaemonSet: false
|
||||||
|
## replicas decides how many router pods to deploy. Only used when deployAsDaemonSet is false.
|
||||||
|
##
|
||||||
|
replicas: 1
|
||||||
## svcAddressMaxRetries is the max times for router to retry with a specific function service address
|
## svcAddressMaxRetries is the max times for router to retry with a specific function service address
|
||||||
##
|
##
|
||||||
svcAddressMaxRetries: 5
|
svcAddressMaxRetries: 5
|
||||||
@@ -338,34 +336,6 @@ buildermgr:
|
|||||||
runAsUser: 10001
|
runAsUser: 10001
|
||||||
runAsGroup: 10001
|
runAsGroup: 10001
|
||||||
|
|
||||||
## controller is the component that the client talks to.
|
|
||||||
## It contains CRUD APIs for functions, triggers, environments, Kubernetes event watches, etc. and proxy APIs to internal 3rd-party services.
|
|
||||||
##
|
|
||||||
controller:
|
|
||||||
enabled: false
|
|
||||||
## Pod resources as:
|
|
||||||
## resources:
|
|
||||||
## limits:
|
|
||||||
## cpu: <tbd>
|
|
||||||
## memory: <tbd>
|
|
||||||
## requests:
|
|
||||||
## cpu: <tbd>
|
|
||||||
## memory: <tbd>
|
|
||||||
##
|
|
||||||
resources: {}
|
|
||||||
|
|
||||||
## Security Context
|
|
||||||
## It holds pod-level and container level security configuration.
|
|
||||||
## This is an experimental section, please verify before enabling in production.
|
|
||||||
## Ref: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context-1
|
|
||||||
securityContext:
|
|
||||||
enabled: true
|
|
||||||
## Mark it false, if you want to stop the non root user validation
|
|
||||||
runAsNonRoot: true
|
|
||||||
fsGroup: 10001
|
|
||||||
runAsUser: 10001
|
|
||||||
runAsGroup: 10001
|
|
||||||
|
|
||||||
## webhook is the component that validates API calls.
|
## 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.
|
||||||
##
|
##
|
||||||
@@ -489,50 +459,8 @@ timer:
|
|||||||
runAsUser: 10001
|
runAsUser: 10001
|
||||||
runAsGroup: 10001
|
runAsGroup: 10001
|
||||||
|
|
||||||
## Kafka: enable and configure the details
|
|
||||||
##
|
|
||||||
kafka:
|
|
||||||
enabled: false
|
|
||||||
## note: below link is only for reference.
|
|
||||||
## Please use the brokers link for your kafka here.
|
|
||||||
##
|
|
||||||
brokers: "broker.kafka:9092" # or your-bootstrap-server.kafka:9092/9093
|
|
||||||
## Sample config for authentication
|
|
||||||
## authentication:
|
|
||||||
## tls:
|
|
||||||
## enabled: true
|
|
||||||
## caCert: 'auth/kafka/ca.crt'
|
|
||||||
## userCert: 'auth/kafka/user.crt'
|
|
||||||
## userKey: 'auth/kafka/user.key'
|
|
||||||
##
|
|
||||||
authentication:
|
|
||||||
tls:
|
|
||||||
enabled: false
|
|
||||||
## InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name.
|
|
||||||
## Warning: Setting this to true, makes TLS susceptible to man-in-the-middle attacks
|
|
||||||
##
|
|
||||||
insecureSkipVerify: false
|
|
||||||
## path to certificate containing public key of CA authority
|
|
||||||
##
|
|
||||||
caCert: ""
|
|
||||||
## path to certificate containing public key of the user signed by CA authority
|
|
||||||
##
|
|
||||||
userCert: ""
|
|
||||||
## path to private key of the user
|
|
||||||
##
|
|
||||||
userKey: ""
|
|
||||||
|
|
||||||
## version of Kafka broker
|
|
||||||
## For 0.x it must be a string in the format
|
|
||||||
## "major.minor.veryMinor.patch" example: 0.8.2.0
|
|
||||||
## For 1.x it must be a string in the format
|
|
||||||
## "major.major.veryMinor" example: 2.0.1
|
|
||||||
## Should be >= 0.11.2.0 to enable Kafka record headers support
|
|
||||||
##
|
|
||||||
# version: "0.11.2.0"
|
|
||||||
|
|
||||||
# The following components expose Prometheus metrics and have servicemonitors in this chart (disabled by default)
|
# The following components expose Prometheus metrics and have servicemonitors in this chart (disabled by default)
|
||||||
# Controller, router, executor, storage svc
|
# router, executor, storage svc
|
||||||
serviceMonitor:
|
serviceMonitor:
|
||||||
enabled: false
|
enabled: false
|
||||||
##namespace in which you want to deploy servicemonitor
|
##namespace in which you want to deploy servicemonitor
|
||||||
@@ -686,7 +614,7 @@ preUpgradeChecks:
|
|||||||
image: fission/pre-upgrade-checks
|
image: fission/pre-upgrade-checks
|
||||||
## pre-install/pre-upgrade checks image version
|
## pre-install/pre-upgrade checks image version
|
||||||
##
|
##
|
||||||
imageTag: v1.18.0
|
imageTag: v1.20.0
|
||||||
|
|
||||||
## Fission post-install/post-upgrade reporting live in this image
|
## Fission post-install/post-upgrade reporting live in this image
|
||||||
##
|
##
|
||||||
@@ -817,29 +745,29 @@ mqt_keda:
|
|||||||
enabled: true
|
enabled: true
|
||||||
connector_images:
|
connector_images:
|
||||||
kafka:
|
kafka:
|
||||||
image: fission/keda-kafka-http-connector
|
image: ghcr.io/fission/keda-kafka-http-connector
|
||||||
tag: v0.11
|
tag: v0.13
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
image: fission/keda-rabbitmq-http-connector
|
image: ghcr.io/fission/keda-rabbitmq-http-connector
|
||||||
tag: v0.10
|
tag: v0.11
|
||||||
awskinesis:
|
awskinesis:
|
||||||
image: fission/keda-aws-kinesis-http-connector
|
image: ghcr.io/fission/keda-aws-kinesis-http-connector
|
||||||
tag: v0.10
|
tag: v0.11
|
||||||
aws_sqs:
|
aws_sqs:
|
||||||
image: fission/keda-aws-sqs-http-connector
|
image: ghcr.io/fission/keda-aws-sqs-http-connector
|
||||||
tag: v0.10
|
|
||||||
nats_steaming:
|
|
||||||
image: fission/keda-nats-streaming-http-connector
|
|
||||||
tag: v0.12
|
tag: v0.12
|
||||||
|
nats_steaming:
|
||||||
|
image: ghcr.io/fission/keda-nats-streaming-http-connector
|
||||||
|
tag: v0.14
|
||||||
nats_jetstream:
|
nats_jetstream:
|
||||||
image: fission/keda-nats-jetstream-http-connector
|
image: ghcr.io/fission/keda-nats-jetstream-http-connector
|
||||||
tag: v0.2
|
|
||||||
gcp_pubsub:
|
|
||||||
image: fission/keda-gcp-pubsub-http-connector
|
|
||||||
tag: v0.5
|
tag: v0.5
|
||||||
|
gcp_pubsub:
|
||||||
|
image: ghcr.io/fission/keda-gcp-pubsub-http-connector
|
||||||
|
tag: v0.7
|
||||||
redis:
|
redis:
|
||||||
image: fission/keda-redis-http-connector
|
image: ghcr.io/fission/keda-redis-http-connector
|
||||||
tag: v0.3
|
tag: v0.4
|
||||||
|
|
||||||
## Pod resources as:
|
## Pod resources as:
|
||||||
## resources:
|
## resources:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.16
|
FROM cgr.dev/chainguard/static:latest
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
COPY builder /builder
|
COPY builder /builder
|
||||||
ENTRYPOINT ["/builder"]
|
ENTRYPOINT ["/builder"]
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ import (
|
|||||||
|
|
||||||
builder "github.com/fission/fission/pkg/builder"
|
builder "github.com/fission/fission/pkg/builder"
|
||||||
"github.com/fission/fission/pkg/utils/httpserver"
|
"github.com/fission/fission/pkg/utils/httpserver"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Usage: builder <shared volume path>
|
// Usage: builder <shared volume path>
|
||||||
func Run(ctx context.Context, logger *zap.Logger, shareVolume string) {
|
func Run(ctx context.Context, logger *zap.Logger, mgr manager.Interface, shareVolume string) {
|
||||||
builder := builder.MakeBuilder(logger, shareVolume)
|
builder := builder.MakeBuilder(logger, shareVolume)
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/", builder.Handler)
|
mux.HandleFunc("/", builder.Handler)
|
||||||
@@ -35,5 +36,5 @@ func Run(ctx context.Context, logger *zap.Logger, shareVolume string) {
|
|||||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
})
|
})
|
||||||
httpserver.StartServer(ctx, logger, "builder", "8001", mux)
|
httpserver.StartServer(ctx, logger, mgr, "builder", "8001", mux)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-2
@@ -24,15 +24,21 @@ import (
|
|||||||
|
|
||||||
"github.com/fission/fission/cmd/builder/app"
|
"github.com/fission/fission/cmd/builder/app"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
"github.com/fission/fission/pkg/utils/profile"
|
"github.com/fission/fission/pkg/utils/profile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Usage: builder <shared volume path>
|
// Usage: builder <shared volume path>
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
mgr := manager.New()
|
||||||
|
defer mgr.Wait()
|
||||||
|
|
||||||
logger := loggerfactory.GetLogger()
|
logger := loggerfactory.GetLogger()
|
||||||
defer logger.Sync()
|
defer logger.Sync()
|
||||||
ctx := signals.SetupSignalHandler()
|
ctx := signals.SetupSignalHandler()
|
||||||
profile.ProfileIfEnabled(ctx, logger)
|
profile.ProfileIfEnabled(ctx, logger, mgr)
|
||||||
|
|
||||||
shareVolume := os.Args[1]
|
shareVolume := os.Args[1]
|
||||||
if _, err := os.Stat(shareVolume); err != nil {
|
if _, err := os.Stat(shareVolume); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
@@ -42,5 +48,5 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.Run(ctx, logger, shareVolume)
|
app.Run(ctx, logger, mgr, shareVolume)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.16
|
FROM cgr.dev/chainguard/static:latest
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
COPY fetcher /
|
COPY fetcher /
|
||||||
ENTRYPOINT ["/fetcher"]
|
ENTRYPOINT ["/fetcher"]
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ import (
|
|||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"github.com/fission/fission/pkg/crd"
|
||||||
"github.com/fission/fission/pkg/fetcher"
|
"github.com/fission/fission/pkg/fetcher"
|
||||||
"github.com/fission/fission/pkg/utils/httpserver"
|
"github.com/fission/fission/pkg/utils/httpserver"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
otelUtils "github.com/fission/fission/pkg/utils/otel"
|
otelUtils "github.com/fission/fission/pkg/utils/otel"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,7 +39,7 @@ var (
|
|||||||
readyToServe uint32
|
readyToServe uint32
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(ctx context.Context, logger *zap.Logger) {
|
func Run(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) {
|
||||||
flag.Usage = fetcherUsage
|
flag.Usage = fetcherUsage
|
||||||
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod startup")
|
specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod startup")
|
||||||
specializePayload := flag.String("specialize-request", "", "JSON payload for specialize request")
|
specializePayload := flag.String("specialize-request", "", "JSON payload for specialize request")
|
||||||
@@ -72,13 +74,13 @@ func Run(ctx context.Context, logger *zap.Logger) {
|
|||||||
ctx, span := tracer.Start(ctx, "fetcher/Run")
|
ctx, span := tracer.Start(ctx, "fetcher/Run")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
f, err := fetcher.MakeFetcher(logger, dir, *secretDir, *configDir)
|
f, err := fetcher.MakeFetcher(logger, clientGen, dir, *secretDir, *configDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("error making fetcher", zap.Error(err))
|
logger.Fatal("error making fetcher", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// do specialization in other goroutine to prevent blocking in newdeploy
|
// do specialization in other goroutine to prevent blocking in newdeploy
|
||||||
go func() {
|
mgr.Add(ctx, func(_ context.Context) {
|
||||||
if *specializeOnStart {
|
if *specializeOnStart {
|
||||||
var specializeReq fetcher.FunctionSpecializeRequest
|
var specializeReq fetcher.FunctionSpecializeRequest
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
atomic.StoreUint32(&readyToServe, 1)
|
atomic.StoreUint32(&readyToServe, 1)
|
||||||
}()
|
})
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/fetch", f.FetchHandler)
|
mux.HandleFunc("/fetch", f.FetchHandler)
|
||||||
@@ -119,7 +121,7 @@ func Run(ctx context.Context, logger *zap.Logger) {
|
|||||||
logger.Info("fetcher ready to receive requests")
|
logger.Info("fetcher ready to receive requests")
|
||||||
|
|
||||||
handler := otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
|
handler := otelUtils.GetHandlerWithOTEL(mux, "fission-fetcher", otelUtils.UrlsToIgnore("/healthz", "/readiness-healthz"))
|
||||||
httpserver.StartServer(ctx, logger, "fetcher", "8000", handler)
|
httpserver.StartServer(ctx, logger, mgr, "fetcher", "8000", handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetcherUsage() {
|
func fetcherUsage() {
|
||||||
|
|||||||
+9
-2
@@ -20,16 +20,23 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||||
|
|
||||||
"github.com/fission/fission/cmd/fetcher/app"
|
"github.com/fission/fission/cmd/fetcher/app"
|
||||||
|
"github.com/fission/fission/pkg/crd"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
"github.com/fission/fission/pkg/utils/profile"
|
"github.com/fission/fission/pkg/utils/profile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Usage: fetcher <shared volume path>
|
// Usage: fetcher <shared volume path>
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
mgr := manager.New()
|
||||||
|
defer mgr.Wait()
|
||||||
|
|
||||||
logger := loggerfactory.GetLogger()
|
logger := loggerfactory.GetLogger()
|
||||||
defer logger.Sync()
|
defer logger.Sync()
|
||||||
|
|
||||||
ctx := signals.SetupSignalHandler()
|
ctx := signals.SetupSignalHandler()
|
||||||
profile.ProfileIfEnabled(ctx, logger)
|
profile.ProfileIfEnabled(ctx, logger, mgr)
|
||||||
app.Run(ctx, logger)
|
|
||||||
|
app.Run(ctx, crd.NewClientGenerator(), logger, mgr)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.16
|
FROM cgr.dev/chainguard/static:latest
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
COPY fission-bundle /
|
COPY fission-bundle /
|
||||||
ENTRYPOINT ["/fission-bundle"]
|
ENTRYPOINT ["/fission-bundle"]
|
||||||
|
|||||||
+51
-71
@@ -26,12 +26,13 @@ import (
|
|||||||
docopt "github.com/docopt/docopt-go"
|
docopt "github.com/docopt/docopt-go"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||||
|
cnwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
|
||||||
"github.com/fission/fission/cmd/fission-bundle/mqtrigger"
|
|
||||||
"github.com/fission/fission/pkg/buildermgr"
|
"github.com/fission/fission/pkg/buildermgr"
|
||||||
"github.com/fission/fission/pkg/canaryconfigmgr"
|
"github.com/fission/fission/pkg/canaryconfigmgr"
|
||||||
"github.com/fission/fission/pkg/controller"
|
"github.com/fission/fission/pkg/crd"
|
||||||
"github.com/fission/fission/pkg/executor"
|
"github.com/fission/fission/pkg/executor"
|
||||||
|
eclient "github.com/fission/fission/pkg/executor/client"
|
||||||
"github.com/fission/fission/pkg/info"
|
"github.com/fission/fission/pkg/info"
|
||||||
"github.com/fission/fission/pkg/kubewatcher"
|
"github.com/fission/fission/pkg/kubewatcher"
|
||||||
functionLogger "github.com/fission/fission/pkg/logger"
|
functionLogger "github.com/fission/fission/pkg/logger"
|
||||||
@@ -40,59 +41,54 @@ import (
|
|||||||
"github.com/fission/fission/pkg/storagesvc"
|
"github.com/fission/fission/pkg/storagesvc"
|
||||||
"github.com/fission/fission/pkg/timer"
|
"github.com/fission/fission/pkg/timer"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
"github.com/fission/fission/pkg/utils/otel"
|
"github.com/fission/fission/pkg/utils/otel"
|
||||||
"github.com/fission/fission/pkg/utils/profile"
|
"github.com/fission/fission/pkg/utils/profile"
|
||||||
"github.com/fission/fission/pkg/webhook"
|
"github.com/fission/fission/pkg/webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runWebhook starts admission webhook server
|
// runWebhook starts admission webhook server
|
||||||
func runWebhook(ctx context.Context, logger *zap.Logger, port int) error {
|
func runWebhook(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, port int) error {
|
||||||
return webhook.Start(ctx, logger, port)
|
return webhook.Start(ctx, clientGen, logger, cnwebhook.Options{
|
||||||
|
Port: port,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func runController(ctx context.Context, logger *zap.Logger, port int) {
|
func runCanaryConfigServer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface) error {
|
||||||
controller.Start(ctx, logger, port, false)
|
return canaryconfigmgr.StartCanaryServer(ctx, clientGen, logger, mgr, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCanaryConfigServer(ctx context.Context, logger *zap.Logger) error {
|
func runRouter(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, executorUrl string) error {
|
||||||
return canaryconfigmgr.StartCanaryServer(ctx, logger, false)
|
return router.Start(ctx, clientGen, logger, mgr, port, eclient.MakeClient(logger, executorUrl))
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRouter(ctx context.Context, logger *zap.Logger, port int, executorUrl string) {
|
func runExecutor(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int) error {
|
||||||
router.Start(ctx, logger, port, executorUrl)
|
return executor.StartExecutor(ctx, clientGen, logger, mgr, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runExecutor(ctx context.Context, logger *zap.Logger, port int) error {
|
func runKubeWatcher(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||||
return executor.StartExecutor(ctx, logger, port)
|
return kubewatcher.Start(ctx, clientGen, logger, mgr, routerUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runKubeWatcher(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
func runTimer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerUrl string) error {
|
||||||
return kubewatcher.Start(ctx, logger, routerUrl)
|
return timer.Start(ctx, clientGen, logger, mgr, routerUrl)
|
||||||
}
|
|
||||||
|
|
||||||
func runTimer(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
|
||||||
return timer.Start(ctx, logger, routerUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func runMessageQueueMgr(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
|
||||||
return mqtrigger.Start(ctx, logger, routerUrl)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// KEDA based MessageQueue Trigger Manager
|
// KEDA based MessageQueue Trigger Manager
|
||||||
func runMQManager(ctx context.Context, logger *zap.Logger, routerURL string) error {
|
func runMQManager(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, routerURL string) error {
|
||||||
return mqt.StartScalerManager(ctx, logger, routerURL)
|
return mqt.StartScalerManager(ctx, clientGen, logger, mgr, routerURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runStorageSvc(ctx context.Context, logger *zap.Logger, port int, storage storagesvc.Storage) error {
|
func runStorageSvc(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, port int, storage storagesvc.Storage) error {
|
||||||
return storagesvc.Start(ctx, logger, storage, port)
|
return storagesvc.Start(ctx, clientGen, logger, storage, mgr, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBuilderMgr(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error {
|
func runBuilderMgr(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, storageSvcUrl string) error {
|
||||||
return buildermgr.Start(ctx, logger, storageSvcUrl)
|
return buildermgr.Start(ctx, clientGen, logger, mgr, storageSvcUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runLogger(ctx context.Context, logger *zap.Logger) {
|
func runLogger(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger) error {
|
||||||
functionLogger.Start(ctx, logger)
|
return functionLogger.Start(ctx, clientGen, logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPort(logger *zap.Logger, portArg interface{}) int {
|
func getPort(logger *zap.Logger, portArg interface{}) int {
|
||||||
@@ -115,9 +111,7 @@ func getStringArgWithDefault(arg interface{}, defaultValue string) string {
|
|||||||
func getServiceName(arguments map[string]interface{}) string {
|
func getServiceName(arguments map[string]interface{}) string {
|
||||||
serviceName := "Fission-Unknown"
|
serviceName := "Fission-Unknown"
|
||||||
|
|
||||||
if arguments["--controllerPort"] != nil {
|
if arguments["--routerPort"] != nil {
|
||||||
serviceName = "Fission-Controller"
|
|
||||||
} else if arguments["--routerPort"] != nil {
|
|
||||||
serviceName = "Fission-Router"
|
serviceName = "Fission-Router"
|
||||||
} else if arguments["--executorPort"] != nil {
|
} else if arguments["--executorPort"] != nil {
|
||||||
serviceName = "Fission-Executor"
|
serviceName = "Fission-Executor"
|
||||||
@@ -125,8 +119,6 @@ func getServiceName(arguments map[string]interface{}) string {
|
|||||||
serviceName = "Fission-KubeWatcher"
|
serviceName = "Fission-KubeWatcher"
|
||||||
} else if arguments["--timer"] == true {
|
} else if arguments["--timer"] == true {
|
||||||
serviceName = "Fission-Timer"
|
serviceName = "Fission-Timer"
|
||||||
} else if arguments["--mqt"] == true {
|
|
||||||
serviceName = "Fission-MessageQueueTrigger"
|
|
||||||
} else if arguments["--builderMgr"] == true {
|
} else if arguments["--builderMgr"] == true {
|
||||||
serviceName = "Fission-BuilderMgr"
|
serviceName = "Fission-BuilderMgr"
|
||||||
} else if arguments["--storageServicePort"] != nil {
|
} else if arguments["--storageServicePort"] != nil {
|
||||||
@@ -145,6 +137,9 @@ func exitWithSync(logger *zap.Logger) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
mgr := manager.New()
|
||||||
|
defer mgr.Wait()
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
// From https://github.com/containous/traefik/pull/1817/files
|
// From https://github.com/containous/traefik/pull/1817/files
|
||||||
@@ -155,18 +150,17 @@ func main() {
|
|||||||
// TODO: fix the lint error. Error checking here is causing all components to crash with error "logtostderr not found"
|
// 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
|
flag.Set("logtostderr", "true") //nolint: errcheck
|
||||||
|
|
||||||
usage := `fission-bundle: Package of all fission microservices: controller, router, executor.
|
usage := `fission-bundle: Package of all fission microservices: router, executor.
|
||||||
|
|
||||||
Use it to start one or more of the fission servers:
|
Use it to start one or more of the fission servers:
|
||||||
|
|
||||||
Controller is a stateless API frontend for fission resources.
|
|
||||||
|
|
||||||
Pool manager maintains a pool of generalized function containers, and
|
Pool manager maintains a pool of generalized function containers, and
|
||||||
specializes them on-demand. Executor must be run from a pod in a
|
specializes them on-demand. Executor must be run from a pod in a
|
||||||
Kubernetes cluster.
|
Kubernetes cluster.
|
||||||
|
|
||||||
Router implements HTTP triggers: it routes to running instances,
|
Router implements HTTP triggers: it routes to running instances,
|
||||||
working with the controller and executor.
|
working with the executor.
|
||||||
|
|
||||||
Kubewatcher implements Kubernetes Watch triggers: it watches
|
Kubewatcher implements Kubernetes Watch triggers: it watches
|
||||||
Kubernetes resources and invokes functions described in the
|
Kubernetes resources and invokes functions described in the
|
||||||
@@ -177,7 +171,6 @@ Use it to start one or more of the fission servers:
|
|||||||
backends.
|
backends.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
fission-bundle --controllerPort=<port>
|
|
||||||
fission-bundle --canaryConfig
|
fission-bundle --canaryConfig
|
||||||
fission-bundle --routerPort=<port> [--executorUrl=<url>]
|
fission-bundle --routerPort=<port> [--executorUrl=<url>]
|
||||||
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
|
fission-bundle --executorPort=<port> [--namespace=<namespace>] [--fission-namespace=<namespace>]
|
||||||
@@ -185,13 +178,11 @@ Usage:
|
|||||||
fission-bundle --storageServicePort=<port> --storageType=<storateType>
|
fission-bundle --storageServicePort=<port> --storageType=<storateType>
|
||||||
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
|
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
|
||||||
fission-bundle --timer [--routerUrl=<url>]
|
fission-bundle --timer [--routerUrl=<url>]
|
||||||
fission-bundle --mqt [--routerUrl=<url>]
|
|
||||||
fission-bundle --mqt_keda [--routerUrl=<url>]
|
fission-bundle --mqt_keda [--routerUrl=<url>]
|
||||||
fission-bundle --webhookPort=<port>
|
fission-bundle --webhookPort=<port>
|
||||||
fission-bundle --logger
|
fission-bundle --logger
|
||||||
fission-bundle --version
|
fission-bundle --version
|
||||||
Options:
|
Options:
|
||||||
--controllerPort=<port> Port that the controller should listen on.
|
|
||||||
--canaryConfig Start canary config server.
|
--canaryConfig Start canary config server.
|
||||||
--webhookPort=<port> Port that the webhook should listen on.
|
--webhookPort=<port> Port that the webhook should listen on.
|
||||||
--routerPort=<port> Port that the router should listen on.
|
--routerPort=<port> Port that the router should listen on.
|
||||||
@@ -205,7 +196,6 @@ Options:
|
|||||||
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
|
--namespace=<namespace> Kubernetes namespace in which to run function containers. Defaults to 'fission-function'.
|
||||||
--kubewatcher Start Kubernetes events watcher.
|
--kubewatcher Start Kubernetes events watcher.
|
||||||
--timer Start Timer.
|
--timer Start Timer.
|
||||||
--mqt Start message queue trigger.
|
|
||||||
--mqt_keda Start message queue trigger of kind KEDA
|
--mqt_keda Start message queue trigger of kind KEDA
|
||||||
--builderMgr Start builder manager.
|
--builderMgr Start builder manager.
|
||||||
--version Print version information
|
--version Print version information
|
||||||
@@ -214,7 +204,7 @@ Options:
|
|||||||
defer exitWithSync(logger)
|
defer exitWithSync(logger)
|
||||||
|
|
||||||
ctx := signals.SetupSignalHandler()
|
ctx := signals.SetupSignalHandler()
|
||||||
profile.ProfileIfEnabled(ctx, logger)
|
profile.ProfileIfEnabled(ctx, logger, mgr)
|
||||||
|
|
||||||
version := fmt.Sprintf("Fission Bundle Version: %s", info.BuildInfo().String())
|
version := fmt.Sprintf("Fission Bundle Version: %s", info.BuildInfo().String())
|
||||||
arguments, err := docopt.ParseArgs(usage, nil, version)
|
arguments, err := docopt.ParseArgs(usage, nil, version)
|
||||||
@@ -235,23 +225,17 @@ Options:
|
|||||||
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
|
executorUrl := getStringArgWithDefault(arguments["--executorUrl"], "http://executor.fission")
|
||||||
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
|
routerUrl := getStringArgWithDefault(arguments["--routerUrl"], "http://router.fission")
|
||||||
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
|
storageSvcUrl := getStringArgWithDefault(arguments["--storageSvcUrl"], "http://storagesvc.fission")
|
||||||
|
clientGen := crd.NewClientGenerator()
|
||||||
|
|
||||||
if arguments["--webhookPort"] != nil {
|
if arguments["--webhookPort"] != nil {
|
||||||
port := getPort(logger, arguments["--webhookPort"])
|
port := getPort(logger, arguments["--webhookPort"])
|
||||||
err = runWebhook(ctx, logger, port)
|
err = runWebhook(ctx, clientGen, logger, port)
|
||||||
logger.Error("webhook server exited:", zap.Error(err))
|
logger.Error("webhook server exited:", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--controllerPort"] != nil {
|
|
||||||
port := getPort(logger, arguments["--controllerPort"])
|
|
||||||
runController(ctx, logger, port)
|
|
||||||
logger.Error("controller exited")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if arguments["--canaryConfig"] == true {
|
if arguments["--canaryConfig"] == true {
|
||||||
err := runCanaryConfigServer(ctx, logger)
|
err := runCanaryConfigServer(ctx, clientGen, logger, mgr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("canary config server exited with error: ", zap.Error(err))
|
logger.Error("canary config server exited with error: ", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -260,14 +244,16 @@ Options:
|
|||||||
|
|
||||||
if arguments["--routerPort"] != nil {
|
if arguments["--routerPort"] != nil {
|
||||||
port := getPort(logger, arguments["--routerPort"])
|
port := getPort(logger, arguments["--routerPort"])
|
||||||
runRouter(ctx, logger, port, executorUrl)
|
err = runRouter(ctx, clientGen, logger, mgr, port, executorUrl)
|
||||||
logger.Error("router exited")
|
if err != nil {
|
||||||
return
|
logger.Error("router exited", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--executorPort"] != nil {
|
if arguments["--executorPort"] != nil {
|
||||||
port := getPort(logger, arguments["--executorPort"])
|
port := getPort(logger, arguments["--executorPort"])
|
||||||
err = runExecutor(ctx, logger, port)
|
err = runExecutor(ctx, clientGen, logger, mgr, port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("executor exited", zap.Error(err))
|
logger.Error("executor exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -275,7 +261,7 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--kubewatcher"] == true {
|
if arguments["--kubewatcher"] == true {
|
||||||
err = runKubeWatcher(ctx, logger, routerUrl)
|
err = runKubeWatcher(ctx, clientGen, logger, mgr, routerUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("kubewatcher exited", zap.Error(err))
|
logger.Error("kubewatcher exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -283,23 +269,15 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--timer"] == true {
|
if arguments["--timer"] == true {
|
||||||
err = runTimer(ctx, logger, routerUrl)
|
err = runTimer(ctx, clientGen, logger, mgr, routerUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("timer exited", zap.Error(err))
|
logger.Error("timer exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--mqt"] == true {
|
|
||||||
err = runMessageQueueMgr(ctx, logger, routerUrl)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("message queue manager exited", zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if arguments["--mqt_keda"] == true {
|
if arguments["--mqt_keda"] == true {
|
||||||
err = runMQManager(ctx, logger, routerUrl)
|
err = runMQManager(ctx, clientGen, logger, mgr, routerUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("mqt scaler manager exited", zap.Error(err))
|
logger.Error("mqt scaler manager exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -307,7 +285,7 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--builderMgr"] == true {
|
if arguments["--builderMgr"] == true {
|
||||||
err = runBuilderMgr(ctx, logger, storageSvcUrl)
|
err = runBuilderMgr(ctx, clientGen, logger, mgr, storageSvcUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("builder manager exited", zap.Error(err))
|
logger.Error("builder manager exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -315,8 +293,10 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if arguments["--logger"] == true {
|
if arguments["--logger"] == true {
|
||||||
runLogger(ctx, logger)
|
err = runLogger(ctx, clientGen, logger)
|
||||||
logger.Error("logger exited")
|
if err != nil {
|
||||||
|
logger.Error("logger exited", zap.Error(err))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +310,7 @@ Options:
|
|||||||
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
|
} else if arguments["--storageType"] == string(storagesvc.StorageTypeLocal) {
|
||||||
storage = storagesvc.NewLocalStorage("/fission")
|
storage = storagesvc.NewLocalStorage("/fission")
|
||||||
}
|
}
|
||||||
err := runStorageSvc(ctx, logger, port, storage)
|
err := runStorageSvc(ctx, clientGen, logger, mgr, port, storage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("storage service exited", zap.Error(err))
|
logger.Error("storage service exited", zap.Error(err))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package mqtrigger
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
"github.com/fission/fission/pkg/crd"
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Start(ctx context.Context, logger *zap.Logger, routerUrl string) error {
|
|
||||||
clientGen := crd.NewClientGenerator()
|
|
||||||
fissionClient, err := clientGen.GetFissionClient()
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "failed to get fission client")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error waiting for CRDs")
|
|
||||||
}
|
|
||||||
|
|
||||||
mqType := (fv1.MessageQueueType)(os.Getenv("MESSAGE_QUEUE_TYPE"))
|
|
||||||
mqUrl := os.Getenv("MESSAGE_QUEUE_URL")
|
|
||||||
|
|
||||||
secretsPath := strings.TrimSpace(os.Getenv("MESSAGE_QUEUE_SECRETS"))
|
|
||||||
|
|
||||||
var secrets map[string][]byte
|
|
||||||
if len(secretsPath) > 0 {
|
|
||||||
// For authentication with message queue
|
|
||||||
secrets, err = readSecrets(logger, secretsPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mq, err := factory.Create(
|
|
||||||
logger,
|
|
||||||
mqType,
|
|
||||||
messageQueue.Config{
|
|
||||||
MQType: (string)(mqType),
|
|
||||||
Url: mqUrl,
|
|
||||||
Secrets: secrets,
|
|
||||||
},
|
|
||||||
routerUrl,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
logger.Fatal("failed to connect to remote message queue server", zap.Error(err))
|
|
||||||
}
|
|
||||||
mqtMgr := mqtrigger.MakeMessageQueueTriggerManager(logger, fissionClient, mqType, mq)
|
|
||||||
mqtMgr.Run(ctx)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func readSecrets(logger *zap.Logger, secretsPath string) (map[string][]byte, error) {
|
|
||||||
// return if no secrets exist
|
|
||||||
if _, err := os.Stat(secretsPath); os.IsNotExist(err) {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
secretFiles, err := os.ReadDir(secretsPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
secrets := make(map[string][]byte)
|
|
||||||
for _, secretFile := range secretFiles {
|
|
||||||
|
|
||||||
fileName := secretFile.Name()
|
|
||||||
// /etc/secrets contain some hidden directories (like .data)
|
|
||||||
// ignore them
|
|
||||||
if !secretFile.IsDir() && !strings.HasPrefix(fileName, ".") {
|
|
||||||
logger.Info(fmt.Sprintf("Reading secret from %s", fileName))
|
|
||||||
|
|
||||||
filePath := path.Join(secretsPath, fileName)
|
|
||||||
secret, fileReadErr := os.ReadFile(filePath)
|
|
||||||
if fileReadErr != nil {
|
|
||||||
return nil, fileReadErr
|
|
||||||
}
|
|
||||||
|
|
||||||
secrets[fileName] = secret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return secrets, nil
|
|
||||||
}
|
|
||||||
@@ -38,7 +38,6 @@ import (
|
|||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
"github.com/fission/fission/pkg/fission-cli/flag"
|
"github.com/fission/fission/pkg/fission-cli/flag"
|
||||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||||
_ "github.com/fission/fission/pkg/mqtrigger/messageQueue/kafka"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -49,7 +48,7 @@ const (
|
|||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
|
||||||
func App() *cobra.Command {
|
func App(clientOptions cmd.ClientOptions) *cobra.Command {
|
||||||
cobra.EnableCommandSorting = false
|
cobra.EnableCommandSorting = false
|
||||||
|
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
@@ -59,9 +58,7 @@ func App() *cobra.Command {
|
|||||||
PersistentPreRunE: wrapper.Wrapper(
|
PersistentPreRunE: wrapper.Wrapper(
|
||||||
func(input cli.Input) error {
|
func(input cli.Input) error {
|
||||||
console.Verbosity = input.Int(flagkey.Verbosity)
|
console.Verbosity = input.Int(flagkey.Verbosity)
|
||||||
clientOptions := cmd.ClientOptions{
|
clientOptions.KubeContext = input.String(flagkey.KubeContext)
|
||||||
KubeContext: input.String(flagkey.KubeContext),
|
|
||||||
}
|
|
||||||
// TODO: use fake rest client for offline spec generation
|
// TODO: use fake rest client for offline spec generation
|
||||||
// if input.IsSet(flagkey.ClientOnly) || input.IsSet(flagkey.PreCheckOnly) {
|
// if input.IsSet(flagkey.ClientOnly) || input.IsSet(flagkey.PreCheckOnly) {
|
||||||
// }
|
// }
|
||||||
@@ -83,7 +80,7 @@ func App() *cobra.Command {
|
|||||||
})
|
})
|
||||||
|
|
||||||
wrapper.SetFlags(rootCmd, flag.FlagSet{
|
wrapper.SetFlags(rootCmd, flag.FlagSet{
|
||||||
Global: []flag.Flag{flag.GlobalServer, flag.GlobalVerbosity, flag.KubeContext, flag.Namespace},
|
Global: []flag.Flag{flag.GlobalVerbosity, flag.KubeContext, flag.Namespace},
|
||||||
})
|
})
|
||||||
|
|
||||||
groups := helptemplate.CommandGroups{}
|
groups := helptemplate.CommandGroups{}
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/fission/fission/cmd/fission-cli/app"
|
"github.com/fission/fission/cmd/fission-cli/app"
|
||||||
|
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||||
"github.com/fission/fission/pkg/fission-cli/console"
|
"github.com/fission/fission/pkg/fission-cli/console"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cmd := app.App()
|
cmd := app.App(cmd.ClientOptions{})
|
||||||
cmd.SilenceErrors = true // use our own error message printer
|
cmd.SilenceErrors = true // use our own error message printer
|
||||||
|
|
||||||
err := cmd.Execute()
|
err := cmd.Execute()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.16
|
FROM cgr.dev/chainguard/static:latest
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
COPY pre-upgrade-checks /
|
COPY pre-upgrade-checks /
|
||||||
ENTRYPOINT ["/pre-upgrade-checks"]
|
ENTRYPOINT ["/pre-upgrade-checks"]
|
||||||
|
|||||||
@@ -18,11 +18,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
multierror "github.com/hashicorp/go-multierror"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||||
@@ -51,19 +50,19 @@ const (
|
|||||||
MqtCRD = "messagequeuetriggers.fission.io"
|
MqtCRD = "messagequeuetriggers.fission.io"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makePreUpgradeTaskClient(logger *zap.Logger) (*PreUpgradeTaskClient, error) {
|
func makePreUpgradeTaskClient(clientGen crd.ClientGeneratorInterface, logger *zap.Logger) (*PreUpgradeTaskClient, error) {
|
||||||
clientGen := crd.NewClientGenerator()
|
var err error
|
||||||
fissionClient, err := clientGen.GetFissionClient()
|
fissionClient, err := clientGen.GetFissionClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to get fission client")
|
return nil, fmt.Errorf("failed to get fission client: %w", err)
|
||||||
}
|
}
|
||||||
k8sClient, err := clientGen.GetKubernetesClient()
|
k8sClient, err := clientGen.GetKubernetesClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to get kubernetes client")
|
return nil, fmt.Errorf("failed to get kubernetes client: %w", err)
|
||||||
}
|
}
|
||||||
apiExtClient, err := clientGen.GetApiExtensionsClient()
|
apiExtClient, err := clientGen.GetApiExtensionsClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to get apiextensions client")
|
return nil, fmt.Errorf("failed to get apiextensions client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &PreUpgradeTaskClient{
|
return &PreUpgradeTaskClient{
|
||||||
@@ -125,12 +124,12 @@ func (client *PreUpgradeTaskClient) LatestSchemaApplied(ctx context.Context) err
|
|||||||
|
|
||||||
// VerifyFunctionSpecReferences verifies that a function references secrets, configmaps, pkgs in its own namespace and
|
// VerifyFunctionSpecReferences verifies that a function references secrets, configmaps, pkgs in its own namespace and
|
||||||
// outputs a list of functions that don't adhere to this requirement.
|
// outputs a list of functions that don't adhere to this requirement.
|
||||||
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Context) {
|
func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Context) error {
|
||||||
client.logger.Info("verifying function spec references for all functions in the cluster")
|
client.logger.Info("verifying function spec references for all functions in the cluster")
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var fList *fv1.FunctionList
|
var fList *fv1.FunctionList
|
||||||
errs := &multierror.Error{}
|
var errs error
|
||||||
|
|
||||||
for _, namespace := range utils.DefaultNSResolver().FissionResourceNS {
|
for _, namespace := range utils.DefaultNSResolver().FissionResourceNS {
|
||||||
for i := 0; i < maxRetries; i++ {
|
for i := 0; i < maxRetries; i++ {
|
||||||
@@ -141,9 +140,11 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Con
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
client.logger.Fatal("error listing functions after max retries",
|
client.logger.Error("error listing functions after max retries",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.Int("max_retries", maxRetries))
|
zap.Int("max_retries", maxRetries))
|
||||||
|
errs = errors.Join(errs, fmt.Errorf("error listing functions in namespace : %s", namespace))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that all secrets, configmaps, packages are in the same namespace
|
// check that all secrets, configmaps, packages are in the same namespace
|
||||||
@@ -151,28 +152,27 @@ func (client *PreUpgradeTaskClient) VerifyFunctionSpecReferences(ctx context.Con
|
|||||||
secrets := fn.Spec.Secrets
|
secrets := fn.Spec.Secrets
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
if secret.Namespace != "" && secret.Namespace != fn.ObjectMeta.Namespace {
|
if secret.Namespace != "" && secret.Namespace != fn.ObjectMeta.Namespace {
|
||||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, secret.Name, secret.Namespace))
|
errs = errors.Join(errs, fmt.Errorf("function : %s.%s cannot reference a secret : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, secret.Name, secret.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configmaps := fn.Spec.ConfigMaps
|
configmaps := fn.Spec.ConfigMaps
|
||||||
for _, configmap := range configmaps {
|
for _, configmap := range configmaps {
|
||||||
if configmap.Namespace != "" && configmap.Namespace != fn.ObjectMeta.Namespace {
|
if configmap.Namespace != "" && configmap.Namespace != fn.ObjectMeta.Namespace {
|
||||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, configmap.Name, configmap.Namespace))
|
errs = errors.Join(errs, fmt.Errorf("function : %s.%s cannot reference a configmap : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, configmap.Name, configmap.Namespace))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fn.Spec.Package.PackageRef.Namespace != "" && fn.Spec.Package.PackageRef.Namespace != fn.ObjectMeta.Namespace {
|
if fn.Spec.Package.PackageRef.Namespace != "" && fn.Spec.Package.PackageRef.Namespace != fn.ObjectMeta.Namespace {
|
||||||
errs = multierror.Append(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
errs = errors.Join(errs, fmt.Errorf("function : %s.%s cannot reference a package : %s in namespace : %s", fn.ObjectMeta.Name, fn.ObjectMeta.Namespace, fn.Spec.Package.PackageRef.Name, fn.Spec.Package.PackageRef.Namespace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if errs.ErrorOrNil() != nil {
|
if errs != nil {
|
||||||
client.logger.Fatal("installation failed",
|
return errs
|
||||||
zap.Error(errs),
|
|
||||||
zap.String("summary", "a function cannot reference secrets, configmaps and packages outside it's own namespace"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.logger.Info("function spec references verified")
|
client.logger.Info("function spec references verified")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/fission/fission/test/e2e/framework"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPreUpgradeTaskClient(t *testing.T) {
|
||||||
|
f := framework.NewFramework()
|
||||||
|
defer f.Logger().Sync()
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
err := f.Start(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
preupgradeClient, err := makePreUpgradeTaskClient(f.ClientGen(), f.Logger())
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
crd := preupgradeClient.GetFunctionCRD(ctx)
|
||||||
|
require.NotNil(t, crd)
|
||||||
|
|
||||||
|
err = preupgradeClient.LatestSchemaApplied(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = preupgradeClient.VerifyFunctionSpecReferences(ctx)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||||
|
|
||||||
|
"github.com/fission/fission/pkg/crd"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,22 +28,25 @@ func main() {
|
|||||||
logger := loggerfactory.GetLogger()
|
logger := loggerfactory.GetLogger()
|
||||||
defer logger.Sync()
|
defer logger.Sync()
|
||||||
|
|
||||||
crdBackedClient, err := makePreUpgradeTaskClient(logger)
|
ctx := signals.SetupSignalHandler()
|
||||||
|
|
||||||
|
preupgradeClient, err := makePreUpgradeTaskClient(crd.NewClientGenerator(), logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("error creating a crd client, please retry helm upgrade",
|
logger.Fatal("error creating a crd client, please retry helm upgrade",
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := signals.SetupSignalHandler()
|
crd := preupgradeClient.GetFunctionCRD(ctx)
|
||||||
crd := crdBackedClient.GetFunctionCRD(ctx)
|
|
||||||
if crd == nil {
|
if crd == nil {
|
||||||
logger.Info("nothing to do since CRDs are not present on the cluster")
|
logger.Info("nothing to do since CRDs are not present on the cluster")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
err = preupgradeClient.LatestSchemaApplied(ctx)
|
||||||
err = crdBackedClient.LatestSchemaApplied(ctx)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("New CRDs are not applied", zap.Error(err))
|
logger.Fatal("New CRDs are not applied", zap.Error(err))
|
||||||
}
|
}
|
||||||
crdBackedClient.VerifyFunctionSpecReferences(ctx)
|
err = preupgradeClient.VerifyFunctionSpecReferences(ctx)
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatal("Function spec references are not valid", zap.Error(err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.16
|
FROM cgr.dev/chainguard/static:latest
|
||||||
RUN apk add --update ca-certificates
|
|
||||||
COPY reporter /
|
COPY reporter /
|
||||||
ENTRYPOINT ["/reporter"]
|
ENTRYPOINT ["/reporter"]
|
||||||
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: canaryconfigs.fission.io
|
name: canaryconfigs.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
|
|||||||
+1112
-259
File diff suppressed because it is too large
Load Diff
+490
-139
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: httptriggers.fission.io
|
name: httptriggers.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: kuberneteswatchtriggers.fission.io
|
name: kuberneteswatchtriggers.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: messagequeuetriggers.fission.io
|
name: messagequeuetriggers.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
@@ -84,7 +83,7 @@ spec:
|
|||||||
description: Maximum times for message queue trigger to retry
|
description: Maximum times for message queue trigger to retry
|
||||||
type: integer
|
type: integer
|
||||||
messageQueueType:
|
messageQueueType:
|
||||||
description: Type of message queue (NATS, Kafka, AzureQueue)
|
description: Type of message queue
|
||||||
type: string
|
type: string
|
||||||
metadata:
|
metadata:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
@@ -1250,7 +1249,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -1349,7 +1351,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -1431,8 +1436,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -1464,7 +1468,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -1639,8 +1645,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -1672,7 +1677,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -1762,10 +1769,54 @@ spec:
|
|||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
resizePolicy:
|
||||||
|
description: Resources resize policy for the container.
|
||||||
|
items:
|
||||||
|
description: ContainerResizePolicy represents resource
|
||||||
|
resize policy for the container.
|
||||||
|
properties:
|
||||||
|
resourceName:
|
||||||
|
description: 'Name of the resource to which this resource
|
||||||
|
resize policy applies. Supported values: cpu, memory.'
|
||||||
|
type: string
|
||||||
|
restartPolicy:
|
||||||
|
description: Restart policy to apply when specified
|
||||||
|
resource is resized. If not specified, it defaults
|
||||||
|
to NotRequired.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- resourceName
|
||||||
|
- restartPolicy
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
resources:
|
resources:
|
||||||
description: 'Compute Resources required by this container.
|
description: 'Compute Resources required by this container.
|
||||||
Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
properties:
|
properties:
|
||||||
|
claims:
|
||||||
|
description: "Claims lists the names of resources, defined
|
||||||
|
in spec.resourceClaims, that are used by this container.
|
||||||
|
\n This is an alpha field and requires enabling the
|
||||||
|
DynamicResourceAllocation feature gate. \n This field
|
||||||
|
is immutable. It can only be set for containers."
|
||||||
|
items:
|
||||||
|
description: ResourceClaim references one entry in
|
||||||
|
PodSpec.ResourceClaims.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name must match the name of one entry
|
||||||
|
in pod.spec.resourceClaims of the Pod where
|
||||||
|
this field is used. It makes that resource available
|
||||||
|
inside a container.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
limits:
|
limits:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
anyOf:
|
anyOf:
|
||||||
@@ -1787,9 +1838,30 @@ spec:
|
|||||||
of compute resources required. If Requests is omitted
|
of compute resources required. If Requests is omitted
|
||||||
for a container, it defaults to Limits if that is
|
for a container, it defaults to Limits if that is
|
||||||
explicitly specified, otherwise to an implementation-defined
|
explicitly specified, otherwise to an implementation-defined
|
||||||
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
|
restartPolicy:
|
||||||
|
description: 'RestartPolicy defines the restart behavior
|
||||||
|
of individual containers in a pod. This field may only
|
||||||
|
be set for init containers, and the only allowed value
|
||||||
|
is "Always". For non-init containers or when this field
|
||||||
|
is not specified, the restart behavior is defined by the
|
||||||
|
Pod''s restart policy and the container type. Setting
|
||||||
|
the RestartPolicy as "Always" for the init container will
|
||||||
|
have the following effect: this init container will be
|
||||||
|
continually restarted on exit until all regular containers
|
||||||
|
have terminated. Once all regular containers have completed,
|
||||||
|
all init containers with restartPolicy "Always" will be
|
||||||
|
shut down. This lifecycle differs from normal init containers
|
||||||
|
and is often referred to as a "sidecar" container. Although
|
||||||
|
this init container still starts in the init container
|
||||||
|
sequence, it does not wait for the container to complete
|
||||||
|
before proceeding to the next init container. Instead,
|
||||||
|
the next init container starts immediately after this
|
||||||
|
init container is started, or after any startupProbe has
|
||||||
|
successfully completed.'
|
||||||
|
type: string
|
||||||
securityContext:
|
securityContext:
|
||||||
description: 'SecurityContext defines the security options
|
description: 'SecurityContext defines the security options
|
||||||
the container should be run with. If set, the fields of
|
the container should be run with. If set, the fields of
|
||||||
@@ -1914,7 +1986,8 @@ spec:
|
|||||||
The profile must be preconfigured on the node
|
The profile must be preconfigured on the node
|
||||||
to work. Must be a descending path, relative to
|
to work. Must be a descending path, relative to
|
||||||
the kubelet's configured seccomp profile location.
|
the kubelet's configured seccomp profile location.
|
||||||
Must only be set if type is "Localhost".
|
Must be set if type is "Localhost". Must NOT be
|
||||||
|
set for any other type.
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: "type indicates which kind of seccomp
|
description: "type indicates which kind of seccomp
|
||||||
@@ -1947,15 +2020,11 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
hostProcess:
|
hostProcess:
|
||||||
description: HostProcess determines if a container
|
description: HostProcess determines if a container
|
||||||
should be run as a 'Host Process' container. This
|
should be run as a 'Host Process' container. All
|
||||||
field is alpha-level and will only be honored
|
of a Pod's containers must have the same effective
|
||||||
by components that enable the WindowsHostProcessContainers
|
HostProcess value (it is not allowed to have a
|
||||||
feature flag. Setting this field without the feature
|
mix of HostProcess containers and non-HostProcess
|
||||||
flag will result in errors when validating the
|
containers). In addition, if HostProcess is true
|
||||||
Pod. All of a Pod's containers must have the same
|
|
||||||
effective HostProcess value (it is not allowed
|
|
||||||
to have a mix of HostProcess containers and non-HostProcess
|
|
||||||
containers). In addition, if HostProcess is true
|
|
||||||
then HostNetwork must also be set to true.
|
then HostNetwork must also be set to true.
|
||||||
type: boolean
|
type: boolean
|
||||||
runAsUserName:
|
runAsUserName:
|
||||||
@@ -2004,8 +2073,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -2037,7 +2105,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -2557,7 +2627,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -2656,7 +2729,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -2736,8 +2812,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -2769,7 +2844,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -2935,8 +3012,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -2968,7 +3044,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -3058,11 +3136,55 @@ spec:
|
|||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
resizePolicy:
|
||||||
|
description: Resources resize policy for the container.
|
||||||
|
items:
|
||||||
|
description: ContainerResizePolicy represents resource
|
||||||
|
resize policy for the container.
|
||||||
|
properties:
|
||||||
|
resourceName:
|
||||||
|
description: 'Name of the resource to which this resource
|
||||||
|
resize policy applies. Supported values: cpu, memory.'
|
||||||
|
type: string
|
||||||
|
restartPolicy:
|
||||||
|
description: Restart policy to apply when specified
|
||||||
|
resource is resized. If not specified, it defaults
|
||||||
|
to NotRequired.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- resourceName
|
||||||
|
- restartPolicy
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
resources:
|
resources:
|
||||||
description: Resources are not allowed for ephemeral containers.
|
description: Resources are not allowed for ephemeral containers.
|
||||||
Ephemeral containers use spare resources already allocated
|
Ephemeral containers use spare resources already allocated
|
||||||
to the pod.
|
to the pod.
|
||||||
properties:
|
properties:
|
||||||
|
claims:
|
||||||
|
description: "Claims lists the names of resources, defined
|
||||||
|
in spec.resourceClaims, that are used by this container.
|
||||||
|
\n This is an alpha field and requires enabling the
|
||||||
|
DynamicResourceAllocation feature gate. \n This field
|
||||||
|
is immutable. It can only be set for containers."
|
||||||
|
items:
|
||||||
|
description: ResourceClaim references one entry in
|
||||||
|
PodSpec.ResourceClaims.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name must match the name of one entry
|
||||||
|
in pod.spec.resourceClaims of the Pod where
|
||||||
|
this field is used. It makes that resource available
|
||||||
|
inside a container.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
limits:
|
limits:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
anyOf:
|
anyOf:
|
||||||
@@ -3084,9 +3206,15 @@ spec:
|
|||||||
of compute resources required. If Requests is omitted
|
of compute resources required. If Requests is omitted
|
||||||
for a container, it defaults to Limits if that is
|
for a container, it defaults to Limits if that is
|
||||||
explicitly specified, otherwise to an implementation-defined
|
explicitly specified, otherwise to an implementation-defined
|
||||||
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
|
restartPolicy:
|
||||||
|
description: Restart policy for the container to manage
|
||||||
|
the restart behavior of each container within a pod. This
|
||||||
|
may only be set for init containers. You cannot set this
|
||||||
|
field on ephemeral containers.
|
||||||
|
type: string
|
||||||
securityContext:
|
securityContext:
|
||||||
description: 'Optional: SecurityContext defines the security
|
description: 'Optional: SecurityContext defines the security
|
||||||
options the ephemeral container should be run with. If
|
options the ephemeral container should be run with. If
|
||||||
@@ -3211,7 +3339,8 @@ spec:
|
|||||||
The profile must be preconfigured on the node
|
The profile must be preconfigured on the node
|
||||||
to work. Must be a descending path, relative to
|
to work. Must be a descending path, relative to
|
||||||
the kubelet's configured seccomp profile location.
|
the kubelet's configured seccomp profile location.
|
||||||
Must only be set if type is "Localhost".
|
Must be set if type is "Localhost". Must NOT be
|
||||||
|
set for any other type.
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: "type indicates which kind of seccomp
|
description: "type indicates which kind of seccomp
|
||||||
@@ -3244,15 +3373,11 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
hostProcess:
|
hostProcess:
|
||||||
description: HostProcess determines if a container
|
description: HostProcess determines if a container
|
||||||
should be run as a 'Host Process' container. This
|
should be run as a 'Host Process' container. All
|
||||||
field is alpha-level and will only be honored
|
of a Pod's containers must have the same effective
|
||||||
by components that enable the WindowsHostProcessContainers
|
HostProcess value (it is not allowed to have a
|
||||||
feature flag. Setting this field without the feature
|
mix of HostProcess containers and non-HostProcess
|
||||||
flag will result in errors when validating the
|
containers). In addition, if HostProcess is true
|
||||||
Pod. All of a Pod's containers must have the same
|
|
||||||
effective HostProcess value (it is not allowed
|
|
||||||
to have a mix of HostProcess containers and non-HostProcess
|
|
||||||
containers). In addition, if HostProcess is true
|
|
||||||
then HostNetwork must also be set to true.
|
then HostNetwork must also be set to true.
|
||||||
type: boolean
|
type: boolean
|
||||||
runAsUserName:
|
runAsUserName:
|
||||||
@@ -3293,8 +3418,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -3326,7 +3450,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -3877,7 +4003,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -3976,7 +4105,10 @@ spec:
|
|||||||
header to be used in HTTP probes
|
header to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This
|
||||||
|
will be canonicalized upon output, so
|
||||||
|
case-variant names will be understood
|
||||||
|
as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -4058,8 +4190,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -4091,7 +4222,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -4266,8 +4399,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -4299,7 +4431,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -4389,10 +4523,54 @@ spec:
|
|||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
resizePolicy:
|
||||||
|
description: Resources resize policy for the container.
|
||||||
|
items:
|
||||||
|
description: ContainerResizePolicy represents resource
|
||||||
|
resize policy for the container.
|
||||||
|
properties:
|
||||||
|
resourceName:
|
||||||
|
description: 'Name of the resource to which this resource
|
||||||
|
resize policy applies. Supported values: cpu, memory.'
|
||||||
|
type: string
|
||||||
|
restartPolicy:
|
||||||
|
description: Restart policy to apply when specified
|
||||||
|
resource is resized. If not specified, it defaults
|
||||||
|
to NotRequired.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- resourceName
|
||||||
|
- restartPolicy
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-type: atomic
|
||||||
resources:
|
resources:
|
||||||
description: 'Compute Resources required by this container.
|
description: 'Compute Resources required by this container.
|
||||||
Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
properties:
|
properties:
|
||||||
|
claims:
|
||||||
|
description: "Claims lists the names of resources, defined
|
||||||
|
in spec.resourceClaims, that are used by this container.
|
||||||
|
\n This is an alpha field and requires enabling the
|
||||||
|
DynamicResourceAllocation feature gate. \n This field
|
||||||
|
is immutable. It can only be set for containers."
|
||||||
|
items:
|
||||||
|
description: ResourceClaim references one entry in
|
||||||
|
PodSpec.ResourceClaims.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name must match the name of one entry
|
||||||
|
in pod.spec.resourceClaims of the Pod where
|
||||||
|
this field is used. It makes that resource available
|
||||||
|
inside a container.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
limits:
|
limits:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
anyOf:
|
anyOf:
|
||||||
@@ -4414,9 +4592,30 @@ spec:
|
|||||||
of compute resources required. If Requests is omitted
|
of compute resources required. If Requests is omitted
|
||||||
for a container, it defaults to Limits if that is
|
for a container, it defaults to Limits if that is
|
||||||
explicitly specified, otherwise to an implementation-defined
|
explicitly specified, otherwise to an implementation-defined
|
||||||
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
|
restartPolicy:
|
||||||
|
description: 'RestartPolicy defines the restart behavior
|
||||||
|
of individual containers in a pod. This field may only
|
||||||
|
be set for init containers, and the only allowed value
|
||||||
|
is "Always". For non-init containers or when this field
|
||||||
|
is not specified, the restart behavior is defined by the
|
||||||
|
Pod''s restart policy and the container type. Setting
|
||||||
|
the RestartPolicy as "Always" for the init container will
|
||||||
|
have the following effect: this init container will be
|
||||||
|
continually restarted on exit until all regular containers
|
||||||
|
have terminated. Once all regular containers have completed,
|
||||||
|
all init containers with restartPolicy "Always" will be
|
||||||
|
shut down. This lifecycle differs from normal init containers
|
||||||
|
and is often referred to as a "sidecar" container. Although
|
||||||
|
this init container still starts in the init container
|
||||||
|
sequence, it does not wait for the container to complete
|
||||||
|
before proceeding to the next init container. Instead,
|
||||||
|
the next init container starts immediately after this
|
||||||
|
init container is started, or after any startupProbe has
|
||||||
|
successfully completed.'
|
||||||
|
type: string
|
||||||
securityContext:
|
securityContext:
|
||||||
description: 'SecurityContext defines the security options
|
description: 'SecurityContext defines the security options
|
||||||
the container should be run with. If set, the fields of
|
the container should be run with. If set, the fields of
|
||||||
@@ -4541,7 +4740,8 @@ spec:
|
|||||||
The profile must be preconfigured on the node
|
The profile must be preconfigured on the node
|
||||||
to work. Must be a descending path, relative to
|
to work. Must be a descending path, relative to
|
||||||
the kubelet's configured seccomp profile location.
|
the kubelet's configured seccomp profile location.
|
||||||
Must only be set if type is "Localhost".
|
Must be set if type is "Localhost". Must NOT be
|
||||||
|
set for any other type.
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: "type indicates which kind of seccomp
|
description: "type indicates which kind of seccomp
|
||||||
@@ -4574,15 +4774,11 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
hostProcess:
|
hostProcess:
|
||||||
description: HostProcess determines if a container
|
description: HostProcess determines if a container
|
||||||
should be run as a 'Host Process' container. This
|
should be run as a 'Host Process' container. All
|
||||||
field is alpha-level and will only be honored
|
of a Pod's containers must have the same effective
|
||||||
by components that enable the WindowsHostProcessContainers
|
HostProcess value (it is not allowed to have a
|
||||||
feature flag. Setting this field without the feature
|
mix of HostProcess containers and non-HostProcess
|
||||||
flag will result in errors when validating the
|
containers). In addition, if HostProcess is true
|
||||||
Pod. All of a Pod's containers must have the same
|
|
||||||
effective HostProcess value (it is not allowed
|
|
||||||
to have a mix of HostProcess containers and non-HostProcess
|
|
||||||
containers). In addition, if HostProcess is true
|
|
||||||
then HostNetwork must also be set to true.
|
then HostNetwork must also be set to true.
|
||||||
type: boolean
|
type: boolean
|
||||||
runAsUserName:
|
runAsUserName:
|
||||||
@@ -4631,8 +4827,7 @@ spec:
|
|||||||
type: integer
|
type: integer
|
||||||
grpc:
|
grpc:
|
||||||
description: GRPC specifies an action involving a GRPC
|
description: GRPC specifies an action involving a GRPC
|
||||||
port. This is a beta field and requires enabling GRPCContainerProbe
|
port.
|
||||||
feature gate.
|
|
||||||
properties:
|
properties:
|
||||||
port:
|
port:
|
||||||
description: Port number of the gRPC service. Number
|
description: Port number of the gRPC service. Number
|
||||||
@@ -4664,7 +4859,9 @@ spec:
|
|||||||
to be used in HTTP probes
|
to be used in HTTP probes
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
description: The header field name
|
description: The header field name. This will
|
||||||
|
be canonicalized upon output, so case-variant
|
||||||
|
names will be understood as the same header.
|
||||||
type: string
|
type: string
|
||||||
value:
|
value:
|
||||||
description: The header field value
|
description: The header field value
|
||||||
@@ -4966,9 +5163,56 @@ spec:
|
|||||||
- conditionType
|
- conditionType
|
||||||
type: object
|
type: object
|
||||||
type: array
|
type: array
|
||||||
|
resourceClaims:
|
||||||
|
description: "ResourceClaims defines which ResourceClaims must
|
||||||
|
be allocated and reserved before the Pod is allowed to start.
|
||||||
|
The resources will be made available to those containers which
|
||||||
|
consume them by name. \n This is an alpha field and requires
|
||||||
|
enabling the DynamicResourceAllocation feature gate. \n This
|
||||||
|
field is immutable."
|
||||||
|
items:
|
||||||
|
description: PodResourceClaim references exactly one ResourceClaim
|
||||||
|
through a ClaimSource. It adds a name to it that uniquely
|
||||||
|
identifies the ResourceClaim inside the Pod. Containers that
|
||||||
|
need access to the ResourceClaim reference it with this name.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name uniquely identifies this resource claim
|
||||||
|
inside the pod. This must be a DNS_LABEL.
|
||||||
|
type: string
|
||||||
|
source:
|
||||||
|
description: Source describes where to find the ResourceClaim.
|
||||||
|
properties:
|
||||||
|
resourceClaimName:
|
||||||
|
description: ResourceClaimName is the name of a ResourceClaim
|
||||||
|
object in the same namespace as this pod.
|
||||||
|
type: string
|
||||||
|
resourceClaimTemplateName:
|
||||||
|
description: "ResourceClaimTemplateName is the name
|
||||||
|
of a ResourceClaimTemplate object in the same namespace
|
||||||
|
as this pod. \n The template will be used to create
|
||||||
|
a new ResourceClaim, which will be bound to this pod.
|
||||||
|
When this pod is deleted, the ResourceClaim will also
|
||||||
|
be deleted. The pod name and resource name, along
|
||||||
|
with a generated component, will be used to form a
|
||||||
|
unique name for the ResourceClaim, which will be recorded
|
||||||
|
in pod.status.resourceClaimStatuses. \n This field
|
||||||
|
is immutable and no changes will be made to the corresponding
|
||||||
|
ResourceClaim by the control plane after creating
|
||||||
|
the ResourceClaim."
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
restartPolicy:
|
restartPolicy:
|
||||||
description: 'Restart policy for all containers within the pod.
|
description: 'Restart policy for all containers within the pod.
|
||||||
One of Always, OnFailure, Never. Default to Always. More info:
|
One of Always, OnFailure, Never. In some contexts, only a subset
|
||||||
|
of those values may be permitted. Default to Always. More info:
|
||||||
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy'
|
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy'
|
||||||
type: string
|
type: string
|
||||||
runtimeClassName:
|
runtimeClassName:
|
||||||
@@ -4984,6 +5228,29 @@ spec:
|
|||||||
scheduler. If not specified, the pod will be dispatched by default
|
scheduler. If not specified, the pod will be dispatched by default
|
||||||
scheduler.
|
scheduler.
|
||||||
type: string
|
type: string
|
||||||
|
schedulingGates:
|
||||||
|
description: "SchedulingGates is an opaque list of values that
|
||||||
|
if specified will block scheduling the pod. If schedulingGates
|
||||||
|
is not empty, the pod will stay in the SchedulingGated state
|
||||||
|
and the scheduler will not attempt to schedule the pod. \n SchedulingGates
|
||||||
|
can only be set at pod creation time, and be removed only afterwards.
|
||||||
|
\n This is a beta feature enabled by the PodSchedulingReadiness
|
||||||
|
feature gate."
|
||||||
|
items:
|
||||||
|
description: PodSchedulingGate is associated to a Pod to guard
|
||||||
|
its scheduling.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name of the scheduling gate. Each scheduling
|
||||||
|
gate must have a unique name field.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
securityContext:
|
securityContext:
|
||||||
description: 'SecurityContext holds pod-level security attributes
|
description: 'SecurityContext holds pod-level security attributes
|
||||||
and common container settings. Optional: Defaults to empty. See
|
and common container settings. Optional: Defaults to empty. See
|
||||||
@@ -5075,7 +5342,8 @@ spec:
|
|||||||
in a file on the node should be used. The profile must
|
in a file on the node should be used. The profile must
|
||||||
be preconfigured on the node to work. Must be a descending
|
be preconfigured on the node to work. Must be a descending
|
||||||
path, relative to the kubelet's configured seccomp profile
|
path, relative to the kubelet's configured seccomp profile
|
||||||
location. Must only be set if type is "Localhost".
|
location. Must be set if type is "Localhost". Must NOT
|
||||||
|
be set for any other type.
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: "type indicates which kind of seccomp profile
|
description: "type indicates which kind of seccomp profile
|
||||||
@@ -5090,9 +5358,13 @@ spec:
|
|||||||
supplementalGroups:
|
supplementalGroups:
|
||||||
description: A list of groups applied to the first process
|
description: A list of groups applied to the first process
|
||||||
run in each container, in addition to the container's primary
|
run in each container, in addition to the container's primary
|
||||||
GID. If unspecified, no groups will be added to any container.
|
GID, the fsGroup (if specified), and group memberships defined
|
||||||
Note that this field cannot be set when spec.os.name is
|
in the container image for the uid of the container process.
|
||||||
windows.
|
If unspecified, no additional groups are added to any container.
|
||||||
|
Note that group memberships defined in the container image
|
||||||
|
for the uid of the container process are still effective,
|
||||||
|
even if they are not included in this list. Note that this
|
||||||
|
field cannot be set when spec.os.name is windows.
|
||||||
items:
|
items:
|
||||||
format: int64
|
format: int64
|
||||||
type: integer
|
type: integer
|
||||||
@@ -5136,15 +5408,12 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
hostProcess:
|
hostProcess:
|
||||||
description: HostProcess determines if a container should
|
description: HostProcess determines if a container should
|
||||||
be run as a 'Host Process' container. This field is
|
be run as a 'Host Process' container. All of a Pod's
|
||||||
alpha-level and will only be honored by components that
|
containers must have the same effective HostProcess
|
||||||
enable the WindowsHostProcessContainers feature flag.
|
value (it is not allowed to have a mix of HostProcess
|
||||||
Setting this field without the feature flag will result
|
containers and non-HostProcess containers). In addition,
|
||||||
in errors when validating the Pod. All of a Pod's containers
|
if HostProcess is true then HostNetwork must also be
|
||||||
must have the same effective HostProcess value (it is
|
set to true.
|
||||||
not allowed to have a mix of HostProcess containers
|
|
||||||
and non-HostProcess containers). In addition, if HostProcess
|
|
||||||
is true then HostNetwork must also be set to true.
|
|
||||||
type: boolean
|
type: boolean
|
||||||
runAsUserName:
|
runAsUserName:
|
||||||
description: The UserName in Windows to run the entrypoint
|
description: The UserName in Windows to run the entrypoint
|
||||||
@@ -5299,14 +5568,19 @@ spec:
|
|||||||
type: object
|
type: object
|
||||||
x-kubernetes-map-type: atomic
|
x-kubernetes-map-type: atomic
|
||||||
matchLabelKeys:
|
matchLabelKeys:
|
||||||
description: MatchLabelKeys is a set of pod label keys to
|
description: "MatchLabelKeys is a set of pod label keys
|
||||||
select the pods over which spreading will be calculated.
|
to select the pods over which spreading will be calculated.
|
||||||
The keys are used to lookup values from the incoming pod
|
The keys are used to lookup values from the incoming pod
|
||||||
labels, those key-value labels are ANDed with labelSelector
|
labels, those key-value labels are ANDed with labelSelector
|
||||||
to select the group of existing pods over which spreading
|
to select the group of existing pods over which spreading
|
||||||
will be calculated for the incoming pod. Keys that don't
|
will be calculated for the incoming pod. The same key
|
||||||
exist in the incoming pod labels will be ignored. A null
|
is forbidden to exist in both MatchLabelKeys and LabelSelector.
|
||||||
or empty list means only match against labelSelector.
|
MatchLabelKeys cannot be set when LabelSelector isn't
|
||||||
|
set. Keys that don't exist in the incoming pod labels
|
||||||
|
will be ignored. A null or empty list means only match
|
||||||
|
against labelSelector. \n This is a beta field and requires
|
||||||
|
the MatchLabelKeysInPodTopologySpread feature gate to
|
||||||
|
be enabled (enabled by default)."
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
@@ -5366,7 +5640,7 @@ spec:
|
|||||||
- Ignore: nodeAffinity/nodeSelector are ignored. All nodes
|
- Ignore: nodeAffinity/nodeSelector are ignored. All nodes
|
||||||
are included in the calculations. \n If this value is
|
are included in the calculations. \n If this value is
|
||||||
nil, the behavior is equivalent to the Honor policy. This
|
nil, the behavior is equivalent to the Honor policy. This
|
||||||
is a alpha-level feature enabled by the NodeInclusionPolicyInPodTopologySpread
|
is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread
|
||||||
feature flag."
|
feature flag."
|
||||||
type: string
|
type: string
|
||||||
nodeTaintsPolicy:
|
nodeTaintsPolicy:
|
||||||
@@ -5376,8 +5650,8 @@ spec:
|
|||||||
tainted nodes for which the incoming pod has a toleration,
|
tainted nodes for which the incoming pod has a toleration,
|
||||||
are included. - Ignore: node taints are ignored. All nodes
|
are included. - Ignore: node taints are ignored. All nodes
|
||||||
are included. \n If this value is nil, the behavior is
|
are included. \n If this value is nil, the behavior is
|
||||||
equivalent to the Ignore policy. This is a alpha-level
|
equivalent to the Ignore policy. This is a beta-level
|
||||||
feature enabled by the NodeInclusionPolicyInPodTopologySpread
|
feature default enabled by the NodeInclusionPolicyInPodTopologySpread
|
||||||
feature flag."
|
feature flag."
|
||||||
type: string
|
type: string
|
||||||
topologyKey:
|
topologyKey:
|
||||||
@@ -5825,7 +6099,7 @@ spec:
|
|||||||
value between the SizeLimit specified here and the
|
value between the SizeLimit specified here and the
|
||||||
sum of memory limits of all containers in a pod. The
|
sum of memory limits of all containers in a pod. The
|
||||||
default is nil which means that the limit is undefined.
|
default is nil which means that the limit is undefined.
|
||||||
More info: http://kubernetes.io/docs/user-guide/volumes#emptydir'
|
More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir'
|
||||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||||
x-kubernetes-int-or-string: true
|
x-kubernetes-int-or-string: true
|
||||||
type: object
|
type: object
|
||||||
@@ -5900,10 +6174,13 @@ spec:
|
|||||||
If the provisioner or an external controller
|
If the provisioner or an external controller
|
||||||
can support the specified data source, it
|
can support the specified data source, it
|
||||||
will create a new volume based on the contents
|
will create a new volume based on the contents
|
||||||
of the specified data source. If the AnyVolumeDataSource
|
of the specified data source. When the AnyVolumeDataSource
|
||||||
feature gate is enabled, this field will always
|
feature gate is enabled, dataSource contents
|
||||||
have the same contents as the DataSourceRef
|
will be copied to dataSourceRef, and dataSourceRef
|
||||||
field.'
|
contents will be copied to dataSource when
|
||||||
|
dataSourceRef.namespace is not specified.
|
||||||
|
If the namespace is specified, then dataSourceRef
|
||||||
|
will not be copied to dataSource.'
|
||||||
properties:
|
properties:
|
||||||
apiGroup:
|
apiGroup:
|
||||||
description: APIGroup is the group for the
|
description: APIGroup is the group for the
|
||||||
@@ -5929,29 +6206,37 @@ spec:
|
|||||||
description: 'dataSourceRef specifies the object
|
description: 'dataSourceRef specifies the object
|
||||||
from which to populate the volume with data,
|
from which to populate the volume with data,
|
||||||
if a non-empty volume is desired. This may
|
if a non-empty volume is desired. This may
|
||||||
be any local object from a non-empty API group
|
be any object from a non-empty API group (non
|
||||||
(non core object) or a PersistentVolumeClaim
|
core object) or a PersistentVolumeClaim object.
|
||||||
object. When this field is specified, volume
|
When this field is specified, volume binding
|
||||||
binding will only succeed if the type of the
|
will only succeed if the type of the specified
|
||||||
specified object matches some installed volume
|
object matches some installed volume populator
|
||||||
populator or dynamic provisioner. This field
|
or dynamic provisioner. This field will replace
|
||||||
will replace the functionality of the DataSource
|
the functionality of the dataSource field
|
||||||
field and as such if both fields are non-empty,
|
and as such if both fields are non-empty,
|
||||||
they must have the same value. For backwards
|
they must have the same value. For backwards
|
||||||
compatibility, both fields (DataSource and
|
compatibility, when namespace isn''t specified
|
||||||
DataSourceRef) will be set to the same value
|
in dataSourceRef, both fields (dataSource
|
||||||
automatically if one of them is empty and
|
and dataSourceRef) will be set to the same
|
||||||
the other is non-empty. There are two important
|
value automatically if one of them is empty
|
||||||
differences between DataSource and DataSourceRef:
|
and the other is non-empty. When namespace
|
||||||
* While DataSource only allows two specific
|
is specified in dataSourceRef, dataSource
|
||||||
types of objects, DataSourceRef allows any
|
isn''t set to the same value and must be empty.
|
||||||
non-core object, as well as PersistentVolumeClaim
|
There are three important differences between
|
||||||
objects. * While DataSource ignores disallowed
|
dataSource and dataSourceRef: * While dataSource
|
||||||
values (dropping them), DataSourceRef preserves
|
only allows two specific types of objects,
|
||||||
all values, and generates an error if a disallowed
|
dataSourceRef allows any non-core object,
|
||||||
value is specified. (Beta) Using this field
|
as well as PersistentVolumeClaim objects.
|
||||||
requires the AnyVolumeDataSource feature gate
|
* While dataSource ignores disallowed values
|
||||||
to be enabled.'
|
(dropping them), dataSourceRef preserves all
|
||||||
|
values, and generates an error if a disallowed
|
||||||
|
value is specified. * While dataSource only
|
||||||
|
allows local objects, dataSourceRef allows
|
||||||
|
objects in any namespaces. (Beta) Using this
|
||||||
|
field requires the AnyVolumeDataSource feature
|
||||||
|
gate to be enabled. (Alpha) Using the namespace
|
||||||
|
field of dataSourceRef requires the CrossNamespaceVolumeDataSource
|
||||||
|
feature gate to be enabled.'
|
||||||
properties:
|
properties:
|
||||||
apiGroup:
|
apiGroup:
|
||||||
description: APIGroup is the group for the
|
description: APIGroup is the group for the
|
||||||
@@ -5968,11 +6253,21 @@ spec:
|
|||||||
description: Name is the name of resource
|
description: Name is the name of resource
|
||||||
being referenced
|
being referenced
|
||||||
type: string
|
type: string
|
||||||
|
namespace:
|
||||||
|
description: Namespace is the namespace
|
||||||
|
of resource being referenced Note that
|
||||||
|
when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant
|
||||||
|
object is required in the referent namespace
|
||||||
|
to allow that namespace's owner to accept
|
||||||
|
the reference. See the ReferenceGrant
|
||||||
|
documentation for details. (Alpha) This
|
||||||
|
field requires the CrossNamespaceVolumeDataSource
|
||||||
|
feature gate to be enabled.
|
||||||
|
type: string
|
||||||
required:
|
required:
|
||||||
- kind
|
- kind
|
||||||
- name
|
- name
|
||||||
type: object
|
type: object
|
||||||
x-kubernetes-map-type: atomic
|
|
||||||
resources:
|
resources:
|
||||||
description: 'resources represents the minimum
|
description: 'resources represents the minimum
|
||||||
resources the volume should have. If RecoverVolumeExpansionFailure
|
resources the volume should have. If RecoverVolumeExpansionFailure
|
||||||
@@ -5982,6 +6277,32 @@ spec:
|
|||||||
capacity recorded in the status field of the
|
capacity recorded in the status field of the
|
||||||
claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources'
|
claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources'
|
||||||
properties:
|
properties:
|
||||||
|
claims:
|
||||||
|
description: "Claims lists the names of
|
||||||
|
resources, defined in spec.resourceClaims,
|
||||||
|
that are used by this container. \n This
|
||||||
|
is an alpha field and requires enabling
|
||||||
|
the DynamicResourceAllocation feature
|
||||||
|
gate. \n This field is immutable. It can
|
||||||
|
only be set for containers."
|
||||||
|
items:
|
||||||
|
description: ResourceClaim references
|
||||||
|
one entry in PodSpec.ResourceClaims.
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Name must match the name
|
||||||
|
of one entry in pod.spec.resourceClaims
|
||||||
|
of the Pod where this field is used.
|
||||||
|
It makes that resource available
|
||||||
|
inside a container.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
|
type: array
|
||||||
|
x-kubernetes-list-map-keys:
|
||||||
|
- name
|
||||||
|
x-kubernetes-list-type: map
|
||||||
limits:
|
limits:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
anyOf:
|
anyOf:
|
||||||
@@ -6005,7 +6326,8 @@ spec:
|
|||||||
If Requests is omitted for a container,
|
If Requests is omitted for a container,
|
||||||
it defaults to Limits if that is explicitly
|
it defaults to Limits if that is explicitly
|
||||||
specified, otherwise to an implementation-defined
|
specified, otherwise to an implementation-defined
|
||||||
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
value. Requests cannot exceed Limits.
|
||||||
|
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
selector:
|
selector:
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: packages.fission.io
|
name: packages.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.10.0
|
controller-gen.kubebuilder.io/version: v0.13.0
|
||||||
creationTimestamp: null
|
|
||||||
name: timetriggers.fission.io
|
name: timetriggers.fission.io
|
||||||
spec:
|
spec:
|
||||||
group: fission.io
|
group: fission.io
|
||||||
|
|||||||
@@ -1,144 +1,125 @@
|
|||||||
module github.com/fission/fission
|
module github.com/fission/fission
|
||||||
|
|
||||||
go 1.19
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Shopify/sarama v1.37.2
|
dario.cat/mergo v1.0.0
|
||||||
github.com/bep/debounce v1.2.1
|
github.com/bep/debounce v1.2.1
|
||||||
github.com/dchest/uniuri v1.2.0
|
github.com/dchest/uniuri v1.2.0
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.1
|
||||||
github.com/elastic/crd-ref-docs v0.0.8
|
github.com/elastic/crd-ref-docs v0.0.10
|
||||||
github.com/emicklei/go-restful-openapi/v2 v2.9.1
|
github.com/fatih/color v1.16.0
|
||||||
github.com/emicklei/go-restful/v3 v3.10.1
|
github.com/fsnotify/fsnotify v1.7.0
|
||||||
github.com/fatih/color v1.13.0
|
github.com/go-git/go-git/v5 v5.10.1
|
||||||
github.com/fsnotify/fsnotify v1.6.0
|
github.com/go-logr/zapr v1.3.0
|
||||||
github.com/go-git/go-git/v5 v5.4.2
|
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||||
github.com/go-openapi/spec v0.20.7
|
github.com/google/go-cmp v0.6.0
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3
|
github.com/google/uuid v1.4.0
|
||||||
github.com/google/go-cmp v0.5.9
|
github.com/gorilla/mux v1.8.1
|
||||||
github.com/gorilla/mux v1.8.0
|
|
||||||
github.com/graymeta/stow v0.2.8
|
github.com/graymeta/stow v0.2.8
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
github.com/hashicorp/go-multierror v1.1.1
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.1
|
github.com/hashicorp/go-retryablehttp v0.7.5
|
||||||
github.com/imdario/mergo v0.3.13
|
github.com/influxdata/influxdb v1.11.2
|
||||||
github.com/influxdata/influxdb v1.11.0
|
|
||||||
github.com/mholt/archiver/v3 v3.5.1
|
github.com/mholt/archiver/v3 v3.5.1
|
||||||
github.com/minio/minio-go v6.0.14+incompatible
|
github.com/minio/minio-go v6.0.14+incompatible
|
||||||
github.com/ory/dockertest v3.3.5+incompatible
|
github.com/ory/dockertest v3.3.5+incompatible
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/prometheus/client_golang v1.14.0
|
github.com/prometheus/client_golang v1.17.0
|
||||||
github.com/prometheus/common v0.37.0
|
github.com/prometheus/common v0.45.0
|
||||||
github.com/robfig/cron/v3 v3.0.0
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
|
github.com/spf13/cobra v1.8.0
|
||||||
github.com/spf13/cobra v1.6.1
|
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.8.1
|
github.com/stretchr/testify v1.8.4
|
||||||
github.com/wcharczuk/go-chart v2.0.1+incompatible
|
github.com/wcharczuk/go-chart v2.0.1+incompatible
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
|
||||||
go.opentelemetry.io/contrib/propagators/autoprop v0.37.0
|
go.opentelemetry.io/contrib/propagators/autoprop v0.46.1
|
||||||
go.opentelemetry.io/otel v1.11.2
|
go.opentelemetry.io/otel v1.21.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0
|
||||||
go.opentelemetry.io/otel/sdk v1.11.2
|
go.opentelemetry.io/otel/sdk v1.21.0
|
||||||
go.opentelemetry.io/otel/trace v1.11.2
|
go.opentelemetry.io/otel/trace v1.21.0
|
||||||
go.uber.org/zap v1.24.0
|
go.uber.org/zap v1.26.0
|
||||||
golang.org/x/net v0.4.0
|
golang.org/x/net v0.19.0
|
||||||
google.golang.org/grpc v1.51.0
|
google.golang.org/grpc v1.59.0
|
||||||
k8s.io/api v0.25.4
|
k8s.io/api v0.28.4
|
||||||
k8s.io/apiextensions-apiserver v0.25.4
|
k8s.io/apiextensions-apiserver v0.28.4
|
||||||
k8s.io/apimachinery v0.25.4
|
k8s.io/apimachinery v0.28.4
|
||||||
k8s.io/client-go v0.25.4
|
k8s.io/client-go v0.28.4
|
||||||
k8s.io/metrics v0.25.4
|
k8s.io/metrics v0.28.4
|
||||||
sigs.k8s.io/controller-runtime v0.13.1
|
sigs.k8s.io/controller-runtime v0.16.3
|
||||||
sigs.k8s.io/controller-tools v0.10.0
|
sigs.k8s.io/controller-tools v0.13.0
|
||||||
sigs.k8s.io/yaml v1.3.0
|
sigs.k8s.io/yaml v1.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.99.0 // indirect
|
|
||||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
|
||||||
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
|
|
||||||
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
|
|
||||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
|
||||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
|
||||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
|
||||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||||
github.com/Masterminds/semver v1.5.0 // indirect
|
github.com/Masterminds/semver v1.5.0 // indirect
|
||||||
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
|
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
|
||||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||||
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
|
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
|
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
|
||||||
github.com/acomagu/bufpipe v1.0.3 // indirect
|
|
||||||
github.com/andybalholm/brotli v1.0.1 // indirect
|
github.com/andybalholm/brotli v1.0.1 // indirect
|
||||||
github.com/aws/aws-sdk-go v1.42.34 // indirect
|
github.com/aws/aws-sdk-go v1.42.34 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/blend/go-sdk v1.20220112.5 // indirect
|
github.com/blend/go-sdk v1.20220112.5 // indirect
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
|
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
github.com/cloudflare/circl v1.1.0 // indirect
|
github.com/cloudflare/circl v1.3.3 // indirect
|
||||||
github.com/containerd/continuity v0.2.2 // indirect
|
github.com/containerd/continuity v0.2.2 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.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/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/docker/go-connections v0.4.0 // indirect
|
github.com/docker/go-connections v0.4.0 // indirect
|
||||||
github.com/docker/go-units v0.4.0 // indirect
|
github.com/docker/go-units v0.4.0 // indirect
|
||||||
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
|
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
|
||||||
github.com/eapache/go-resiliency v1.3.0 // indirect
|
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
|
||||||
github.com/eapache/queue v1.1.0 // indirect
|
|
||||||
github.com/emirpasic/gods v1.18.1 // indirect
|
github.com/emirpasic/gods v1.18.1 // indirect
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||||
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
github.com/go-git/gcfg v1.5.0 // indirect
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||||
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
github.com/go-git/go-billy/v5 v5.5.0 // indirect
|
||||||
github.com/go-ini/ini v1.66.4 // indirect
|
github.com/go-ini/ini v1.66.4 // indirect
|
||||||
github.com/go-logr/logr v1.2.3 // indirect
|
github.com/go-logr/logr v1.3.0 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-logr/zapr v1.2.3 // indirect
|
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
github.com/go-openapi/swag v0.22.3 // indirect
|
||||||
github.com/go-openapi/swag v0.19.15 // indirect
|
github.com/gobuffalo/flect v1.0.2 // indirect
|
||||||
github.com/gobuffalo/flect v0.2.5 // indirect
|
github.com/goccy/go-yaml v1.11.0 // indirect
|
||||||
github.com/goccy/go-yaml v1.1.5 // indirect
|
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/gnostic v0.5.7-v3refs // indirect
|
github.com/google/gnostic-models v0.6.8 // indirect
|
||||||
github.com/google/gofuzz v1.1.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
|
||||||
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
|
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
github.com/huandu/xstrings v1.3.3 // indirect
|
||||||
github.com/huandu/xstrings v1.2.1 // indirect
|
github.com/imdario/mergo v0.3.11 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
|
||||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
|
||||||
github.com/jcmturner/gofork v1.7.6 // indirect
|
|
||||||
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
|
|
||||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||||
github.com/klauspost/compress v1.15.11 // indirect
|
github.com/klauspost/compress v1.16.7 // indirect
|
||||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||||
github.com/lib/pq v1.10.4 // indirect
|
github.com/lib/pq v1.10.4 // indirect
|
||||||
github.com/mailru/easyjson v0.7.6 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||||
github.com/mitchellh/copystructure v1.0.0 // indirect
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/mitchellh/reflectwalk v1.0.0 // indirect
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||||
github.com/moby/spdystream v0.2.0 // indirect
|
github.com/moby/spdystream v0.2.0 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
@@ -146,51 +127,52 @@ require (
|
|||||||
github.com/nwaples/rardecode v1.1.0 // indirect
|
github.com/nwaples/rardecode v1.1.0 // indirect
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/opencontainers/image-spec v1.0.2 // indirect
|
github.com/opencontainers/image-spec v1.0.2 // indirect
|
||||||
github.com/opencontainers/runc v1.1.2 // indirect
|
github.com/opencontainers/runc v1.1.5 // indirect
|
||||||
github.com/pierrec/lz4/v4 v4.1.17 // indirect
|
github.com/pierrec/lz4/v4 v4.1.18 // indirect
|
||||||
|
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/client_model v0.3.0 // indirect
|
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
github.com/prometheus/procfs v0.11.1 // indirect
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/sergi/go-diff v1.1.0 // indirect
|
||||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||||
|
github.com/skeema/knownhosts v1.2.1 // indirect
|
||||||
github.com/ulikunitz/xz v0.5.9 // indirect
|
github.com/ulikunitz/xz v0.5.9 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.2 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||||
go.opentelemetry.io/contrib/propagators/aws v1.12.0 // indirect
|
go.opentelemetry.io/contrib/propagators/aws v1.21.1 // indirect
|
||||||
go.opentelemetry.io/contrib/propagators/b3 v1.12.0 // indirect
|
go.opentelemetry.io/contrib/propagators/b3 v1.21.1 // indirect
|
||||||
go.opentelemetry.io/contrib/propagators/jaeger v1.12.0 // indirect
|
go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 // indirect
|
||||||
go.opentelemetry.io/contrib/propagators/ot v1.12.0 // indirect
|
go.opentelemetry.io/contrib/propagators/ot v1.21.1 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
|
go.opentelemetry.io/otel/metric v1.21.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v0.34.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/atomic v1.9.0 // indirect
|
golang.org/x/crypto v0.16.0 // indirect
|
||||||
go.uber.org/multierr v1.8.0 // indirect
|
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
|
||||||
golang.org/x/crypto v0.3.0 // indirect
|
golang.org/x/image v0.10.0 // indirect
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
|
golang.org/x/mod v0.12.0 // indirect
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
golang.org/x/oauth2 v0.12.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
|
golang.org/x/sync v0.4.0 // indirect
|
||||||
golang.org/x/sys v0.3.0 // indirect
|
golang.org/x/sys v0.15.0 // indirect
|
||||||
golang.org/x/term v0.3.0 // indirect
|
golang.org/x/term v0.15.0 // indirect
|
||||||
golang.org/x/text v0.5.0 // indirect
|
golang.org/x/text v0.14.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
golang.org/x/tools v0.1.12 // indirect
|
golang.org/x/tools v0.13.0 // indirect
|
||||||
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
k8s.io/component-base v0.25.4 // indirect
|
k8s.io/component-base v0.28.4 // indirect
|
||||||
k8s.io/klog/v2 v2.70.1 // indirect
|
k8s.io/klog/v2 v2.100.1 // indirect
|
||||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
|
||||||
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
|
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
|
||||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
+14
-7
@@ -28,12 +28,19 @@ set +x
|
|||||||
# for codecov
|
# for codecov
|
||||||
echo "" > coverage.txt
|
echo "" > coverage.txt
|
||||||
|
|
||||||
|
make install-envtest
|
||||||
|
KUBEBUILDER_ASSETS=$(setup-envtest -p path use 1.23.x)
|
||||||
|
export KUBEBUILDER_ASSETS
|
||||||
|
|
||||||
# The executor unit test only works with NodePort-type services for
|
# The executor unit test only works with NodePort-type services for
|
||||||
# now. So disable it for our travis ci tests except some partial tests.
|
# now. So disable it for our travis ci tests except some partial tests.
|
||||||
for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v executor | grep -v 'benchmark') github.com/fission/fission/pkg/executor/util; do
|
# for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v 'benchmark'); do
|
||||||
go test -race -v -coverprofile=profile.out -covermode=atomic $d
|
# echo "Running tests in $d"
|
||||||
if [ -f profile.out ]; then
|
# go test -race -v -coverprofile=profile.out -covermode=atomic $d
|
||||||
cat profile.out >> coverage.txt
|
# if [ -f profile.out ]; then
|
||||||
rm profile.out
|
# cat profile.out >> coverage.txt
|
||||||
fi
|
# rm profile.out
|
||||||
done
|
# fi
|
||||||
|
# done
|
||||||
|
echo "Running tests ..."
|
||||||
|
go test -race -v -coverprofile=coverage.txt -covermode=atomic --coverpkg=./... ./...
|
||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -50,19 +51,19 @@ func (r *CanaryConfig) Default() {
|
|||||||
var _ webhook.Validator = &CanaryConfig{}
|
var _ webhook.Validator = &CanaryConfig{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *CanaryConfig) ValidateCreate() error {
|
func (r *CanaryConfig) ValidateCreate() (admission.Warnings, error) {
|
||||||
canaryconfiglog.Debug("validate create", zap.String("name", r.Name))
|
canaryconfiglog.Debug("validate create", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *CanaryConfig) ValidateUpdate(old runtime.Object) error {
|
func (r *CanaryConfig) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
canaryconfiglog.Debug("validate update", zap.String("name", r.Name))
|
canaryconfiglog.Debug("validate update", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *CanaryConfig) ValidateDelete() error {
|
func (r *CanaryConfig) ValidateDelete() (admission.Warnings, error) {
|
||||||
canaryconfiglog.Debug("validate delete", zap.String("name", r.Name))
|
canaryconfiglog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ const (
|
|||||||
PodInfoMount = "/etc/podinfo"
|
PodInfoMount = "/etc/podinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
MessageQueueTypeKafka = "kafka"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// FunctionReferenceFunctionName means that the function
|
// FunctionReferenceFunctionName means that the function
|
||||||
// reference is simply by function name.
|
// reference is simply by function name.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -49,24 +50,24 @@ func (r *Environment) Default() {
|
|||||||
var _ webhook.Validator = &Environment{}
|
var _ webhook.Validator = &Environment{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Environment) ValidateCreate() error {
|
func (r *Environment) ValidateCreate() (admission.Warnings, error) {
|
||||||
environmentlog.Debug("validate create", zap.String("name", r.Name))
|
environmentlog.Debug("validate create", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("Environment", err)
|
err = AggregateValidationErrors("Environment", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Environment) ValidateUpdate(old runtime.Object) error {
|
func (r *Environment) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
environmentlog.Debug("validate update", zap.String("name", r.Name))
|
environmentlog.Debug("validate update", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Environment) ValidateDelete() error {
|
func (r *Environment) ValidateDelete() (admission.Warnings, error) {
|
||||||
environmentlog.Debug("validate delete", zap.String("name", r.Name))
|
environmentlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -50,55 +51,55 @@ func (r *Function) Default() {
|
|||||||
var _ webhook.Validator = &Function{}
|
var _ webhook.Validator = &Function{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Function) ValidateCreate() error {
|
func (r *Function) ValidateCreate() (admission.Warnings, error) {
|
||||||
functionlog.Debug("validate create", zap.String("name", r.Name))
|
functionlog.Debug("validate create", zap.String("name", r.Name))
|
||||||
|
|
||||||
for _, cnfMap := range r.Spec.ConfigMaps {
|
for _, cnfMap := range r.Spec.ConfigMaps {
|
||||||
if cnfMap.Namespace != r.ObjectMeta.Namespace {
|
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)
|
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, secret := range r.Spec.Secrets {
|
for _, secret := range r.Spec.Secrets {
|
||||||
if secret.Namespace != r.ObjectMeta.Namespace {
|
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)
|
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Function) ValidateUpdate(old runtime.Object) error {
|
func (r *Function) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
functionlog.Debug("validate update", zap.String("name", r.Name))
|
functionlog.Debug("validate update", zap.String("name", r.Name))
|
||||||
|
|
||||||
for _, cnfMap := range r.Spec.ConfigMaps {
|
for _, cnfMap := range r.Spec.ConfigMaps {
|
||||||
if cnfMap.Namespace != r.ObjectMeta.Namespace {
|
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)
|
err := fmt.Errorf("ConfigMap's [%s] and function's Namespace [%s] are different. ConfigMap needs to be present in the same namespace as function", cnfMap.Namespace, r.ObjectMeta.Namespace)
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, secret := range r.Spec.Secrets {
|
for _, secret := range r.Spec.Secrets {
|
||||||
if secret.Namespace != r.ObjectMeta.Namespace {
|
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)
|
err := fmt.Errorf("secret [%s] and function's Namespace [%s] are different. Secret needs to be present in the same namespace as function", secret.Namespace, r.ObjectMeta.Namespace)
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return AggregateValidationErrors("Function", err)
|
return nil, AggregateValidationErrors("Function", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Function) ValidateDelete() error {
|
func (r *Function) ValidateDelete() (admission.Warnings, error) {
|
||||||
functionlog.Debug("validate delete", zap.String("name", r.Name))
|
functionlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -49,31 +50,31 @@ func (r *HTTPTrigger) Default() {
|
|||||||
var _ webhook.Validator = &HTTPTrigger{}
|
var _ webhook.Validator = &HTTPTrigger{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (t *HTTPTrigger) ValidateCreate() error {
|
func (t *HTTPTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||||
httptriggerlog.Debug("validate create", zap.String("name", t.Name))
|
httptriggerlog.Debug("validate create", zap.String("name", t.Name))
|
||||||
err := t.Validate()
|
err := t.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("HTTPTrigger", err)
|
err = AggregateValidationErrors("HTTPTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *HTTPTrigger) ValidateUpdate(old runtime.Object) error {
|
func (r *HTTPTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
httptriggerlog.Debug("validate update", zap.String("name", r.Name))
|
httptriggerlog.Debug("validate update", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("HTTPTrigger", err)
|
err = AggregateValidationErrors("HTTPTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *HTTPTrigger) ValidateDelete() error {
|
func (r *HTTPTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||||
httptriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
httptriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
|
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -49,24 +50,24 @@ func (r *KubernetesWatchTrigger) Default() {
|
|||||||
var _ webhook.Validator = &KubernetesWatchTrigger{}
|
var _ webhook.Validator = &KubernetesWatchTrigger{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *KubernetesWatchTrigger) ValidateCreate() error {
|
func (r *KubernetesWatchTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||||
kuberneteswatchtriggerlog.Debug("validate create", zap.String("name", r.Name))
|
kuberneteswatchtriggerlog.Debug("validate create", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("Watch", err)
|
err = AggregateValidationErrors("Watch", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *KubernetesWatchTrigger) ValidateUpdate(old runtime.Object) error {
|
func (r *KubernetesWatchTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
// WATCH UPDATE NOT IMPLEMENTED
|
// WATCH UPDATE NOT IMPLEMENTED
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *KubernetesWatchTrigger) ValidateDelete() error {
|
func (r *KubernetesWatchTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||||
kuberneteswatchtriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
kuberneteswatchtriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
)
|
)
|
||||||
@@ -49,29 +50,29 @@ func (r *MessageQueueTrigger) Default() {
|
|||||||
var _ webhook.Validator = &MessageQueueTrigger{}
|
var _ webhook.Validator = &MessageQueueTrigger{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *MessageQueueTrigger) ValidateCreate() error {
|
func (r *MessageQueueTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||||
messagequeuetriggerlog.Debug("validate create", zap.String("name", r.Name))
|
messagequeuetriggerlog.Debug("validate create", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("MessageQueueTrigger", err)
|
err = AggregateValidationErrors("MessageQueueTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *MessageQueueTrigger) ValidateUpdate(old runtime.Object) error {
|
func (r *MessageQueueTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
messagequeuetriggerlog.Debug("validate update", zap.String("name", r.Name))
|
messagequeuetriggerlog.Debug("validate update", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("MessageQueueTrigger", err)
|
err = AggregateValidationErrors("MessageQueueTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *MessageQueueTrigger) ValidateDelete() error {
|
func (r *MessageQueueTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||||
messagequeuetriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
messagequeuetriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
ferror "github.com/fission/fission/pkg/error"
|
ferror "github.com/fission/fission/pkg/error"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
@@ -56,43 +57,43 @@ func (r *Package) Default() {
|
|||||||
var _ webhook.Validator = &Package{}
|
var _ webhook.Validator = &Package{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Package) ValidateCreate() error {
|
func (r *Package) ValidateCreate() (admission.Warnings, error) {
|
||||||
packagelog.Debug("validate create", zap.String("name", r.Name))
|
packagelog.Debug("validate create", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("Package", err)
|
err = AggregateValidationErrors("Package", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure size limits
|
// Ensure size limits
|
||||||
if len(r.Spec.Source.Literal) > int(ArchiveLiteralSizeLimit) {
|
if len(r.Spec.Source.Literal) > int(ArchiveLiteralSizeLimit) {
|
||||||
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
||||||
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(r.Spec.Deployment.Literal) > int(ArchiveLiteralSizeLimit) {
|
if len(r.Spec.Deployment.Literal) > int(ArchiveLiteralSizeLimit) {
|
||||||
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
err := ferror.MakeError(ferror.ErrorInvalidArgument,
|
||||||
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
fmt.Sprintf("Package literal larger than %s", humanize.Bytes(uint64(ArchiveLiteralSizeLimit))))
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Package) ValidateUpdate(old runtime.Object) error {
|
func (r *Package) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
packagelog.Debug("validate update", zap.String("name", r.Name))
|
packagelog.Debug("validate update", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("Package", err)
|
err = AggregateValidationErrors("Package", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *Package) ValidateDelete() error {
|
func (r *Package) ValidateDelete() (admission.Warnings, error) {
|
||||||
packagelog.Debug("validate delete", zap.String("name", r.Name))
|
packagelog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||||
|
|
||||||
ferror "github.com/fission/fission/pkg/error"
|
ferror "github.com/fission/fission/pkg/error"
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||||
@@ -50,42 +51,42 @@ func (r *TimeTrigger) Default() {
|
|||||||
var _ webhook.Validator = &TimeTrigger{}
|
var _ webhook.Validator = &TimeTrigger{}
|
||||||
|
|
||||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *TimeTrigger) ValidateCreate() error {
|
func (r *TimeTrigger) ValidateCreate() (admission.Warnings, error) {
|
||||||
timetriggerlog.Debug("validate create", zap.String("name", r.Name))
|
timetriggerlog.Debug("validate create", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("TimeTrigger", err)
|
err = AggregateValidationErrors("TimeTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = IsValidCronSpec(r.Spec.Cron)
|
err = IsValidCronSpec(r.Spec.Cron)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *TimeTrigger) ValidateUpdate(old runtime.Object) error {
|
func (r *TimeTrigger) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||||
timetriggerlog.Debug("validate update", zap.String("name", r.Name))
|
timetriggerlog.Debug("validate update", zap.String("name", r.Name))
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = AggregateValidationErrors("TimeTrigger", err)
|
err = AggregateValidationErrors("TimeTrigger", err)
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = IsValidCronSpec(r.Spec.Cron)
|
err = IsValidCronSpec(r.Spec.Cron)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
err = ferror.MakeError(ferror.ErrorInvalidArgument, "TimeTrigger cron spec is not valid")
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||||
func (r *TimeTrigger) ValidateDelete() error {
|
func (r *TimeTrigger) ValidateDelete() (admission.Warnings, error) {
|
||||||
timetriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
timetriggerlog.Debug("validate delete", zap.String("name", r.Name))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,16 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
|
asv2 "k8s.io/api/autoscaling/v2"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultConcurrency = 500
|
||||||
|
DefaultRequestsPerPod = 1
|
||||||
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
// To add a Fission CRD type:
|
// To add a Fission CRD type:
|
||||||
// 1. Create a "spec" type, for everything in the type except metadata
|
// 1. Create a "spec" type, for everything in the type except metadata
|
||||||
@@ -394,6 +399,11 @@ type (
|
|||||||
// +optional
|
// +optional
|
||||||
OnceOnly bool `json:"onceOnly,omitempty"`
|
OnceOnly bool `json:"onceOnly,omitempty"`
|
||||||
|
|
||||||
|
// RetainPods specifies the number of specialized pods that should be retained after serving requests
|
||||||
|
// This is optional. If not specified default value will be taken as 0
|
||||||
|
// +optional
|
||||||
|
RetainPods int `json:"retainPods,omitempty"`
|
||||||
|
|
||||||
// Podspec specifies podspec to use for executor type container based functions
|
// Podspec specifies podspec to use for executor type container based functions
|
||||||
// Different arguments mentioned for container based function are populated inside a pod.
|
// Different arguments mentioned for container based function are populated inside a pod.
|
||||||
// +optional
|
// +optional
|
||||||
@@ -465,12 +475,12 @@ type (
|
|||||||
// created for the function.
|
// created for the function.
|
||||||
// Applicable for executor type newdeploy and container.
|
// Applicable for executor type newdeploy and container.
|
||||||
// +optional
|
// +optional
|
||||||
Metrics []asv2beta2.MetricSpec `json:"hpaMetrics,omitempty"`
|
Metrics []asv2.MetricSpec `json:"hpaMetrics,omitempty"`
|
||||||
|
|
||||||
// hpaBehavior is the behavior of HPA when scaling in up/down direction.
|
// hpaBehavior is the behavior of HPA when scaling in up/down direction.
|
||||||
// Applicable for executor type newdeploy and container.
|
// Applicable for executor type newdeploy and container.
|
||||||
// +optional
|
// +optional
|
||||||
Behavior *asv2beta2.HorizontalPodAutoscalerBehavior `json:"hpaBehavior,omitempty"`
|
Behavior *asv2.HorizontalPodAutoscalerBehavior `json:"hpaBehavior,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FunctionReferenceType refers to type of Function
|
// FunctionReferenceType refers to type of Function
|
||||||
@@ -741,7 +751,7 @@ type (
|
|||||||
// +optional
|
// +optional
|
||||||
FunctionReference FunctionReference `json:"functionref"`
|
FunctionReference FunctionReference `json:"functionref"`
|
||||||
|
|
||||||
// Type of message queue (NATS, Kafka, AzureQueue)
|
// Type of message queue
|
||||||
// +optional
|
// +optional
|
||||||
MessageQueueType MessageQueueType `json:"messageQueueType"`
|
MessageQueueType MessageQueueType `json:"messageQueueType"`
|
||||||
|
|
||||||
@@ -863,3 +873,21 @@ type (
|
|||||||
func (a Archive) IsEmpty() bool {
|
func (a Archive) IsEmpty() bool {
|
||||||
return len(a.Literal) == 0 && len(a.URL) == 0
|
return len(a.Literal) == 0 && len(a.URL) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fn Function) GetConcurrency() int {
|
||||||
|
if fn.Spec.Concurrency == 0 {
|
||||||
|
return DefaultConcurrency
|
||||||
|
}
|
||||||
|
return fn.Spec.Concurrency
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fn Function) GetRetainPods() int {
|
||||||
|
return fn.Spec.RetainPods
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fn Function) GetRequestPerPod() int {
|
||||||
|
if fn.Spec.RequestsPerPod == 0 {
|
||||||
|
return DefaultRequestsPerPod
|
||||||
|
}
|
||||||
|
return fn.Spec.RequestsPerPod
|
||||||
|
}
|
||||||
|
|||||||
@@ -129,25 +129,24 @@ func ValidateKubeLabel(field string, labels map[string]string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ValidateKubePort(field string, port int) error {
|
func ValidateKubePort(field string, port int) error {
|
||||||
result := &multierror.Error{}
|
var err error
|
||||||
|
|
||||||
e := validation.IsValidPortNum(port)
|
e := validation.IsValidPortNum(port)
|
||||||
if len(e) > 0 {
|
if len(e) > 0 {
|
||||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, port, e...))
|
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, port, e...))
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
return result.ErrorOrNil()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateKubeName(field string, val string) error {
|
func ValidateKubeName(field string, val string) error {
|
||||||
result := &multierror.Error{}
|
var err error
|
||||||
|
|
||||||
e := validation.IsDNS1123Label(val)
|
e := validation.IsDNS1123Label(val)
|
||||||
if len(e) > 0 {
|
if len(e) > 0 {
|
||||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, val, e...))
|
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, val, e...))
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.ErrorOrNil()
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateNS is to match the k8s behaviour. Where it is not mandatory to provide a NS. And so we validate it if user has provided one.
|
// validateNS is to match the k8s behaviour. Where it is not mandatory to provide a NS. And so we validate it if user has provided one.
|
||||||
@@ -338,7 +337,7 @@ func (es ExecutionStrategy) Validate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add validation warning
|
// TODO Add validation warning
|
||||||
//if es.SpecializationTimeout < 120 {
|
// if es.SpecializationTimeout < 120 {
|
||||||
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.SpecializationTimeout", es.SpecializationTimeout, "SpecializationTimeout must be a value equal to or greater than 120"))
|
// result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.SpecializationTimeout", es.SpecializationTimeout, "SpecializationTimeout must be a value equal to or greater than 120"))
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@@ -524,11 +523,11 @@ func (spec MessageQueueTriggerSpec) Validate() error {
|
|||||||
if !validator.IsValidMessageQueue((string)(spec.MessageQueueType), spec.MqtKind) {
|
if !validator.IsValidMessageQueue((string)(spec.MessageQueueType), spec.MqtKind) {
|
||||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "MessageQueueTriggerSpec.MessageQueueType", spec.MessageQueueType, "not a supported message queue type"))
|
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "MessageQueueTriggerSpec.MessageQueueType", spec.MessageQueueType, "not a supported message queue type"))
|
||||||
} else {
|
} else {
|
||||||
if !validator.IsValidTopic((string)(spec.MessageQueueType), spec.Topic, spec.MqtKind) {
|
if !validator.IsValidTopic(spec.MqtKind) {
|
||||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.Topic", spec.Topic, "not a valid topic"))
|
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.Topic", spec.Topic, "not a valid topic"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(spec.ResponseTopic) > 0 && !validator.IsValidTopic((string)(spec.MessageQueueType), spec.ResponseTopic, spec.MqtKind) {
|
if len(spec.ResponseTopic) > 0 && !validator.IsValidTopic(spec.MqtKind) {
|
||||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.ResponseTopic", spec.ResponseTopic, "not a valid topic"))
|
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.ResponseTopic", spec.ResponseTopic, "not a valid topic"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !ignore_autogenerated
|
//go:build !ignore_autogenerated
|
||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The Fission Authors.
|
Copyright The Fission Authors.
|
||||||
@@ -22,7 +21,7 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/autoscaling/v2beta2"
|
"k8s.io/api/autoscaling/v2"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
@@ -303,14 +302,14 @@ func (in *ExecutionStrategy) DeepCopyInto(out *ExecutionStrategy) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
if in.Metrics != nil {
|
if in.Metrics != nil {
|
||||||
in, out := &in.Metrics, &out.Metrics
|
in, out := &in.Metrics, &out.Metrics
|
||||||
*out = make([]v2beta2.MetricSpec, len(*in))
|
*out = make([]v2.MetricSpec, len(*in))
|
||||||
for i := range *in {
|
for i := range *in {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if in.Behavior != nil {
|
if in.Behavior != nil {
|
||||||
in, out := &in.Behavior, &out.Behavior
|
in, out := &in.Behavior, &out.Behavior
|
||||||
*out = new(v2beta2.HorizontalPodAutoscalerBehavior)
|
*out = new(v2.HorizontalPodAutoscalerBehavior)
|
||||||
(*in).DeepCopyInto(*out)
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ var map_FunctionSpec = map[string]string{
|
|||||||
"concurrency": "Maximum number of pods to be specialized which will serve requests This is optional. If not specified default value will be taken as 500",
|
"concurrency": "Maximum number of pods to be specialized which will serve requests This is optional. If not specified default value will be taken as 500",
|
||||||
"requestsPerPod": "RequestsPerPod indicates the maximum number of concurrent requests that can be served by a specialized pod This is optional. If not specified default value will be taken as 1",
|
"requestsPerPod": "RequestsPerPod indicates the maximum number of concurrent requests that can be served by a specialized pod This is optional. If not specified default value will be taken as 1",
|
||||||
"onceOnly": "OnceOnly specifies if specialized pod will serve exactly one request in its lifetime and would be garbage collected after serving that one request This is optional. If not specified default value will be taken as false",
|
"onceOnly": "OnceOnly specifies if specialized pod will serve exactly one request in its lifetime and would be garbage collected after serving that one request This is optional. If not specified default value will be taken as false",
|
||||||
|
"retainPods": "RetainPods specifies the number of specialized pods that should be retained after serving requests This is optional. If not specified default value will be taken as 0",
|
||||||
"podspec": "Podspec specifies podspec to use for executor type container based functions Different arguments mentioned for container based function are populated inside a pod.",
|
"podspec": "Podspec specifies podspec to use for executor type container based functions Different arguments mentioned for container based function are populated inside a pod.",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +312,7 @@ func (MessageQueueTriggerList) SwaggerDoc() map[string]string {
|
|||||||
var map_MessageQueueTriggerSpec = map[string]string{
|
var map_MessageQueueTriggerSpec = map[string]string{
|
||||||
"": "MessageQueueTriggerSpec defines a binding from a topic in a message queue to a function.",
|
"": "MessageQueueTriggerSpec defines a binding from a topic in a message queue to a function.",
|
||||||
"functionref": "The reference to a function for message queue trigger to invoke with when receiving messages from subscribed topic.",
|
"functionref": "The reference to a function for message queue trigger to invoke with when receiving messages from subscribed topic.",
|
||||||
"messageQueueType": "Type of message queue (NATS, Kafka, AzureQueue)",
|
"messageQueueType": "Type of message queue",
|
||||||
"topic": "Subscribed topic",
|
"topic": "Subscribed topic",
|
||||||
"respTopic": "Topic for message queue trigger to sent response from function.",
|
"respTopic": "Topic for message queue trigger to sent response from function.",
|
||||||
"errorTopic": "Topic to collect error response sent from function",
|
"errorTopic": "Topic to collect error response sent from function",
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
|
"github.com/hashicorp/go-retryablehttp"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@@ -36,23 +35,29 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Client struct {
|
ClientInterface interface {
|
||||||
|
Build(context.Context, *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
client struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
url string
|
url string
|
||||||
httpClient *http.Client
|
httpClient *retryablehttp.Client
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeClient(logger *zap.Logger, builderUrl string) *Client {
|
func MakeClient(logger *zap.Logger, builderUrl string) ClientInterface {
|
||||||
hc := &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}
|
hc := retryablehttp.NewClient()
|
||||||
return &Client{
|
hc.ErrorHandler = retryablehttp.PassthroughErrorHandler
|
||||||
|
hc.HTTPClient.Transport = otelhttp.NewTransport(hc.HTTPClient.Transport)
|
||||||
|
return &client{
|
||||||
logger: logger.Named("builder_client"),
|
logger: logger.Named("builder_client"),
|
||||||
url: strings.TrimSuffix(builderUrl, "/"),
|
url: strings.TrimSuffix(builderUrl, "/"),
|
||||||
httpClient: hc,
|
httpClient: hc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error) {
|
func (c *client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*builder.PackageBuildResponse, error) {
|
||||||
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
|
logger := otelUtils.LoggerWithTraceID(ctx, c.logger)
|
||||||
|
|
||||||
body, err := json.Marshal(req)
|
body, err := json.Marshal(req)
|
||||||
@@ -60,27 +65,10 @@ func (c *Client) Build(ctx context.Context, req *builder.PackageBuildRequest) (*
|
|||||||
return nil, errors.Wrap(err, "error marshaling json")
|
return nil, errors.Wrap(err, "error marshaling json")
|
||||||
}
|
}
|
||||||
|
|
||||||
maxRetries := 20
|
resp, err := ctxhttp.Post(ctx, c.httpClient.StandardClient(), c.url, "application/json", bytes.NewReader(body))
|
||||||
var resp *http.Response
|
if err != nil {
|
||||||
|
|
||||||
for i := 0; i < maxRetries; i++ {
|
|
||||||
resp, err = ctxhttp.Post(ctx, c.httpClient, c.url, "application/json", bytes.NewReader(body))
|
|
||||||
if err == nil {
|
|
||||||
if resp.StatusCode == 200 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
err = ferror.MakeErrorFromHTTP(resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
if i < maxRetries-1 {
|
|
||||||
time.Sleep(50 * time.Duration(2*i) * time.Millisecond)
|
|
||||||
logger.Error("error building package, retrying", zap.Error(err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
rBody, err := io.ReadAll(resp.Body)
|
rBody, err := io.ReadAll(resp.Body)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package buildermgr
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -28,13 +29,13 @@ import (
|
|||||||
"github.com/fission/fission/pkg/executor/util"
|
"github.com/fission/fission/pkg/executor/util"
|
||||||
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Start the buildermgr service.
|
// Start the buildermgr service.
|
||||||
func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error {
|
func Start(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, storageSvcUrl string) error {
|
||||||
bmLogger := logger.Named("builder_manager")
|
bmLogger := logger.Named("builder_manager")
|
||||||
|
|
||||||
clientGen := crd.NewClientGenerator()
|
|
||||||
fissionClient, err := clientGen.GetFissionClient()
|
fissionClient, err := clientGen.GetFissionClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to get fission client")
|
return errors.Wrap(err, "failed to get fission client")
|
||||||
@@ -44,7 +45,7 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error
|
|||||||
return errors.Wrap(err, "failed to get kubernetes client")
|
return errors.Wrap(err, "failed to get kubernetes client")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = crd.WaitForCRDs(ctx, logger, fissionClient)
|
err = crd.WaitForFunctionCRDs(ctx, logger, fissionClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error waiting for CRDs")
|
return errors.Wrap(err, "error waiting for CRDs")
|
||||||
}
|
}
|
||||||
@@ -55,17 +56,23 @@ func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
podSpecPatch, err := util.GetSpecFromConfigMap(fv1.BuilderPodSpecPath)
|
podSpecPatch, err := util.GetSpecFromConfigMap(fv1.BuilderPodSpecPath)
|
||||||
if err != nil {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
logger.Warn("error reading data for pod spec patch", zap.String("path", fv1.BuilderPodSpecPath), zap.Error(err))
|
logger.Warn("error reading data for pod spec patch", zap.String("path", fv1.BuilderPodSpecPath), zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
envWatcher := makeEnvironmentWatcher(ctx, bmLogger, fissionClient, kubernetesClient, fetcherConfig, podSpecPatch)
|
envWatcher, err := makeEnvironmentWatcher(ctx, bmLogger, fissionClient, kubernetesClient, fetcherConfig, podSpecPatch)
|
||||||
envWatcher.Run(ctx)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
envWatcher.Run(ctx, mgr)
|
||||||
|
|
||||||
pkgWatcher := makePackageWatcher(bmLogger, fissionClient,
|
pkgWatcher := makePackageWatcher(bmLogger, fissionClient,
|
||||||
kubernetesClient, storageSvcUrl,
|
kubernetesClient, storageSvcUrl,
|
||||||
utils.GetK8sInformersForNamespaces(kubernetesClient, time.Minute*30, fv1.Pods),
|
utils.GetK8sInformersForNamespaces(kubernetesClient, time.Minute*30, fv1.Pods),
|
||||||
utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.PackagesResource))
|
utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.PackagesResource))
|
||||||
pkgWatcher.Run(ctx)
|
err = pkgWatcher.Run(ctx, mgr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
k8sCache "k8s.io/client-go/tools/cache"
|
k8sCache "k8s.io/client-go/tools/cache"
|
||||||
@@ -39,6 +39,7 @@ import (
|
|||||||
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
|
||||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -63,7 +64,7 @@ type (
|
|||||||
|
|
||||||
environmentWatcher struct {
|
environmentWatcher struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
cache map[string]*builderInfo
|
cache map[types.UID]*builderInfo
|
||||||
fissionClient versioned.Interface
|
fissionClient versioned.Interface
|
||||||
kubernetesClient kubernetes.Interface
|
kubernetesClient kubernetes.Interface
|
||||||
nsResolver *utils.NamespaceResolver
|
nsResolver *utils.NamespaceResolver
|
||||||
@@ -81,7 +82,7 @@ func makeEnvironmentWatcher(
|
|||||||
fissionClient versioned.Interface,
|
fissionClient versioned.Interface,
|
||||||
kubernetesClient kubernetes.Interface,
|
kubernetesClient kubernetes.Interface,
|
||||||
fetcherConfig *fetcherConfig.Config,
|
fetcherConfig *fetcherConfig.Config,
|
||||||
podSpecPatch *apiv1.PodSpec) *environmentWatcher {
|
podSpecPatch *apiv1.PodSpec) (*environmentWatcher, error) {
|
||||||
|
|
||||||
useIstio := false
|
useIstio := false
|
||||||
enableIstio := os.Getenv("ENABLE_ISTIO")
|
enableIstio := os.Getenv("ENABLE_ISTIO")
|
||||||
@@ -97,7 +98,7 @@ func makeEnvironmentWatcher(
|
|||||||
|
|
||||||
envWatcher := &environmentWatcher{
|
envWatcher := &environmentWatcher{
|
||||||
logger: logger.Named("environment_watcher"),
|
logger: logger.Named("environment_watcher"),
|
||||||
cache: make(map[string]*builderInfo),
|
cache: make(map[types.UID]*builderInfo),
|
||||||
fissionClient: fissionClient,
|
fissionClient: fissionClient,
|
||||||
kubernetesClient: kubernetesClient,
|
kubernetesClient: kubernetesClient,
|
||||||
nsResolver: utils.DefaultNSResolver(),
|
nsResolver: utils.DefaultNSResolver(),
|
||||||
@@ -108,8 +109,11 @@ func makeEnvironmentWatcher(
|
|||||||
envWatchInformer: utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.EnvironmentResource),
|
envWatchInformer: utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.EnvironmentResource),
|
||||||
}
|
}
|
||||||
|
|
||||||
envWatcher.EnvWatchEventHandlers(ctx)
|
err := envWatcher.EnvWatchEventHandlers(ctx)
|
||||||
return envWatcher
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return envWatcher, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *environmentWatcher) getDeploymentLabels(envName string) map[string]string {
|
func (env *environmentWatcher) getDeploymentLabels(envName string) map[string]string {
|
||||||
@@ -128,15 +132,13 @@ func (envw *environmentWatcher) getLabels(envName string, envNamespace string, e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (envw *environmentWatcher) Run(ctx context.Context) {
|
func (envw *environmentWatcher) Run(ctx context.Context, mgr manager.Interface) {
|
||||||
for _, informer := range envw.envWatchInformer {
|
mgr.AddInformers(ctx, envw.envWatchInformer)
|
||||||
go informer.Run(ctx.Done())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) {
|
func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) error {
|
||||||
for _, informer := range envw.envWatchInformer {
|
for _, informer := range envw.envWatchInformer {
|
||||||
informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
|
_, err := informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
envObj := obj.(*fv1.Environment)
|
envObj := obj.(*fv1.Environment)
|
||||||
envw.AddUpdateBuilder(ctx, envObj)
|
envw.AddUpdateBuilder(ctx, envObj)
|
||||||
@@ -153,19 +155,23 @@ func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) {
|
|||||||
envw.DeleteBuilder(ctx, envObj)
|
envw.DeleteBuilder(ctx, envObj)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.Environment) {
|
func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.Environment) {
|
||||||
//builder is not supported with v1 interface and ignore env without builder image
|
// builder is not supported with v1 interface and ignore env without builder image
|
||||||
if env.Spec.Version != 1 && len(env.Spec.Builder.Image) != 0 {
|
if env.Spec.Version != 1 && len(env.Spec.Builder.Image) != 0 {
|
||||||
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; !ok {
|
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; !ok {
|
||||||
builderInfo, err := envw.createBuilder(ctx, env, envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace))
|
builderInfo, err := envw.createBuilder(ctx, env, envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
envw.logger.Error("error creating builder service", zap.Error(err))
|
envw.logger.Error("error creating builder service", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
envw.cache[crd.CacheKeyUID(&env.ObjectMeta)] = builderInfo
|
envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)] = builderInfo
|
||||||
} else {
|
} else {
|
||||||
envw.DeleteBuilder(ctx, env)
|
envw.DeleteBuilder(ctx, env)
|
||||||
// once older builder deleted then add new builder service
|
// once older builder deleted then add new builder service
|
||||||
@@ -174,16 +180,16 @@ func (envw *environmentWatcher) AddUpdateBuilder(ctx context.Context, env *fv1.E
|
|||||||
envw.logger.Error("error updating builder service", zap.Error(err))
|
envw.logger.Error("error updating builder service", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
envw.cache[crd.CacheKeyUID(&env.ObjectMeta)] = builderInfo
|
envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)] = builderInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (envw *environmentWatcher) DeleteBuilder(ctx context.Context, env *fv1.Environment) {
|
func (envw *environmentWatcher) DeleteBuilder(ctx context.Context, env *fv1.Environment) {
|
||||||
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
|
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
|
||||||
envw.DeleteBuilderService(ctx, env)
|
envw.DeleteBuilderService(ctx, env)
|
||||||
envw.DeleteBuilderDeployment(ctx, env)
|
envw.DeleteBuilderDeployment(ctx, env)
|
||||||
delete(envw.cache, crd.CacheKeyUID(&env.ObjectMeta))
|
delete(envw.cache, crd.CacheKeyUIDFromMeta(&env.ObjectMeta))
|
||||||
envw.logger.Info("builder service deleted", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
|
envw.logger.Info("builder service deleted", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
|
||||||
} else {
|
} else {
|
||||||
envw.logger.Debug("builder service not found", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
|
envw.logger.Debug("builder service not found", zap.String("env_name", env.ObjectMeta.Name), zap.String("namespace", envw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)))
|
||||||
@@ -198,7 +204,7 @@ func (envw *environmentWatcher) DeleteBuilderService(ctx context.Context, env *f
|
|||||||
}
|
}
|
||||||
for _, svc := range svcList {
|
for _, svc := range svcList {
|
||||||
envName := svc.ObjectMeta.Labels[LABEL_ENV_NAME]
|
envName := svc.ObjectMeta.Labels[LABEL_ENV_NAME]
|
||||||
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
|
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
|
||||||
err := envw.deleteBuilderServiceByName(ctx, svc.ObjectMeta.Name, svc.ObjectMeta.Namespace)
|
err := envw.deleteBuilderServiceByName(ctx, svc.ObjectMeta.Name, svc.ObjectMeta.Namespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
envw.logger.Error("error removing builder service", zap.Error(err),
|
envw.logger.Error("error removing builder service", zap.Error(err),
|
||||||
@@ -222,7 +228,7 @@ func (envw *environmentWatcher) DeleteBuilderDeployment(ctx context.Context, env
|
|||||||
envw.logger.Error("error getting the builder deployment list", zap.Error(err))
|
envw.logger.Error("error getting the builder deployment list", zap.Error(err))
|
||||||
}
|
}
|
||||||
for _, deploy := range deployList {
|
for _, deploy := range deployList {
|
||||||
if _, ok := envw.cache[crd.CacheKeyUID(&env.ObjectMeta)]; ok {
|
if _, ok := envw.cache[crd.CacheKeyUIDFromMeta(&env.ObjectMeta)]; ok {
|
||||||
err := envw.deleteBuilderDeploymentByName(ctx, deploy.ObjectMeta.Name, deploy.ObjectMeta.Namespace)
|
err := envw.deleteBuilderDeploymentByName(ctx, deploy.ObjectMeta.Name, deploy.ObjectMeta.Namespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
envw.logger.Error("error removing builder deployment", zap.Error(err),
|
envw.logger.Error("error removing builder deployment", zap.Error(err),
|
||||||
@@ -252,9 +258,7 @@ func (envw *environmentWatcher) createBuilder(ctx context.Context, env *fv1.Envi
|
|||||||
if len(svcList) == 0 {
|
if len(svcList) == 0 {
|
||||||
svc, err = envw.createBuilderService(ctx, env, ns)
|
svc, err = envw.createBuilderService(ctx, env, ns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err,
|
return nil, fmt.Errorf("error creating builder service for environment in namespace %s %s: %w", env.ObjectMeta.Name, ns, err)
|
||||||
fmt.Sprintf("error creating builder service for environment in namespace %s %s", env.ObjectMeta.Name, ns))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if len(svcList) == 1 {
|
} else if len(svcList) == 1 {
|
||||||
svc = &svcList[0]
|
svc = &svcList[0]
|
||||||
@@ -270,8 +274,7 @@ func (envw *environmentWatcher) createBuilder(ctx context.Context, env *fv1.Envi
|
|||||||
if len(deployList) == 0 {
|
if len(deployList) == 0 {
|
||||||
deploy, err = envw.createBuilderDeployment(ctx, env, ns)
|
deploy, err = envw.createBuilderDeployment(ctx, env, ns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, fmt.Sprintf("error creating builder deployment for environment in namespace %s %s", env.ObjectMeta.Name, ns))
|
return nil, fmt.Errorf("error creating builder deployment for environment in namespace %s %s: %w", env.ObjectMeta.Name, ns, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if len(deployList) == 1 {
|
} else if len(deployList) == 1 {
|
||||||
deploy = &deployList[0]
|
deploy = &deployList[0]
|
||||||
@@ -291,7 +294,7 @@ func (envw *environmentWatcher) deleteBuilderServiceByName(ctx context.Context,
|
|||||||
Services(namespace).
|
Services(namespace).
|
||||||
Delete(ctx, name, delOpt)
|
Delete(ctx, name, delOpt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error deleting builder service %s.%s", name, namespace)
|
return fmt.Errorf("error deleting builder service %s.%s: %w", name, namespace, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -301,7 +304,7 @@ func (envw *environmentWatcher) deleteBuilderDeploymentByName(ctx context.Contex
|
|||||||
Deployments(namespace).
|
Deployments(namespace).
|
||||||
Delete(ctx, name, delOpt)
|
Delete(ctx, name, delOpt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error deleting builder deployment %s.%s", name, namespace)
|
return fmt.Errorf("error deleting builder deployment %s.%s: %w", name, namespace, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -313,7 +316,7 @@ func (envw *environmentWatcher) getBuilderServiceList(ctx context.Context, sel m
|
|||||||
LabelSelector: labels.Set(sel).AsSelector().String(),
|
LabelSelector: labels.Set(sel).AsSelector().String(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error getting builder service list")
|
return nil, fmt.Errorf("error getting builder service list for namespace %s: %w", ns, err)
|
||||||
}
|
}
|
||||||
return svcList.Items, nil
|
return svcList.Items, nil
|
||||||
}
|
}
|
||||||
@@ -367,7 +370,7 @@ func (envw *environmentWatcher) getBuilderDeploymentList(ctx context.Context, se
|
|||||||
LabelSelector: labels.Set(sel).AsSelector().String(),
|
LabelSelector: labels.Set(sel).AsSelector().String(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error getting builder deployment list")
|
return nil, fmt.Errorf("error getting builder deployment list for namespace %s: %w", ns, err)
|
||||||
}
|
}
|
||||||
return deployList.Items, nil
|
return deployList.Items, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/cache"
|
"github.com/fission/fission/pkg/cache"
|
||||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
"github.com/fission/fission/pkg/utils/metrics"
|
"github.com/fission/fission/pkg/utils/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ func (pkgw *packageWatcher) build(ctx context.Context, srcpkg *fv1.Package) {
|
|||||||
healthCheckBackOff := utils.NewDefaultBackOff()
|
healthCheckBackOff := utils.NewDefaultBackOff()
|
||||||
builderNs := pkgw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)
|
builderNs := pkgw.nsResolver.GetBuilderNS(env.ObjectMeta.Namespace)
|
||||||
|
|
||||||
//if err != nil {
|
// if err != nil {
|
||||||
// pkgw.logger.Error("Unable to create BackOff for Health Check", zap.Error(err))
|
// pkgw.logger.Error("Unable to create BackOff for Health Check", zap.Error(err))
|
||||||
//}
|
//}
|
||||||
// Do health check for environment builder pod
|
// Do health check for environment builder pod
|
||||||
@@ -308,15 +309,21 @@ func (pkgw *packageWatcher) packageInformerHandler(ctx context.Context) k8sCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pkgw *packageWatcher) Run(ctx context.Context) {
|
func (pkgw *packageWatcher) Run(ctx context.Context, mgr manager.Interface) error {
|
||||||
go metrics.ServeMetrics(ctx, pkgw.logger)
|
|
||||||
for _, podInformer := range pkgw.podInformer {
|
mgr.Add(ctx, func(ctx context.Context) {
|
||||||
go podInformer.Run(ctx.Done())
|
metrics.ServeMetrics(ctx, "buildermgr", pkgw.logger, mgr)
|
||||||
}
|
})
|
||||||
|
mgr.AddInformers(ctx, pkgw.podInformer)
|
||||||
for _, pkgInformer := range pkgw.pkgInformer {
|
for _, pkgInformer := range pkgw.pkgInformer {
|
||||||
pkgInformer.AddEventHandler(pkgw.packageInformerHandler(ctx))
|
_, err := pkgInformer.AddEventHandler(pkgw.packageInformerHandler(ctx))
|
||||||
go pkgInformer.Run(ctx.Done())
|
if err != nil {
|
||||||
|
pkgw.logger.Fatal("error adding package informer handler", zap.Error(err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mgr.AddInformers(ctx, pkgw.pkgInformer)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setInitialBuildStatus sets initial build status to a package if it is empty.
|
// setInitialBuildStatus sets initial build status to a package if it is empty.
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ package canaryconfigmgr
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@@ -35,6 +35,7 @@ import (
|
|||||||
"github.com/fission/fission/pkg/crd"
|
"github.com/fission/fission/pkg/crd"
|
||||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
||||||
"github.com/fission/fission/pkg/utils"
|
"github.com/fission/fission/pkg/utils"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -78,7 +79,7 @@ func MakeCanaryConfigMgr(ctx context.Context, logger *zap.Logger, fissionClient
|
|||||||
|
|
||||||
_, err := url.Parse(prometheusSvc)
|
_, err := url.Parse(prometheusSvc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Errorf("prometheus service url not found/invalid, can't create canary config manager: %v", prometheusSvc)
|
return nil, fmt.Errorf("prometheus service url not found/invalid, can't create canary config manager: %s", prometheusSvc)
|
||||||
}
|
}
|
||||||
|
|
||||||
promClient, err := MakePrometheusClient(logger, prometheusSvc)
|
promClient, err := MakePrometheusClient(logger, prometheusSvc)
|
||||||
@@ -94,13 +95,16 @@ func MakeCanaryConfigMgr(ctx context.Context, logger *zap.Logger, fissionClient
|
|||||||
canaryCfgCancelFuncMap: makecanaryConfigCancelFuncMap(),
|
canaryCfgCancelFuncMap: makecanaryConfigCancelFuncMap(),
|
||||||
}
|
}
|
||||||
configMgr.canaryConfigInformer = utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.CanaryConfigResource)
|
configMgr.canaryConfigInformer = utils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.CanaryConfigResource)
|
||||||
configMgr.CanaryConfigEventHandlers(ctx)
|
err = configMgr.CanaryConfigEventHandlers(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return configMgr, nil
|
return configMgr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Context) {
|
func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Context) error {
|
||||||
for _, informer := range canaryCfgMgr.canaryConfigInformer {
|
for _, informer := range canaryCfgMgr.canaryConfigInformer {
|
||||||
informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
|
_, err := informer.AddEventHandler(k8sCache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
canaryConfig := obj.(*fv1.CanaryConfig)
|
canaryConfig := obj.(*fv1.CanaryConfig)
|
||||||
if canaryConfig.Status.Status == fv1.CanaryConfigStatusPending {
|
if canaryConfig.Status.Status == fv1.CanaryConfigStatusPending {
|
||||||
@@ -126,13 +130,15 @@ func (canaryCfgMgr *canaryConfigMgr) CanaryConfigEventHandlers(ctx context.Conte
|
|||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canaryCfgMgr *canaryConfigMgr) Run(ctx context.Context) {
|
func (canaryCfgMgr *canaryConfigMgr) Run(ctx context.Context, mgr manager.Interface) {
|
||||||
for _, informer := range canaryCfgMgr.canaryConfigInformer {
|
mgr.AddInformers(ctx, canaryCfgMgr.canaryConfigInformer)
|
||||||
go informer.Run(ctx.Done())
|
|
||||||
}
|
|
||||||
canaryCfgMgr.logger.Info("started canary configmgr controller")
|
canaryCfgMgr.logger.Info("started canary configmgr controller")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,9 +380,8 @@ func (canaryCfgMgr *canaryConfigMgr) updateHttpTriggerWithRetries(ctx context.Co
|
|||||||
for i := 0; i < maxRetries; i++ {
|
for i := 0; i < maxRetries; i++ {
|
||||||
triggerObj, err := canaryCfgMgr.fissionClient.CoreV1().HTTPTriggers(triggerNamespace).Get(ctx, triggerName, metav1.GetOptions{})
|
triggerObj, err := canaryCfgMgr.fissionClient.CoreV1().HTTPTriggers(triggerNamespace).Get(ctx, triggerName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e := "error getting http trigger object"
|
canaryCfgMgr.logger.Error("error getting http trigger object", zap.Error(err), zap.String("trigger_name", triggerName), zap.String("trigger_namespace", triggerNamespace))
|
||||||
canaryCfgMgr.logger.Error(e, zap.Error(err), zap.String("trigger_name", triggerName), zap.String("trigger_namespace", triggerNamespace))
|
return fmt.Errorf("error getting http trigger object: %w", err)
|
||||||
return errors.Wrap(err, e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerObj.Spec.FunctionReference.FunctionWeights = fnWeights
|
triggerObj.Spec.FunctionReference.FunctionWeights = fnWeights
|
||||||
@@ -394,11 +399,11 @@ func (canaryCfgMgr *canaryConfigMgr) updateHttpTriggerWithRetries(ctx context.Co
|
|||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
e := "error updating http trigger"
|
e := "error updating http trigger"
|
||||||
canaryCfgMgr.logger.Error(e,
|
canaryCfgMgr.logger.Error("error updating http trigger",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("trigger_name", triggerName),
|
zap.String("trigger_name", triggerName),
|
||||||
zap.String("trigger_namespace", triggerNamespace))
|
zap.String("trigger_namespace", triggerNamespace))
|
||||||
return errors.Wrapf(err, "%s: %s.%s", e, triggerName, triggerNamespace)
|
return fmt.Errorf("%s: %s.%s %w", e, triggerName, triggerNamespace, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +420,7 @@ func (canaryCfgMgr *canaryConfigMgr) updateCanaryConfigStatusWithRetries(ctx con
|
|||||||
zap.String("name", cfgName),
|
zap.String("name", cfgName),
|
||||||
zap.String("namespace", cfgNamespace),
|
zap.String("namespace", cfgNamespace),
|
||||||
zap.String("status", status))
|
zap.String("status", status))
|
||||||
return errors.Wrap(err, e)
|
return fmt.Errorf("%s: %s.%s %w", e, cfgName, cfgNamespace, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
canaryCfgMgr.logger.Info("updating status of canary config",
|
canaryCfgMgr.logger.Info("updating status of canary config",
|
||||||
@@ -444,7 +449,7 @@ func (canaryCfgMgr *canaryConfigMgr) updateCanaryConfigStatusWithRetries(ctx con
|
|||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("name", cfgName),
|
zap.String("name", cfgName),
|
||||||
zap.String("namespace", cfgNamespace))
|
zap.String("namespace", cfgNamespace))
|
||||||
return errors.Wrapf(err, "%s: %s.%s", e, cfgName, cfgNamespace)
|
return fmt.Errorf("%s: %s.%s %w", e, cfgName, cfgNamespace, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,20 +557,19 @@ func getEnvValue(envVar string) string {
|
|||||||
return envVarSplit[1]
|
return envVarSplit[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartCanaryServer(ctx context.Context, logger *zap.Logger, unitTestFlag bool) error {
|
func StartCanaryServer(ctx context.Context, clientGen crd.ClientGeneratorInterface, logger *zap.Logger, mgr manager.Interface, unitTestFlag bool) error {
|
||||||
cLogger := logger.Named("CanaryServer")
|
cLogger := logger.Named("CanaryServer")
|
||||||
|
|
||||||
clientGen := crd.NewClientGenerator()
|
|
||||||
fissionClient, err := clientGen.GetFissionClient()
|
fissionClient, err := clientGen.GetFissionClient()
|
||||||
if err != nil {
|
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()
|
kubernetesClient, err := clientGen.GetKubernetesClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to get kubernetes client")
|
return fmt.Errorf("failed to get kubernetes client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ConfigureFeatures(ctx, cLogger, unitTestFlag, fissionClient, kubernetesClient)
|
err = ConfigureFeatures(ctx, cLogger, unitTestFlag, fissionClient, kubernetesClient, mgr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cLogger.Error("error configuring features - proceeding without optional features", zap.Error(err))
|
cLogger.Error("error configuring features - proceeding without optional features", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,17 +25,19 @@ import (
|
|||||||
|
|
||||||
config "github.com/fission/fission/pkg/featureconfig"
|
config "github.com/fission/fission/pkg/featureconfig"
|
||||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
||||||
|
"github.com/fission/fission/pkg/utils/manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigureFeatures gets the feature config and configures the features that are enabled
|
// ConfigureFeatures gets the feature config and configures the features that are enabled
|
||||||
func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode bool, fissionClient versioned.Interface, kubeClient kubernetes.Interface) error {
|
func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode bool, fissionClient versioned.Interface,
|
||||||
|
kubeClient kubernetes.Interface, mgr manager.Interface) error {
|
||||||
// set feature enabled to false if unitTestMode
|
// set feature enabled to false if unitTestMode
|
||||||
if unitTestMode {
|
if unitTestMode {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the featureConfig from config map mounted onto the file system
|
// get the featureConfig from config map mounted onto the file system
|
||||||
featureConfig, err := config.GetFeatureConfig()
|
featureConfig, err := config.GetFeatureConfig(logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("error getting feature config", zap.Error(err))
|
logger.Error("error getting feature config", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
@@ -47,7 +49,7 @@ func ConfigureFeatures(ctx context.Context, logger *zap.Logger, unitTestMode boo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to start canary config manager")
|
return errors.Wrap(err, "failed to start canary config manager")
|
||||||
}
|
}
|
||||||
canaryCfgMgr.Run(ctx)
|
canaryCfgMgr.Run(ctx, mgr)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,271 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
apiv1 "k8s.io/api/core/v1"
|
|
||||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
|
|
||||||
ferror "github.com/fission/fission/pkg/error"
|
|
||||||
"github.com/fission/fission/pkg/fission-cli/logdb"
|
|
||||||
"github.com/fission/fission/pkg/generated/clientset/versioned"
|
|
||||||
"github.com/fission/fission/pkg/info"
|
|
||||||
"github.com/fission/fission/pkg/utils"
|
|
||||||
"github.com/fission/fission/pkg/utils/httpserver"
|
|
||||||
"github.com/fission/fission/pkg/utils/metrics"
|
|
||||||
"github.com/fission/fission/pkg/utils/otel"
|
|
||||||
)
|
|
||||||
|
|
||||||
var podNamespace string
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
podNamespace = os.Getenv("POD_NAMESPACE")
|
|
||||||
if podNamespace == "" {
|
|
||||||
podNamespace = "fission"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
|
||||||
API struct {
|
|
||||||
logger *zap.Logger
|
|
||||||
fissionClient versioned.Interface
|
|
||||||
kubernetesClient kubernetes.Interface
|
|
||||||
storageServiceUrl string
|
|
||||||
builderManagerUrl string
|
|
||||||
workflowApiUrl string
|
|
||||||
functionNamespace string
|
|
||||||
featureStatus map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
logDBConfig struct {
|
|
||||||
httpURL string
|
|
||||||
username string
|
|
||||||
password string
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func MakeAPI(logger *zap.Logger, fissionClient versioned.Interface, kubernetesClient kubernetes.Interface) (*API, error) {
|
|
||||||
api, err := makeCRDBackedAPI(logger, fissionClient, kubernetesClient)
|
|
||||||
|
|
||||||
u := os.Getenv("STORAGE_SERVICE_URL")
|
|
||||||
if len(u) > 0 {
|
|
||||||
api.storageServiceUrl = strings.TrimSuffix(u, "/")
|
|
||||||
} else {
|
|
||||||
api.storageServiceUrl = "http://storagesvc"
|
|
||||||
}
|
|
||||||
|
|
||||||
u = os.Getenv("BUILDER_MANAGER_URL")
|
|
||||||
if len(u) > 0 {
|
|
||||||
api.builderManagerUrl = strings.TrimSuffix(u, "/")
|
|
||||||
} else {
|
|
||||||
api.builderManagerUrl = "http://buildermgr"
|
|
||||||
}
|
|
||||||
|
|
||||||
wfEnv := os.Getenv("WORKFLOW_API_URL")
|
|
||||||
if len(u) > 0 {
|
|
||||||
api.workflowApiUrl = strings.TrimSuffix(wfEnv, "/")
|
|
||||||
} else {
|
|
||||||
api.workflowApiUrl = "http://workflows-apiserver"
|
|
||||||
}
|
|
||||||
|
|
||||||
nsResolver := utils.DefaultNSResolver()
|
|
||||||
api.functionNamespace = nsResolver.ResolveNamespace(os.Getenv(utils.ENV_FUNCTION_NAMESPACE))
|
|
||||||
|
|
||||||
return api, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) respondWithSuccess(w http.ResponseWriter, resp []byte) {
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
_, err := w.Write(resp)
|
|
||||||
if err != nil {
|
|
||||||
// this will probably fail too, but try anyway
|
|
||||||
api.respondWithError(w, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) respondWithError(w http.ResponseWriter, err error) {
|
|
||||||
// this error type comes with an HTTP code, so just use that
|
|
||||||
se, ok := err.(*kerrors.StatusError)
|
|
||||||
if ok {
|
|
||||||
api.logger.Error(err.Error(), zap.Int32("code", se.ErrStatus.Code))
|
|
||||||
http.Error(w, se.Error(), int(se.ErrStatus.Code))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
code, msg := ferror.GetHTTPError(err)
|
|
||||||
api.logger.Error(msg, zap.Int("code", code))
|
|
||||||
http.Error(w, msg, code)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) extractQueryParamFromRequest(r *http.Request, queryParam string) string {
|
|
||||||
values := r.URL.Query()
|
|
||||||
return values.Get(queryParam)
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if namespace exists, if not create it.
|
|
||||||
func (api *API) createNsIfNotExists(ctx context.Context, ns string) error {
|
|
||||||
if ns == metav1.NamespaceDefault {
|
|
||||||
// we don't have to create default ns
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := api.kubernetesClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{})
|
|
||||||
if err != nil && kerrors.IsNotFound(err) {
|
|
||||||
ns := &apiv1.Namespace{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: ns,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
_, err = api.kubernetesClient.CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{})
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) getLogDBConfig(dbType string) logDBConfig {
|
|
||||||
dbType = strings.ToUpper(dbType)
|
|
||||||
// retrieve db auth config from the env
|
|
||||||
url := os.Getenv(fmt.Sprintf("%s_URL", dbType))
|
|
||||||
if url == "" {
|
|
||||||
// set up default database url
|
|
||||||
url = logdb.INFLUXDB_URL
|
|
||||||
}
|
|
||||||
username := os.Getenv(fmt.Sprintf("%s_USERNAME", dbType))
|
|
||||||
password := os.Getenv(fmt.Sprintf("%s_PASSWORD", dbType))
|
|
||||||
return logDBConfig{
|
|
||||||
httpURL: url,
|
|
||||||
username: username,
|
|
||||||
password: password,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) HomeHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
_, err := w.Write([]byte(info.ApiInfo().String()))
|
|
||||||
if err != nil {
|
|
||||||
api.respondWithError(w, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) ApiVersionMismatchHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
err := ferror.MakeError(ferror.ErrorNotFound, "Fission server supports API v2 only -- v1 is not supported. Please upgrade your Fission client/CLI.")
|
|
||||||
api.respondWithError(w, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) HealthHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) GetSvcName(w http.ResponseWriter, r *http.Request) {
|
|
||||||
appLabelSelector := "application=" + r.URL.Query().Get("application")
|
|
||||||
services, err := api.kubernetesClient.CoreV1().Services(podNamespace).List(r.Context(), metav1.ListOptions{
|
|
||||||
LabelSelector: appLabelSelector,
|
|
||||||
})
|
|
||||||
if err != nil || len(services.Items) > 1 || len(services.Items) == 0 {
|
|
||||||
api.respondWithError(w, err)
|
|
||||||
}
|
|
||||||
service := services.Items[0]
|
|
||||||
fmt.Fprintf(w, service.Name+"."+podNamespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) GetHandler() http.Handler {
|
|
||||||
r := mux.NewRouter()
|
|
||||||
r.Use(metrics.HTTPMetricMiddleware)
|
|
||||||
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
|
|
||||||
// Give a useful error message if an older CLI attempts to make a request
|
|
||||||
r.HandleFunc(`/v1/{rest:[a-zA-Z0-9=\-\/]+}`, api.ApiVersionMismatchHandler)
|
|
||||||
r.HandleFunc("/", api.HomeHandler)
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/packages", api.PackageApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/packages", api.PackageApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/packages/{package}", api.PackageApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/packages/{package}", api.PackageApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/packages/{package}", api.PackageApiDelete).Methods("DELETE")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/functions", api.FunctionApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/functions", api.FunctionApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/functions/{function}", api.FunctionApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/functions/{function}", api.FunctionApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/functions/{function}", api.FunctionApiDelete).Methods("DELETE")
|
|
||||||
r.HandleFunc("/v2/functions/{function}/pods", api.FunctionApiPodList).Methods("GET")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/triggers/http", api.HTTPTriggerApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/http", api.HTTPTriggerApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/triggers/http/{httpTrigger}", api.HTTPTriggerApiDelete).Methods("DELETE")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/environments", api.EnvironmentApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/environments", api.EnvironmentApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/environments/{environment}", api.EnvironmentApiDelete).Methods("DELETE")
|
|
||||||
r.HandleFunc("/v2/environments/{environment}/pods", api.EnvironmentApiPodList).Methods("GET")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/watches", api.WatchApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/watches", api.WatchApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/watches/{watch}", api.WatchApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/watches/{watch}", api.WatchApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/watches/{watch}", api.WatchApiDelete).Methods("DELETE")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/triggers/time", api.TimeTriggerApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/time", api.TimeTriggerApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/triggers/time/{timeTrigger}", api.TimeTriggerApiDelete).Methods("DELETE")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/triggers/messagequeue", api.MessageQueueTriggerApiList).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/messagequeue", api.MessageQueueTriggerApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/secrets/{secret}", api.SecretExists).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/configmaps/{configmap}", api.ConfigMapExists).Methods("GET")
|
|
||||||
|
|
||||||
r.HandleFunc("/v2/canaryconfigs", api.CanaryConfigApiCreate).Methods("POST")
|
|
||||||
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiGet).Methods("GET")
|
|
||||||
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiUpdate).Methods("PUT")
|
|
||||||
r.HandleFunc("/v2/canaryconfigs/{canaryConfig}", api.CanaryConfigApiDelete).Methods("DELETE")
|
|
||||||
r.HandleFunc("/v2/canaryconfigs", api.CanaryConfigApiList).Methods("GET")
|
|
||||||
|
|
||||||
r.HandleFunc("/proxy/{dbType}", api.FunctionLogsApiPost).Methods("POST")
|
|
||||||
r.HandleFunc("/proxy/storage/v1/archive", api.StorageServiceProxy)
|
|
||||||
r.HandleFunc("/proxy/logs/{function}", api.FunctionPodLogs).Methods("POST")
|
|
||||||
r.HandleFunc("/proxy/workflows-apiserver/{path:.*}", api.WorkflowApiserverProxy) // Deprecated
|
|
||||||
r.HandleFunc("/proxy/svcname", api.GetSvcName).Queries("application", "").Methods("GET")
|
|
||||||
|
|
||||||
r.Handle("/v2/apidocs.json", openAPI()).Methods("GET")
|
|
||||||
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func (api *API) Serve(ctx context.Context, port int) {
|
|
||||||
handler := otel.GetHandlerWithOTEL(api.GetHandler(), "fission-controller", otel.UrlsToIgnore("/healthz"))
|
|
||||||
go metrics.ServeMetrics(ctx, api.logger)
|
|
||||||
httpserver.StartServer(ctx, api.logger, "controller", fmt.Sprintf("%d", port), handler)
|
|
||||||
}
|
|
||||||
@@ -1,554 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
v1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
"github.com/fission/fission/pkg/controller/client"
|
|
||||||
"github.com/fission/fission/pkg/controller/client/rest"
|
|
||||||
"github.com/fission/fission/pkg/crd"
|
|
||||||
ferror "github.com/fission/fission/pkg/error"
|
|
||||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
|
||||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// g struct {
|
|
||||||
// cmd.CommandActioner
|
|
||||||
// }
|
|
||||||
testNS = metav1.NamespaceDefault
|
|
||||||
)
|
|
||||||
|
|
||||||
func panicIf(err error) {
|
|
||||||
if err != nil {
|
|
||||||
log.Panicf("err: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func assert(c bool, msg string) {
|
|
||||||
if !c {
|
|
||||||
log.Fatalf("assert failed: %v", msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func assertNameReuseFailure(err error, name string) {
|
|
||||||
assert(err != nil, "recreating "+name+" with same name must fail")
|
|
||||||
fe, ok := err.(ferror.Error)
|
|
||||||
assert(ok, "error must be a fission Error")
|
|
||||||
assert(fe.Code == ferror.ErrorNameExists, "error must be a name exists error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func assertNotFoundFailure(err error, name string) {
|
|
||||||
assert(err != nil, "requesting a non-existent "+name+" must fail")
|
|
||||||
fe, ok := err.(ferror.Error)
|
|
||||||
assert(ok, "error must be a fission Error")
|
|
||||||
if fe.Code != ferror.ErrorNotFound {
|
|
||||||
log.Fatalf("error must be a not found error: %v", fe)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func assertCronSpecFails(err error) {
|
|
||||||
assert(err != nil, "using an invalid cron spec must fail")
|
|
||||||
ok := strings.Contains(err.Error(), "not a valid cron spec")
|
|
||||||
assert(ok, "invalid cron spec must fail")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFunctionApi(t *testing.T) {
|
|
||||||
testFunc := &fv1.Function{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.FunctionSpec{
|
|
||||||
Environment: fv1.EnvironmentReference{
|
|
||||||
Name: "nodejs",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Package: fv1.FunctionPackageRef{
|
|
||||||
FunctionName: "xxx",
|
|
||||||
PackageRef: fv1.PackageRef{
|
|
||||||
Namespace: testNS,
|
|
||||||
Name: "xxx",
|
|
||||||
ResourceVersion: "12345",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
|
|
||||||
_, err := dClient.V1().Function().Get(&metav1.ObjectMeta{
|
|
||||||
Name: testFunc.ObjectMeta.Name,
|
|
||||||
Namespace: testNS,
|
|
||||||
})
|
|
||||||
assertNotFoundFailure(err, "function")
|
|
||||||
|
|
||||||
m, err := dClient.V1().Function().Create(testFunc)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().Function().Delete(m)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = dClient.V1().Function().Create(testFunc)
|
|
||||||
assertNameReuseFailure(err, "function")
|
|
||||||
|
|
||||||
testFunc.ObjectMeta.ResourceVersion = m.ResourceVersion
|
|
||||||
testFunc.Spec.Package.FunctionName = "yyy"
|
|
||||||
_, err = dClient.V1().Function().Update(testFunc)
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
testFunc.ObjectMeta.ResourceVersion = ""
|
|
||||||
testFunc.ObjectMeta.Name = "bar"
|
|
||||||
m2, err := dClient.V1().Function().Create(testFunc)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().Function().Delete(m2)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
funcs, err := dClient.V1().Function().List(testNS)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(funcs) == 2, fmt.Sprintf("created two functions, but found %v", len(funcs)))
|
|
||||||
|
|
||||||
funcs_url := dClient.ServerURL() + "/v2/functions"
|
|
||||||
resp, err := http.Get(funcs_url)
|
|
||||||
panicIf(err)
|
|
||||||
defer resp.Body.Close()
|
|
||||||
assert(resp.StatusCode == 200, "http get status code on /v1/functions")
|
|
||||||
|
|
||||||
var found bool = false
|
|
||||||
for _, b := range resp.Header["Content-Type"] {
|
|
||||||
if b == "application/json; charset=utf-8" {
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(found, "incorrect response content type")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHTTPTriggerApi(t *testing.T) {
|
|
||||||
testTrigger := &fv1.HTTPTrigger{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.HTTPTriggerSpec{
|
|
||||||
Methods: []string{http.MethodGet},
|
|
||||||
RelativeURL: "/hello",
|
|
||||||
FunctionReference: fv1.FunctionReference{
|
|
||||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
|
|
||||||
_, err := dClient.V1().HTTPTrigger().Get(&metav1.ObjectMeta{
|
|
||||||
Name: testTrigger.ObjectMeta.Name,
|
|
||||||
Namespace: testNS,
|
|
||||||
})
|
|
||||||
assertNotFoundFailure(err, "httptrigger")
|
|
||||||
|
|
||||||
m, err := dClient.V1().HTTPTrigger().Create(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().HTTPTrigger().Delete(m)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = dClient.V1().HTTPTrigger().Create(testTrigger)
|
|
||||||
assertNameReuseFailure(err, "httptrigger")
|
|
||||||
|
|
||||||
tr, err := dClient.V1().HTTPTrigger().Get(m)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(testTrigger.Spec.Methods) == len(tr.Spec.Methods) &&
|
|
||||||
testTrigger.Spec.RelativeURL == tr.Spec.RelativeURL &&
|
|
||||||
testTrigger.Spec.FunctionReference.Type == tr.Spec.FunctionReference.Type &&
|
|
||||||
testTrigger.Spec.FunctionReference.Name == tr.Spec.FunctionReference.Name, "trigger should match after reading")
|
|
||||||
|
|
||||||
testTrigger.ObjectMeta.ResourceVersion = m.ResourceVersion
|
|
||||||
testTrigger.Spec.RelativeURL = "/hi"
|
|
||||||
_, err = dClient.V1().HTTPTrigger().Update(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
testTrigger.ObjectMeta.ResourceVersion = ""
|
|
||||||
testTrigger.ObjectMeta.Name = "yyy"
|
|
||||||
_, err = dClient.V1().HTTPTrigger().Create(testTrigger)
|
|
||||||
assert(err != nil, "duplicate trigger should not be allowed")
|
|
||||||
|
|
||||||
testTrigger.Spec.RelativeURL = "/hi2"
|
|
||||||
m2, err := dClient.V1().HTTPTrigger().Create(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err = dClient.V1().HTTPTrigger().Delete(m2)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
ts, err := dClient.V1().HTTPTrigger().List(testNS)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(ts) == 2, fmt.Sprintf("created two triggers, but found %v", len(ts)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func createFissionFnForMultipleTrigger() {
|
|
||||||
testFunc := &fv1.Function{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo1",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.FunctionSpec{
|
|
||||||
Environment: fv1.EnvironmentReference{
|
|
||||||
Name: "nodejs",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Package: fv1.FunctionPackageRef{
|
|
||||||
FunctionName: "xxx",
|
|
||||||
PackageRef: fv1.PackageRef{
|
|
||||||
Namespace: testNS,
|
|
||||||
Name: "xxx",
|
|
||||||
ResourceVersion: "12345",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
_, err := dClient.V1().Function().Create(testFunc)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
testFunc.Name = "foo2"
|
|
||||||
|
|
||||||
_, err = dClient.V1().Function().Create(testFunc)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHTTPTriggerCreateMultipleTrigger(t *testing.T) {
|
|
||||||
logger := loggerfactory.GetLogger()
|
|
||||||
createFissionFnForMultipleTrigger()
|
|
||||||
prefix := "url_new"
|
|
||||||
testTrigger := &fv1.HTTPTrigger{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo1",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
|
|
||||||
Spec: fv1.HTTPTriggerSpec{
|
|
||||||
Methods: []string{http.MethodGet},
|
|
||||||
Prefix: &prefix,
|
|
||||||
FunctionReference: fv1.FunctionReference{
|
|
||||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
|
||||||
Name: "foo1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
m, err := dClient.V1().HTTPTrigger().Create(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
defer panicIf(dClient.V1().HTTPTrigger().Delete(m))
|
|
||||||
|
|
||||||
prefix_2 := "url_another"
|
|
||||||
testTrigger2 := &fv1.HTTPTrigger{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo2",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
|
|
||||||
Spec: fv1.HTTPTriggerSpec{
|
|
||||||
Methods: []string{http.MethodGet},
|
|
||||||
Prefix: &prefix_2,
|
|
||||||
FunctionReference: fv1.FunctionReference{
|
|
||||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
|
||||||
Name: "foo2",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
m2, err := dClient.V1().HTTPTrigger().Create(testTrigger2)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal()
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
if m2 != nil {
|
|
||||||
err := dClient.V1().HTTPTrigger().Delete(m2)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("Error deleting http trigger", zap.String("name", m2.Name), zap.Error(err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEnvironmentApi(t *testing.T) {
|
|
||||||
testEnv := &fv1.Environment{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.EnvironmentSpec{
|
|
||||||
Version: 1,
|
|
||||||
Runtime: fv1.Runtime{
|
|
||||||
Image: "gcr.io/xyz",
|
|
||||||
},
|
|
||||||
Resources: v1.ResourceRequirements{},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
|
|
||||||
_, err := dClient.V1().Environment().Get(&metav1.ObjectMeta{
|
|
||||||
Name: testEnv.ObjectMeta.Name,
|
|
||||||
Namespace: testNS,
|
|
||||||
})
|
|
||||||
assertNotFoundFailure(err, "environment")
|
|
||||||
|
|
||||||
m, err := dClient.V1().Environment().Create(testEnv)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().Environment().Delete(m)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = dClient.V1().Environment().Create(testEnv)
|
|
||||||
assertNameReuseFailure(err, "environment")
|
|
||||||
|
|
||||||
e, err := dClient.V1().Environment().Get(m)
|
|
||||||
panicIf(err)
|
|
||||||
assert(reflect.DeepEqual(testEnv.Spec, e.Spec), "env should match after reading")
|
|
||||||
|
|
||||||
testEnv.ObjectMeta.ResourceVersion = m.ResourceVersion
|
|
||||||
testEnv.Spec.Runtime.Image = "another-img"
|
|
||||||
_, err = dClient.V1().Environment().Update(testEnv)
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
testEnv.ObjectMeta.ResourceVersion = ""
|
|
||||||
testEnv.ObjectMeta.Name = "bar"
|
|
||||||
|
|
||||||
m2, err := dClient.V1().Environment().Create(testEnv)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().Environment().Delete(m2)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
ts, err := dClient.V1().Environment().List(testNS)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(ts) == 2, fmt.Sprintf("created two envs, but found %v", len(ts)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWatchApi(t *testing.T) {
|
|
||||||
testWatch := &fv1.KubernetesWatchTrigger{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "xxx",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.KubernetesWatchTriggerSpec{
|
|
||||||
Namespace: "default",
|
|
||||||
Type: "pod",
|
|
||||||
FunctionReference: fv1.FunctionReference{
|
|
||||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
|
|
||||||
_, err := dClient.V1().KubeWatcher().Get(&metav1.ObjectMeta{
|
|
||||||
Name: testWatch.ObjectMeta.Name,
|
|
||||||
Namespace: testNS,
|
|
||||||
})
|
|
||||||
assertNotFoundFailure(err, "watch")
|
|
||||||
|
|
||||||
m, err := dClient.V1().KubeWatcher().Create(testWatch)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().KubeWatcher().Delete(m)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = dClient.V1().KubeWatcher().Create(testWatch)
|
|
||||||
assertNameReuseFailure(err, "watch")
|
|
||||||
|
|
||||||
w, err := dClient.V1().KubeWatcher().Get(m)
|
|
||||||
panicIf(err)
|
|
||||||
assert(testWatch.Spec.Namespace == w.Spec.Namespace &&
|
|
||||||
testWatch.Spec.Type == w.Spec.Type &&
|
|
||||||
testWatch.Spec.FunctionReference.Type == w.Spec.FunctionReference.Type &&
|
|
||||||
testWatch.Spec.FunctionReference.Name == w.Spec.FunctionReference.Name, "watch should match after reading")
|
|
||||||
|
|
||||||
testWatch.ObjectMeta.Name = "yyy"
|
|
||||||
m2, err := dClient.V1().KubeWatcher().Create(testWatch)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().KubeWatcher().Delete(m2)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
ws, err := dClient.V1().KubeWatcher().List(testNS)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(ws) == 2, fmt.Sprintf("created two watches, but found %v", len(ws)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTimeTriggerApi(t *testing.T) {
|
|
||||||
testTrigger := &fv1.TimeTrigger{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "xxx",
|
|
||||||
Namespace: testNS,
|
|
||||||
},
|
|
||||||
Spec: fv1.TimeTriggerSpec{
|
|
||||||
Cron: "0 30 * * * *",
|
|
||||||
FunctionReference: fv1.FunctionReference{
|
|
||||||
Type: fv1.FunctionReferenceTypeFunctionName,
|
|
||||||
Name: "asdf",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
restClient := rest.NewRESTClient("http://localhost:8888")
|
|
||||||
dClient := client.MakeClientset(restClient)
|
|
||||||
|
|
||||||
_, err := dClient.V1().TimeTrigger().Get(&metav1.ObjectMeta{Name: testTrigger.ObjectMeta.Name})
|
|
||||||
assertNotFoundFailure(err, "trigger")
|
|
||||||
|
|
||||||
m, err := dClient.V1().TimeTrigger().Create(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
defer func() {
|
|
||||||
err := dClient.V1().TimeTrigger().Delete(m)
|
|
||||||
panicIf(err)
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = dClient.V1().TimeTrigger().Create(testTrigger)
|
|
||||||
assertNameReuseFailure(err, "trigger")
|
|
||||||
|
|
||||||
tr, err := dClient.V1().TimeTrigger().Get(m)
|
|
||||||
panicIf(err)
|
|
||||||
assert(testTrigger.Spec.Cron == tr.Spec.Cron &&
|
|
||||||
testTrigger.Spec.FunctionReference.Type == tr.Spec.FunctionReference.Type &&
|
|
||||||
testTrigger.Spec.FunctionReference.Name == tr.Spec.FunctionReference.Name, "trigger should match after reading")
|
|
||||||
|
|
||||||
testTrigger.ObjectMeta.ResourceVersion = m.ResourceVersion
|
|
||||||
testTrigger.Spec.Cron = "@hourly"
|
|
||||||
_, err = dClient.V1().TimeTrigger().Update(testTrigger)
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
testTrigger.ObjectMeta.ResourceVersion = ""
|
|
||||||
testTrigger.ObjectMeta.Name = "yyy"
|
|
||||||
testTrigger.Spec.Cron = "Not valid cron spec"
|
|
||||||
_, err = dClient.V1().TimeTrigger().Create(testTrigger)
|
|
||||||
assertCronSpecFails(err)
|
|
||||||
|
|
||||||
ts, err := dClient.V1().TimeTrigger().List(testNS)
|
|
||||||
panicIf(err)
|
|
||||||
assert(len(ts) == 1, fmt.Sprintf("created two time triggers, but found %v", len(ts)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
|
|
||||||
logger := loggerfactory.GetLogger()
|
|
||||||
|
|
||||||
// skip test if no cluster available for testing
|
|
||||||
kubeconfig := os.Getenv("KUBECONFIG")
|
|
||||||
if len(kubeconfig) == 0 {
|
|
||||||
log.Println("Skipping test, no kubernetes cluster")
|
|
||||||
cancel()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
clientGen := crd.NewClientGenerator()
|
|
||||||
kubeClient, err := clientGen.GetKubernetesClient()
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
// testNS isolation for running multiple CI builds concurrently.
|
|
||||||
id, err := uuid.NewV4()
|
|
||||||
panicIf(err)
|
|
||||||
testNS = id.String()
|
|
||||||
_, err = kubeClient.CoreV1().Namespaces().Create(ctx, &v1.Namespace{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: testNS,
|
|
||||||
},
|
|
||||||
}, metav1.CreateOptions{})
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
go Start(ctx, logger, 8888, true)
|
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
|
|
||||||
client, err := cmd.NewClient(cmd.ClientOptions{})
|
|
||||||
panicIf(err)
|
|
||||||
// TODO: use fake rest client for offline spec generation
|
|
||||||
cmd.SetClientset(*client)
|
|
||||||
|
|
||||||
resp, err := http.Get("http://localhost:8888/")
|
|
||||||
panicIf(err)
|
|
||||||
assert(resp.StatusCode == 200, "http get status code on root")
|
|
||||||
|
|
||||||
var found bool = false
|
|
||||||
for _, b := range resp.Header["Content-Type"] {
|
|
||||||
if b == "application/json; charset=utf-8" {
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(found, "incorrect response content type")
|
|
||||||
|
|
||||||
_, err = io.ReadAll(resp.Body)
|
|
||||||
panicIf(err)
|
|
||||||
|
|
||||||
exitVal := m.Run()
|
|
||||||
logger.Info("Deleting test namespace", zap.String("namespace", testNS))
|
|
||||||
gracePeriod := int64(0)
|
|
||||||
err = kubeClient.CoreV1().Namespaces().Delete(ctx, testNS, metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod})
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("error deleting test namespace", zap.String("namespace", testNS), zap.Error(err))
|
|
||||||
}
|
|
||||||
cancel()
|
|
||||||
os.Exit(exitVal)
|
|
||||||
}
|
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
restfulspec "github.com/emicklei/go-restful-openapi/v2"
|
|
||||||
restful "github.com/emicklei/go-restful/v3"
|
|
||||||
"github.com/go-openapi/spec"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
ferror "github.com/fission/fission/pkg/error"
|
|
||||||
config "github.com/fission/fission/pkg/featureconfig"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RegisterCanaryConfigRoute(ws *restful.WebService) {
|
|
||||||
tags := []string{"CanaryConfig"}
|
|
||||||
specTag = append(specTag, spec.Tag{TagProps: spec.TagProps{Name: "CanaryConfig", Description: "CanaryConfig Operation"}})
|
|
||||||
|
|
||||||
ws.Route(
|
|
||||||
ws.GET("/v2/canaryconfigs").
|
|
||||||
Doc("List all canary configs").
|
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
||||||
To(func(req *restful.Request, resp *restful.Response) {
|
|
||||||
resp.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
}).
|
|
||||||
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
|
|
||||||
Produces(restful.MIME_JSON).
|
|
||||||
Writes([]fv1.CanaryConfig{}).
|
|
||||||
Returns(http.StatusOK, "List of canaryConfigs", []fv1.CanaryConfig{}))
|
|
||||||
|
|
||||||
ws.Route(
|
|
||||||
ws.POST("/v2/canaryconfigs").
|
|
||||||
Doc("Create canary config").
|
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
||||||
To(func(req *restful.Request, resp *restful.Response) {
|
|
||||||
resp.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
}).
|
|
||||||
Produces(restful.MIME_JSON).
|
|
||||||
Reads(fv1.CanaryConfig{}).
|
|
||||||
Writes(metav1.ObjectMeta{}).
|
|
||||||
Returns(http.StatusCreated, "ObjectMeta of created canaryConfig", metav1.ObjectMeta{}))
|
|
||||||
|
|
||||||
ws.Route(
|
|
||||||
ws.GET("/v2/canaryconfigs/{canaryConfig}").
|
|
||||||
Doc("Get detail of canary config").
|
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
||||||
To(func(req *restful.Request, resp *restful.Response) {
|
|
||||||
resp.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
}).
|
|
||||||
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
|
|
||||||
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
|
|
||||||
Produces(restful.MIME_JSON).
|
|
||||||
Writes(fv1.CanaryConfig{}). // on the response
|
|
||||||
Returns(http.StatusOK, "A canaryConfig", fv1.CanaryConfig{}))
|
|
||||||
|
|
||||||
ws.Route(
|
|
||||||
ws.PUT("/v2/canaryconfigs/{canaryConfig}").
|
|
||||||
Doc("Update canary config").
|
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
||||||
To(func(req *restful.Request, resp *restful.Response) {
|
|
||||||
resp.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
}).
|
|
||||||
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
|
|
||||||
Produces(restful.MIME_JSON).
|
|
||||||
Reads(fv1.CanaryConfig{}).
|
|
||||||
Writes(metav1.ObjectMeta{}). // on the response
|
|
||||||
Returns(http.StatusOK, "ObjectMeta of updated canaryConfig", metav1.ObjectMeta{}))
|
|
||||||
|
|
||||||
ws.Route(
|
|
||||||
ws.DELETE("/v2/canaryconfigs/{canaryConfig}").
|
|
||||||
Doc("Delete canary config").
|
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
||||||
To(func(req *restful.Request, resp *restful.Response) {
|
|
||||||
resp.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
}).
|
|
||||||
Param(ws.PathParameter("canaryConfig", "CanaryConfig name").DataType("string").DefaultValue("").Required(true)).
|
|
||||||
Param(ws.QueryParameter("namespace", "Namespace of canaryConfig").DataType("string").DefaultValue(metav1.NamespaceAll).Required(false)).
|
|
||||||
Produces(restful.MIME_JSON).
|
|
||||||
Returns(http.StatusOK, "Only HTTP status returned", nil))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *API) CanaryConfigApiCreate(w http.ResponseWriter, r *http.Request) {
|
|
||||||
featureErr := a.featureStatus[config.CanaryFeature]
|
|
||||||
if len(featureErr) > 0 {
|
|
||||||
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := io.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var canaryCfg fv1.CanaryConfig
|
|
||||||
err = json.Unmarshal(body, &canaryCfg)
|
|
||||||
if err != nil {
|
|
||||||
a.logger.Error("failed to unmarshal request body", zap.Error(err), zap.Binary("body", body))
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
canaryCfgNew, err := a.fissionClient.CoreV1().CanaryConfigs(canaryCfg.ObjectMeta.Namespace).Create(r.Context(), &canaryCfg, metav1.CreateOptions{})
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := json.Marshal(canaryCfgNew.ObjectMeta)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
|
||||||
a.respondWithSuccess(w, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *API) CanaryConfigApiGet(w http.ResponseWriter, r *http.Request) {
|
|
||||||
featureErr := a.featureStatus[config.CanaryFeature]
|
|
||||||
if len(featureErr) > 0 {
|
|
||||||
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
name := vars["canaryConfig"]
|
|
||||||
|
|
||||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
|
||||||
if len(ns) == 0 {
|
|
||||||
ns = metav1.NamespaceDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
canaryCfg, err := a.fissionClient.CoreV1().CanaryConfigs(ns).Get(r.Context(), name, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := json.Marshal(canaryCfg)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a.respondWithSuccess(w, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *API) CanaryConfigApiList(w http.ResponseWriter, r *http.Request) {
|
|
||||||
featureErr := a.featureStatus[config.CanaryFeature]
|
|
||||||
if len(featureErr) > 0 {
|
|
||||||
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
|
||||||
if len(ns) == 0 {
|
|
||||||
ns = metav1.NamespaceDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
canaryCfgs, err := a.fissionClient.CoreV1().CanaryConfigs(ns).List(r.Context(), metav1.ListOptions{})
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := json.Marshal(canaryCfgs.Items)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a.respondWithSuccess(w, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *API) CanaryConfigApiUpdate(w http.ResponseWriter, r *http.Request) {
|
|
||||||
featureErr := a.featureStatus[config.CanaryFeature]
|
|
||||||
if len(featureErr) > 0 {
|
|
||||||
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := io.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var c fv1.CanaryConfig
|
|
||||||
err = json.Unmarshal(body, &c)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
canayCfgNew, err := a.fissionClient.CoreV1().CanaryConfigs(c.ObjectMeta.Namespace).Update(r.Context(), &c, metav1.UpdateOptions{})
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := json.Marshal(canayCfgNew.ObjectMeta)
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a.respondWithSuccess(w, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *API) CanaryConfigApiDelete(w http.ResponseWriter, r *http.Request) {
|
|
||||||
featureErr := a.featureStatus[config.CanaryFeature]
|
|
||||||
if len(featureErr) > 0 {
|
|
||||||
a.respondWithError(w, ferror.MakeError(http.StatusInternalServerError, fmt.Sprintf("Error enabling canary feature: %v", featureErr)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
name := vars["canaryConfig"]
|
|
||||||
ns := a.extractQueryParamFromRequest(r, "namespace")
|
|
||||||
if len(ns) == 0 {
|
|
||||||
ns = metav1.NamespaceDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
err := a.fissionClient.CoreV1().CanaryConfigs(ns).Delete(r.Context(), name, metav1.DeleteOptions{})
|
|
||||||
if err != nil {
|
|
||||||
a.respondWithError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a.respondWithSuccess(w, []byte(""))
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/fission/fission/pkg/controller/client/rest"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
Interface interface {
|
|
||||||
V1() v1.V1Interface
|
|
||||||
ServerURL() string
|
|
||||||
}
|
|
||||||
|
|
||||||
Clientset struct {
|
|
||||||
restClient rest.Interface
|
|
||||||
v1 v1.V1Interface
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func MakeClientset(restClient rest.Interface) Interface {
|
|
||||||
return &Clientset{
|
|
||||||
restClient: restClient,
|
|
||||||
v1: v1.MakeV1Client(restClient),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Clientset) V1() v1.V1Interface {
|
|
||||||
return c.v1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Clientset) ServerURL() string {
|
|
||||||
return c.restClient.ServerURL()
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/fission/fission/pkg/controller/client/rest"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
"github.com/fission/fission/pkg/controller/client/v1/fake"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeClientset struct {
|
|
||||||
v1 v1.V1Interface
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func MakeFakeClientset(restClient rest.Interface) Interface {
|
|
||||||
return &FakeClientset{
|
|
||||||
v1: fake.MakeV1Client(nil),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeClientset) V1() v1.V1Interface {
|
|
||||||
return c.v1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeClientset) ServerURL() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package rest
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
Interface interface {
|
|
||||||
Create(relativeUrl string, contentType string, payload []byte) (*http.Response, error)
|
|
||||||
Put(relativeUrl string, contentType string, payload []byte) (*http.Response, error)
|
|
||||||
Get(relativeUrl string) (*http.Response, error)
|
|
||||||
Delete(relativeUrl string) error
|
|
||||||
Proxy(method string, relativeUrl string, payload []byte) (*http.Response, error)
|
|
||||||
ServerInfo() (*http.Response, error)
|
|
||||||
ServerURL() string
|
|
||||||
}
|
|
||||||
|
|
||||||
RESTClient struct {
|
|
||||||
url string
|
|
||||||
HTTPClient *http.Client
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewRESTClient(serverUrl string) Interface {
|
|
||||||
return &RESTClient{
|
|
||||||
url: strings.TrimSuffix(serverUrl, "/"),
|
|
||||||
HTTPClient: &http.Client{
|
|
||||||
Transport: otelhttp.NewTransport(http.DefaultTransport),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) Create(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
|
|
||||||
var reader io.Reader
|
|
||||||
if len(payload) > 0 {
|
|
||||||
reader = bytes.NewReader(payload)
|
|
||||||
}
|
|
||||||
return c.sendRequest(context.TODO(), http.MethodPost, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) Put(relativeUrl string, contentType string, payload []byte) (*http.Response, error) {
|
|
||||||
var reader io.Reader
|
|
||||||
if len(payload) > 0 {
|
|
||||||
reader = bytes.NewReader(payload)
|
|
||||||
}
|
|
||||||
return c.sendRequest(context.TODO(), http.MethodPut, c.v2CrdUrl(relativeUrl), map[string]string{"Content-type": contentType}, reader)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) Get(relativeUrl string) (*http.Response, error) {
|
|
||||||
return c.sendRequest(context.TODO(), http.MethodGet, c.v2CrdUrl(relativeUrl), nil, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) Delete(relativeUrl string) error {
|
|
||||||
resp, err := c.sendRequest(context.TODO(), http.MethodDelete, c.v2CrdUrl(relativeUrl), nil, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
|
||||||
body, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error deleting")
|
|
||||||
} else {
|
|
||||||
return errors.Errorf("failed to delete: %v", string(body))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) Proxy(method string, relativeUrl string, payload []byte) (*http.Response, error) {
|
|
||||||
var reader io.Reader
|
|
||||||
if len(payload) > 0 {
|
|
||||||
reader = bytes.NewReader(payload)
|
|
||||||
}
|
|
||||||
return c.sendRequest(context.TODO(), method, c.proxyUrl(relativeUrl), nil, reader)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) ServerInfo() (*http.Response, error) {
|
|
||||||
return c.sendRequest(context.TODO(), http.MethodGet, c.url, nil, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) ServerURL() string {
|
|
||||||
return c.url
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) sendRequest(ctx context.Context, method string, relativeUrl string, headers map[string]string, reader io.Reader) (*http.Response, error) {
|
|
||||||
req, err := http.NewRequestWithContext(ctx, method, relativeUrl, reader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for k, v := range headers {
|
|
||||||
req.Header.Set(k, v)
|
|
||||||
}
|
|
||||||
return c.HTTPClient.Do(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) v2CrdUrl(relativeUrl string) string {
|
|
||||||
return c.url + "/v2/" + strings.TrimPrefix(relativeUrl, "/")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RESTClient) proxyUrl(relativeUrl string) string {
|
|
||||||
return c.url + "/proxy/" + strings.TrimPrefix(relativeUrl, "/")
|
|
||||||
}
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
"github.com/fission/fission/pkg/controller/client/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
CanaryConfigGetter interface {
|
|
||||||
CanaryConfig() CanaryConfigInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
CanaryConfigInterface interface {
|
|
||||||
Create(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error)
|
|
||||||
Get(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error)
|
|
||||||
Update(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error)
|
|
||||||
Delete(m *metav1.ObjectMeta) error
|
|
||||||
List(ns string) ([]fv1.CanaryConfig, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
CanaryConfig struct {
|
|
||||||
client rest.Interface
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newCanaryConfigClient(c *V1) CanaryConfigInterface {
|
|
||||||
return &CanaryConfig{client: c.restClient}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CanaryConfig) Create(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
|
|
||||||
reqbody, err := json.Marshal(canaryConf)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := c.client.Create("canaryconfigs", "application/json", reqbody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleCreateResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var m metav1.ObjectMeta
|
|
||||||
err = json.Unmarshal(body, &m)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CanaryConfig) Get(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error) {
|
|
||||||
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
|
|
||||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
|
||||||
|
|
||||||
resp, err := c.client.Get(relativeUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var canaryCfg fv1.CanaryConfig
|
|
||||||
err = json.Unmarshal(body, &canaryCfg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &canaryCfg, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CanaryConfig) Update(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
|
|
||||||
reqbody, err := json.Marshal(canaryConf)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
relativeUrl := fmt.Sprintf("canaryconfigs/%v", canaryConf.ObjectMeta.Name)
|
|
||||||
|
|
||||||
resp, err := c.client.Put(relativeUrl, "application/json", reqbody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var m metav1.ObjectMeta
|
|
||||||
err = json.Unmarshal(body, &m)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CanaryConfig) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
relativeUrl := fmt.Sprintf("canaryconfigs/%v", m.Name)
|
|
||||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
|
||||||
return c.client.Delete(relativeUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CanaryConfig) List(ns string) ([]fv1.CanaryConfig, error) {
|
|
||||||
relativeUrl := fmt.Sprintf("canaryconfigs?namespace=%v", ns)
|
|
||||||
resp, err := c.client.Get(relativeUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
canaryCfgs := make([]fv1.CanaryConfig, 0)
|
|
||||||
err = json.Unmarshal(body, &canaryCfgs)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return canaryCfgs, nil
|
|
||||||
}
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net/url"
|
|
||||||
|
|
||||||
apiv1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
"github.com/fission/fission/pkg/controller/client/rest"
|
|
||||||
"github.com/fission/fission/pkg/generator/encoder"
|
|
||||||
v1generator "github.com/fission/fission/pkg/generator/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
EnvironmentGetter interface {
|
|
||||||
Environment() EnvironmentInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
EnvironmentInterface interface {
|
|
||||||
Create(env *fv1.Environment) (*metav1.ObjectMeta, error)
|
|
||||||
Get(m *metav1.ObjectMeta) (*fv1.Environment, error)
|
|
||||||
Update(env *fv1.Environment) (*metav1.ObjectMeta, error)
|
|
||||||
Delete(m *metav1.ObjectMeta) error
|
|
||||||
List(ns string) ([]fv1.Environment, error)
|
|
||||||
ListPods(m *metav1.ObjectMeta) ([]apiv1.Pod, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment struct {
|
|
||||||
client rest.Interface
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func getEnvEncodingPayload(env *fv1.Environment) ([]byte, error) {
|
|
||||||
generator, err := v1generator.CreateEnvironmentGeneratorFromObj(env)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return generator.StructuredGenerate(encoder.DefaultJSONEncoder())
|
|
||||||
}
|
|
||||||
|
|
||||||
func newEnvironmentClient(c *V1) EnvironmentInterface {
|
|
||||||
return &Environment{client: c.restClient}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) Create(env *fv1.Environment) (*metav1.ObjectMeta, error) {
|
|
||||||
data, err := getEnvEncodingPayload(env)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := c.client.Create("environments", "application/json", data)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleCreateResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var m metav1.ObjectMeta
|
|
||||||
err = json.Unmarshal(body, &m)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) Get(m *metav1.ObjectMeta) (*fv1.Environment, error) {
|
|
||||||
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
|
|
||||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
|
||||||
|
|
||||||
resp, err := c.client.Get(relativeUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var env fv1.Environment
|
|
||||||
err = json.Unmarshal(body, &env)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &env, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) Update(env *fv1.Environment) (*metav1.ObjectMeta, error) {
|
|
||||||
data, err := getEnvEncodingPayload(env)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
relativeUrl := fmt.Sprintf("environments/%v", env.ObjectMeta.Name)
|
|
||||||
|
|
||||||
resp, err := c.client.Put(relativeUrl, "application/json", data)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var m metav1.ObjectMeta
|
|
||||||
err = json.Unmarshal(body, &m)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
relativeUrl := fmt.Sprintf("environments/%v", m.Name)
|
|
||||||
relativeUrl += fmt.Sprintf("?namespace=%v", m.Namespace)
|
|
||||||
return c.client.Delete(relativeUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) List(ns string) ([]fv1.Environment, error) {
|
|
||||||
relativeUrl := fmt.Sprintf("environments?namespace=%v", ns)
|
|
||||||
resp, err := c.client.Get(relativeUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
envs := make([]fv1.Environment, 0)
|
|
||||||
err = json.Unmarshal(body, &envs)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return envs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Environment) ListPods(m *metav1.ObjectMeta) ([]apiv1.Pod, error) {
|
|
||||||
relativeUrl := fmt.Sprintf("environments/%s/pods", m.Name)
|
|
||||||
|
|
||||||
values := url.Values{}
|
|
||||||
if len(m.Labels) != 0 {
|
|
||||||
if envns, ok := m.Labels[fv1.ENVIRONMENT_NAMESPACE]; ok && len(envns) != 0 {
|
|
||||||
values.Add(fv1.ENVIRONMENT_NAMESPACE, envns)
|
|
||||||
|
|
||||||
}
|
|
||||||
if extype, ok := m.Labels[fv1.EXECUTOR_TYPE]; ok && len(extype) != 0 {
|
|
||||||
values.Add(fv1.EXECUTOR_TYPE, extype)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
relativeUrl = fmt.Sprintf("%s?%s", relativeUrl, values.Encode())
|
|
||||||
resp, err := c.client.Get(relativeUrl)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, err := handleResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
pods := make([]apiv1.Pod, 0)
|
|
||||||
err = json.Unmarshal(body, &pods)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return pods, nil
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeCanaryConfig struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newCanaryConfigClient(c *v1.V1) v1.CanaryConfigInterface {
|
|
||||||
return &FakeCanaryConfig{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeCanaryConfig) Create(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeCanaryConfig) Get(m *metav1.ObjectMeta) (*fv1.CanaryConfig, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeCanaryConfig) Update(canaryConf *fv1.CanaryConfig) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeCanaryConfig) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeCanaryConfig) List(ns string) ([]fv1.CanaryConfig, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
apiv1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeEnvironment struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newEnvironmentClient(c *v1.V1) v1.EnvironmentInterface {
|
|
||||||
return &FakeEnvironment{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) Create(env *fv1.Environment) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) Get(m *metav1.ObjectMeta) (*fv1.Environment, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) Update(env *fv1.Environment) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) List(ns string) ([]fv1.Environment, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeEnvironment) ListPods(m *metav1.ObjectMeta) ([]apiv1.Pod, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
apiv1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeFunction struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newFunctionClient(c *v1.V1) v1.FunctionInterface {
|
|
||||||
return &FakeFunction{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) Create(f *fv1.Function) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) Get(m *metav1.ObjectMeta) (*fv1.Function, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) GetRawDeployment(m *metav1.ObjectMeta) ([]byte, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) Update(f *fv1.Function) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) List(functionNamespace string) ([]fv1.Function, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeFunction) ListPods(m *metav1.ObjectMeta) ([]apiv1.Pod, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeHTTPTrigger struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newHTTPTriggerClient(c *v1.V1) v1.HTTPTriggerInterface {
|
|
||||||
return &FakeHTTPTrigger{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeHTTPTrigger) Create(t *fv1.HTTPTrigger) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeHTTPTrigger) Get(m *metav1.ObjectMeta) (*fv1.HTTPTrigger, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeHTTPTrigger) Update(t *fv1.HTTPTrigger) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeHTTPTrigger) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeHTTPTrigger) List(triggerNamespace string) ([]fv1.HTTPTrigger, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
FakeKubeWatcher struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newKubeWatcher(c *v1.V1) v1.KubeWatcherInterface {
|
|
||||||
return &FakeKubeWatcher{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeWatcher) Create(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeWatcher) Get(m *metav1.ObjectMeta) (*fv1.KubernetesWatchTrigger, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeWatcher) Update(w *fv1.KubernetesWatchTrigger) (*metav1.ObjectMeta, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeWatcher) Delete(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeKubeWatcher) List(ns string) ([]fv1.KubernetesWatchTrigger, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Fission Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
v1 "github.com/fission/fission/pkg/controller/client/v1"
|
|
||||||
"github.com/fission/fission/pkg/info"
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO: we should remove this interface, having this for now is for backward compatibility.
|
|
||||||
type (
|
|
||||||
FakeMisc struct{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newMiscClient(c *v1.V1) v1.MiscInterface {
|
|
||||||
return &FakeMisc{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeMisc) SecretExists(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeMisc) ConfigMapExists(m *metav1.ObjectMeta) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeMisc) GetSvcURL(label string) (string, error) {
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeMisc) ServerInfo() (*info.ServerInfo, error) {
|
|
||||||
return &info.ServerInfo{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeMisc) PodLogs(m *metav1.ObjectMeta) (io.ReadCloser, int, error) {
|
|
||||||
return nil, 0, nil
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user