Skip to content

Commit 3e740fe

Browse files
authored
Chart: Set --enable-metrics depending on controller.metrics.enabled. (#10959)
1 parent 48b9831 commit 3e740fe

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

charts/ingress-nginx/templates/_params.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
{{- if .Values.controller.watchIngressWithoutClass }}
5555
- --watch-ingress-without-class=true
5656
{{- end }}
57+
{{- if not .Values.controller.metrics.enabled }}
58+
- --enable-metrics={{ .Values.controller.metrics.enabled }}
59+
{{- end }}
5760
{{- if .Values.controller.enableTopologyAwareRouting }}
5861
- --enable-topology-aware-routing=true
5962
{{- end }}

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,34 @@ tests:
1414
- equal:
1515
path: metadata.name
1616
value: RELEASE-NAME-ingress-nginx-controller
17+
18+
- it: should create a DaemonSet with argument `--enable-metrics=false` if `controller.metrics.enabled` is false
19+
set:
20+
controller.kind: DaemonSet
21+
controller.metrics.enabled: false
22+
asserts:
23+
- contains:
24+
path: spec.template.spec.containers[0].args
25+
content: --enable-metrics=false
26+
27+
- it: should create a DaemonSet without argument `--enable-metrics=false` if `controller.metrics.enabled` is true
28+
set:
29+
controller.kind: DaemonSet
30+
controller.metrics.enabled: true
31+
asserts:
32+
- notContains:
33+
path: spec.template.spec.containers[0].args
34+
content: --enable-metrics=false
35+
36+
- it: should create a DaemonSet with resource limits if `controller.resources.limits` is set
37+
set:
38+
controller.kind: DaemonSet
39+
controller.resources.limits.cpu: 500m
40+
controller.resources.limits.memory: 512Mi
41+
asserts:
42+
- equal:
43+
path: spec.template.spec.containers[0].resources.limits.cpu
44+
value: 500m
45+
- equal:
46+
path: spec.template.spec.containers[0].resources.limits.memory
47+
value: 512Mi

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ tests:
2121
path: spec.replicas
2222
value: 3
2323

24+
- it: should create a Deployment with argument `--enable-metrics=false` if `controller.metrics.enabled` is false
25+
set:
26+
controller.metrics.enabled: false
27+
asserts:
28+
- contains:
29+
path: spec.template.spec.containers[0].args
30+
content: --enable-metrics=false
31+
32+
- it: should create a Deployment without argument `--enable-metrics=false` if `controller.metrics.enabled` is true
33+
set:
34+
controller.metrics.enabled: true
35+
asserts:
36+
- notContains:
37+
path: spec.template.spec.containers[0].args
38+
content: --enable-metrics=false
39+
2440
- it: should create a Deployment with resource limits if `controller.resources.limits` is set
2541
set:
2642
controller.resources.limits.cpu: 500m

0 commit comments

Comments
 (0)