|
| 1 | +{{- if .Values.rollout.enabled }} |
| 2 | +apiVersion: argoproj.io/v1alpha1 |
| 3 | +kind: Rollout |
| 4 | +metadata: |
| 5 | + name: {{ include "devops-python-app.fullname" . }} |
| 6 | + labels: |
| 7 | + {{- include "devops-python-app.labels" . | nindent 4 }} |
| 8 | +spec: |
| 9 | + replicas: {{ .Values.replicaCount }} |
| 10 | + revisionHistoryLimit: {{ .Values.rollout.revisionHistoryLimit }} |
| 11 | + selector: |
| 12 | + matchLabels: |
| 13 | + {{- include "devops-python-app.selectorLabels" . | nindent 6 }} |
| 14 | + template: |
| 15 | + metadata: |
| 16 | + labels: |
| 17 | + {{- include "devops-python-app.selectorLabels" . | nindent 8 }} |
| 18 | + app.kubernetes.io/component: api |
| 19 | + {{- if or .Values.configMap.file.enabled .Values.configMap.env.enabled .Values.vault.enabled }} |
| 20 | + annotations: |
| 21 | + {{- if .Values.configMap.file.enabled }} |
| 22 | + checksum/config-file: {{ .Files.Get "files/config.json" | sha256sum }} |
| 23 | + {{- end }} |
| 24 | + {{- if .Values.configMap.env.enabled }} |
| 25 | + checksum/config-env: {{ printf "%s|%s|%s" .Values.appConfig.appEnv .Values.appConfig.logLevel (toYaml .Values.configMap.env.data) | sha256sum }} |
| 26 | + {{- end }} |
| 27 | + {{- if .Values.vault.enabled }} |
| 28 | + vault.hashicorp.com/agent-inject: "true" |
| 29 | + vault.hashicorp.com/role: {{ .Values.vault.role | quote }} |
| 30 | + {{ printf "vault.hashicorp.com/agent-inject-secret-%s" .Values.vault.fileName | quote }}: {{ .Values.vault.secretPath | quote }} |
| 31 | + {{ printf "vault.hashicorp.com/secret-volume-path-%s" .Values.vault.fileName | quote }}: {{ .Values.vault.mountPath | quote }} |
| 32 | + {{ printf "vault.hashicorp.com/agent-inject-command-%s" .Values.vault.fileName | quote }}: {{ .Values.vault.injectCommand | quote }} |
| 33 | + {{ printf "vault.hashicorp.com/agent-inject-template-%s" .Values.vault.fileName | quote }}: | |
| 34 | +{{ .Values.vault.template | nindent 10 }} |
| 35 | + {{- end }} |
| 36 | + {{- end }} |
| 37 | + spec: |
| 38 | + serviceAccountName: {{ include "devops-python-app.serviceAccountName" . }} |
| 39 | + containers: |
| 40 | + - name: {{ include "devops-python-app.name" . }} |
| 41 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 42 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 43 | + ports: |
| 44 | + - name: http |
| 45 | + containerPort: {{ .Values.container.port }} |
| 46 | + protocol: TCP |
| 47 | + env: |
| 48 | + {{- include "devops-python-app.commonEnv" . | nindent 12 }} |
| 49 | + {{- with .Values.extraEnv }} |
| 50 | + {{- toYaml . | nindent 12 }} |
| 51 | + {{- end }} |
| 52 | + {{- if or .Values.secret.enabled .Values.configMap.env.enabled }} |
| 53 | + envFrom: |
| 54 | + {{- if .Values.secret.enabled }} |
| 55 | + - secretRef: |
| 56 | + name: {{ include "devops-python-app.secretName" . }} |
| 57 | + {{- end }} |
| 58 | + {{- if .Values.configMap.env.enabled }} |
| 59 | + - configMapRef: |
| 60 | + name: {{ include "devops-python-app.configEnvConfigMapName" . }} |
| 61 | + {{- end }} |
| 62 | + {{- end }} |
| 63 | + {{- if or .Values.configMap.file.enabled .Values.persistence.enabled }} |
| 64 | + volumeMounts: |
| 65 | + {{- if .Values.configMap.file.enabled }} |
| 66 | + - name: app-config |
| 67 | + mountPath: {{ .Values.configMap.file.mountPath }} |
| 68 | + readOnly: true |
| 69 | + {{- end }} |
| 70 | + {{- if .Values.persistence.enabled }} |
| 71 | + - name: app-data |
| 72 | + mountPath: {{ .Values.persistence.mountPath }} |
| 73 | + {{- end }} |
| 74 | + {{- end }} |
| 75 | + resources: |
| 76 | + {{- toYaml .Values.resources | nindent 12 }} |
| 77 | + readinessProbe: |
| 78 | + {{- toYaml .Values.readinessProbe | nindent 12 }} |
| 79 | + livenessProbe: |
| 80 | + {{- toYaml .Values.livenessProbe | nindent 12 }} |
| 81 | + {{- if or .Values.configMap.file.enabled .Values.persistence.enabled }} |
| 82 | + volumes: |
| 83 | + {{- if .Values.configMap.file.enabled }} |
| 84 | + - name: app-config |
| 85 | + configMap: |
| 86 | + name: {{ include "devops-python-app.configFileConfigMapName" . }} |
| 87 | + {{- end }} |
| 88 | + {{- if .Values.persistence.enabled }} |
| 89 | + - name: app-data |
| 90 | + persistentVolumeClaim: |
| 91 | + claimName: {{ include "devops-python-app.pvcName" . }} |
| 92 | + {{- end }} |
| 93 | + {{- end }} |
| 94 | + strategy: |
| 95 | + {{- if eq .Values.rollout.strategy "canary" }} |
| 96 | + canary: |
| 97 | + {{- if .Values.rollout.canary.useAnalysis }} |
| 98 | + steps: |
| 99 | + - setWeight: 20 |
| 100 | + - analysis: |
| 101 | + templates: |
| 102 | + - templateName: {{ include "devops-python-app.fullname" . }}-health-check |
| 103 | + - setWeight: 50 |
| 104 | + - pause: { duration: 30s } |
| 105 | + - analysis: |
| 106 | + templates: |
| 107 | + - templateName: {{ include "devops-python-app.fullname" . }}-health-check |
| 108 | + - setWeight: 100 |
| 109 | + {{- else }} |
| 110 | + steps: |
| 111 | + {{- toYaml .Values.rollout.canary.steps | nindent 8 }} |
| 112 | + {{- end }} |
| 113 | + {{- else if eq .Values.rollout.strategy "blueGreen" }} |
| 114 | + blueGreen: |
| 115 | + activeService: {{ include "devops-python-app.fullname" . }}-service |
| 116 | + previewService: {{ include "devops-python-app.fullname" . }}-service-preview |
| 117 | + autoPromotionEnabled: {{ .Values.rollout.blueGreen.autoPromotionEnabled }} |
| 118 | + {{- if .Values.rollout.blueGreen.autoPromotionSeconds }} |
| 119 | + autoPromotionSeconds: {{ .Values.rollout.blueGreen.autoPromotionSeconds }} |
| 120 | + {{- end }} |
| 121 | + {{- end }} |
| 122 | +{{- end }} |
0 commit comments