Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resource overrides in nginx-php templates #267

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions legacy/helmcharts/nginx-php-persistent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -135,3 +135,16 @@ Generate path for twig storage emptyDir
{{- define "nginx-php-persistent.twig-storage.path" -}}
{{- printf "%s/php" .Values.persistentStorage.path }}
{{- end -}}

{{/*
Merge resources from global over resources defined in the values
*/}}
{{- define "resources" -}}
{{- $value := dict -}}
{{- range (rest .) -}}
{{- $value = merge $value . -}}
{{- end -}}
{{- if $value -}}
{{- toYaml $value }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -109,8 +109,7 @@ spec:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.nginx | nindent 12 }}

{{- include "resources" (list "resources" .Values.resources .Values.containerResources.nginx) | nindent 12 }}
- image: {{ .Values.images.php | quote }}
name: "php"
imagePullPolicy: {{ .Values.imagePullPolicy }}
@@ -146,7 +145,7 @@ spec:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.php | nindent 12 }}
{{- include "resources" (list "resources" .Values.resources .Values.containerResources.php ) | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
4 changes: 3 additions & 1 deletion legacy/helmcharts/nginx-php-persistent/values.yaml
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ fastly:
# serviceId: ''
# apiSecretName: ''

resources:
containerResources:
nginx:
# limits:
# cpu: 100m
@@ -56,6 +56,8 @@ resources:
cpu: 10m
memory: 100Mi

resources: {}

nodeSelector: {}

cronjobNodeSelector: {}
13 changes: 13 additions & 0 deletions legacy/helmcharts/nginx-php/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -113,3 +113,16 @@ lagoon.sh/prHeadBranch: {{ .Values.prHeadBranch | quote }}
lagoon.sh/prBaseBranch: {{ .Values.prBaseBranch | quote }}
{{- end }}
{{- end -}}

{{/*
Merge resources from global over resources defined in the values
*/}}
{{- define "resources" -}}
{{- $value := dict -}}
{{- range (rest .) -}}
{{- $value = merge $value . -}}
{{- end -}}
{{- if $value -}}
{{- toYaml $value }}
{{- end }}
{{- end -}}
4 changes: 2 additions & 2 deletions legacy/helmcharts/nginx-php/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ spec:
- configMapRef:
name: lagoon-env
resources:
{{- toYaml .Values.resources.nginx | nindent 12 }}
{{- include "resources" (list "resources" .Values.resources .Values.containerResources.nginx ) | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
@@ -105,7 +105,7 @@ spec:
- name: NGINX_FASTCGI_PASS
value: '127.0.0.1'
resources:
{{- toYaml .Values.resources.php | nindent 12 }}
{{- include "resources" (list "resources" .Values.resources .Values.containerResources.php ) | nindent 12 }}
{{- if .Values.dynamicSecretMounts }}
volumeMounts:
{{- toYaml .Values.dynamicSecretMounts | nindent 12 }}
4 changes: 3 additions & 1 deletion legacy/helmcharts/nginx-php/values.yaml
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ fastly:
# serviceId: ''
# apiSecretName: ''

resources:
containerResources:
nginx:
# limits:
# cpu: 100m
@@ -53,6 +53,8 @@ resources:
cpu: 10m
memory: 100Mi

resources: {}

nodeSelector: {}

cronjobNodeSelector: {}