-
Notifications
You must be signed in to change notification settings - Fork 123
/
deployment.yaml
134 lines (134 loc) · 4.06 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{{- $tlsDisabled := (eq (include "cerbos.tlsSecretName" .) "None") -}}
{{- $defaultBundleDriverEnabled := (eq (include "cerbos.defaultBundleDriverEnabled" .) "yes") -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cerbos.fullname" . }}
labels:
{{- include "cerbos.labels" . | nindent 4 }}
{{- with .Values.deployment.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "cerbos.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "cerbos.selectorLabels" . | nindent 8 }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "cerbos.podAnnotations" . | nindent 6 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "cerbos.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: {{ include "cerbos.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "server"
- "--config=/config/config.yaml"
- "--log-level={{ .Values.cerbos.logLevel }}"
ports:
- name: http
containerPort: {{ .Values.cerbos.httpPort }}
- name: grpc
containerPort: {{ .Values.cerbos.grpcPort }}
livenessProbe:
httpGet:
path: /_cerbos/health
port: http
scheme: {{ include "cerbos.httpScheme" . | upper }}
readinessProbe:
httpGet:
path: /_cerbos/health
port: http
scheme: {{ include "cerbos.httpScheme" . | upper }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /config
readOnly: true
{{- if $defaultBundleDriverEnabled }}
- name: bundletmp
mountPath: /tmp
- name: bundlecache
mountPath: /.cache
{{- else }}
- name: work
mountPath: /work
{{- end }}
{{- if not $tlsDisabled }}
- name: certs
mountPath: /certs
readOnly: true
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "cerbos.fullname" . }}
{{- if $defaultBundleDriverEnabled }}
- name: bundletmp
emptyDir: {}
- name: bundlecache
emptyDir: {}
{{- else }}
- name: work
emptyDir: {}
{{- end }}
{{- if not $tlsDisabled }}
- name: certs
secret:
secretName: {{ include "cerbos.tlsSecretName" . }}
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}