Skip to content

Commit 97a0483

Browse files
authored
Merge pull request #10721 from Gacko/k4as9
Chart: Improve #10673.
2 parents e285680 + 2f7f4d7 commit 97a0483

File tree

4 files changed

+29
-28
lines changed

4 files changed

+29
-28
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{{- if .Values.defaultBackend.enabled }}
2-
{{- range .Values.defaultBackend.extraConfigMaps }}
2+
{{- range .Values.defaultBackend.extraConfigMaps }}
33
---
44
apiVersion: v1
55
kind: ConfigMap
66
metadata:
7-
name: {{ .name }}
8-
namespace: {{ include "ingress-nginx.namespace" $ | quote }}
97
labels:
108
{{- include "ingress-nginx.labels" $ | nindent 4 }}
9+
app.kubernetes.io/component: default-backend
1110
{{- with $.Values.defaultBackend.labels }}
1211
{{- toYaml . | nindent 4 }}
1312
{{- end }}
1413
{{- with .labels }}
1514
{{- toYaml . | nindent 4 }}
1615
{{- end }}
16+
name: {{ .name }}
17+
namespace: {{ include "ingress-nginx.namespace" $ }}
1718
data:
1819
{{- with .data }}
1920
{{- toYaml . | nindent 2 }}
2021
{{- end }}
21-
{{- end }}
2222
{{- end }}
23-
23+
{{- end }}

charts/ingress-nginx/tests/controller-service_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tests:
2424

2525
- it: should create a Service of type "NodePort" if `controller.service.external.enabled` is true and `controller.service.type` is "NodePort"
2626
set:
27-
controller.service.enabled: true
27+
controller.service.external.enabled: true
2828
controller.service.type: NodePort
2929
asserts:
3030
- equal:

charts/ingress-nginx/tests/default-backend-extra-configmaps_test.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
suite: test default backend extra ConfigMaps
1+
suite: Default Backend > Extra ConfigMaps
22
templates:
33
- default-backend-extra-configmaps.yaml
44

55
tests:
6-
- it: should not create any ConfigMap by default
6+
- it: should not create a ConfigMap if `defaultBackend.extraConfigMaps` is empty
77
set:
8-
Release.Namespace: default
98
defaultBackend.enabled: true
9+
defaultBackend.extraConfigMaps: []
1010
asserts:
1111
- hasDocuments:
1212
count: 0
1313

14-
- it: should create one ConfigMap
14+
- it: should create one ConfigMap if `defaultBackend.extraConfigMaps` has one element
1515
set:
16-
Release.Namespace: default
1716
defaultBackend.enabled: true
1817
defaultBackend.extraConfigMaps:
1918
- name: my-configmap-1
@@ -27,10 +26,12 @@ tests:
2726
- equal:
2827
path: metadata.name
2928
value: my-configmap-1
29+
- equal:
30+
path: data.key1
31+
value: value1
3032

31-
- it: should correctly render multiple ConfigMaps
33+
- it: should create two ConfigMaps if `defaultBackend.extraConfigMaps` has two elements
3234
set:
33-
Release.Namespace: nginx
3435
defaultBackend.enabled: true
3536
defaultBackend.extraConfigMaps:
3637
- name: my-configmap-1
@@ -46,4 +47,4 @@ tests:
4647
of: ConfigMap
4748
- matchRegex:
4849
path: metadata.name
49-
pattern: "my-configmap-\\d+"
50+
pattern: my-configmap-(1|2)

charts/ingress-nginx/values.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,21 +1040,21 @@ defaultBackend:
10401040
## Additional volumes to the default backend pod.
10411041
# - name: copy-portal-skins
10421042
# emptyDir: {}
1043+
10431044
extraConfigMaps: []
1044-
## Additional configmaps to the default backend pod.
1045-
# Example ConfigMap, uncomment and configure as needed
1046-
# - name: my-extra-configmap-1
1047-
# labels:
1048-
# type: config-1
1049-
# data:
1050-
# extra_file_1.html: |
1051-
# <!-- Extra HTML content for ConfigMap 1 -->
1052-
# - name: my-extra-configmap-2
1053-
# labels:
1054-
# type: config-2
1055-
# data:
1056-
# extra_file_2.html: |
1057-
# <!-- Extra HTML content for ConfigMap 2 -->
1045+
## Additional configmaps to the default backend pod.
1046+
# - name: my-extra-configmap-1
1047+
# labels:
1048+
# type: config-1
1049+
# data:
1050+
# extra_file_1.html: |
1051+
# <!-- Extra HTML content for ConfigMap 1 -->
1052+
# - name: my-extra-configmap-2
1053+
# labels:
1054+
# type: config-2
1055+
# data:
1056+
# extra_file_2.html: |
1057+
# <!-- Extra HTML content for ConfigMap 2 -->
10581058

10591059
autoscaling:
10601060
annotations: {}

0 commit comments

Comments
 (0)