Skip to content

Commit

Permalink
Feature: dynamic secret loading (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
bomoko authored Nov 29, 2022
1 parent de40456 commit 178e99f
Show file tree
Hide file tree
Showing 54 changed files with 358 additions and 25 deletions.
3 changes: 3 additions & 0 deletions legacy/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,9 @@ do
# handle spot configurations
. /kubectl-build-deploy/scripts/exec-spot-generation.sh

# handle dynamically added secrets
. /kubectl-build-deploy/scripts/exec-dynamic-secret-volumes.sh

# TODO: we don't need this anymore
# DEPLOYMENT_STRATEGY=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.deployment\\.strategy false)
# if [ ! $DEPLOYMENT_STRATEGY == "false" ]; then
Expand Down
6 changes: 6 additions & 0 deletions legacy/helmcharts/basic-persistent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
- name: {{ include "basic-persistent.persistentStorageName" . }}
persistentVolumeClaim:
claimName: {{ include "basic-persistent.persistentStorageName" . }}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
priorityClassName: {{ include "basic-persistent.lagoonPriority" . }}
enableServiceLinks: false
securityContext:
Expand Down Expand Up @@ -70,6 +73,9 @@ spec:
volumeMounts:
- name: {{ include "basic-persistent.persistentStorageName" . }}
mountPath: {{ .Values.persistentStorage.path | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/basic-persistent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
8 changes: 8 additions & 0 deletions legacy/helmcharts/basic/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ spec:
enableServiceLinks: false
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.dynamicSecretVolumes }}
volumes:
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
containers:
- image: {{ .Values.image | quote }}
name: {{ .Chart.Name }}
Expand Down Expand Up @@ -67,6 +71,10 @@ spec:
name: lagoon-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/basic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
6 changes: 6 additions & 0 deletions legacy/helmcharts/cli-persistent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
claimName: {{ .Values.persistentStorage.name }}
- name: {{ include "cli-persistent.twig-storage.name" . | quote }}
emptyDir: {}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
priorityClassName: {{ include "cli-persistent.lagoonPriority" . }}
enableServiceLinks: false
securityContext:
Expand Down Expand Up @@ -70,6 +73,9 @@ spec:
mountPath: {{ .Values.persistentStorage.path | quote }}
- name: {{ include "cli-persistent.twig-storage.name" . | quote }}
mountPath: {{ include "cli-persistent.twig-storage.path" . | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
readinessProbe:
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/cli-persistent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
6 changes: 6 additions & 0 deletions legacy/helmcharts/cli/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ spec:
secret:
defaultMode: 420
secretName: lagoon-sshkey
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
containers:
- image: {{ .Values.image | quote }}
name: {{ include "cli.fullname" . }}
Expand All @@ -63,6 +66,9 @@ spec:
- mountPath: /var/run/secrets/lagoon/sshkey/
name: lagoon-sshkey
readOnly: true
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 2
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/cli/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
6 changes: 6 additions & 0 deletions legacy/helmcharts/elasticsearch/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ spec:
- name: {{ include "elasticsearch.persistentStorageName" . }}
persistentVolumeClaim:
claimName: {{ include "elasticsearch.persistentStorageName" . }}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
priorityClassName: {{ include "elasticsearch.lagoonPriority" . }}
enableServiceLinks: false
securityContext:
Expand Down Expand Up @@ -85,5 +88,8 @@ spec:
volumeMounts:
- name: {{ include "elasticsearch.persistentStorageName" . }}
mountPath: {{ .Values.persistentStorage.path | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
6 changes: 5 additions & 1 deletion legacy/helmcharts/elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
8 changes: 8 additions & 0 deletions legacy/helmcharts/kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.dynamicSecretVolumes }}
volumes:
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
containers:
- image: {{ .Values.image | quote }}
name: {{ .Chart.Name }}
Expand Down Expand Up @@ -61,6 +65,10 @@ spec:
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/kibana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
8 changes: 8 additions & 0 deletions legacy/helmcharts/logstash/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.dynamicSecretVolumes }}
volumes:
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name | quote }}
securityContext:
Expand Down Expand Up @@ -63,6 +67,10 @@ spec:
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
6 changes: 6 additions & 0 deletions legacy/helmcharts/mariadb-single/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
- name: {{ include "mariadb-single.fullname" . }}
persistentVolumeClaim:
claimName: {{ include "mariadb-single.fullname" . }}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down Expand Up @@ -69,6 +72,9 @@ spec:
volumeMounts:
- name: {{ include "mariadb-single.fullname" . }}
mountPath: {{ .Values.persistentStorage.path | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/mariadb-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
6 changes: 6 additions & 0 deletions legacy/helmcharts/mongodb-single/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
- name: {{ include "mongodb-single.fullname" . }}
persistentVolumeClaim:
claimName: {{ include "mongodb-single.fullname" . }}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down Expand Up @@ -64,6 +67,9 @@ spec:
volumeMounts:
- name: {{ include "mongodb-single.fullname" . }}
mountPath: {{ .Values.persistentStorage.path | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/mongodb-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ spec:
claimName: {{ include "nginx-php-persistent.persistentStorageName" . }}
- name: {{ include "nginx-php-persistent.twig-storage.name" . | quote }}
emptyDir: {}
{{- if .Values.dynamicSecretVolumes }}
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
priorityClassName: {{ include "nginx-php-persistent.lagoonPriority" . }}
enableServiceLinks: false
securityContext:
Expand Down Expand Up @@ -102,6 +105,9 @@ spec:
volumeMounts:
- name: {{ include "nginx-php-persistent.persistentStorageName" . }}
mountPath: {{ .Values.persistentStorage.path | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.nginx | nindent 12 }}

Expand Down Expand Up @@ -136,6 +142,9 @@ spec:
mountPath: {{ .Values.persistentStorage.path | quote }}
- name: {{ include "nginx-php-persistent.twig-storage.name" . | quote }}
mountPath: {{ include "nginx-php-persistent.twig-storage.path" . | quote }}
{{- if .Values.dynamicSecretMounts }}
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.php | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/nginx-php-persistent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
12 changes: 12 additions & 0 deletions legacy/helmcharts/nginx-php/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ spec:
enableServiceLinks: false
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.dynamicSecretVolumes }}
volumes:
{{- toYaml .Values.dynamicSecretVolumes | nindent 8 }}
{{- end }}
containers:
- image: {{ .Values.images.nginx | quote }}
name: "nginx"
Expand Down Expand Up @@ -69,6 +73,10 @@ spec:
name: lagoon-env
resources:
{{- toYaml .Values.resources.nginx | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}

- image: {{ .Values.images.php | quote }}
name: "php"
Expand Down Expand Up @@ -98,6 +106,10 @@ spec:
value: '127.0.0.1'
resources:
{{- toYaml .Values.resources.php | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
6 changes: 5 additions & 1 deletion legacy/helmcharts/nginx-php/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ configMapSha: ""

useSpot: false

cronjobUseSpot: false
cronjobUseSpot: false

dynamicSecretMounts: []

dynamicSecretVolumes: []
Loading

0 comments on commit 178e99f

Please sign in to comment.