-
Notifications
You must be signed in to change notification settings - Fork 28
/
deployment.yaml
167 lines (155 loc) · 5.74 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{{- $_ := set . "appName" "idm" -}}
{{- if not .Values.features.externalUserManagement.enabled }}
{{- $_ := set . "resources" (default (default (dict) .Values.resources) .Values.services.idm.resources) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .appName }}
namespace: {{ template "ocis.namespace" . }}
labels:
{{- include "ocis.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
app: {{ .appName }}
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: {{ .appName }}
{{- include "ocis.labels" . | nindent 8 }}
spec:
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
fsGroupChangePolicy: {{ .Values.securityContext.fsGroupChangePolicy }}
initContainers:
{{- if and $.Values.services.idm.persistence.enabled $.Values.services.idm.persistence.chownInitContainer }}
- name: init-chown-data
image: busybox
securityContext:
runAsNonRoot: false
runAsUser: 0
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.runAsGroup }}", "/var/lib/ocis"]
volumeMounts:
- name: idm-data
mountPath: /var/lib/ocis
{{ end }}
- name: init-dir #TODO: that should not be needed, needs fix in the idm service
image: busybox:stable
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.securityContext.runAsUser }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
readOnlyRootFilesystem: true
command: ["mkdir", "-p", "/var/lib/ocis/idm"]
resources: {{ toYaml .resources | nindent 12 }}
volumeMounts:
- name: idm-data
mountPath: /var/lib/ocis
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- tpl . $ | nindent 8 }}
{{- end }}
containers:
- name: {{ .appName }}
image: {{ template "ocis.image" $ }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["ocis"]
args: ["idm", "server"]
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.securityContext.runAsUser }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
readOnlyRootFilesystem: true
env:
- name: MICRO_REGISTRY
value: kubernetes
- name: IDM_LOG_COLOR
value: {{ .Values.logging.color | quote }}
- name: IDM_LOG_LEVEL
value: {{ .Values.logging.level | quote }}
- name: IDM_LOG_PRETTY
value: {{ .Values.logging.pretty | quote }}
# - name: IDM_DEBUG_PPROF
# value: {{ .Values.debug.profiling | quote }}
- name: IDM_LDAPS_ADDR
value: 0.0.0.0:9235
# - name: IDM_DEBUG_ADDR
# value: 0.0.0.0:9239
- name: IDM_CREATE_DEMO_USERS
value: {{ .Values.features.demoUsers | quote }}
- name: IDM_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secretRefs.adminUserSecretRef }}
key: password
- name: IDM_ADMIN_USER_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secretRefs.adminUserSecretRef }}
key: user-id
- name: IDM_SVC_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secretRefs.ldapSecretRef }}
key: graph-ldap-bind-password
- name: IDM_REVASVC_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secretRefs.ldapSecretRef }}
key: reva-ldap-bind-password
- name: IDM_IDPSVC_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secretRefs.ldapSecretRef }}
key: idp-ldap-bind-password
- name: IDM_LDAPS_CERT
value: /etc/ocis/ldap-cert/ldap.crt
- name: IDM_LDAPS_KEY
value: /etc/ocis/ldap-cert/ldap.key
livenessProbe:
# TODO: IDM does not currently provide a debug port, re-enable this once that is implemented
# httpGet:
# path: /healthz
# port: metrics-debug
# until then we're just doing a TCP check on the main port
tcpSocket:
port: ldaps
timeoutSeconds: 10
initialDelaySeconds: 60
periodSeconds: 20
failureThreshold: 3
resources: {{ toYaml .resources | nindent 12 }}
ports:
- name: ldaps
containerPort: 9235
# TODO: IDM does not currently provide a debug port, re-enable this once that is implemented
# - name: metrics-debug
# containerPort: 9239
volumeMounts:
- name: ocis-config-tmp
mountPath: /etc/ocis # we mount that volume only to apply fsGroup to that path
- name: ldap-cert
mountPath: /etc/ocis/ldap-cert
readOnly: true
- name: idm-data
mountPath: /var/lib/ocis
volumes:
- name: ocis-config-tmp
emptyDir:
medium: Memory
sizeLimit: 6Mi
- name: ldap-cert
secret:
secretName: {{ .Values.secretRefs.ldapCertRef }}
{{ if .Values.services.idm.persistence.enabled }}
- name: idm-data
persistentVolumeClaim:
claimName: idm-data
{{ else }}
- name: idm-data
emptyDir: {}
{{ end }}
{{- end }}