Refactor: update DaemonSet and Deployment command params to use templates (#7689)
* Refactor: update DaemonSet and Deployment command parameters to use helm templates * Fix whitespace issues
This commit is contained in:
parent
14f6b32032
commit
5a52d99ae8
3 changed files with 54 additions and 103 deletions
52
charts/ingress-nginx/templates/_params.tpl
Normal file
52
charts/ingress-nginx/templates/_params.tpl
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{{- define "ingress-nginx.params" -}}
|
||||||
|
- /nginx-ingress-controller
|
||||||
|
{{- if .Values.defaultBackend.enabled }}
|
||||||
|
- --default-backend-service=$(POD_NAMESPACE)/{{ include "ingress-nginx.defaultBackend.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.publishService.enabled }}
|
||||||
|
- --publish-service={{ template "ingress-nginx.controller.publishServicePath" . }}
|
||||||
|
{{- end }}
|
||||||
|
- --election-id={{ .Values.controller.electionID }}
|
||||||
|
- --controller-class={{ .Values.controller.ingressClassResource.controllerValue }}
|
||||||
|
- --configmap={{ default "$(POD_NAMESPACE)" .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
|
||||||
|
{{- if .Values.tcp }}
|
||||||
|
- --tcp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.tcp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-tcp
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.udp }}
|
||||||
|
- --udp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.udp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-udp
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.scope.enabled }}
|
||||||
|
- --watch-namespace={{ default "$(POD_NAMESPACE)" .Values.controller.scope.namespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.controller.reportNodeInternalIp .Values.controller.hostNetwork }}
|
||||||
|
- --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.admissionWebhooks.enabled }}
|
||||||
|
- --validating-webhook=:{{ .Values.controller.admissionWebhooks.port }}
|
||||||
|
- --validating-webhook-certificate={{ .Values.controller.admissionWebhooks.certificate }}
|
||||||
|
- --validating-webhook-key={{ .Values.controller.admissionWebhooks.key }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.maxmindLicenseKey }}
|
||||||
|
- --maxmind-license-key={{ .Values.controller.maxmindLicenseKey }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.healthCheckHost }}
|
||||||
|
- --healthz-host={{ .Values.controller.healthCheckHost }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not (eq .Values.controller.healthCheckPath "/healthz") }}
|
||||||
|
- --health-check-path={{ .Values.controller.healthCheckPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.ingressClassByName }}
|
||||||
|
- --ingress-class-by-name=true
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.controller.watchIngressWithoutClass }}
|
||||||
|
- --watch-ingress-without-class=true
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := .Values.controller.extraArgs }}
|
||||||
|
{{- /* Accept keys without values or with false as value */}}
|
||||||
|
{{- if eq ($value | quote | len) 2 }}
|
||||||
|
- --{{ $key }}
|
||||||
|
{{- else }}
|
||||||
|
- --{{ $key }}={{ $value }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
|
@ -75,59 +75,7 @@ spec:
|
||||||
lifecycle: {{ toYaml .Values.controller.lifecycle | nindent 12 }}
|
lifecycle: {{ toYaml .Values.controller.lifecycle | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
{{- include "ingress-nginx.params" . | nindent 12 }}
|
||||||
{{- if .Values.defaultBackend.enabled }}
|
|
||||||
- --default-backend-service=$(POD_NAMESPACE)/{{ include "ingress-nginx.defaultBackend.fullname" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.publishService.enabled }}
|
|
||||||
- --publish-service={{ template "ingress-nginx.controller.publishServicePath" . }}
|
|
||||||
{{- end }}
|
|
||||||
- --election-id={{ .Values.controller.electionID }}
|
|
||||||
- --controller-class={{ .Values.controller.ingressClassResource.controllerValue }}
|
|
||||||
- --configmap={{ default "$(POD_NAMESPACE)" .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
|
|
||||||
{{- if .Values.tcp }}
|
|
||||||
- --tcp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.tcp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-tcp
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.udp }}
|
|
||||||
- --udp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.udp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-udp
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.scope.enabled }}
|
|
||||||
- --watch-namespace={{ default "$(POD_NAMESPACE)" .Values.controller.scope.namespace }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.controller.reportNodeInternalIp .Values.controller.hostNetwork }}
|
|
||||||
- --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.admissionWebhooks.enabled }}
|
|
||||||
- --validating-webhook=:{{ .Values.controller.admissionWebhooks.port }}
|
|
||||||
- --validating-webhook-certificate={{ .Values.controller.admissionWebhooks.certificate }}
|
|
||||||
- --validating-webhook-key={{ .Values.controller.admissionWebhooks.key }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.maxmindMirror }}
|
|
||||||
- --maxmind-mirror={{ .Values.controller.maxmindMirror }}
|
|
||||||
{{- end}}
|
|
||||||
{{- if .Values.controller.maxmindLicenseKey }}
|
|
||||||
- --maxmind-license-key={{ .Values.controller.maxmindLicenseKey }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if not (eq .Values.controller.healthCheckPath "/healthz") }}
|
|
||||||
- --health-check-path={{ .Values.controller.healthCheckPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.healthCheckHost }}
|
|
||||||
- --healthz-host={{ .Values.controller.healthCheckHost }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.ingressClassByName }}
|
|
||||||
- --ingress-class-by-name=true
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.watchIngressWithoutClass }}
|
|
||||||
- --watch-ingress-without-class=true
|
|
||||||
{{- end }}
|
|
||||||
{{- range $key, $value := .Values.controller.extraArgs }}
|
|
||||||
{{- /* Accept keys without values or with false as value */}}
|
|
||||||
{{- if eq ($value | quote | len) 2 }}
|
|
||||||
- --{{ $key }}
|
|
||||||
{{- else }}
|
|
||||||
- --{{ $key }}={{ $value }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
drop:
|
drop:
|
||||||
|
|
|
@ -79,56 +79,7 @@ spec:
|
||||||
lifecycle: {{ toYaml .Values.controller.lifecycle | nindent 12 }}
|
lifecycle: {{ toYaml .Values.controller.lifecycle | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
{{- include "ingress-nginx.params" . | nindent 12 }}
|
||||||
{{- if .Values.defaultBackend.enabled }}
|
|
||||||
- --default-backend-service=$(POD_NAMESPACE)/{{ include "ingress-nginx.defaultBackend.fullname" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.publishService.enabled }}
|
|
||||||
- --publish-service={{ template "ingress-nginx.controller.publishServicePath" . }}
|
|
||||||
{{- end }}
|
|
||||||
- --election-id={{ .Values.controller.electionID }}
|
|
||||||
- --controller-class={{ .Values.controller.ingressClassResource.controllerValue }}
|
|
||||||
- --configmap={{ default "$(POD_NAMESPACE)" .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
|
|
||||||
{{- if .Values.tcp }}
|
|
||||||
- --tcp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.tcp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-tcp
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.udp }}
|
|
||||||
- --udp-services-configmap={{ default "$(POD_NAMESPACE)" .Values.controller.udp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-udp
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.scope.enabled }}
|
|
||||||
- --watch-namespace={{ default "$(POD_NAMESPACE)" .Values.controller.scope.namespace }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.controller.reportNodeInternalIp .Values.controller.hostNetwork }}
|
|
||||||
- --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.admissionWebhooks.enabled }}
|
|
||||||
- --validating-webhook=:{{ .Values.controller.admissionWebhooks.port }}
|
|
||||||
- --validating-webhook-certificate={{ .Values.controller.admissionWebhooks.certificate }}
|
|
||||||
- --validating-webhook-key={{ .Values.controller.admissionWebhooks.key }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.maxmindLicenseKey }}
|
|
||||||
- --maxmind-license-key={{ .Values.controller.maxmindLicenseKey }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.healthCheckHost }}
|
|
||||||
- --healthz-host={{ .Values.controller.healthCheckHost }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if not (eq .Values.controller.healthCheckPath "/healthz") }}
|
|
||||||
- --health-check-path={{ .Values.controller.healthCheckPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.ingressClassByName }}
|
|
||||||
- --ingress-class-by-name=true
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.controller.watchIngressWithoutClass }}
|
|
||||||
- --watch-ingress-without-class=true
|
|
||||||
{{- end }}
|
|
||||||
{{- range $key, $value := .Values.controller.extraArgs }}
|
|
||||||
{{- /* Accept keys without values or with false as value */}}
|
|
||||||
{{- if eq ($value | quote | len) 2 }}
|
|
||||||
- --{{ $key }}
|
|
||||||
{{- else }}
|
|
||||||
- --{{ $key }}={{ $value }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
drop:
|
drop:
|
||||||
|
|
Loading…
Reference in a new issue