################################################################################ # Copyright (c) 2019 AT&T Intellectual Property. # # Copyright (c) 2019 Nokia. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # # You may obtain a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ {{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaasha.image.registry }} --- apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "common.statefulsetname.dbaasha" . }}-server namespace: {{ include "common.namespace.platform" . }} labels: app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: selector: matchLabels: app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }} release: {{ .Release.Name }} serviceName: {{ template "common.servicename.dbaasha.tcp" . }} replicas: {{ .Values.dbaasha.replicas }} podManagementPolicy: OrderedReady updateStrategy: type: RollingUpdate template: metadata: labels: app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }} release: {{ .Release.Name }} spec: {{- if .Values.dbaasha.nodeSelector }} nodeSelector: {{ toYaml .Values.dbaasha.nodeSelector | indent 8 }} {{- end }} {{- with .Values.dbaasha.affinity }} affinity: {{ tpl . $ | indent 8 }} {{- end }} imagePullSecrets: {{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaasha.image.registry }} - name: {{ include "common.dockerregistry.credential" $ctx }} initContainers: {{- if .Values.dbaasha.sysctlImage.enabled }} - name: init-systctl image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }} imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx }} {{ if .Values.dbaasha.sysctlImage.mountHostSys }} volumeMounts: - name: host-sys mountPath: /host-sys {{- end }} command: {{ toYaml .Values.dbaasha.sysctlImage.command | indent 10 }} securityContext: runAsNonRoot: false privileged: true runAsUser: 0 {{- end }} - name: config-init image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }} imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx }} command: - sh args: - /readonly-config/init.sh volumeMounts: - name: config mountPath: /readonly-config readOnly: true - name: data mountPath: /data containers: - name: {{ include "common.containername.dbaasha.redis" . }} image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }} imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx }} command: - redis-server args: - /data/conf/redis.conf livenessProbe: exec: command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}] initialDelaySeconds: 15 periodSeconds: 5 readinessProbe: exec: command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}] initialDelaySeconds: 15 periodSeconds: 5 ports: - name: redis containerPort: {{ include "common.serviceport.dbaasha.redis" . }} volumeMounts: - mountPath: /data name: data - mountPath: /probes name: probes - name: {{ include "common.containername.dbaasha.sentinel" . }} image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }} imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx }} command: - redis-server args: - /data/conf/sentinel.conf - --sentinel livenessProbe: exec: command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}] initialDelaySeconds: 15 periodSeconds: 5 readinessProbe: exec: command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}] initialDelaySeconds: 15 periodSeconds: 5 ports: - name: sentinel containerPort: {{ include "common.serviceport.dbaasha.sentinel" . }} volumeMounts: - mountPath: /data name: data - mountPath: /probes name: probes volumes: - name: config configMap: name: {{ template "common.configmapname.dbaasha" . }}-config - name: probes configMap: name: {{ template "common.configmapname.dbaasha" . }}-probes {{- if .Values.dbaasha.sysctlImage.mountHostSys }} - name: host-sys hostPath: path: /sys {{- end }} - name: data emptyDir: {}