Skip to content

Commit

Permalink
Fix issue with php service sub dicts copying into php-base for all se…
Browse files Browse the repository at this point in the history
…rvices

An example of an issue with this is AUTOSTART_PHP_FPM in php-fpm environment occasionally appearing in other pods depending on the non-deterministic order of resource rendering
  • Loading branch information
andytson-inviqa committed Jan 21, 2022
1 parent 8460e3a commit 9e2210d
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/_base/helm/app/templates/_base_helper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ stringData:
{{ end }}
{{ end }}
{{- end }}

{{- define "service.php.resolved" -}}
{{- $service := index $.root.Values.services $.service_name -}}
{{- $extended := index $.root.Values.services "php-base" -}}
{{- $merged := mergeOverwrite (deepCopy $extended) (deepCopy $service) -}}
{{ $merged | toYaml }}
{{- end -}}
2 changes: 1 addition & 1 deletion src/_base/helm/app/templates/application/app-init.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "console") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "console") | fromYaml) -}}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
2 changes: 1 addition & 1 deletion src/_base/helm/app/templates/application/app-migrate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "console") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "console") | fromYaml) -}}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "console") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "console") | fromYaml) -}}
{{- if .enabled -}}
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $service := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "console") -}}
{{- $service := include "service.php.resolved" (dict "root" $ "service_name" "console") | fromYaml -}}
{{ template "service.environment.secret" (dict "service_name" "console" "service" $service "root" $) }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "cron") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "cron") | fromYaml) -}}
{{- if .enabled -}}
apiVersion: apps/v1
kind: Deployment
Expand Down
2 changes: 1 addition & 1 deletion src/_base/helm/app/templates/application/cron/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $service := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "cron") -}}
{{- $service := include "service.php.resolved" (dict "root" $ "service_name" "cron") | fromYaml -}}
{{ template "service.environment.secret" (dict "service_name" "cron" "service" $service "root" $) }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $service_php_fpm := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "php-fpm") -}}
{{- $service_php_fpm := include "service.php.resolved" (dict "root" $ "service_name" "php-fpm") | fromYaml -}}
{{- if .Values.services.webapp.enabled -}}
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $service := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "php-fpm") -}}
{{- $service := include "service.php.resolved" (dict "root" $ "service_name" "php-fpm") | fromYaml -}}
{{ template "service.environment.secret" (dict "component" "webapp" "service_name" "php-fpm" "service" $service "root" $) }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "job-queue-consumer") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "job-queue-consumer") | fromYaml) -}}
{{- if .enabled }}
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $service := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "job-queue-consumer") -}}
{{- $service := include "service.php.resolved" (dict "root" $ "service_name" "job-queue-consumer") | fromYaml -}}
{{ template "service.environment.secret" (dict "service_name" "job-queue-consumer" "service" $service "root" $) }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "jenkins-runner") -}}
{{- with (include "service.php.resolved" (dict "root" $ "service_name" "jenkins-runner") | fromYaml) -}}
{{- if .enabled -}}
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $service := mergeOverwrite (dict) (index .Values.services "php-base") (index .Values.services "jenkins-runner") -}}
{{- $service := include "service.php.resolved" (dict "root" $ "service_name" "jenkins-runner") | fromYaml -}}
{{ template "service.environment.secret" (dict "service_name" "jenkins-runner" "service" $service "root" $) }}

0 comments on commit 9e2210d

Please sign in to comment.