Files
netbird-kubernetes-operator/helm/kubernetes-operator/templates/deployment.yaml
T

150 lines
5.9 KiB
YAML
Raw Normal View History

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kubernetes-operator.fullname" . }}
labels:
app.kubernetes.io/component: operator
{{- include "kubernetes-operator.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.operator.replicaCount }}
selector:
matchLabels:
{{- include "kubernetes-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.operator.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/component: operator
{{- include "kubernetes-operator.labels" . | nindent 8 }}
{{- with .Values.operator.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.operator.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "kubernetes-operator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.operator.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.operator.securityContext | nindent 12 }}
image: "{{ .Values.operator.image.registry }}/{{ .Values.operator.image.repository }}:{{ .Values.operator.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
command:
- /manager
args:
{{- if .Values.operator.metrics.enabled }}
- --metrics-bind-address=:{{ .Values.operator.metrics.port}}
{{- end }}
- --leader-elect
- --health-probe-bind-address=:{{ .Values.operator.livenessProbe.port }}
- --webhook-cert-path=/tmp/k8s-webhook-server/serving-certs
2026-03-18 12:00:31 +01:00
- --runtime-namespace=$(POD_NAMESPACE)
{{- if .Values.gatewayAPI.enabled }}
- --gateway-api-enabled=true
{{- end }}
{{- if .Values.managementURL }}
- --netbird-management-url={{.Values.managementURL}}
{{- end }}
2025-03-06 10:57:45 +02:00
{{- if .Values.cluster.name }}
- --cluster-name={{.Values.cluster.name}}
{{- end }}
{{- if .Values.ingress.namespacedNetworks }}
- --namespaced-networks={{.Values.ingress.namespacedNetworks}}
{{- end }}
{{- if .Values.cluster.dns }}
- --cluster-dns={{.Values.cluster.dns}}
{{- end }}
{{- if or .Values.netbirdAPI.key .Values.netbirdAPI.keyFromSecret }}
- --netbird-api-key=$(NB_API_KEY)
{{- end }}
2025-04-13 23:00:23 +02:00
{{- if .Values.ingress.allowAutomaticPolicyCreation }}
- --allow-automatic-policy-creation
{{- end }}
2025-07-10 12:57:12 +02:00
{{- if .Values.routingClientImage }}
- --netbird-client-image={{.Values.routingClientImage}}
{{- end }}
{{- if .Values.general.labels }}
{{- $list := list }}
{{- range $k, $v := .Values.general.labels }}
{{- $list = append $list (printf "%s=%s" $k $v) }}
{{- end }}
- --default-labels="{{ join ", " $list }}"
{{- end }}
ports:
- name: webhook-server
containerPort: {{ .Values.webhook.service.port }}
protocol: TCP
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: {{ .Values.operator.livenessProbe.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.operator.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.operator.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.operator.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.operator.livenessProbe.timeoutSeconds }}
2025-05-01 13:52:03 +01:00
env:
2026-03-18 12:00:31 +01:00
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if or .Values.netbirdAPI.key .Values.netbirdAPI.keyFromSecret }}
2025-05-01 13:52:03 +01:00
- name: NB_API_KEY
2025-05-02 10:10:50 +01:00
valueFrom:
secretKeyRef:
2025-05-01 13:52:03 +01:00
{{- if .Values.netbirdAPI.keyFromSecret }}
2025-05-02 10:10:50 +01:00
name: {{ .Values.netbirdAPI.keyFromSecret.name }}
key: {{ .Values.netbirdAPI.keyFromSecret.key }}
2025-05-01 13:52:03 +01:00
{{- else }}
name: {{ include "kubernetes-operator.fullname" . }}
key: NB_API_KEY
{{- end }}
2025-03-06 10:57:45 +02:00
{{- end }}
readinessProbe:
failureThreshold: 3
httpGet:
path: /readyz
port: {{ .Values.operator.readinessProbe.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.operator.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.operator.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.operator.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.operator.readinessProbe.timeoutSeconds }}
resources:
{{- toYaml .Values.operator.resources | nindent 12 }}
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-certs
readOnly: true
{{- with .Values.operator.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: webhook-certs
secret:
defaultMode: 420
secretName: {{ template "kubernetes-operator.webhookCertSecret" . }}
{{- with .Values.operator.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}