|
| 1 | +{{- /* |
| 2 | +MONGODB_HOST env var value |
| 3 | +*/}} |
| 4 | +{{- define "codefresh-gitops.mongodb-host-env-var-value" }} |
| 5 | + {{- if .Values.global.mongodbHostSecretKeyRef }} |
| 6 | +valueFrom: |
| 7 | + secretKeyRef: |
| 8 | + {{- .Values.global.mongodbHostSecretKeyRef | toYaml | nindent 4 }} |
| 9 | + {{- else if .Values.global.mongodbHost }} |
| 10 | +valueFrom: |
| 11 | + secretKeyRef: |
| 12 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 13 | + key: MONGODB_HOST |
| 14 | + optional: true |
| 15 | + {{- end }} |
| 16 | +{{- end }} |
| 17 | + |
| 18 | +{{- /* |
| 19 | +MONGODB_USER env var value |
| 20 | +*/}} |
| 21 | +{{- define "codefresh-gitops.mongodb-user-env-var-value" }} |
| 22 | + {{- if .Values.global.mongodbUserSecretKeyRef }} |
| 23 | +valueFrom: |
| 24 | + secretKeyRef: |
| 25 | + {{- .Values.global.mongodbUserSecretKeyRef | toYaml | nindent 4 }} |
| 26 | + {{- else if .Values.global.mongodbUser }} |
| 27 | +valueFrom: |
| 28 | + secretKeyRef: |
| 29 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 30 | + key: MONGODB_USER |
| 31 | + optional: true |
| 32 | + {{- end }} |
| 33 | +{{- end }} |
| 34 | + |
| 35 | +{{- /* |
| 36 | +MONGODB_PASSWORD env var value |
| 37 | +*/}} |
| 38 | +{{- define "codefresh-gitops.mongodb-password-env-var-value" }} |
| 39 | + {{- if .Values.global.mongodbPasswordSecretKeyRef }} |
| 40 | +valueFrom: |
| 41 | + secretKeyRef: |
| 42 | + {{- .Values.global.mongodbPasswordSecretKeyRef | toYaml | nindent 4 }} |
| 43 | + {{- else if .Values.global.mongodbPassword }} |
| 44 | +valueFrom: |
| 45 | + secretKeyRef: |
| 46 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 47 | + key: MONGODB_PASSWORD |
| 48 | + optional: true |
| 49 | + {{- end }} |
| 50 | +{{- end }} |
| 51 | + |
| 52 | +{{- /* |
| 53 | +MONGO_URI env var value |
| 54 | +*/}} |
| 55 | +{{- define "codefresh-gitops.mongo-uri-env-var-value" }} |
| 56 | +{{- /* |
| 57 | +Check for legacy global.mongoURI |
| 58 | +*/}} |
| 59 | + {{- if .Values.global.mongoURI }} |
| 60 | +value: "$(MONGO_URI)" |
| 61 | +{{- /* |
| 62 | +New secret implementation |
| 63 | +*/}} |
| 64 | + {{- else }} |
| 65 | +value: "$(MONGODB_PROTOCOL)://$(MONGODB_USER):$(MONGODB_PASSWORD)@$(MONGODB_HOST)/$(MONGODB_DATABASE)?$(MONGODB_OPTIONS)" |
| 66 | + {{- end }} |
| 67 | +{{- end }} |
| 68 | + |
| 69 | +{{- /* |
| 70 | +MONGO_SEED_URI env var value |
| 71 | +*/}} |
| 72 | +{{- define "codefresh-gitops.mongo-seed-uri-env-var-value" }} |
| 73 | +{{- /* |
| 74 | +Check for legacy global.mongoURI |
| 75 | +*/}} |
| 76 | + {{- if .Values.global.mongoURI }} |
| 77 | +value: "$(MONGO_URI)" |
| 78 | +{{- /* |
| 79 | +New secret implementation |
| 80 | +*/}} |
| 81 | + {{- else }} |
| 82 | +value: "$(MONGODB_PROTOCOL)://$(MONGODB_USER):$(MONGODB_PASSWORD)@$(MONGODB_HOST)/?$(MONGODB_OPTIONS)" |
| 83 | + {{- end }} |
| 84 | +{{- end }} |
| 85 | + |
| 86 | +{{- /* |
| 87 | +MONGODB_ROOT_USER env var value |
| 88 | +*/}} |
| 89 | +{{- define "codefresh-gitops.mongodb-root-user-env-var-value" }} |
| 90 | + {{- if or .Values.seed.mongoSeedJob.mongodbRootUserSecretKeyRef .Values.global.mongodbRootUserSecretKeyRef }} |
| 91 | +valueFrom: |
| 92 | + secretKeyRef: |
| 93 | + {{- coalesce .Values.seed.mongoSeedJob.mongodbRootUserSecretKeyRef .Values.global.mongodbRootUserSecretKeyRef | toYaml | nindent 4 }} |
| 94 | + {{- else if or .Values.global.mongodbRootUser .Values.seed.mongoSeedJob.mongodbRootUser }} |
| 95 | +valueFrom: |
| 96 | + secretKeyRef: |
| 97 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 98 | + key: MONGODB_ROOT_USER |
| 99 | + optional: true |
| 100 | + {{- end }} |
| 101 | +{{- end }} |
| 102 | + |
| 103 | +{{- /* |
| 104 | +MONGODB_ROOT_PASSWORD env var value |
| 105 | +*/}} |
| 106 | +{{- define "codefresh-gitops.mongodb-root-password-env-var-value" }} |
| 107 | + {{- if or .Values.seed.mongoSeedJob.mongodbRootPasswordSecretKeyRef .Values.global.mongodbRootPasswordSecretKeyRef }} |
| 108 | +valueFrom: |
| 109 | + secretKeyRef: |
| 110 | + {{- coalesce .Values.seed.mongoSeedJob.mongodbRootPasswordSecretKeyRef .Values.global.mongodbRootPasswordSecretKeyRef | toYaml | nindent 4 }} |
| 111 | + {{- else if or .Values.global.mongodbRootPassword .Values.seed.mongoSeedJob.mongodbRootPassword }} |
| 112 | +valueFrom: |
| 113 | + secretKeyRef: |
| 114 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 115 | + key: MONGODB_ROOT_PASSWORD |
| 116 | + optional: true |
| 117 | + {{- end }} |
| 118 | +{{- end }} |
| 119 | + |
| 120 | +{{- /* |
| 121 | +MONGO_URI_RE_MANAGER env var value |
| 122 | +*/}} |
| 123 | +{{- define "codefresh-gitops.mongo-uri-re-manager-env-var-value" }} |
| 124 | +{{- /* |
| 125 | +Check for legacy global.mongoURI |
| 126 | +*/}} |
| 127 | + {{- if .Values.global.mongoURI }} |
| 128 | +value: "$(MONGO_URI_RE_MANAGER)" |
| 129 | +{{- /* |
| 130 | +New secret implementation |
| 131 | +*/}} |
| 132 | + {{- else }} |
| 133 | +value: "$(MONGODB_PROTOCOL)://$(MONGODB_USER):$(MONGODB_PASSWORD)@$(MONGODB_HOST)/$(MONGODB_RE_DATABASE)?$(MONGODB_OPTIONS)" |
| 134 | + {{- end }} |
| 135 | +{{- end }} |
| 136 | + |
| 137 | +{{- /* |
| 138 | +POSTGRES_USER env var value |
| 139 | +*/}} |
| 140 | +{{- define "codefresh-gitops.postgres-user-env-var-value" }} |
| 141 | + {{- if .Values.global.postgresUserSecretKeyRef }} |
| 142 | +valueFrom: |
| 143 | + secretKeyRef: |
| 144 | + {{- .Values.global.postgresUserSecretKeyRef | toYaml | nindent 4 }} |
| 145 | + {{- else if .Values.global.postgresUser }} |
| 146 | +valueFrom: |
| 147 | + secretKeyRef: |
| 148 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 149 | + key: POSTGRES_USER |
| 150 | + optional: true |
| 151 | + {{- end }} |
| 152 | +{{- end }} |
| 153 | + |
| 154 | +{{- /* |
| 155 | +POSTGRES_PASSWORD env var value |
| 156 | +*/}} |
| 157 | +{{- define "codefresh-gitops.postgres-password-env-var-value" }} |
| 158 | + {{- if .Values.global.postgresPasswordSecretKeyRef }} |
| 159 | +valueFrom: |
| 160 | + secretKeyRef: |
| 161 | + {{- .Values.global.postgresPasswordSecretKeyRef | toYaml | nindent 4 }} |
| 162 | + {{- else if .Values.global.postgresPassword }} |
| 163 | +valueFrom: |
| 164 | + secretKeyRef: |
| 165 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 166 | + key: POSTGRES_PASSWORD |
| 167 | + optional: true |
| 168 | + {{- end }} |
| 169 | +{{- end }} |
| 170 | + |
| 171 | +{{- /* |
| 172 | +POSTGRES_HOSTNAME env var value |
| 173 | +*/}} |
| 174 | +{{- define "codefresh-gitops.postgres-host-env-var-value" }} |
| 175 | + {{- if .Values.global.postgresHostnameSecretKeyRef }} |
| 176 | +valueFrom: |
| 177 | + secretKeyRef: |
| 178 | + {{- .Values.global.postgresHostnameSecretKeyRef | toYaml | nindent 4 }} |
| 179 | + {{- else if .Values.global.postgresPassword }} |
| 180 | +valueFrom: |
| 181 | + secretKeyRef: |
| 182 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 183 | + key: POSTGRES_HOSTNAME |
| 184 | + optional: true |
| 185 | + {{- end }} |
| 186 | +{{- end }} |
| 187 | + |
| 188 | +{{- /* |
| 189 | +POSTGRES_SEED_USER env var value |
| 190 | +*/}} |
| 191 | +{{- define "codefresh-gitops.postgres-seed-user-env-var-value" }} |
| 192 | + {{- if or .Values.seed.postgresSeedJob.postgresUserSecretKeyRef .Values.global.postgresSeedJob.postgresUserSecretKeyRef .Values.global.postgresUserSecretKeyRef }} |
| 193 | +valueFrom: |
| 194 | + secretKeyRef: |
| 195 | + {{- coalesce .Values.seed.postgresSeedJob.postgresUserSecretKeyRef .Values.global.postgresSeedJob.postgresUserSecretKeyRef .Values.global.postgresUserSecretKeyRef | toYaml | nindent 4 }} |
| 196 | + {{- else if or .Values.seed.postgresSeedJob.postgresUser .Values.global.postgresSeedJob.postgresUser .Values.global.postgresUser }} |
| 197 | +valueFrom: |
| 198 | + secretKeyRef: |
| 199 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 200 | + key: POSTGRES_SEED_USER |
| 201 | + optional: true |
| 202 | + {{- end }} |
| 203 | +{{- end }} |
| 204 | + |
| 205 | +{{- /* |
| 206 | +POSTGRES_SEED_PASSWORD env var value |
| 207 | +*/}} |
| 208 | +{{- define "codefresh-gitops.postgres-seed-password-env-var-value" }} |
| 209 | + {{- if or .Values.seed.postgresSeedJob.postgresPasswordSecretKeyRef .Values.global.postgresSeedJob.postgresPasswordSecretKeyRef .Values.global.postgresPasswordSecretKeyRef }} |
| 210 | +valueFrom: |
| 211 | + secretKeyRef: |
| 212 | + {{- coalesce .Values.seed.postgresSeedJob.postgresPasswordSecretKeyRef .Values.global.postgresSeedJob.postgresPasswordSecretKeyRef .Values.global.postgresPasswordSecretKeyRef | toYaml | nindent 4 }} |
| 213 | + {{- else if or .Values.seed.postgresSeedJob.postgresPassword .Values.global.postgresSeedJob.postgresPassword .Values.global.postgresPassword }} |
| 214 | +valueFrom: |
| 215 | + secretKeyRef: |
| 216 | + name: {{ include "codefresh-gitops.fullname" . }} |
| 217 | + key: POSTGRES_SEED_PASSWORD |
| 218 | + optional: true |
| 219 | + {{- end }} |
| 220 | +{{- end }} |
0 commit comments