Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 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 | |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 15 | apiVersion: apps/v1beta1 |
| 16 | kind: StatefulSet |
Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 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: |
Taka Cho | 7275985 | 2019-06-26 13:51:46 -0400 | [diff] [blame] | 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 |
Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 40 | containers: |
| 41 | - name: {{ include "common.name" . }} |
| 42 | command: ["/bin/bash"] |
Aaron Hay | fbe516c | 2018-09-27 08:06:15 -0400 | [diff] [blame] | 43 | args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"] |
Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 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 |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 69 | - mountPath: {{ .Values.persistence.playbookPath }} |
Taka Cho | 7275985 | 2019-06-26 13:51:46 -0400 | [diff] [blame] | 70 | name: {{ include "common.fullname" . }}-playbook |
Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 71 | resources: |
Mandeep Khinda | 5e3f36a | 2018-09-24 15:25:42 +0000 | [diff] [blame] | 72 | {{ include "common.resources" . | indent 12 }} |
Sylvain Desbureaux | 45bb713 | 2018-11-23 15:41:38 +0100 | [diff] [blame] | 73 | {{- if .Values.nodeSelector }} |
Aaron Hay | 343e600 | 2018-08-21 13:55:00 -0400 | [diff] [blame] | 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 |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 89 | {{ if not .Values.persistence.enabled }} |
Taka Cho | 7275985 | 2019-06-26 13:51:46 -0400 | [diff] [blame] | 90 | - name: {{ include "common.fullname" . }}-playbook |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 91 | emptyDir: {} |
| 92 | {{ else }} |
| 93 | volumeClaimTemplates: |
| 94 | - metadata: |
Taka Cho | 7275985 | 2019-06-26 13:51:46 -0400 | [diff] [blame] | 95 | name: {{ include "common.fullname" . }}-playbook |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 96 | labels: |
| 97 | name: {{ include "common.fullname" . }} |
Sylvain Desbureaux | 5f46e6e | 2019-11-29 09:19:40 +0100 | [diff] [blame] | 98 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 99 | release: "{{ .Release.Name }}" |
| 100 | heritage: "{{ .Release.Service }}" |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 101 | spec: |
Sylvain Desbureaux | 5f46e6e | 2019-11-29 09:19:40 +0100 | [diff] [blame] | 102 | accessModes: |
| 103 | - {{ .Values.persistence.accessMode }} |
| 104 | storageClassName: {{ include "common.storageClass" . }} |
Aaron Hay | 0fc9076 | 2019-03-20 19:48:42 -0400 | [diff] [blame] | 105 | resources: |
| 106 | requests: |
| 107 | storage: {{ .Values.persistence.size }} |
| 108 | {{ end }} |