-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extra configMaps support to helm chart (#10673)
* Add extra configMaps support to helm chart Signed-off-by: Stavros Foteinopoulos <[email protected]> * Introducing unit tests for helm chart Signed-off-by: Stavros Foteinopoulos <[email protected]> --------- Signed-off-by: Stavros Foteinopoulos <[email protected]>
- Loading branch information
Showing
8 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,4 @@ cmd/plugin/release/*.tar.gz | |
cmd/plugin/release/LICENSE | ||
tmp/ | ||
test/junitreports/ | ||
tests/__snapshot__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
__snapshot__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
charts/ingress-nginx/templates/default-backend-extra-configmaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- if .Values.defaultBackend.enabled }} | ||
{{- range .Values.defaultBackend.extraConfigMaps }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .name }} | ||
namespace: {{ include "ingress-nginx.namespace" $ | quote }} | ||
labels: | ||
{{- include "ingress-nginx.labels" $ | nindent 4 }} | ||
{{- with $.Values.defaultBackend.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
data: | ||
{{- with .data }} | ||
{{- toYaml . | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
49 changes: 49 additions & 0 deletions
49
charts/ingress-nginx/tests/default-backend-extra-configmaps_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
suite: test default backend extra ConfigMaps | ||
templates: | ||
- default-backend-extra-configmaps.yaml | ||
|
||
tests: | ||
- it: should not create any ConfigMap by default | ||
set: | ||
Release.Namespace: default | ||
defaultBackend.enabled: true | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: should create one ConfigMap | ||
set: | ||
Release.Namespace: default | ||
defaultBackend.enabled: true | ||
defaultBackend.extraConfigMaps: | ||
- name: my-configmap-1 | ||
data: | ||
key1: value1 | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ConfigMap | ||
- equal: | ||
path: metadata.name | ||
value: my-configmap-1 | ||
|
||
- it: should correctly render multiple ConfigMaps | ||
set: | ||
Release.Namespace: nginx | ||
defaultBackend.enabled: true | ||
defaultBackend.extraConfigMaps: | ||
- name: my-configmap-1 | ||
data: | ||
key1: value1 | ||
- name: my-configmap-2 | ||
data: | ||
key2: value2 | ||
asserts: | ||
- hasDocuments: | ||
count: 2 | ||
- isKind: | ||
of: ConfigMap | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: "my-configmap-\\d+" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters