Skip to content

Commit

Permalink
Merge pull request #10721 from Gacko/k4as9
Browse files Browse the repository at this point in the history
Chart: Improve #10673.
  • Loading branch information
strongjz committed Dec 20, 2023
2 parents e285680 + 2f7f4d7 commit 97a0483
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{{- if .Values.defaultBackend.enabled }}
{{- range .Values.defaultBackend.extraConfigMaps }}
{{- range .Values.defaultBackend.extraConfigMaps }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .name }}
namespace: {{ include "ingress-nginx.namespace" $ | quote }}
labels:
{{- include "ingress-nginx.labels" $ | nindent 4 }}
app.kubernetes.io/component: default-backend
{{- with $.Values.defaultBackend.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ .name }}
namespace: {{ include "ingress-nginx.namespace" $ }}
data:
{{- with .data }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}

{{- end }}
2 changes: 1 addition & 1 deletion charts/ingress-nginx/tests/controller-service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tests:

- it: should create a Service of type "NodePort" if `controller.service.external.enabled` is true and `controller.service.type` is "NodePort"
set:
controller.service.enabled: true
controller.service.external.enabled: true
controller.service.type: NodePort
asserts:
- equal:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
suite: test default backend extra ConfigMaps
suite: Default Backend > Extra ConfigMaps
templates:
- default-backend-extra-configmaps.yaml

tests:
- it: should not create any ConfigMap by default
- it: should not create a ConfigMap if `defaultBackend.extraConfigMaps` is empty
set:
Release.Namespace: default
defaultBackend.enabled: true
defaultBackend.extraConfigMaps: []
asserts:
- hasDocuments:
count: 0

- it: should create one ConfigMap
- it: should create one ConfigMap if `defaultBackend.extraConfigMaps` has one element
set:
Release.Namespace: default
defaultBackend.enabled: true
defaultBackend.extraConfigMaps:
- name: my-configmap-1
Expand All @@ -27,10 +26,12 @@ tests:
- equal:
path: metadata.name
value: my-configmap-1
- equal:
path: data.key1
value: value1

- it: should correctly render multiple ConfigMaps
- it: should create two ConfigMaps if `defaultBackend.extraConfigMaps` has two elements
set:
Release.Namespace: nginx
defaultBackend.enabled: true
defaultBackend.extraConfigMaps:
- name: my-configmap-1
Expand All @@ -46,4 +47,4 @@ tests:
of: ConfigMap
- matchRegex:
path: metadata.name
pattern: "my-configmap-\\d+"
pattern: my-configmap-(1|2)
28 changes: 14 additions & 14 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1040,21 +1040,21 @@ defaultBackend:
## Additional volumes to the default backend pod.
# - name: copy-portal-skins
# emptyDir: {}

extraConfigMaps: []
## Additional configmaps to the default backend pod.
# Example ConfigMap, uncomment and configure as needed
# - name: my-extra-configmap-1
# labels:
# type: config-1
# data:
# extra_file_1.html: |
# <!-- Extra HTML content for ConfigMap 1 -->
# - name: my-extra-configmap-2
# labels:
# type: config-2
# data:
# extra_file_2.html: |
# <!-- Extra HTML content for ConfigMap 2 -->
## Additional configmaps to the default backend pod.
# - name: my-extra-configmap-1
# labels:
# type: config-1
# data:
# extra_file_1.html: |
# <!-- Extra HTML content for ConfigMap 1 -->
# - name: my-extra-configmap-2
# labels:
# type: config-2
# data:
# extra_file_2.html: |
# <!-- Extra HTML content for ConfigMap 2 -->

autoscaling:
annotations: {}
Expand Down

0 comments on commit 97a0483

Please sign in to comment.