Collectd operator utilties
[demo.git] / vnfs / DAaaS / minio / templates / deployment.yaml
1 {{- if eq .Values.mode "standalone" }}
2 apiVersion: apps/v1beta2
3 kind: Deployment
4 metadata:
5   name: {{ template "minio.fullname" . }}
6   labels:
7     app: {{ template "minio.name" . }}
8     chart: {{ template "minio.chart" . }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   strategy:
13     type: {{ .Values.DeploymentUpdate.type }}
14     rollingUpdate:
15       maxSurge: {{ .Values.DeploymentUpdate.maxSurge }}
16       maxUnavailable: {{ .Values.DeploymentUpdate.maxUnavailable }}
17   {{- if .Values.nasgateway.enabled }}
18   replicas: {{ .Values.nasgateway.replicas }}
19   {{- end }}
20   {{- if .Values.s3gateway.enabled }}
21   replicas: {{ .Values.s3gateway.replicas }}
22   {{- end }}
23   {{- if .Values.azuregateway.enabled }}
24   replicas: {{ .Values.azuregateway.replicas }}
25   {{- end }}
26   {{- if .Values.gcsgateway.enabled }}
27   replicas: {{ .Values.gcsgateway.replicas }}
28   {{- end }}
29   {{- if .Values.ossgateway.enabled }}
30   replicas: {{ .Values.ossgateway.replicas }}
31   {{- end }}
32   selector:
33     matchLabels:
34       app: {{ template "minio.name" . }}
35       release: {{ .Release.Name }}
36   template:
37     metadata:
38       name: {{ template "minio.fullname" . }}
39       labels:
40         app: {{ template "minio.name" . }}
41         release: {{ .Release.Name }}
42       {{- if .Values.podAnnotations }}
43       annotations:
44 {{ toYaml .Values.podAnnotations | indent 8 }}
45       {{- end }}
46     spec:
47   {{- if .Values.priorityClassName }}
48       priorityClassName: "{{ .Values.priorityClassName }}"
49   {{- end }}
50       containers:
51         - name: {{ .Chart.Name }}
52           image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
53           imagePullPolicy: {{ .Values.image.pullPolicy }}
54           {{- if .Values.s3gateway.enabled }}
55           command: [ "/bin/sh",
56           "-ce",
57           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} gateway s3 {{ .Values.s3gateway.serviceEndpoint }}" ]
58           {{- else }}
59           {{- if .Values.azuregateway.enabled }}
60           command: [ "/bin/sh", 
61           "-ce", 
62           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} gateway azure" ]
63           {{- else }}
64           {{- if .Values.gcsgateway.enabled }}
65           command: [ "/bin/sh", 
66           "-ce", 
67           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} gateway gcs {{ .Values.gcsgateway.projectId }}" ]
68           {{- else }}
69           {{- if .Values.ossgateway.enabled }}
70           command: [ "/bin/sh", 
71           "-ce", 
72           "cp /tmp/config.json {{ .Values.configPath }} && 
73           /usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} gateway oss {{ .Values.ossgateway.endpointURL }}" ]
74           {{- else }}
75           {{- if .Values.nasgateway.enabled }}
76           command: [ "/bin/sh", 
77           "-ce", 
78           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} gateway nas {{ .Values.mountPath }}" ]
79           {{- else }}
80           command: [ "/bin/sh", 
81           "-ce", 
82           "/usr/bin/docker-entrypoint.sh minio -C {{ .Values.configPath }} server {{ .Values.mountPath }}" ]
83           {{- end }}
84           {{- end }}
85           {{- end }}
86           {{- end }}
87           {{- end }}
88           volumeMounts:
89             {{- if and .Values.persistence.enabled (not .Values.gcsgateway.enabled) (not .Values.azuregateway.enabled) (not .Values.s3gateway.enabled) }}
90             - name: export
91               mountPath: {{ .Values.mountPath }}
92               {{- if .Values.persistence.subPath }}
93               subPath: "{{ .Values.persistence.subPath }}"
94               {{- end }}
95             {{- end }}
96             {{- if .Values.gcsgateway.enabled }}
97             - name: minio-user
98               mountPath: "/etc/credentials"
99               readOnly: true
100             {{- end }}
101             - name: minio-config-dir
102               mountPath: {{ .Values.configPath }}
103             {{- if .Values.tls.enabled }}
104             - name: cert-secret-volume
105               mountPath: {{ .Values.configPath }}certs
106             {{ end }}
107           ports:
108             - name: service
109               containerPort: 9000
110           env:
111             - name: MINIO_ACCESS_KEY
112               valueFrom:
113                 secretKeyRef:
114                   name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
115                   key: accesskey
116             - name: MINIO_SECRET_KEY
117               valueFrom:
118                 secretKeyRef:
119                   name: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
120                   key: secretkey
121             {{- if .Values.gcsgateway.enabled }}
122             - name: GOOGLE_APPLICATION_CREDENTIALS
123               value: "/etc/credentials/gcs_key.json"
124             {{- end }}
125             {{- range $key, $val := .Values.environment }}
126             - name: {{ $key }}
127               value: {{ $val | quote }}
128             {{- end}}
129           livenessProbe:
130             httpGet:
131               path: /minio/health/live
132               port: service
133               {{- if .Values.tls.enabled }}
134               scheme: HTTPS
135               {{ else }}
136               scheme: HTTP
137               {{- end }}
138             initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
139             periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
140             timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
141             successThreshold: {{ .Values.livenessProbe.successThreshold }}
142             failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
143           readinessProbe:
144             httpGet:
145               {{- if .Values.tls.enabled }}
146               scheme: HTTPS
147               {{- end }}
148               path: /minio/health/ready
149               port: service
150             periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
151             timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
152             successThreshold: {{ .Values.readinessProbe.successThreshold }}
153             failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
154           resources:
155 {{ toYaml .Values.resources | indent 12 }}
156 {{- with .Values.nodeSelector }}
157       nodeSelector:
158 {{ toYaml . | indent 8 }}
159 {{- end }}
160 {{- with .Values.affinity }}
161       affinity:
162 {{ toYaml . | indent 8 }}
163 {{- end }}
164 {{- with .Values.tolerations }}
165       tolerations:
166 {{ toYaml . | indent 8 }}
167 {{- end }}
168       volumes:
169         {{- if and (not .Values.gcsgateway.enabled) (not .Values.azuregateway.enabled) (not .Values.s3gateway.enabled) }}
170         - name: export
171         {{- if .Values.persistence.enabled }}
172           persistentVolumeClaim:
173             claimName: {{ .Values.persistence.existingClaim | default (include "minio.fullname" .) }}
174         {{- else }}
175           emptyDir: {}
176         {{- end }}
177         {{- end }}
178         - name: minio-user
179           secret:
180             secretName: {{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "minio.fullname" . }}{{ end }}
181         - name: minio-config-dir
182           emptyDir: {}
183         {{- if .Values.tls.enabled }}
184         - name: cert-secret-volume
185           secret:
186             secretName: {{ .Values.tls.certSecret }}
187             items:
188             - key: {{ .Values.tls.publicCrt }}
189               path: public.crt
190             - key: {{ .Values.tls.privateKey }}
191               path: private.key
192             - key: {{ .Values.tls.publicCrt }}
193               path: CAs/public.crt
194         {{ end }}
195 {{- end }}