mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 18:59:09 +00:00
Remove goreleaser and fix helm packaging (#6)
Goreleaser was causing issues when helm chart action created releases for packaged helm chart, this PR replaces goreleaser with a much simpler build and push model, and returns packaged helm charts to normal.
This commit is contained in:
@@ -8,13 +8,8 @@ on:
|
|||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
|
||||||
GORELEASER_VER: "v2.3.2"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
env:
|
|
||||||
flags: ""
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -24,51 +19,42 @@ jobs:
|
|||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Parse semver string
|
- name: Docker meta
|
||||||
id: semver_parser
|
id: meta
|
||||||
uses: booxmedialtd/ws-action-parse-semver@v1
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
input_string: ${{ (startsWith(github.ref, 'refs/tags/v') && github.ref) || 'refs/tags/v0.0.0' }}
|
# list of Docker images to use as base name for tags
|
||||||
version_extractor_regex: '\/v(.*)$'
|
images: |
|
||||||
|
netbirdio/kubernetes-operator
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=ref,event=pr
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
- name: Login to Docker Hub
|
||||||
run: echo "flags=--snapshot" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # It is required for GoReleaser to work properly
|
|
||||||
|
|
||||||
- name: Install modules
|
|
||||||
run: go mod tidy
|
|
||||||
|
|
||||||
- name: check git status
|
|
||||||
run: git --no-pager diff --exit-code
|
|
||||||
# Set up BuildKit Docker container builder to be able to build
|
|
||||||
# multi-platform images and export cache
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
|
||||||
|
|
||||||
# Login against a Docker registry except on PR
|
|
||||||
# https://github.com/docker/login-action
|
|
||||||
- name: Login to Docker hub
|
|
||||||
if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref
|
if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Install OS build dependencies
|
- name: Set up QEMU
|
||||||
run: sudo apt update && sudo apt install -y -q gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Install goversioninfo
|
- name: Set up Docker Buildx
|
||||||
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Build and push
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
version: ${{ env.GORELEASER_VER }}
|
platforms: linux/amd64,linux/arm64
|
||||||
args: release --clean ${{ env.flags }}
|
push: true
|
||||||
env:
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
labels: |
|
||||||
|
"org.opencontainers.image.created={{.Date}}"
|
||||||
|
"org.opencontainers.image.title={{.ProjectName}}"
|
||||||
|
"org.opencontainers.image.version={{.Version}}"
|
||||||
|
"org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
|
"org.opencontainers.image.version={{.Version}}"
|
||||||
|
"maintainer=dev@netbird.io"
|
||||||
|
|||||||
+14
-38
@@ -4,7 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
# update this file to trigger helm chart release
|
# update this file to trigger helm chart release
|
||||||
- 'helm/netbird-operator/Chart.yaml'
|
- 'helm/kubernetes-operator/Chart.yaml'
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
@@ -18,49 +18,25 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
pages: write
|
pages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3.1.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set ENVs
|
- name: Configure Git
|
||||||
id: env-setup
|
|
||||||
run: |
|
run: |
|
||||||
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
git config user.name "$GITHUB_ACTOR"
|
git config user.name "$GITHUB_ACTOR"
|
||||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||||
|
|
||||||
- name: Package Charts
|
- name: Install Helm
|
||||||
run: |
|
uses: azure/setup-helm@v3.4
|
||||||
# Package charts
|
|
||||||
mkdir -p charts/.ci-build
|
|
||||||
echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
|
|
||||||
|
|
||||||
for DIR in $CHART_BASE_DIR/*; do
|
|
||||||
# Check if Chart.yaml exists in this directory
|
|
||||||
if [ -f "${DIR}/Chart.yaml" ]; then
|
|
||||||
echo "Packaging ${DIR}"
|
|
||||||
helm dependency update $DIR
|
|
||||||
helm lint $DIR
|
|
||||||
helm package $DIR --destination charts/.ci-build
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
git fetch --all
|
|
||||||
|
|
||||||
- name: Upload chart artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: helm-charts-${{ github.ref_name }}
|
version: v3.4.2
|
||||||
path: charts/.ci-build/*
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
- name: Publish to GH-Pages
|
- name: Run chart-releaser
|
||||||
id: ghpublish
|
uses: helm/chart-releaser-action@v1.4.1
|
||||||
run: |
|
with:
|
||||||
git checkout $GH_PAGES_BRANCH --force
|
charts_dir: helm
|
||||||
helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
|
env:
|
||||||
cp charts/.ci-build/index.yaml index.yaml
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
echo "New index:" && cat index.yaml
|
CR_RELEASE_NAME_TEMPLATE: "helm-v{{ .Version }}"
|
||||||
git add index.yaml charts
|
|
||||||
git commit -a -m "bot: update pages index for helm charts"
|
|
||||||
git push origin $GH_PAGES_BRANCH
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Lint Helm Chart
|
- name: Lint Helm Chart
|
||||||
run: |
|
run: |
|
||||||
helm lint ./helm/netbird-operator
|
helm lint ./helm/kubernetes-operator
|
||||||
|
|
||||||
- name: Install cert-manager via Helm
|
- name: Install cert-manager via Helm
|
||||||
run: |
|
run: |
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Helm chart for project
|
- name: Install Helm chart for project
|
||||||
run: |
|
run: |
|
||||||
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/netbird-operator
|
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/kubernetes-operator
|
||||||
|
|
||||||
- name: Check Helm release status
|
- name: Check Helm release status
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
version: 2
|
|
||||||
|
|
||||||
project_name: kubernetes-operator
|
|
||||||
|
|
||||||
release:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
builds:
|
|
||||||
- id: manager
|
|
||||||
dir: cmd
|
|
||||||
binary: manager
|
|
||||||
env: [CGO_ENABLED=0]
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
goarch:
|
|
||||||
- arm
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
ldflags:
|
|
||||||
- -s -w
|
|
||||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
|
||||||
|
|
||||||
dockers:
|
|
||||||
- image_templates:
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-amd64
|
|
||||||
ids:
|
|
||||||
- manager
|
|
||||||
goarch: amd64
|
|
||||||
dockerfile: Dockerfile.release
|
|
||||||
use: buildx
|
|
||||||
skip_push: false
|
|
||||||
build_flag_templates:
|
|
||||||
- "--platform=linux/amd64"
|
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
|
||||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=maintainer=dev@netbird.io"
|
|
||||||
- image_templates:
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm64v8
|
|
||||||
ids:
|
|
||||||
- manager
|
|
||||||
goarch: arm64
|
|
||||||
dockerfile: Dockerfile.release
|
|
||||||
use: buildx
|
|
||||||
skip_push: false
|
|
||||||
build_flag_templates:
|
|
||||||
- "--platform=linux/arm64"
|
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
|
||||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=maintainer=dev@netbird.io"
|
|
||||||
- image_templates:
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm
|
|
||||||
ids:
|
|
||||||
- manager
|
|
||||||
goarch: arm
|
|
||||||
goarm: 6
|
|
||||||
dockerfile: Dockerfile.release
|
|
||||||
use: buildx
|
|
||||||
skip_push: false
|
|
||||||
build_flag_templates:
|
|
||||||
- "--platform=linux/arm"
|
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
|
||||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
- "--label=maintainer=dev@netbird.io"
|
|
||||||
|
|
||||||
docker_manifests:
|
|
||||||
- name_template: netbirdio/kubernetes-operator:{{ .Version }}
|
|
||||||
skip_push: false
|
|
||||||
image_templates:
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm64v8
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-amd64
|
|
||||||
|
|
||||||
- name_template: netbirdio/kubernetes-operator:latest
|
|
||||||
image_templates:
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm64v8
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-arm
|
|
||||||
- netbirdio/kubernetes-operator:{{ .Version }}-amd64
|
|
||||||
@@ -43,7 +43,7 @@ help: ## Display this help.
|
|||||||
|
|
||||||
.PHONY: manifests
|
.PHONY: manifests
|
||||||
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
|
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
|
||||||
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=helm/netbird-operator/crds
|
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=helm/kubernetes-operator/crds
|
||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
|
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
|
||||||
@@ -126,7 +126,7 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
|
|||||||
.PHONY: build-installer
|
.PHONY: build-installer
|
||||||
build-installer: manifests ## Generate a consolidated YAML with CRDs and deployment.
|
build-installer: manifests ## Generate a consolidated YAML with CRDs and deployment.
|
||||||
mkdir -p manifests
|
mkdir -p manifests
|
||||||
$(HELM) template --include-crds netbird-operator helm/netbird-operator > manifests/install.yaml
|
$(HELM) template --include-crds kubernetes-operator helm/kubernetes-operator > manifests/install.yaml
|
||||||
|
|
||||||
##@ Deployment
|
##@ Deployment
|
||||||
|
|
||||||
@@ -136,19 +136,19 @@ endif
|
|||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config.
|
install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config.
|
||||||
$(KUBECTL) apply -f helm/netbird-operator/crds
|
$(KUBECTL) apply -f helm/kubernetes-operator/crds
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
|
uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
|
||||||
$(KUBECTL) delete -f helm/netbird-operator/crds
|
$(KUBECTL) delete -f helm/kubernetes-operator/crds
|
||||||
|
|
||||||
.PHONY: deploy
|
.PHONY: deploy
|
||||||
deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
|
deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
|
||||||
$(HELM) install -n netbird --create-namespace netbird-operator --set operator.image.tag=$(word 2,$(subst :, ,${IMG})) helm/netbird-operator
|
$(HELM) install -n netbird --create-namespace kubernetes-operator --set operator.image.tag=$(word 2,$(subst :, ,${IMG})) helm/kubernetes-operator
|
||||||
|
|
||||||
.PHONY: undeploy
|
.PHONY: undeploy
|
||||||
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
|
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
|
||||||
$(HELM) uninstall -n netbird netbird-operator
|
$(HELM) uninstall -n netbird kubernetes-operator
|
||||||
|
|
||||||
##@ Dependencies
|
##@ Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/rel
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
|
helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
|
||||||
helm install -n netbird netbird-operator netbirdio/netbird-operator
|
helm install -n netbird kubernetes-operator netbirdio/kubernetes-operator
|
||||||
```
|
```
|
||||||
|
|
||||||
For more options, check the default values by running
|
For more options, check the default values by running
|
||||||
```sh
|
```sh
|
||||||
helm show values netbirdio/netbird-operator
|
helm show values netbirdio/kubernetes-operator
|
||||||
```
|
```
|
||||||
|
|
||||||
### To Uninstall
|
### To Uninstall
|
||||||
@@ -45,7 +45,7 @@ kubectl delete namespace netbird
|
|||||||
**Using helm**
|
**Using helm**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
helm uninstall -n netbird netbird-operator
|
helm uninstall -n netbird kubernetes-operator
|
||||||
```
|
```
|
||||||
|
|
||||||
### Provision pods with NetBird access
|
### Provision pods with NetBird access
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
description: A Helm chart for Kubernetes
|
description: A Helm chart for Kubernetes
|
||||||
type: application
|
type: application
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
netbirdAPI:
|
||||||
|
key: "nbp_1TpgsCUaF2BU3NVZfaDrGpoY1jx2iT2g7rWj"
|
||||||
|
|
||||||
|
operator:
|
||||||
|
image:
|
||||||
|
tag: "v0.1.0"
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
router:
|
||||||
|
enabled: true
|
||||||
|
policies:
|
||||||
|
default:
|
||||||
|
name: Kubernetes Default Policy
|
||||||
|
sourceGroups:
|
||||||
|
- All
|
||||||
+19
-19
@@ -1,7 +1,7 @@
|
|||||||
{{/*
|
{{/*
|
||||||
Expand the name of the chart.
|
Expand the name of the chart.
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.name" -}}
|
{{- define "kubernetes-operator.name" -}}
|
||||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ Create a default fully qualified app name.
|
|||||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
If release name contains chart name it will be used as a full name.
|
If release name contains chart name it will be used as a full name.
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.fullname" -}}
|
{{- define "kubernetes-operator.fullname" -}}
|
||||||
{{- if .Values.fullnameOverride }}
|
{{- if .Values.fullnameOverride }}
|
||||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
|
|||||||
{{/*
|
{{/*
|
||||||
Create chart name and version as used by the chart label.
|
Create chart name and version as used by the chart label.
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.chart" -}}
|
{{- define "kubernetes-operator.chart" -}}
|
||||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Common labels
|
Common labels
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.labels" -}}
|
{{- define "kubernetes-operator.labels" -}}
|
||||||
helm.sh/chart: {{ include "netbird-operator.chart" . }}
|
helm.sh/chart: {{ include "kubernetes-operator.chart" . }}
|
||||||
{{ include "netbird-operator.selectorLabels" . }}
|
{{ include "kubernetes-operator.selectorLabels" . }}
|
||||||
{{- if .Chart.AppVersion }}
|
{{- if .Chart.AppVersion }}
|
||||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|||||||
{{/*
|
{{/*
|
||||||
Selector labels
|
Selector labels
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.selectorLabels" -}}
|
{{- define "kubernetes-operator.selectorLabels" -}}
|
||||||
app.kubernetes.io/name: {{ include "netbird-operator.name" . }}
|
app.kubernetes.io/name: {{ include "kubernetes-operator.name" . }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Create the name of the service account to use
|
Create the name of the service account to use
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.serviceAccountName" -}}
|
{{- define "kubernetes-operator.serviceAccountName" -}}
|
||||||
{{- if .Values.operator.serviceAccount.create }}
|
{{- if .Values.operator.serviceAccount.create }}
|
||||||
{{- default (include "netbird-operator.fullname" .) .Values.operator.serviceAccount.name }}
|
{{- default (include "kubernetes-operator.fullname" .) .Values.operator.serviceAccount.name }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- default "default" .Values.operator.serviceAccount.name }}
|
{{- default "default" .Values.operator.serviceAccount.name }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -65,23 +65,23 @@ Create the name of the service account to use
|
|||||||
{{/*
|
{{/*
|
||||||
Create the name of the webhook service
|
Create the name of the webhook service
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.webhookService" -}}
|
{{- define "kubernetes-operator.webhookService" -}}
|
||||||
{{- printf "%s-webhook-service" (include "netbird-operator.fullname" .) -}}
|
{{- printf "%s-webhook-service" (include "kubernetes-operator.fullname" .) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Create the name of the webhook cert secret
|
Create the name of the webhook cert secret
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.webhookCertSecret" -}}
|
{{- define "kubernetes-operator.webhookCertSecret" -}}
|
||||||
{{- printf "%s-tls" (include "netbird-operator.fullname" .) -}}
|
{{- printf "%s-tls" (include "kubernetes-operator.fullname" .) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Generate certificates for webhook
|
Generate certificates for webhook
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "netbird-operator.webhookCerts" -}}
|
{{- define "kubernetes-operator.webhookCerts" -}}
|
||||||
{{- $serviceName := (include "netbird-operator.webhookService" .) -}}
|
{{- $serviceName := (include "kubernetes-operator.webhookService" .) -}}
|
||||||
{{- $secretName := (include "netbird-operator.webhookCertSecret" .) -}}
|
{{- $secretName := (include "kubernetes-operator.webhookCertSecret" .) -}}
|
||||||
{{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}}
|
{{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}}
|
||||||
{{- if (and .Values.webhook.tls.caCert .Values.webhook.tls.cert .Values.webhook.tls.key) -}}
|
{{- if (and .Values.webhook.tls.caCert .Values.webhook.tls.cert .Values.webhook.tls.key) -}}
|
||||||
caCert: {{ .Values.webhook.tls.caCert | b64enc }}
|
caCert: {{ .Values.webhook.tls.caCert | b64enc }}
|
||||||
@@ -93,8 +93,8 @@ clientCert: {{ index $secret.data "tls.crt" }}
|
|||||||
clientKey: {{ index $secret.data "tls.key" }}
|
clientKey: {{ index $secret.data "tls.key" }}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $altNames := list (printf "%s.%s" $serviceName .Release.Namespace) (printf "%s.%s.svc" $serviceName .Release.Namespace) (printf "%s.%s.svc.%s" $serviceName .Release.Namespace .Values.webhook.cluster.dnsDomain) -}}
|
{{- $altNames := list (printf "%s.%s" $serviceName .Release.Namespace) (printf "%s.%s.svc" $serviceName .Release.Namespace) (printf "%s.%s.svc.%s" $serviceName .Release.Namespace .Values.webhook.cluster.dnsDomain) -}}
|
||||||
{{- $ca := genCA "netbird-operator-ca" 3650 -}}
|
{{- $ca := genCA "kubernetes-operator-ca" 3650 -}}
|
||||||
{{- $cert := genSignedCert (include "netbird-operator.fullname" .) nil $altNames 3650 $ca -}}
|
{{- $cert := genSignedCert (include "kubernetes-operator.fullname" .) nil $altNames 3650 $ca -}}
|
||||||
caCert: {{ $ca.Cert | b64enc }}
|
caCert: {{ $ca.Cert | b64enc }}
|
||||||
clientCert: {{ $cert.Cert | b64enc }}
|
clientCert: {{ $cert.Cert | b64enc }}
|
||||||
clientKey: {{ $cert.Key | b64enc }}
|
clientKey: {{ $cert.Key | b64enc }}
|
||||||
+6
-6
@@ -1,15 +1,15 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/component: operator
|
app.kubernetes.io/component: operator
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
replicas: {{ .Values.operator.replicaCount }}
|
replicas: {{ .Values.operator.replicaCount }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
{{- include "netbird-operator.selectorLabels" . | nindent 6 }}
|
{{- include "kubernetes-operator.selectorLabels" . | nindent 6 }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
{{- with .Values.operator.podAnnotations }}
|
{{- with .Values.operator.podAnnotations }}
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/component: operator
|
app.kubernetes.io/component: operator
|
||||||
{{- include "netbird-operator.labels" . | nindent 8 }}
|
{{- include "kubernetes-operator.labels" . | nindent 8 }}
|
||||||
{{- with .Values.operator.podLabels }}
|
{{- with .Values.operator.podLabels }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -27,7 +27,7 @@ spec:
|
|||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
serviceAccountName: {{ include "netbird-operator.serviceAccountName" . }}
|
serviceAccountName: {{ include "kubernetes-operator.serviceAccountName" . }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.operator.podSecurityContext | nindent 8 }}
|
{{- toYaml .Values.operator.podSecurityContext | nindent 8 }}
|
||||||
containers:
|
containers:
|
||||||
@@ -85,7 +85,7 @@ spec:
|
|||||||
- name: webhook-certs
|
- name: webhook-certs
|
||||||
secret:
|
secret:
|
||||||
defaultMode: 420
|
defaultMode: 420
|
||||||
secretName: {{ template "netbird-operator.webhookCertSecret" . }}
|
secretName: {{ template "kubernetes-operator.webhookCertSecret" . }}
|
||||||
{{- with .Values.operator.volumes }}
|
{{- with .Values.operator.volumes }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
+12
-12
@@ -1,9 +1,9 @@
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- netbird.io
|
- netbird.io
|
||||||
@@ -49,24 +49,24 @@ rules:
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: {{ include "netbird-operator.serviceAccountName" . }}
|
name: {{ include "kubernetes-operator.serviceAccountName" . }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: Role
|
kind: Role
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
@@ -103,14 +103,14 @@ rules:
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: Role
|
kind: Role
|
||||||
name: {{ include "netbird-operator.fullname" . }}
|
name: {{ include "kubernetes-operator.fullname" . }}
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: {{ include "netbird-operator.serviceAccountName" . }}
|
name: {{ include "kubernetes-operator.serviceAccountName" . }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
+6
-6
@@ -2,9 +2,9 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.fullname" . }}-metrics
|
name: {{ include "kubernetes-operator.fullname" . }}-metrics
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.operator.metrics.type }}
|
type: {{ .Values.operator.metrics.type }}
|
||||||
ports:
|
ports:
|
||||||
@@ -13,15 +13,15 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: {{ .Values.operator.metrics.port }}
|
targetPort: {{ .Values.operator.metrics.port }}
|
||||||
selector:
|
selector:
|
||||||
{{- include "netbird-operator.selectorLabels" . | nindent 4 }}
|
{{- include "kubernetes-operator.selectorLabels" . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.webhookService" . }}
|
name: {{ include "kubernetes-operator.webhookService" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.webhook.service.type }}
|
type: {{ .Values.webhook.service.type }}
|
||||||
ports:
|
ports:
|
||||||
@@ -30,4 +30,4 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: {{ .Values.webhook.service.targetPort }}
|
targetPort: {{ .Values.webhook.service.targetPort }}
|
||||||
selector:
|
selector:
|
||||||
{{- include "netbird-operator.selectorLabels" . | nindent 4 }}
|
{{- include "kubernetes-operator.selectorLabels" . | nindent 4 }}
|
||||||
+2
-2
@@ -2,9 +2,9 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "netbird-operator.serviceAccountName" . }}
|
name: {{ include "kubernetes-operator.serviceAccountName" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
{{- with .Values.operator.serviceAccount.annotations }}
|
{{- with .Values.operator.serviceAccount.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
+20
-20
@@ -1,22 +1,22 @@
|
|||||||
{{ $tls := fromYaml ( include "netbird-operator.webhookCerts" . ) }}
|
{{ $tls := fromYaml ( include "kubernetes-operator.webhookCerts" . ) }}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: MutatingWebhookConfiguration
|
kind: MutatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
{{- if $.Values.webhook.enableCertManager }}
|
{{- if $.Values.webhook.enableCertManager }}
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ template "netbird-operator.fullname" . }}-serving-cert
|
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ template "kubernetes-operator.fullname" . }}-serving-cert
|
||||||
{{- end }}
|
{{- end }}
|
||||||
name: {{ include "netbird-operator.fullname" . }}-mpod-webhook
|
name: {{ include "kubernetes-operator.fullname" . }}-mpod-webhook
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
webhooks:
|
webhooks:
|
||||||
- clientConfig:
|
- clientConfig:
|
||||||
{{- if not $.Values.webhook.enableCertManager -}}
|
{{- if not $.Values.webhook.enableCertManager -}}
|
||||||
caBundle: {{ $tls.caCert }}
|
caBundle: {{ $tls.caCert }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
service:
|
service:
|
||||||
name: {{ template "netbird-operator.webhookService" . }}
|
name: {{ template "kubernetes-operator.webhookService" . }}
|
||||||
namespace: {{ $.Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
path: /mutate--v1-pod
|
path: /mutate--v1-pod
|
||||||
failurePolicy: Fail
|
failurePolicy: Fail
|
||||||
@@ -33,7 +33,7 @@ webhooks:
|
|||||||
- key: app.kubernetes.io/name
|
- key: app.kubernetes.io/name
|
||||||
operator: NotIn
|
operator: NotIn
|
||||||
values:
|
values:
|
||||||
- {{ include "netbird-operator.name" . }}
|
- {{ include "kubernetes-operator.name" . }}
|
||||||
{{- if .Values.webhook.objectSelector.matchExpressions }}
|
{{- if .Values.webhook.objectSelector.matchExpressions }}
|
||||||
{{- toYaml .Values.webhook.objectSelector.matchExpressions | nindent 4 }}
|
{{- toYaml .Values.webhook.objectSelector.matchExpressions | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -57,18 +57,18 @@ kind: ValidatingWebhookConfiguration
|
|||||||
metadata:
|
metadata:
|
||||||
{{- if $.Values.webhook.enableCertManager }}
|
{{- if $.Values.webhook.enableCertManager }}
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ template "netbird-operator.fullname" . }}-serving-cert
|
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ template "kubernetes-operator.fullname" . }}-serving-cert
|
||||||
{{- end }}
|
{{- end }}
|
||||||
name: {{ include "netbird-operator.fullname" . }}-vnbsetupkey-webhook
|
name: {{ include "kubernetes-operator.fullname" . }}-vnbsetupkey-webhook
|
||||||
labels:
|
labels:
|
||||||
{{- include "netbird-operator.labels" . | nindent 4 }}
|
{{- include "kubernetes-operator.labels" . | nindent 4 }}
|
||||||
webhooks:
|
webhooks:
|
||||||
- clientConfig:
|
- clientConfig:
|
||||||
{{- if not $.Values.webhook.enableCertManager -}}
|
{{- if not $.Values.webhook.enableCertManager -}}
|
||||||
caBundle: {{ $tls.caCert }}
|
caBundle: {{ $tls.caCert }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
service:
|
service:
|
||||||
name: {{ template "netbird-operator.webhookService" . }}
|
name: {{ template "kubernetes-operator.webhookService" . }}
|
||||||
namespace: {{ $.Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
path: /validate-netbird-io-v1-nbsetupkey
|
path: /validate-netbird-io-v1-nbsetupkey
|
||||||
failurePolicy: Fail
|
failurePolicy: Fail
|
||||||
@@ -96,10 +96,10 @@ webhooks:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "netbird-operator.webhookCertSecret" . }}
|
name: {{ template "kubernetes-operator.webhookCertSecret" . }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
{{ include "netbird-operator.labels" . | indent 4 }}
|
{{ include "kubernetes-operator.labels" . | indent 4 }}
|
||||||
type: kubernetes.io/tls
|
type: kubernetes.io/tls
|
||||||
data:
|
data:
|
||||||
ca.crt: {{ $tls.caCert }}
|
ca.crt: {{ $tls.caCert }}
|
||||||
@@ -109,26 +109,26 @@ data:
|
|||||||
apiVersion: cert-manager.io/v1
|
apiVersion: cert-manager.io/v1
|
||||||
kind: Certificate
|
kind: Certificate
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "netbird-operator.fullname" . }}-serving-cert
|
name: {{ template "kubernetes-operator.fullname" . }}-serving-cert
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
{{ include "netbird-operator.labels" . | indent 4 }}
|
{{ include "kubernetes-operator.labels" . | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
dnsNames:
|
dnsNames:
|
||||||
- {{ template "netbird-operator.webhookService" . }}.{{ .Release.Namespace }}.svc
|
- {{ template "kubernetes-operator.webhookService" . }}.{{ .Release.Namespace }}.svc
|
||||||
- {{ template "netbird-operator.webhookService" . }}.{{ .Release.Namespace }}.svc.{{ .Values.webhook.cluster.dnsDomain }}
|
- {{ template "kubernetes-operator.webhookService" . }}.{{ .Release.Namespace }}.svc.{{ .Values.webhook.cluster.dnsDomain }}
|
||||||
issuerRef:
|
issuerRef:
|
||||||
kind: Issuer
|
kind: Issuer
|
||||||
name: {{ template "netbird-operator.fullname" . }}-selfsigned-issuer
|
name: {{ template "kubernetes-operator.fullname" . }}-selfsigned-issuer
|
||||||
secretName: {{ template "netbird-operator.webhookCertSecret" . }}
|
secretName: {{ template "kubernetes-operator.webhookCertSecret" . }}
|
||||||
---
|
---
|
||||||
apiVersion: cert-manager.io/v1
|
apiVersion: cert-manager.io/v1
|
||||||
kind: Issuer
|
kind: Issuer
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "netbird-operator.fullname" . }}-selfsigned-issuer
|
name: {{ template "kubernetes-operator.fullname" . }}-selfsigned-issuer
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
{{ include "netbird-operator.labels" . | indent 4 }}
|
{{ include "kubernetes-operator.labels" . | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
selfSigned: {}
|
selfSigned: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -66,7 +66,7 @@ var _ = BeforeSuite(func() {
|
|||||||
|
|
||||||
By("bootstrapping test environment")
|
By("bootstrapping test environment")
|
||||||
testEnv = &envtest.Environment{
|
testEnv = &envtest.Environment{
|
||||||
CRDDirectoryPaths: []string{filepath.Join("..", "..", "helm", "netbird-operator", "crds")},
|
CRDDirectoryPaths: []string{filepath.Join("..", "..", "helm", "kubernetes-operator", "crds")},
|
||||||
ErrorIfCRDPathMissing: true,
|
ErrorIfCRDPathMissing: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ var _ = BeforeSuite(func() {
|
|||||||
|
|
||||||
By("bootstrapping test environment")
|
By("bootstrapping test environment")
|
||||||
testEnv = &envtest.Environment{
|
testEnv = &envtest.Environment{
|
||||||
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "helm", "netbird-operator", "crds")},
|
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "helm", "kubernetes-operator", "crds")},
|
||||||
ErrorIfCRDPathMissing: false,
|
ErrorIfCRDPathMissing: false,
|
||||||
|
|
||||||
// WebhookInstallOptions: envtest.WebhookInstallOptions{
|
// WebhookInstallOptions: envtest.WebhookInstallOptions{
|
||||||
|
|||||||
+86
-86
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
# Source: netbird-operator/crds/netbird.io_nbsetupkeys.yaml
|
# Source: kubernetes-operator/crds/netbird.io_nbsetupkeys.yaml
|
||||||
---
|
---
|
||||||
apiVersion: apiextensions.k8s.io/v1
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
@@ -118,28 +118,28 @@ spec:
|
|||||||
status: {}
|
status: {}
|
||||||
|
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/serviceaccount.yaml
|
# Source: kubernetes-operator/templates/serviceaccount.yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
automountServiceAccountToken: true
|
automountServiceAccountToken: true
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/rbac.yaml
|
# Source: kubernetes-operator/templates/rbac.yaml
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
rules:
|
rules:
|
||||||
@@ -182,35 +182,35 @@ rules:
|
|||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/rbac.yaml
|
# Source: kubernetes-operator/templates/rbac.yaml
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
namespace: default
|
namespace: default
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/rbac.yaml
|
# Source: kubernetes-operator/templates/rbac.yaml
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: Role
|
kind: Role
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
rules:
|
rules:
|
||||||
@@ -246,35 +246,35 @@ rules:
|
|||||||
- create
|
- create
|
||||||
- patch
|
- patch
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/rbac.yaml
|
# Source: kubernetes-operator/templates/rbac.yaml
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: Role
|
kind: Role
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
namespace: default
|
namespace: default
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/service.yaml
|
# Source: kubernetes-operator/templates/service.yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator-metrics
|
name: kubernetes-operator-metrics
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
@@ -285,18 +285,18 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 8080
|
targetPort: 8080
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/service.yaml
|
# Source: kubernetes-operator/templates/service.yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator-webhook-service
|
name: kubernetes-operator-webhook-service
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
@@ -307,44 +307,44 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 9443
|
targetPort: 9443
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/deployment.yaml
|
# Source: kubernetes-operator/templates/deployment.yaml
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator
|
name: kubernetes-operator
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/component: operator
|
app.kubernetes.io/component: operator
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/component: operator
|
app.kubernetes.io/component: operator
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: netbird-operator
|
serviceAccountName: kubernetes-operator
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
seccompProfile:
|
seccompProfile:
|
||||||
type: RuntimeDefault
|
type: RuntimeDefault
|
||||||
containers:
|
containers:
|
||||||
- name: netbird-operator
|
- name: kubernetes-operator
|
||||||
securityContext:
|
securityContext:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
capabilities:
|
capabilities:
|
||||||
@@ -393,61 +393,61 @@ spec:
|
|||||||
- name: webhook-certs
|
- name: webhook-certs
|
||||||
secret:
|
secret:
|
||||||
defaultMode: 420
|
defaultMode: 420
|
||||||
secretName: netbird-operator-tls
|
secretName: kubernetes-operator-tls
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/webhook.yaml
|
# Source: kubernetes-operator/templates/webhook.yaml
|
||||||
apiVersion: cert-manager.io/v1
|
apiVersion: cert-manager.io/v1
|
||||||
kind: Certificate
|
kind: Certificate
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator-serving-cert
|
name: kubernetes-operator-serving-cert
|
||||||
namespace: default
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
dnsNames:
|
dnsNames:
|
||||||
- netbird-operator-webhook-service.default.svc
|
- kubernetes-operator-webhook-service.default.svc
|
||||||
- netbird-operator-webhook-service.default.svc.cluster.local
|
- kubernetes-operator-webhook-service.default.svc.cluster.local
|
||||||
issuerRef:
|
issuerRef:
|
||||||
kind: Issuer
|
kind: Issuer
|
||||||
name: netbird-operator-selfsigned-issuer
|
name: kubernetes-operator-selfsigned-issuer
|
||||||
secretName: netbird-operator-tls
|
secretName: kubernetes-operator-tls
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/webhook.yaml
|
# Source: kubernetes-operator/templates/webhook.yaml
|
||||||
apiVersion: cert-manager.io/v1
|
apiVersion: cert-manager.io/v1
|
||||||
kind: Issuer
|
kind: Issuer
|
||||||
metadata:
|
metadata:
|
||||||
name: netbird-operator-selfsigned-issuer
|
name: kubernetes-operator-selfsigned-issuer
|
||||||
namespace: default
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
spec:
|
spec:
|
||||||
selfSigned: {}
|
selfSigned: {}
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/webhook.yaml
|
# Source: kubernetes-operator/templates/webhook.yaml
|
||||||
apiVersion: admissionregistration.k8s.io/v1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: MutatingWebhookConfiguration
|
kind: MutatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/inject-ca-from: default/netbird-operator-serving-cert
|
cert-manager.io/inject-ca-from: default/kubernetes-operator-serving-cert
|
||||||
name: netbird-operator-mpod-webhook
|
name: kubernetes-operator-mpod-webhook
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
webhooks:
|
webhooks:
|
||||||
- clientConfig:
|
- clientConfig:
|
||||||
service:
|
service:
|
||||||
name: netbird-operator-webhook-service
|
name: kubernetes-operator-webhook-service
|
||||||
namespace: default
|
namespace: default
|
||||||
path: /mutate--v1-pod
|
path: /mutate--v1-pod
|
||||||
failurePolicy: Fail
|
failurePolicy: Fail
|
||||||
@@ -459,7 +459,7 @@ webhooks:
|
|||||||
- key: app.kubernetes.io/name
|
- key: app.kubernetes.io/name
|
||||||
operator: NotIn
|
operator: NotIn
|
||||||
values:
|
values:
|
||||||
- netbird-operator
|
- kubernetes-operator
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
@@ -471,23 +471,23 @@ webhooks:
|
|||||||
- pods
|
- pods
|
||||||
sideEffects: None
|
sideEffects: None
|
||||||
---
|
---
|
||||||
# Source: netbird-operator/templates/webhook.yaml
|
# Source: kubernetes-operator/templates/webhook.yaml
|
||||||
apiVersion: admissionregistration.k8s.io/v1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: ValidatingWebhookConfiguration
|
kind: ValidatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/inject-ca-from: default/netbird-operator-serving-cert
|
cert-manager.io/inject-ca-from: default/kubernetes-operator-serving-cert
|
||||||
name: netbird-operator-vnbsetupkey-webhook
|
name: kubernetes-operator-vnbsetupkey-webhook
|
||||||
labels:
|
labels:
|
||||||
helm.sh/chart: netbird-operator-0.1.0
|
helm.sh/chart: kubernetes-operator-0.1.0
|
||||||
app.kubernetes.io/name: netbird-operator
|
app.kubernetes.io/name: kubernetes-operator
|
||||||
app.kubernetes.io/instance: netbird-operator
|
app.kubernetes.io/instance: kubernetes-operator
|
||||||
app.kubernetes.io/version: "v0.1.0"
|
app.kubernetes.io/version: "v0.1.0"
|
||||||
app.kubernetes.io/managed-by: Helm
|
app.kubernetes.io/managed-by: Helm
|
||||||
webhooks:
|
webhooks:
|
||||||
- clientConfig:
|
- clientConfig:
|
||||||
service:
|
service:
|
||||||
name: netbird-operator-webhook-service
|
name: kubernetes-operator-webhook-service
|
||||||
namespace: default
|
namespace: default
|
||||||
path: /validate-netbird-io-v1-nbsetupkey
|
path: /validate-netbird-io-v1-nbsetupkey
|
||||||
failurePolicy: Fail
|
failurePolicy: Fail
|
||||||
|
|||||||
+13
-13
@@ -32,7 +32,7 @@ import (
|
|||||||
const namespace = "netbird"
|
const namespace = "netbird"
|
||||||
|
|
||||||
// metricsServiceName is the name of the metrics service of the project
|
// metricsServiceName is the name of the metrics service of the project
|
||||||
const metricsServiceName = "netbird-operator-metrics"
|
const metricsServiceName = "kubernetes-operator-metrics"
|
||||||
|
|
||||||
var _ = Describe("Manager", Ordered, func() {
|
var _ = Describe("Manager", Ordered, func() {
|
||||||
var controllerPodName string
|
var controllerPodName string
|
||||||
@@ -57,13 +57,13 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
_, err = utils.Run(cmd)
|
_, err = utils.Run(cmd)
|
||||||
Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs")
|
Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs")
|
||||||
|
|
||||||
By("deploying the netbird-operator")
|
By("deploying the kubernetes-operator")
|
||||||
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectImage))
|
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectImage))
|
||||||
out, err := utils.Run(cmd)
|
out, err := utils.Run(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(out)
|
fmt.Println(out)
|
||||||
}
|
}
|
||||||
Expect(err).NotTo(HaveOccurred(), "Failed to deploy the netbird-operator")
|
Expect(err).NotTo(HaveOccurred(), "Failed to deploy the kubernetes-operator")
|
||||||
})
|
})
|
||||||
|
|
||||||
// After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs,
|
// After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs,
|
||||||
@@ -73,7 +73,7 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
cmd := exec.Command("kubectl", "delete", "pod", "curl-metrics", "-n", namespace)
|
cmd := exec.Command("kubectl", "delete", "pod", "curl-metrics", "-n", namespace)
|
||||||
_, _ = utils.Run(cmd)
|
_, _ = utils.Run(cmd)
|
||||||
|
|
||||||
By("undeploying the netbird-operator")
|
By("undeploying the kubernetes-operator")
|
||||||
cmd = exec.Command("make", "undeploy")
|
cmd = exec.Command("make", "undeploy")
|
||||||
_, _ = utils.Run(cmd)
|
_, _ = utils.Run(cmd)
|
||||||
|
|
||||||
@@ -134,11 +134,11 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
|
|
||||||
Context("Manager", func() {
|
Context("Manager", func() {
|
||||||
It("should run successfully", func() {
|
It("should run successfully", func() {
|
||||||
By("validating that the netbird-operator pod is running as expected")
|
By("validating that the kubernetes-operator pod is running as expected")
|
||||||
verifyControllerUp := func(g Gomega) {
|
verifyControllerUp := func(g Gomega) {
|
||||||
// Get the name of the netbird-operator pod
|
// Get the name of the kubernetes-operator pod
|
||||||
cmd := exec.Command("kubectl", "get",
|
cmd := exec.Command("kubectl", "get",
|
||||||
"pods", "-l", "app.kubernetes.io/component=operator,app.kubernetes.io/name=netbird-operator",
|
"pods", "-l", "app.kubernetes.io/component=operator,app.kubernetes.io/name=kubernetes-operator",
|
||||||
"-o", "go-template={{ range .items }}"+
|
"-o", "go-template={{ range .items }}"+
|
||||||
"{{ if not .metadata.deletionTimestamp }}"+
|
"{{ if not .metadata.deletionTimestamp }}"+
|
||||||
"{{ .metadata.name }}"+
|
"{{ .metadata.name }}"+
|
||||||
@@ -147,11 +147,11 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
podOutput, err := utils.Run(cmd)
|
podOutput, err := utils.Run(cmd)
|
||||||
g.Expect(err).NotTo(HaveOccurred(), "Failed to retrieve netbird-operator pod information")
|
g.Expect(err).NotTo(HaveOccurred(), "Failed to retrieve kubernetes-operator pod information")
|
||||||
podNames := utils.GetNonEmptyLines(podOutput)
|
podNames := utils.GetNonEmptyLines(podOutput)
|
||||||
g.Expect(podNames).To(HaveLen(1), "expected 1 controller pod running")
|
g.Expect(podNames).To(HaveLen(1), "expected 1 controller pod running")
|
||||||
controllerPodName = podNames[0]
|
controllerPodName = podNames[0]
|
||||||
g.Expect(controllerPodName).To(ContainSubstring("netbird-operator"))
|
g.Expect(controllerPodName).To(ContainSubstring("kubernetes-operator"))
|
||||||
|
|
||||||
// Validate the pod's status
|
// Validate the pod's status
|
||||||
cmd = exec.Command("kubectl", "get",
|
cmd = exec.Command("kubectl", "get",
|
||||||
@@ -160,7 +160,7 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
)
|
)
|
||||||
output, err := utils.Run(cmd)
|
output, err := utils.Run(cmd)
|
||||||
g.Expect(err).NotTo(HaveOccurred())
|
g.Expect(err).NotTo(HaveOccurred())
|
||||||
g.Expect(output).To(Equal("Running"), "Incorrect netbird-operator pod status")
|
g.Expect(output).To(Equal("Running"), "Incorrect kubernetes-operator pod status")
|
||||||
}
|
}
|
||||||
Eventually(verifyControllerUp).Should(Succeed())
|
Eventually(verifyControllerUp).Should(Succeed())
|
||||||
})
|
})
|
||||||
@@ -240,7 +240,7 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
It("should provisioned cert-manager", func() {
|
It("should provisioned cert-manager", func() {
|
||||||
By("validating that cert-manager has the certificate Secret")
|
By("validating that cert-manager has the certificate Secret")
|
||||||
verifyCertManager := func(g Gomega) {
|
verifyCertManager := func(g Gomega) {
|
||||||
cmd := exec.Command("kubectl", "get", "secrets", "netbird-operator-tls", "-n", namespace)
|
cmd := exec.Command("kubectl", "get", "secrets", "kubernetes-operator-tls", "-n", namespace)
|
||||||
_, err := utils.Run(cmd)
|
_, err := utils.Run(cmd)
|
||||||
g.Expect(err).NotTo(HaveOccurred())
|
g.Expect(err).NotTo(HaveOccurred())
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
verifyCAInjection := func(g Gomega) {
|
verifyCAInjection := func(g Gomega) {
|
||||||
cmd := exec.Command("kubectl", "get",
|
cmd := exec.Command("kubectl", "get",
|
||||||
"mutatingwebhookconfigurations.admissionregistration.k8s.io",
|
"mutatingwebhookconfigurations.admissionregistration.k8s.io",
|
||||||
"netbird-operator-mpod-webhook",
|
"kubernetes-operator-mpod-webhook",
|
||||||
"-o", "go-template={{ range .webhooks }}{{ .clientConfig.caBundle }}{{ end }}")
|
"-o", "go-template={{ range .webhooks }}{{ .clientConfig.caBundle }}{{ end }}")
|
||||||
mwhOutput, err := utils.Run(cmd)
|
mwhOutput, err := utils.Run(cmd)
|
||||||
g.Expect(err).NotTo(HaveOccurred())
|
g.Expect(err).NotTo(HaveOccurred())
|
||||||
@@ -266,7 +266,7 @@ var _ = Describe("Manager", Ordered, func() {
|
|||||||
verifyCAInjection := func(g Gomega) {
|
verifyCAInjection := func(g Gomega) {
|
||||||
cmd := exec.Command("kubectl", "get",
|
cmd := exec.Command("kubectl", "get",
|
||||||
"validatingwebhookconfigurations.admissionregistration.k8s.io",
|
"validatingwebhookconfigurations.admissionregistration.k8s.io",
|
||||||
"netbird-operator-vnbsetupkey-webhook",
|
"kubernetes-operator-vnbsetupkey-webhook",
|
||||||
"-o", "go-template={{ range .webhooks }}{{ .clientConfig.caBundle }}{{ end }}")
|
"-o", "go-template={{ range .webhooks }}{{ .clientConfig.caBundle }}{{ end }}")
|
||||||
vwhOutput, err := utils.Run(cmd)
|
vwhOutput, err := utils.Run(cmd)
|
||||||
g.Expect(err).NotTo(HaveOccurred())
|
g.Expect(err).NotTo(HaveOccurred())
|
||||||
|
|||||||
Reference in New Issue
Block a user