Skip to content

Commit

Permalink
Helm: add globalConfigurationCustomName parameter
Browse files Browse the repository at this point in the history
Extend globalConfiguration customName functionality
when gc create true (nginx#6679)
  • Loading branch information
frantsao committed Dec 12, 2024
1 parent ae76aea commit 8490da9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion charts/nginx-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ false
{{- end -}}
{{- end -}}

{{/*
Create the global configuration custom name from the globalConfiguration.customName value.
*/}}
{{- define "nginx-ingress.globalConfiguration.customName" -}}
{{ splitList "/" .Values.controller.globalConfiguration.customName | last }}
{{- end -}}

{{/*
Create the global configuration custom namespace from the globalConfiguration.customName value.
*/}}
{{- define "nginx-ingress.globalConfiguration.customNamespace" -}}
{{ splitList "/" .Values.controller.globalConfiguration.customName | first }}
{{- end -}}

{{/*
Build the args for the service binary.
*/}}
Expand Down Expand Up @@ -314,7 +328,7 @@ Build the args for the service binary.
- -enable-external-dns={{ .Values.controller.enableExternalDNS }}
- -default-http-listener-port={{ .Values.controller.defaultHTTPListenerPort}}
- -default-https-listener-port={{ .Values.controller.defaultHTTPSListenerPort}}
{{- if .Values.controller.globalConfiguration.create }}
{{- if and .Values.controller.globalConfiguration.create (not .Values.controller.globalConfiguration.customName) }}
- -global-configuration=$(POD_NAMESPACE)/{{ include "nginx-ingress.controller.fullname" . }}
{{- else }}
{{- if .Values.controller.globalConfiguration.customName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
apiVersion: k8s.nginx.org/v1
kind: GlobalConfiguration
metadata:
{{- if not .Values.controller.globalConfiguration.customName }}
name: {{ include "nginx-ingress.controller.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- else }}
name: {{ include "nginx-ingress.globalConfiguration.customName" . }}
namespace: {{ include "nginx-ingress.globalConfiguration.customNamespace" . }}
{{- end }}
labels:
{{- include "nginx-ingress.labels" . | nindent 4 }}
spec:
Expand Down

0 comments on commit 8490da9

Please sign in to comment.