447b671db36d7d51a79e92777aed64ce98648e41
[demo.git] / vnfs / DAaaS / minio / templates / statefulset.yaml
1 {{- if eq .Values.mode "distributed" }}
2 {{ $nodeCount := .Values.replicas | int }}
3 apiVersion: apps/v1beta1
4 kind: StatefulSet
5 metadata:
6   name: {{ template "minio.fullname" . }}
7   labels:
8     app: {{ template "minio.name" . }}
9     chart: {{ template "minio.chart" . }}
10     release: {{ .Release.Name }}
11     heritage: {{ .Release.Service }}
12 spec:
13   updateStrategy:
14     type: {{ .Values.StatefulSetUpdate.updateStrategy }}
15   serviceName: {{ template "minio.fullname" . }}
16   replicas: {{ .Values.replicas }}
17   selector:
18     matchLabels:
19       app: {{ template "minio.name" . }}
20       release: {{ .Release.Name }}
21   template:
22     metadata:
23       name: {{ template "minio.fullname" . }}
24       labels:
25         app: {{ template "minio.name" . }}
26         release: {{ .Release.Name }}
27       {{- if .Values.podAnnotations }}
28       annotations:
29 {{ toYaml .Values.podAnnotations | indent 8 }}
30       {{- end }}
31     spec:
32       {{- if .Values.priorityClassName }}
33       priorityClassName: "{{ .Values.priorityClassName }}"
34       {{- end }}
35       containers:
36         - name: {{ .Chart.Name }}
37           image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
38           imagePullPolicy: {{ .Values.image.pullPolicy }}
39           {{- if .Values.tls.enabled }}
40           command: [ "/bin/sh",
41           "-ce",
42           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} server
43           {{- range $i := until $nodeCount }}
44           https://{{ template `minio.fullname` $ }}-{{ $i }}.{{ template `minio.fullname` $ }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}{{ $.Values.mountPath }}
45           {{- end }}" ]
46           {{ else }}
47           command: [ "/bin/sh",
48           "-ce",
49           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} server
50           {{- range $i := until $nodeCount }}
51           http://{{ template `minio.fullname` $ }}-{{ $i }}.{{ template `minio.fullname` $ }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}{{ $.Values.mountPath }}
52           {{- end }}" ]
53           {{ end }}
54           volumeMounts:
55             - name: export
56               mountPath: {{ .Values.mountPath }}
57               {{- if and .Values.persistence.enabled .Values.persistence.subPath }}
58               subPath: "{{ .Values.persistence.subPath }}"
59               {{- end }}
60             - name: minio-config-dir
61               mountPath: {{ .Values.configPath }}
62             {{- if .Values.tls.enabled }}
63             - name: cert-secret-volume
64               mountPath: {{ .Values.configPath }}certs
65             {{ end }}
66           ports:
67             - name: service
68               containerPort: 9000
69           env:
70             - name: MINIO_ACCESS_KEY
71               valueFrom:
72                 secretKeyRef:
73                   name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
74                   key: accesskey
75             - name: MINIO_SECRET_KEY
76               valueFrom:
77                 secretKeyRef:
78                   name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
79                   key: secretkey
80             {{- range $key, $val := .Values.environment }}
81             - name: {{ $key }}
82               value: {{ $val | quote }}
83             {{- end}}
84           livenessProbe:
85             httpGet:
86               path: /minio/health/live
87               port: service
88               {{- if .Values.tls.enabled }}
89               scheme: HTTPS
90               {{ else }}
91               scheme: HTTP
92               {{- end }}
93             initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
94             periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
95             timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
96             successThreshold: {{ .Values.livenessProbe.successThreshold }}
97             failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
98           resources:
99 {{ toYaml .Values.resources | indent 12 }}
100     {{- with .Values.nodeSelector }}
101       nodeSelector:
102 {{ toYaml . | indent 8 }}
103     {{- end }}
104     {{- with .Values.affinity }}
105       affinity:
106 {{ toYaml . | indent 8 }}
107     {{- end }}
108     {{- with .Values.tolerations }}
109       tolerations:
110 {{ toYaml . | indent 8 }}
111     {{- end }}
112       volumes:
113         - name: minio-user
114           secret:
115             secretName: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
116         - name: minio-config-dir
117           emptyDir: {}
118         {{- if .Values.tls.enabled }}
119         - name: cert-secret-volume
120           secret:
121             secretName: {{ .Values.tls.certSecret }}
122             items:
123             - key: {{ .Values.tls.publicCrt }}
124               path: public.crt
125             - key: {{ .Values.tls.privateKey }}
126               path: private.key
127             - key: {{ .Values.tls.publicCrt }}
128               path: CAs/public.crt
129         {{ end }}
130   volumeClaimTemplates:
131     - metadata:
132         name: export
133       spec:
134         accessModes: [ {{ .Values.persistence.accessMode | quote }} ]
135         {{- if .Values.persistence.storageClass }}
136         storageClassName: {{ .Values.persistence.storageClass }}
137         {{- end }}
138         resources:
139           requests:
140             storage: {{ .Values.persistence.size }}
141 {{- end }}