Add dcaemod charts
[oom.git] / kubernetes / dcaemod / components / dcaemod-nifi-registry / templates / deployment.yaml
1 #============LICENSE_START========================================================
2 # ================================================================================
3 # Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=========================================================
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   replicas: 1
23   selector: {{- include "common.selectors" . | nindent 4 }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       initContainers:
28       # nifi-registry app runs as user "nifi", uid 1000, group "nifi", gid 1000
29       # the volume is mounted with root permissions
30       # this initContainer changes ownership to uid 1000 gid 1000
31       # (tried using a securityContext in the pod spec, but it didn't seem to work)
32         - name: set-permissions
33           image: busybox:latest
34           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35           command:
36             - sh
37             - -c
38             - chown -R 1000:1000 /opt/nifi-registry/nifi-registry-0.4.0/flow_storage
39           volumeMounts:
40           - mountPath: /opt/nifi-registry/nifi-registry-0.4.0/flow_storage
41             name: flow-storage
42       containers:
43         - name: {{ include "common.name" . }}
44           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
45           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46           ports: {{ include "common.containerPorts" . | nindent 12  }}
47           {{- if eq .Values.liveness.enabled true }}
48           livenessProbe:
49             tcpSocket:
50               port: {{ .Values.liveness.port }}
51             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
52             periodSeconds: {{ .Values.liveness.periodSeconds }}
53           {{ end }}
54           readinessProbe:
55             tcpSocket:
56               port: {{ .Values.readiness.port }}
57             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
58             periodSeconds: {{ .Values.readiness.periodSeconds }}
59           volumeMounts:
60           - mountPath: /opt/nifi-registry/nifi-registry-0.4.0/flow_storage
61             name: flow-storage
62           resources: {{ include "common.resources" . | nindent 12 }}
63           env:
64           - name: NIFI_REGISTRY_DB_URL
65             value: {{ .Values.config.dbURL }}
66           - name: NIFI_REGISTRY_DB_USER
67             {{- include "common.secret.envFromSecret" (dict "global" . "uid" "dbsecret" "key" "login") | indent 12 }}
68           - name: NIFI_REGISTRY_DB_PASS
69             {{- include "common.secret.envFromSecret" (dict "global" . "uid" "dbsecret" "key" "password") | indent 12 }}
70       volumes:
71       - name: flow-storage
72         persistentVolumeClaim:
73           claimName: {{ include "common.fullname" . }}
74       imagePullSecrets:
75       - name: "{{ include "common.namespace" . }}-docker-registry-key"