Skip to content

Commit 3859f16

Browse files
段洪义段洪义
authored andcommitted
chore(controller): add rabbitmq env
1 parent 83a9bd7 commit 3859f16

4 files changed

Lines changed: 39 additions & 24 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,26 @@ env:
136136
secretKeyRef:
137137
name: influxdb-creds
138138
key: token
139+
{{ if eq .Values.global.rabbitmq_location "off-cluster"}}
140+
- name: "DRYCC_RABBITMQ_URL"
141+
valueFrom:
142+
secretKeyRef:
143+
name: rabbitmq-creds
144+
key: url
145+
{{- else if eq .Values.global.rabbitmq_location "on-cluster" }}
146+
- name: "DRYCC_RABBITMQ_USERNAME"
147+
valueFrom:
148+
secretKeyRef:
149+
name: rabbitmq-creds
150+
key: username
151+
- name: "DRYCC_RABBITMQ_PASSWORD"
152+
valueFrom:
153+
secretKeyRef:
154+
name: rabbitmq-creds
155+
key: password
156+
- name: "DRYCC_RABBITMQ_URL"
157+
value: "amqp://$DRYCC_RABBITMQ_USERNAME:$DRYCC_RABBITMQ_PASSWORD@drycc-rabbitmq-0.drycc-rabbitmq.{{$.Release.Namespace}}.svc.{{$.Values.global.cluster_domain}}:5672/drycc"
158+
{{- end }}
139159
{{- range $key, $value := .Values.environment }}
140160
- name: {{ $key }}
141161
value: {{ $value | quote }}
@@ -157,10 +177,23 @@ resources:
157177
{{- end }}
158178

159179

180+
181+
160182
{{/* Generate controller deployment volumeMounts */}}
161183
{{- define "controller.volumeMounts" -}}
162184
volumeMounts:
163185
- mountPath: /etc/slugrunner
164186
name: slugrunner-config
165187
readOnly: true
166188
{{- end }}
189+
190+
{{/* Generate controller deployment volumes */}}
191+
{{- define "controller.volumes" -}}
192+
volumes:
193+
- name: rabbitmq-creds
194+
secret:
195+
secretName: rabbitmq-creds
196+
- name: slugrunner-config
197+
configMap:
198+
name: slugrunner-config
199+
{{- end }}

charts/controller/templates/controller-celery.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ spec:
6060
- celery -A api worker -Q priority.low --autoscale=8,1 --loglevel=WARNING
6161
{{- include "controller.limits" . | indent 10 }}
6262
{{- include "controller.envs" . | indent 10 }}
63-
volumeMounts:
64-
- mountPath: /etc/slugrunner
65-
name: slugrunner-config
66-
readOnly: true
63+
{{- include "controller.volumeMounts" . | indent 10 }}
6764
imagePullPolicy: {{.Values.image_pull_policy}}
68-
volumes:
69-
- name: slugrunner-config
70-
configMap:
71-
name: slugrunner-config
65+
{{- include "controller.volumes" . | indent 6 }}

charts/controller/templates/controller-cronjob-daily.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ spec:
7777
args:
7878
- python -u /app/manage.py measure_volumes
7979
{{- include "controller.envs" . | indent 12 }}
80-
volumeMounts:
81-
- mountPath: /etc/slugrunner
82-
name: slugrunner-config
83-
readOnly: true
84-
volumes:
85-
- name: slugrunner-config
86-
configMap:
87-
name: slugrunner-config
80+
{{- include "controller.volumeMounts" . | indent 12 }}
81+
{{- include "controller.volumes" . | indent 10 }}
8882

charts/controller/templates/controller-deployment.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,5 @@ spec:
4444
name: http
4545
{{- include "controller.limits" . | indent 10 }}
4646
{{- include "controller.envs" . | indent 10 }}
47-
volumeMounts:
48-
- mountPath: /etc/slugrunner
49-
name: slugrunner-config
50-
readOnly: true
51-
volumes:
52-
- name: slugrunner-config
53-
configMap:
54-
name: slugrunner-config
47+
{{- include "controller.volumeMounts" . | indent 10 }}
48+
{{- include "controller.volumes" . | indent 6 }}

0 commit comments

Comments
 (0)