Skip to content

Commit

Permalink
Merge pull request #3 from mojaloop/feat/add-secret-env
Browse files Browse the repository at this point in the history
alter deployment to use secret
  • Loading branch information
dfry authored Mar 27, 2024
2 parents 794f80b + 2a45926 commit 4721c79
Show file tree
Hide file tree
Showing 54 changed files with 363 additions and 199 deletions.
10 changes: 10 additions & 0 deletions account-lookup-http-oracle-svc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion account-lookup-http-oracle-svc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}

containers:
Expand Down
10 changes: 10 additions & 0 deletions account-lookup-svc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
14 changes: 9 additions & 5 deletions account-lookup-svc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -58,7 +58,14 @@ spec:
- name: KAFKA_AUDITS_TOPIC
value: {{ .Values.env.kafka_audits_topic }}
- name: MONGO_URL
value: {{ .Values.env.mongo_url }}
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: '{{ .Values.config.mongo_url }}'
{{- end }}
- name: PLATFORM_CONFIG_BASE_SVC_URL
value: {{ .Values.env.platform_config_base_svc_url }}
- name: AUTH_Z_SVC_BASEURL
Expand All @@ -71,9 +78,6 @@ spec:
value: {{ .Values.env.auth_n_token_audience }}
- name: PARTICIPANTS_SVC_URL
value: {{ .Values.env.participants_svc_url }}
{{- if .Values.extraEnvs | default .Values.extraEnvs }}
{{ toYaml ( .Values.extraEnvs | default .Values.extraEnvs ) | indent 10 }}
{{- end }}
volumes:
- name: account-lookup-svc-data
emptyDir: {}
Expand Down
17 changes: 4 additions & 13 deletions account-lookup-svc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down Expand Up @@ -108,16 +108,7 @@ env:
auth_n_token_audience: mojaloop.vnext.dev.default_audience
participants_svc_url: http://participants-svc:3010

extraEnvs:
- name: mongo_url
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: {{ .Values.config.mongo_url }}
{{- end }}
extraEnvs: {}
# - name: KAFKA_URL
# value: kafka:9092
# - name: KAFKA_URL
Expand Down Expand Up @@ -159,4 +150,4 @@ initContainers: |
echo participants-svc ok!;
env:
- name: PARTICIPANTS_SVC_URL
value: http://participants-svc:3010
value: '{{ .Values.env.participants_svc_url }}'
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -58,7 +58,14 @@ spec:
- name: KAFKA_AUDITS_TOPIC
value: {{ .Values.env.kafka_audits_topic }}
- name: MONGO_URL
value: {{ .Values.env.mongo_url }}
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: '{{ .Values.config.mongo_url }}'
{{- end }}
- name: PLATFORM_CONFIG_BASE_SVC_URL
value: {{ .Values.env.platform_config_base_svc_url }}
- name: AUTH_Z_SVC_BASEURL
Expand All @@ -75,9 +82,6 @@ spec:
value: {{ .Values.env.redis_host}}
- name: REDIS_PORT
value: {{ .Values.env.redis_port | quote}}
{{- if .Values.extraEnvs | default .Values.extraEnvs }}
{{ toYaml ( .Values.extraEnvs | default .Values.extraEnvs ) | indent 10 }}
{{- end }}
volumes:
- name: aandb-builtin-ledger-grpc-svc-data
emptyDir: {}
Expand Down
29 changes: 9 additions & 20 deletions accounts-and-balances-builtin-ledger-grpc-svc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
#general config params
config:
mongo_url: mongodb://root:mongodb@mongodb:27017
# db_secret:
### Example config for an existing secret
# mongo_url_secret:
# name: mongo-secret
# key: password
mongo_url_secret:
name: mongo-secret
key: password
replicaCount: 1

image:
Expand Down Expand Up @@ -109,16 +108,7 @@ env:
redis_host: redis-master
redis_port: 6379

extraEnvs:
- name: mongo_url
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: {{ .Values.config.mongo_url }}
{{- end }}
extraEnvs: {}
# - name: KAFKA_URL
# value: kafka:9092
# - name: KAFKA_LOGS_TOPIC
Expand Down Expand Up @@ -165,14 +155,14 @@ initContainers: |
echo ====================;
echo MongoDB ok!;
env:
- name: mongo_url
- name: MONGO_URL
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: {{ .Values.config.mongo_url }}
value: '{{ .Values.config.mongo_url }}'
{{- end }}
- name: wait-for-platform-configuration-svc
Expand All @@ -192,7 +182,7 @@ initContainers: |
echo platform-configuration-svc ok!;
env:
- name: PLATFORM_CONFIG_BASE_SVC_URL
value: http://platform-configuration-svc:3100
value: '{{ .Values.env.platform_config_base_svc_url }}'
- name: wait-for-redis
Expand All @@ -210,9 +200,8 @@ initContainers: |
done;
echo ====================;
echo redis-service ok!;
env:
- name: REDIS_HOST
value: redis-master
value: '{{ .Values.env.redis_host }}'
- name: REDIS_PORT
value: "6379"
value: '{{ .Values.env.redis_port }}'
10 changes: 10 additions & 0 deletions accounts-and-balances-coa-grpc-svc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
11 changes: 9 additions & 2 deletions accounts-and-balances-coa-grpc-svc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -58,7 +58,14 @@ spec:
- name: KAFKA_AUDITS_TOPIC
value: {{ .Values.env.kafka_audits_topic }}
- name: MONGO_URL
value: {{ .Values.env.mongo_url }}
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: '{{ .Values.config.mongo_url }}'
{{- end }}
- name: PLATFORM_CONFIG_BASE_SVC_URL
value: {{ .Values.env.platform_config_base_svc_url }}
- name: ELASTICSEARCH_URL
Expand Down
17 changes: 4 additions & 13 deletions accounts-and-balances-coa-grpc-svc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down Expand Up @@ -111,16 +111,7 @@ env:
redis_port: 6379
builtin_ledger_svc_url: accounts-and-balances-builtin-ledger-grpc-svc:3350

extraEnvs:
- name: mongo_url
{{- if .Values.config.mongo_url_secret }}
valueFrom:
secretKeyRef:
name: '{{ .Values.config.mongo_url_secret.name }}'
key: '{{ .Values.config.mongo_url_secret.key }}'
{{- else }}
value: {{ .Values.config.mongo_url }}
{{- end }}
extraEnvs: {}
# - name: KAFKA_URL
# value: kafka:9092
# - name: KAFKA_LOGS_TOPIC
Expand Down Expand Up @@ -170,4 +161,4 @@ initContainers: |
echo platform-configuration-svc ok!;
env:
- name: PLATFORM_CONFIG_BASE_SVC_URL
value: http://platform-configuration-svc:3100
value: '{{ .Values.env.platform_config_base_svc_url }}'
10 changes: 10 additions & 0 deletions admin-ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
10 changes: 10 additions & 0 deletions auditing-svc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion auditing-svc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
6 changes: 3 additions & 3 deletions auditing-svc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down Expand Up @@ -123,4 +123,4 @@ initContainers: |
echo Kafka ok!;
env:
- name: KAFKA_URL
value: kafka:9092
value: '{{ .Values.env.kafka_url }}'
10 changes: 10 additions & 0 deletions authentication-svc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion authentication-svc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.initContainers }}
{{- .Values.initContainers | nindent 8 }}
{{- include "tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
Loading

0 comments on commit 4721c79

Please sign in to comment.