apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "flex-auth.name" . }} labels: {{- include "flex-auth.labels" . | nindent 4 }} spec: {{- if .Values.outbox.enabled }} {{- if ne (int .Values.replicaCount) 1 }} {{- fail "outbox requires replicaCount=1: one writer per source and PVC" }} {{- end }} strategy: type: Recreate {{- end }} replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "flex-auth.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "flex-auth.labels" . | nindent 8 }} spec: automountServiceAccountToken: false {{- if eq (include "flex-auth.callerAuth.enabled" .) "true" }} serviceAccountName: {{ include "flex-auth.name" . }} {{- end }} securityContext: runAsNonRoot: true runAsUser: 65532 runAsGroup: 65532 fsGroup: 65532 seccompProfile: type: RuntimeDefault containers: - name: flex-auth image: {{ include "flex-auth.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: {{- toYaml .Values.args | nindent 12 }} {{- if .Values.outbox.enabled }} - --outbox-dir - {{ .Values.outbox.mountPath | quote }} - --emission-source - {{ required "outbox.source is required when outbox.enabled=true" .Values.outbox.source | quote }} {{- end }} {{- if eq (include "flex-auth.callerAuth.enabled" .) "true" }} {{- $binding := required "callerAuth.binding is required when callerAuth.mode is warn or enforce" .Values.callerAuth.binding }} - --caller-auth-mode - {{ include "flex-auth.callerAuth.mode" . | quote }} - --caller-kubernetes-url - {{ required "callerAuth.kubernetesURL is required when callerAuth.mode is warn or enforce" .Values.callerAuth.kubernetesURL | quote }} - --caller-binding - {{ $binding | quote }} {{- range .Values.callerAuth.extraBindings }} - --caller-binding - {{ . | quote }} {{- end }} {{- end }} ports: - name: http containerPort: {{ .Values.service.port }} livenessProbe: httpGet: path: {{ .Values.health.path }} port: http periodSeconds: 20 readinessProbe: httpGet: path: {{ .Values.health.path }} port: http periodSeconds: 5 resources: {{- toYaml .Values.resources | nindent 12 }} securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL readOnlyRootFilesystem: true {{- if or .Values.outbox.enabled (eq (include "flex-auth.callerAuth.enabled" .) "true") }} volumeMounts: {{- if .Values.outbox.enabled }} - mountPath: {{ .Values.outbox.mountPath | quote }} name: flex-auth-outbox {{- end }} {{- if eq (include "flex-auth.callerAuth.enabled" .) "true" }} - mountPath: {{ .Values.callerAuth.reviewer.mountPath }} name: flex-auth-reviewer readOnly: true {{- end }} {{- end }} {{- if or .Values.outbox.enabled (eq (include "flex-auth.callerAuth.enabled" .) "true") }} volumes: {{- if .Values.outbox.enabled }} - name: flex-auth-outbox persistentVolumeClaim: claimName: {{ default (printf "%s-outbox" (include "flex-auth.name" .)) .Values.outbox.existingClaim | quote }} {{- end }} {{- if eq (include "flex-auth.callerAuth.enabled" .) "true" }} - name: flex-auth-reviewer projected: defaultMode: 0440 sources: - serviceAccountToken: {{- if .Values.callerAuth.reviewer.audience }} audience: {{ .Values.callerAuth.reviewer.audience | quote }} {{- end }} expirationSeconds: {{ .Values.callerAuth.reviewer.expirationSeconds }} path: token - configMap: name: kube-root-ca.crt items: - key: ca.crt path: ca.crt {{- end }} {{- end }}