access-engine/charts/flex-auth/templates/deployment.yaml

88 lines
3.1 KiB
YAML
Raw Permalink Normal View History

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "flex-auth.name" . }}
labels:
{{- include "flex-auth.labels" . | nindent 4 }}
spec:
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 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 }}
{{- 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 eq (include "flex-auth.callerAuth.enabled" .) "true" }}
volumeMounts:
- mountPath: {{ .Values.callerAuth.reviewer.mountPath }}
name: flex-auth-reviewer
readOnly: true
{{- end }}
{{- if eq (include "flex-auth.callerAuth.enabled" .) "true" }}
volumes:
- 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 }}