Skip to content

Commit f3bfa56

Browse files
authored
Chart: Add controller.metrics.service.enabled. (#12056)
1 parent 03affad commit f3bfa56

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

charts/ingress-nginx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
372372
| controller.metrics.prometheusRule.enabled | bool | `false` | |
373373
| controller.metrics.prometheusRule.rules | list | `[]` | |
374374
| controller.metrics.service.annotations | object | `{}` | |
375+
| controller.metrics.service.enabled | bool | `true` | Enable the metrics service or not. |
375376
| controller.metrics.service.externalIPs | list | `[]` | List of IP addresses at which the stats-exporter service is available # Ref: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips # |
376377
| controller.metrics.service.labels | object | `{}` | Labels to be added to the metrics service resource |
377378
| controller.metrics.service.loadBalancerSourceRanges | list | `[]` | |

charts/ingress-nginx/templates/controller-service-metrics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.controller.metrics.enabled -}}
1+
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.service.enabled -}}
22
apiVersion: v1
33
kind: Service
44
metadata:

charts/ingress-nginx/tests/controller-service-metrics_test.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,34 @@ templates:
33
- controller-service-metrics.yaml
44

55
tests:
6-
- it: should not create a metrics Service if `controller.metrics.enabled` is false
6+
- it: should not create a metrics Service if `controller.metrics.enabled` is false and `controller.metrics.service.enabled` is false
77
set:
88
controller.metrics.enabled: false
9+
controller.metrics.service.enabled: false
910
asserts:
1011
- hasDocuments:
1112
count: 0
1213

13-
- it: should create a metrics Service if `controller.metrics.enabled` is true
14+
- it: should not create a metrics Service if `controller.metrics.enabled` is false and `controller.metrics.service.enabled` is true
15+
set:
16+
controller.metrics.enabled: false
17+
controller.metrics.service.enabled: true
18+
asserts:
19+
- hasDocuments:
20+
count: 0
21+
22+
- it: should not create a metrics Service if `controller.metrics.enabled` is true and `controller.metrics.service.enabled` is false
23+
set:
24+
controller.metrics.enabled: true
25+
controller.metrics.service.enabled: false
26+
asserts:
27+
- hasDocuments:
28+
count: 0
29+
30+
- it: should create a metrics Service if `controller.metrics.enabled` is true and `controller.metrics.service.enabled` is true
1431
set:
1532
controller.metrics.enabled: true
33+
controller.metrics.service.enabled: true
1634
asserts:
1735
- hasDocuments:
1836
count: 1

charts/ingress-nginx/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,8 @@ controller:
844844
# if this port is changed, change healthz-port: in extraArgs: accordingly
845845
enabled: false
846846
service:
847+
# -- Enable the metrics service or not.
848+
enabled: true
847849
annotations: {}
848850
# prometheus.io/scrape: "true"
849851
# prometheus.io/port: "10254"

0 commit comments

Comments
 (0)