Chart: Add controller.metrics.service.enabled.

This commit is contained in:
Myst 2024-09-30 15:09:05 +00:00 committed by Marco Ebert
parent 03affadd36
commit ced332be0d
4 changed files with 24 additions and 3 deletions

View file

@ -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.enabled | bool | `false` | |
| controller.metrics.prometheusRule.rules | list | `[]` | | | controller.metrics.prometheusRule.rules | list | `[]` | |
| controller.metrics.service.annotations | object | `{}` | | | 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.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.labels | object | `{}` | Labels to be added to the metrics service resource |
| controller.metrics.service.loadBalancerSourceRanges | list | `[]` | | | controller.metrics.service.loadBalancerSourceRanges | list | `[]` | |

View file

@ -1,4 +1,4 @@
{{- if .Values.controller.metrics.enabled -}} {{- if and .Values.controller.metrics.enabled .Values.controller.metrics.service.enabled -}}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:

View file

@ -3,16 +3,34 @@ templates:
- controller-service-metrics.yaml - controller-service-metrics.yaml
tests: 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: set:
controller.metrics.enabled: false controller.metrics.enabled: false
controller.metrics.service.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 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: set:
controller.metrics.enabled: true 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: asserts:
- hasDocuments: - hasDocuments:
count: 1 count: 1

View file

@ -844,6 +844,8 @@ controller:
# if this port is changed, change healthz-port: in extraArgs: accordingly # if this port is changed, change healthz-port: in extraArgs: accordingly
enabled: false enabled: false
service: service:
# -- Enable the metrics service or not.
enabled: true
annotations: {} annotations: {}
# prometheus.io/scrape: "true" # prometheus.io/scrape: "true"
# prometheus.io/port: "10254" # prometheus.io/port: "10254"