Mavenized image creation for readiness-check
[oom.git] / kubernetes / appc / charts / appc-ansible-server / templates / statefulset.yaml
1 # Copyright © 2018 Amdocs, Bell Canada, AT&T
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: apps/v1beta1
16 kind: StatefulSet
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - name: {{ include "common.name" . }}-chown
35         image: "busybox"
36         command: ["sh", "-c", "chown -R {{ .Values.config.ansibleUid }}:{{ .Values.config.ansibleGid}} {{ .Values.persistence.playbookPath }}"]
37         volumeMounts:
38           - mountPath: {{ .Values.persistence.playbookPath }}
39             name: {{ include "common.fullname" . }}-playbook
40       containers:
41         - name: {{ include "common.name" . }}
42           command: ["/bin/bash"]
43           args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"]
44           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
45           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46           ports:
47           - containerPort: {{ .Values.service.internalPort }}
48           # disable liveness probe when breakpoints set in debugger
49           # so K8s doesn't restart unresponsive container
50           {{ if .Values.liveness.enabled }}
51           livenessProbe:
52             tcpSocket:
53               port: {{ .Values.service.internalPort }}
54             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
55             periodSeconds: {{ .Values.liveness.periodSeconds }}
56           {{ end }}
57           readinessProbe:
58             tcpSocket:
59               port: {{ .Values.service.internalPort }}
60             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
61             periodSeconds: {{ .Values.readiness.periodSeconds }}
62           volumeMounts:
63           - mountPath: /etc/localtime
64             name: localtime
65             readOnly: true
66           - mountPath: {{ .Values.config.configDir }}/RestServer_config
67             name: config
68             subPath: RestServer_config
69           - mountPath: {{ .Values.persistence.playbookPath }}
70             name: {{ include "common.fullname" . }}-playbook
71           resources:
72 {{ include "common.resources" . | indent 12 }}
73         {{- if .Values.nodeSelector }}
74         nodeSelector:
75 {{ toYaml .Values.nodeSelector | indent 10 }}
76         {{- end -}}
77         {{- if .Values.affinity }}
78         affinity:
79 {{ toYaml .Values.affinity | indent 10 }}
80         {{- end }}
81       volumes:
82         - name: localtime
83           hostPath:
84             path: /etc/localtime
85         - name: config
86           configMap:
87             name: {{ include "common.fullname" . }}
88             defaultMode: 0644
89 {{ if not .Values.persistence.enabled }}
90         - name: {{ include "common.fullname" . }}-playbook
91           emptyDir: {}
92 {{ else }}
93   volumeClaimTemplates:
94   - metadata:
95       name: {{ include "common.fullname" . }}-playbook
96       labels:
97         name: {{ include "common.fullname" . }}
98     spec:
99       accessModes: [ {{ .Values.persistence.accessMode }} ]
100       storageClassName: {{ include "common.fullname" . }}-playbook
101       resources:
102         requests:
103           storage: {{ .Values.persistence.size }}
104 {{ end }}