Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart: Add controller.metrics.service.enabled. #12056

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Gacko marked this conversation as resolved.
Show resolved Hide resolved
annotations: {}
# prometheus.io/scrape: "true"
# prometheus.io/port: "10254"
Expand Down