@@ -213,6 +213,40 @@ false
213213{ {- end -} }
214214{ {- end -} }
215215
216+ { {/*
217+ Validate the globalConfiguration.customName value format.
218+ Ensures exactly one ' /' separator for proper namespace/name parsing.
219+ */} }
220+ { {- define " nginx-ingress.globalConfiguration.validateCustomName" -} }
221+ { {- if .Values.controller.globalConfiguration.customName } }
222+ { {- $parts := splitList " /" .Values.controller.globalConfiguration.customName } }
223+ { {- if ne (len $parts ) 2 } }
224+ { {- fail " globalConfiguration.customName must contain exactly one '/' separator in namespace/name format (e.g., \" my-namespace/my-global-config\" )" } }
225+ { {- end } }
226+ { {- if or (eq (index $parts 0) " " ) (eq (index $parts 1) " " ) } }
227+ { {- fail " globalConfiguration.customName namespace and name parts cannot be empty (e.g., \" my-namespace/my-global-config\" )" } }
228+ { {- end } }
229+ { {- end } }
230+ { {- end -} }
231+
232+ { {/*
233+ Create the global configuration custom name from the globalConfiguration.customName value.
234+ */} }
235+ { {- define " nginx-ingress.globalConfiguration.customName" -} }
236+ { {- include " nginx-ingress.globalConfiguration.validateCustomName" . -} }
237+ { {- $parts := splitList " /" .Values.controller.globalConfiguration.customName -} }
238+ { {- index $parts 1 -} }
239+ { {- end -} }
240+
241+ { {/*
242+ Create the global configuration custom namespace from the globalConfiguration.customName value.
243+ */} }
244+ { {- define " nginx-ingress.globalConfiguration.customNamespace" -} }
245+ { {- include " nginx-ingress.globalConfiguration.validateCustomName" . -} }
246+ { {- $parts := splitList " /" .Values.controller.globalConfiguration.customName -} }
247+ { {- index $parts 0 -} }
248+ { {- end -} }
249+
216250{ {/*
217251Build the args for the service binary.
218252*/} }
@@ -314,8 +348,10 @@ Build the args for the service binary.
314348- -enable-external-dns={ { .Values.controller.enableExternalDNS } }
315349- -default-http-listener-port={ { .Values.controller.defaultHTTPListenerPort} }
316350- -default-https-listener-port={ { .Values.controller.defaultHTTPSListenerPort} }
317- { {- if .Values.controller.globalConfiguration.create } }
351+ { {- if and .Values.controller.globalConfiguration.create ( not .Values.controller.globalConfiguration.customName) } }
318352- -global-configuration=$(POD_NAMESPACE)/{ { include " nginx-ingress.controller.fullname" . } }
353+ { {- else if .Values.controller.globalConfiguration.customName } }
354+ - -global-configuration={ { .Values.controller.globalConfiguration.customName } }
319355{ {- end } }
320356{ {- end } }
321357- -ready-status={ { .Values.controller.readyStatus.enable } }
0 commit comments