Chart: Add tests for PrometheusRule
& ServiceMonitor
. (#11883)
This commit is contained in:
parent
d4c49112a4
commit
5d457c7daa
5 changed files with 48 additions and 1 deletions
|
@ -381,7 +381,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
|
||||||
| controller.metrics.service.servicePort | int | `10254` | |
|
| controller.metrics.service.servicePort | int | `10254` | |
|
||||||
| controller.metrics.service.type | string | `"ClusterIP"` | |
|
| controller.metrics.service.type | string | `"ClusterIP"` | |
|
||||||
| controller.metrics.serviceMonitor.additionalLabels | object | `{}` | |
|
| controller.metrics.serviceMonitor.additionalLabels | object | `{}` | |
|
||||||
| controller.metrics.serviceMonitor.annotations | object | `{}` | |
|
| controller.metrics.serviceMonitor.annotations | object | `{}` | Annotations to be added to the ServiceMonitor. |
|
||||||
| controller.metrics.serviceMonitor.enabled | bool | `false` | |
|
| controller.metrics.serviceMonitor.enabled | bool | `false` | |
|
||||||
| controller.metrics.serviceMonitor.metricRelabelings | list | `[]` | |
|
| controller.metrics.serviceMonitor.metricRelabelings | list | `[]` | |
|
||||||
| controller.metrics.serviceMonitor.namespace | string | `""` | |
|
| controller.metrics.serviceMonitor.namespace | string | `""` | |
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
suite: Controller > PrometheusRule
|
||||||
|
templates:
|
||||||
|
- controller-prometheusrule.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should create a PrometheusRule if `controller.metrics.prometheusRule.enabled` is true
|
||||||
|
set:
|
||||||
|
controller.metrics.enabled: true
|
||||||
|
controller.metrics.prometheusRule.enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: PrometheusRule
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-ingress-nginx-controller
|
|
@ -0,0 +1,29 @@
|
||||||
|
suite: Controller > ServiceMonitor
|
||||||
|
templates:
|
||||||
|
- controller-servicemonitor.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should create a ServiceMonitor if `controller.metrics.serviceMonitor.enabled` is true
|
||||||
|
set:
|
||||||
|
controller.metrics.enabled: true
|
||||||
|
controller.metrics.serviceMonitor.enabled: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: ServiceMonitor
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: RELEASE-NAME-ingress-nginx-controller
|
||||||
|
|
||||||
|
- it: should create a ServiceMonitor with annotations if `controller.metrics.serviceMonitor.annotations` is set
|
||||||
|
set:
|
||||||
|
controller.metrics.enabled: true
|
||||||
|
controller.metrics.serviceMonitor.enabled: true
|
||||||
|
controller.metrics.serviceMonitor.annotations:
|
||||||
|
my-little-annotation: test-value
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.annotations
|
||||||
|
value:
|
||||||
|
my-little-annotation: test-value
|
|
@ -881,6 +881,7 @@ controller:
|
||||||
serviceMonitor:
|
serviceMonitor:
|
||||||
enabled: false
|
enabled: false
|
||||||
additionalLabels: {}
|
additionalLabels: {}
|
||||||
|
# -- Annotations to be added to the ServiceMonitor.
|
||||||
annotations: {}
|
annotations: {}
|
||||||
## The label to use to retrieve the job name from.
|
## The label to use to retrieve the job name from.
|
||||||
## jobLabel: "app.kubernetes.io/name"
|
## jobLabel: "app.kubernetes.io/name"
|
||||||
|
|
Loading…
Reference in a new issue