@@ -213,6 +213,40 @@ false
213
213
{ {- end -} }
214
214
{ {- end -} }
215
215
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
+
216
250
{ {/*
217
251
Build the args for the service binary.
218
252
*/} }
@@ -314,8 +348,10 @@ Build the args for the service binary.
314
348
- -enable-external-dns={ { .Values.controller.enableExternalDNS } }
315
349
- -default-http-listener-port={ { .Values.controller.defaultHTTPListenerPort} }
316
350
- -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) } }
318
352
- -global-configuration=$(POD_NAMESPACE)/{ { include " nginx-ingress.controller.fullname" . } }
353
+ { {- else if .Values.controller.globalConfiguration.customName } }
354
+ - -global-configuration={ { .Values.controller.globalConfiguration.customName } }
319
355
{ {- end } }
320
356
{ {- end } }
321
357
- -ready-status={ { .Values.controller.readyStatus.enable } }
0 commit comments