-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathhermes-deployment.yaml
183 lines (183 loc) · 6.82 KB
/
hermes-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
{{- if gt .Values.hermesCount 0.0 -}}
{{- $rucio_daemon := "hermes" }}
{{- $component_values := .Values.hermes }}
{{- $component_count := .Values.hermesCount }}
{{- $app_label := printf "%s-%s" (include "rucio.name" .) $rucio_daemon }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "rucio.fullname" . }}.config.{{ $rucio_daemon }}
labels:
app: {{ $app_label }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{- $common_config := .Values.config | default dict | mustToPrettyJson | b64enc }}
{{- $component_config := $component_values.config | default dict | mustToPrettyJson | b64enc }}
component.json: {{ $component_config | quote }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ $rucio_daemon }}
labels:
app: {{ $app_label }}
app-group: {{ template "rucio.name" . }}
chart: {{ template "rucio.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ $component_count }}
selector:
matchLabels:
app: {{ $app_label }}
release: {{ .Release.Name }}
strategy:
type: {{ .Values.strategy.type }}
{{- if eq .Values.strategy.type "RollingUpdate" }}
{{- with .Values.strategy.rollingUpdate }}
rollingUpdate:
{{ toYaml . | trim | indent 6 }}
{{- end }}
{{- end }}
minReadySeconds: {{ .Values.minReadySeconds }}
template:
metadata:
labels:
app: {{ $app_label }}
app-group: {{ template "rucio.name" . }}
release: {{ .Release.Name }}
rucio-daemon: {{ $rucio_daemon }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/config: {{ print "%s%s" $common_config $component_config | sha1sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $component_values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.serviceAccountName }}
serviceAccountName: {{ .Values.serviceAccountName }}
{{- end }}
volumes:
- name: config-common
secret:
secretName: {{ template "rucio.fullname" . }}.config.common
- name: config-component
secret:
secretName: {{ template "rucio.fullname" . }}.config.{{ $rucio_daemon }}
{{ if $component_values.useSSL }}
- name: usercert
secret:
secretName: {{ .Release.Name }}-hermes-cert
- name: userkey
secret:
secretName: {{ .Release.Name }}-hermes-key
{{ end }}
{{- range $collection := tuple (coalesce $component_values.secretMounts .Values.secretMounts) $component_values.extraSecretMounts }}
{{- range $key, $val := $collection }}
- name: {{ coalesce $val.volumeName $val.secretName $val.secretFullName }}
secret:
secretName: {{ coalesce $val.secretFullName (printf "%s-%s" $.Release.Name $val.secretName) }}
{{- if $val.defaultMode }}
defaultMode: {{ $val.defaultMode }}
{{- end }}
{{- end}}
{{- end}}
{{- range $key, $val := .Values.persistentVolumes }}
- name: {{ $key }}
persistentVolumeClaim:
claimName: {{ $val.name }}
{{- end}}
{{- range $collection := tuple (hasKey $component_values "hostPathMounts" | ternary $component_values.hostPathMounts .Values.hostPathMounts) $component_values.extraHostPathMounts }}
{{- range $key, $val := $collection }}
- name: {{ $val.volumeName | default (printf "a%s" ($val.mountPath | sha1sum)) }}
hostPath:
{{- if $val.type }}
type: {{ $val.type }}
{{- end}}
path: {{ $val.hostPath }}
{{- end}}
{{- end}}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ coalesce ($component_values.image | default dict).tag .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
{{ if $component_values.useSSL }}
- name: usercert
mountPath: /opt/rucio/certs/
- name: userkey
mountPath: /opt/rucio/keys/
{{ end }}
- name: config-common
mountPath: /opt/rucio/etc/conf.d/10_common.json
subPath: common.json
- name: config-component
mountPath: /opt/rucio/etc/conf.d/20_component.json
subPath: component.json
{{- range $collection := tuple (coalesce $component_values.secretMounts .Values.secretMounts) $component_values.extraSecretMounts }}
{{- range $key, $val := $collection }}
- name: {{ coalesce $val.volumeName $val.secretName $val.secretFullName }}
mountPath: {{ $val.mountPath }}
{{- if $val.subPath }}
subPath: "{{ $val.subPath }}"
{{- end }}
{{- end}}
{{- end}}
{{- range $key, $val := .Values.persistentVolumes }}
- name: {{ $key }}
mountPath: {{ $val.mountPath }}
{{- end}}
{{- range $collection := tuple (hasKey $component_values "hostPathMounts" | ternary $component_values.hostPathMounts .Values.hostPathMounts) $component_values.extraHostPathMounts }}
{{- range $key, $val := $collection }}
- name: {{ $val.volumeName | default (printf "a%s" ($val.mountPath | sha1sum)) }}
mountPath: {{ $val.mountPath }}
readOnly: {{ $val.readOnly | default false }}
{{- end}}
{{- end}}
ports:
- name: metrics
containerPort: 8080
protocol: TCP
env:
{{- range $key1, $val1 := .Values.optional_config }}
- name: {{ $key1 | upper }}
value: "{{ $val1 }}"
{{- end}}
- name: RUCIO_OVERRIDE_CONFIGS
value: "/opt/rucio/etc/conf.d/"
- name: RUCIO_DAEMON
value: "{{ $rucio_daemon }}"
- name: RUCIO_DAEMON_ARGS
value: "{{- if $component_values.threads }} --threads {{ $component_values.threads }}{{ end }} {{ if $component_values.bulk }} --bulk {{ $component_values.bulk }}{{ end }}"
{{- with $component_values.additionalEnvs }}
{{ toYaml . | indent 12 }}
{{- end}}
{{- with $component_values.resources }}
resources:
{{ toYaml . | trim | indent 12 }}
{{ end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml . | indent 6 }}
{{- end}}
{{- with $component_values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with $component_values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with $component_values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{ end }}