8000 add globalConfigurationCustomName parameter by mohamadaldawamnah · Pull Request #8142 · nginx/kubernetes-ingress · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
45b91bf
Helm: add globalConfigurationCustomName parameter
frantsao Oct 17, 2024
34ffce9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2024
fe07870
Remove unneeded comment in values.yaml
frantsao Oct 17, 2024
d0620e6
moved globalConfigurationCustomName parameter to globalConfiguration.…
frantsao Nov 19, 2024
5156092
Fix values.schema.json format
frantsao Nov 19, 2024 8000
2b81c69
Helm: add globalConfigurationCustomName parameter
frantsao Dec 12, 2024
a73f946
Helm: add globalConfigurationCustomName parameter
frantsao Dec 12, 2024
089e37d
adding validation and testing for global conifugration submitted by c…
mohamadaldawamnah Aug 14, 2025
4218155
add global configuration customName tests
mohamadaldawamnah Aug 15, 2025
5d4556e
add snapshot file for testing customnames
mohamadaldawamnah Aug 15, 2025
c042083
Update charts/nginx-ingress/templates/_helpers.tpl
mohamadaldawamnah Aug 15, 2025
8cf9e2e
Update charts/nginx-ingress/templates/_helpers.tpl
mohamadaldawamnah Aug 15, 2025
a7b308c
resolving issues mentioned by github copilot
mohamadaldawamnah Aug 15, 2025
7907d46
resolving issues mentioned by github copilot
mohamadaldawamnah Aug 15, 2025
ff4cef0
fixing linting format
mohamadaldawamnah Aug 15, 2025
5376dd5
changing If statment and making sure it can be reached
mohamadaldawamnah Aug 15, 2025
0aed68b
Update charts/nginx-ingress/templates/_helpers.tpl
mohamadaldawamnah Aug 15, 2025
fb8f8dd
Update charts/nginx-ingress/templates/_helpers.tpl
mohamadaldawamnah Aug 15, 2025
69c4789
fixing copilot mentioned error
mohamadaldawamnah Aug 15, 2025
7f6203a
Update charts/nginx-ingress/templates/_helpers.tpl
mohamadaldawamnah Aug 15, 2025
3f242c3
fixing copilot mentioned error
mohamadaldawamnah Aug 15, 2025
14cc1ac
Fix formatting and remove merge conflict markers
mohamadaldawamnah Aug 27, 2025
66d0fed
fixed some testing issues
mohamadaldawamnah Aug 27, 2025
bd9f67c
fixed some testing issues
mohamadaldawamnah Aug 27, 2025
bf20392
fixed make cover issue
mohamadaldawamnah Aug 27, 2025
564a826
added some annotation validation
mohamadaldawamnah Aug 27, 2025
c31fdde
Revert "added some annotation validation"
mohamadaldawamnah Aug 27, 2025
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
38 changes: 37 additions & 1 deletion charts/nginx-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,40 @@ false
{{- end -}}
{{- end -}}

{{/*
Validate the globalConfiguration.customName value format.
Ensures exactly one '/' separator for proper namespace/name parsing.
*/}}
{{- define "nginx-ingress.globalConfiguration.validateCustomName" -}}
{{- if .Values.controller.globalConfiguration.customName }}
{{- $parts := splitList "/" .Values.controller.globalConfiguration.customName }}
{{- if ne (len $parts) 2 }}
{{- fail "globalConfiguration.customName must contain exactly one '/' separator in namespace/name format (e.g., \"my-namespace/my-global-config\")" }}
{{- end }}
{{- if or (eq (index $parts 0) "") (eq (index $parts 1) "") }}
{{- fail "globalConfiguration.customName namespace and name parts cannot be empty (e.g., \"my-namespace/my-global-config\")" }}
{{- end }}
{{- end }}
{{- end -}}

{{/*
Create the global configuration custom name from the globalConfiguration.customName value.
*/}}
{{- define "nginx-ingress.globalConfiguration.customName" -}}
{{- include "nginx-ingress.globalConfiguration.validateCustomName" . -}}
{{- $parts := splitList "/" .Values.controller.globalConfiguration.customName -}}
{{- index $parts 1 -}}
{{- end -}}

{{/*
Create the global configuration custom namespace from the globalConfiguration.customName value.
*/}}
{{- define "nginx-ingress.globalConfiguration.customNamespace" -}}
{{- include "nginx-ingress.globalConfiguration.validateCustomName" . -}}
{{- $parts := splitList "/" .Values.controller.globalConfiguration.customName -}}
{{- index $parts 0 -}}
{{- end -}}

{{/*
Build the args for the service binary.
*/}}
Expand Down Expand Up @@ -314,8 +348,10 @@ 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 }}
- -global-configuration={{ .Values.controller.globalConfiguration.customName }}
{{- end }}
{{- end }}
- -ready-status={{ .Values.controller.readyStatus.enable }}
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
8 changes: 8 additions & 0 deletions charts/nginx-ingress/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,14 @@
false
]
},
"customName": {
"type": "string",
"default": "",
"title": "The customName Schema",
"examples": [
"the-namespace/the-name-of-the-global-configuration-custom-resource"
]
},
"spec": {
"type": "object",
"default": {},
Expand Down
5 changes: 5 additions & 0 deletions charts/nginx-ingress/v 6D4E alues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ controller:
## Creates the GlobalConfiguration custom resource. Requires controller.enableCustomResources.
create: false

## customName: "the-namespace/the-name-of-the-global-configuration-custom-resource"
## The name of the GlobalConfiguration custom resource to use instead of the one provided by default.
## Make sure the namespace is watched when watchNamespace or watchNamespaceLabel parameters are in use.
customName: ""

## The spec of the GlobalConfiguration for defining the global configuration parameters of the Ingress Controller.
spec: {} ## Ensure both curly brackets are removed when adding listeners in YAML format.
# listeners:
Expand Down
Loading
0