Skip to content

Commit

Permalink
patch nginx-ingress chart: disable CM generation
Browse files Browse the repository at this point in the history
  • Loading branch information
eg-ayoub committed Jan 9, 2025
1 parent 8f96f50 commit b0e842d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion catalog-source/catalog/nginx-operator/bundles/v4.11.3.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions nginx-operator/BUMPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ rm -rf helm-charts/ingress-nginx
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm fetch -d helm-charts --untar https://kubernetes.github.io/ingress-nginx/ingress-nginx --version $VERSION
git apply remove_configmap.patch
sed -i "s/^VERSION.*/VERSION ?= $VERSION/" Makefile
make bundle
```

also change `NGINX_OPERATOR_VERSION` in `buildchain/buildchain/versions.py`.

### About the patch

The ConfigMaps are managed by salt. Previously, they were automatically deleted from the manifest
after generating the chart.
If we keep them, they interfere with the salt-generated configmap.
We don't have a way to disable the configmap generation, so we patch it in the chart.
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2025-01-07T17:56:14Z"
createdAt: "2025-01-09T10:08:53Z"
operators.operatorframework.io/builder: operator-sdk-v1.38.0
operators.operatorframework.io/project_layout: helm.sdk.operatorframework.io/v1
name: nginx-operator.v4.11.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.controller.generateConfigMap -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -26,3 +27,4 @@ data:
{{- range $key, $value := .Values.controller.config }}
{{- $key | nindent 2 }}: {{ tpl (toString $value) $ | quote }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions nginx-operator/helm-charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ controller:
# -- Global configuration passed to the ConfigMap consumed by the controller. Values may contain Helm templates.
# Ref.: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
config: {}
# -- whether to generate the configmap object or not
generateConfigMap: false
# -- Annotations to be added to the controller config configuration configmap.
configAnnotations: {}
# -- Will add custom headers before sending traffic to backends according to https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-headers
Expand Down
27 changes: 27 additions & 0 deletions nginx-operator/remove_configmap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/nginx-operator/helm-charts/ingress-nginx/templates/controller-configmap.yaml b/nginx-operator/helm-charts/ingress-nginx/templates/controller-configmap.yaml
index 22080d115..e24a96742 100644
--- a/nginx-operator/helm-charts/ingress-nginx/templates/controller-configmap.yaml
+++ b/nginx-operator/helm-charts/ingress-nginx/templates/controller-configmap.yaml
@@ -1,3 +1,4 @@
+{{- if .Values.controller.generateConfigMap -}}
apiVersion: v1
kind: ConfigMap
metadata:
@@ -26,3 +27,4 @@ data:
{{- range $key, $value := .Values.controller.config }}
{{- $key | nindent 2 }}: {{ tpl (toString $value) $ | quote }}
{{- end }}
+{{- end }}
diff --git a/nginx-operator/helm-charts/ingress-nginx/values.yaml b/nginx-operator/helm-charts/ingress-nginx/values.yaml
index f42a6821d..6c44a3a92 100644
--- a/nginx-operator/helm-charts/ingress-nginx/values.yaml
+++ b/nginx-operator/helm-charts/ingress-nginx/values.yaml
@@ -48,6 +48,8 @@ controller:
# -- Global configuration passed to the ConfigMap consumed by the controller. Values may contain Helm templates.
# Ref.: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
config: {}
+ # -- whether to generate the configmap object or not
+ generateConfigMap: false
# -- Annotations to be added to the controller config configuration configmap.
configAnnotations: {}
# -- Will add custom headers before sending traffic to backends according to https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-headers

0 comments on commit b0e842d

Please sign in to comment.