Skip to content

Commit

Permalink
Chart: Add controller.metrics.service.enabled. (#12056)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeMyst authored Oct 1, 2024
1 parent 03affad commit f3bfa56
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.metrics.prometheusRule.enabled | bool | `false` | |
| controller.metrics.prometheusRule.rules | list | `[]` | |
| controller.metrics.service.annotations | object | `{}` | |
| controller.metrics.service.enabled | bool | `true` | Enable the metrics service or not. |
| 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 # |
| controller.metrics.service.labels | object | `{}` | Labels to be added to the metrics service resource |
| controller.metrics.service.loadBalancerSourceRanges | list | `[]` | |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.controller.metrics.enabled -}}
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
22 changes: 20 additions & 2 deletions charts/ingress-nginx/tests/controller-service-metrics_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@ templates:
- controller-service-metrics.yaml

tests:
- it: should not create a metrics Service if `controller.metrics.enabled` is false
- it: should not create a metrics Service if `controller.metrics.enabled` is false and `controller.metrics.service.enabled` is false
set:
controller.metrics.enabled: false
controller.metrics.service.enabled: false
asserts:
- hasDocuments:
count: 0

- it: should create a metrics Service if `controller.metrics.enabled` is true
- it: should not create a metrics Service if `controller.metrics.enabled` is false and `controller.metrics.service.enabled` is true
set:
controller.metrics.enabled: false
controller.metrics.service.enabled: true
asserts:
- hasDocuments:
count: 0

- it: should not create a metrics Service if `controller.metrics.enabled` is true and `controller.metrics.service.enabled` is false
set:
controller.metrics.enabled: true
controller.metrics.service.enabled: false
asserts:
- hasDocuments:
count: 0

- it: should create a metrics Service if `controller.metrics.enabled` is true and `controller.metrics.service.enabled` is true
set:
controller.metrics.enabled: true
controller.metrics.service.enabled: true
asserts:
- hasDocuments:
count: 1
Expand Down
2 changes: 2 additions & 0 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ controller:
# if this port is changed, change healthz-port: in extraArgs: accordingly
enabled: false
service:
# -- Enable the metrics service or not.
enabled: true
annotations: {}
# prometheus.io/scrape: "true"
# prometheus.io/port: "10254"
Expand Down

0 comments on commit f3bfa56

Please sign in to comment.