|
| 1 | +{{- if and .Values.hooks.rabbitmq.enabled .Values.rabbitmq.enabled }} |
| 2 | +{{- $libTemplateName := printf "cf-common-%s" (index .Subcharts "cf-common").Chart.Version }} |
| 3 | +{{- $tolerations := .Values.hooks.consul.tolerations | default list }} |
| 4 | +{{- $globalTolerations := .Values.global.tolerations | default list }} |
| 5 | +{{- $allToleration := concat $globalTolerations $tolerations }} |
| 6 | +{{- $affinity := .Values.hooks.consul.affinity | default dict }} |
| 7 | +{{- $globalAffinity := .Values.global.affinity | default dict }} |
| 8 | +{{- $allAffinity := mergeOverwrite $globalAffinity $affinity }} |
| 9 | +{{- $nodeSelector := .Values.hooks.consul.nodeSelector | default dict }} |
| 10 | +{{- $globalNodeSelector := .Values.global.nodeSelector | default dict }} |
| 11 | +{{- $allNodeSelector := mergeOverwrite $globalNodeSelector $nodeSelector }} |
| 12 | +--- |
| 13 | +apiVersion: batch/v1 |
| 14 | +kind: Job |
| 15 | +metadata: |
| 16 | + name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 17 | + labels: |
| 18 | + {{ include "codefresh.labels" . | nindent 4 }} |
| 19 | + annotations: |
| 20 | + helm.sh/hook: pre-upgrade |
| 21 | + helm.sh/hook-weight: "5" |
| 22 | + helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation,hook-failed |
| 23 | +spec: |
| 24 | + ttlSecondsAfterFinished: 300 |
| 25 | + backoffLimit: 0 |
| 26 | + template: |
| 27 | + metadata: |
| 28 | + name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 29 | + labels: |
| 30 | + {{ include "codefresh.labels" . | nindent 8 }} |
| 31 | + spec: |
| 32 | + serviceAccountName: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 33 | + {{- include (printf "%s.image.pullSecrets" $libTemplateName ) . | nindent 6 }} |
| 34 | + containers: |
| 35 | + - name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 36 | + image: {{ include (printf "%s.image.name" $libTemplateName) (dict "image" .Values.hooks.rabbitmq.image "context" .) }} |
| 37 | + env: |
| 38 | + - name: RABBITMQADMIN_TARGET_HOST |
| 39 | + valueFrom: |
| 40 | + secretKeyRef: |
| 41 | + name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 42 | + key: RABBITMQADMIN_TARGET_HOST |
| 43 | + - name: RABBITMQADMIN_USERNAME |
| 44 | + valueFrom: |
| 45 | + secretKeyRef: |
| 46 | + name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 47 | + key: RABBITMQADMIN_USERNAME |
| 48 | + - name: RABBITMQADMIN_PASSWORD |
| 49 | + valueFrom: |
| 50 | + secretKeyRef: |
| 51 | + name: {{ template "codefresh.fullname" . }}-rabbitmq-enable-stable-flags |
| 52 | + key: RABBITMQADMIN_PASSWORD |
| 53 | + command: |
| 54 | + - /bin/bash |
| 55 | + - -c |
| 56 | + - | |
| 57 | + rabbitmqadmin \ |
| 58 | + --host=$RABBITMQADMIN_TARGET_HOST \ |
| 59 | + --username=$RABBITMQADMIN_USERNAME \ |
| 60 | + --password=$RABBITMQADMIN_PASSWORD \ |
| 61 | + feature_flags enable_all |
| 62 | + resources: |
| 63 | + {{- toYaml .Values.hooks.rabbitmq.resources | nindent 10 }} |
| 64 | + {{- with $allNodeSelector }} |
| 65 | + nodeSelector: |
| 66 | + {{- toYaml . | nindent 8 }} |
| 67 | + {{- end }} |
| 68 | + {{- with $allAffinity }} |
| 69 | + affinity: |
| 70 | + {{- toYaml . | nindent 8}} |
| 71 | + {{- end }} |
| 72 | + {{- with $allToleration }} |
| 73 | + tolerations: |
| 74 | + {{- toYaml . | nindent 6 }} |
| 75 | + {{- end }} |
| 76 | + restartPolicy: OnFailure |
| 77 | +{{- end }} |
0 commit comments