|
|
@@ -264,3 +264,96 @@ tests:
|
|
|
count: 1
|
|
|
- isNull:
|
|
|
path: metadata.labels["app.kubernetes.io/metrics"]
|
|
|
+
|
|
|
+ - it: should have no annotations when nothing configured
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - isNull:
|
|
|
+ path: metadata.annotations
|
|
|
+
|
|
|
+ - it: should have only service annotations when only they are configured
|
|
|
+ set:
|
|
|
+ webhook.service.annotations:
|
|
|
+ custom.annotation: value
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["custom.annotation"]
|
|
|
+ value: value
|
|
|
+
|
|
|
+ - it: should have no annotations when only metrics enabled without annotations
|
|
|
+ set:
|
|
|
+ webhook.metrics.service.enabled: true
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - isNull:
|
|
|
+ path: metadata.annotations
|
|
|
+
|
|
|
+ - it: should have only service annotations when metrics enabled without metrics annotations
|
|
|
+ set:
|
|
|
+ webhook.service.annotations:
|
|
|
+ custom.annotation: value
|
|
|
+ webhook.metrics.service.enabled: true
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["custom.annotation"]
|
|
|
+ value: value
|
|
|
+
|
|
|
+ - it: should have no annotations when metrics annotations exist but metrics disabled
|
|
|
+ set:
|
|
|
+ webhook.metrics.service.annotations:
|
|
|
+ prometheus.io/scrape: "true"
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - isNull:
|
|
|
+ path: metadata.annotations
|
|
|
+
|
|
|
+ - it: should have only service annotations when metrics annotations exist but metrics disabled
|
|
|
+ set:
|
|
|
+ webhook.service.annotations:
|
|
|
+ custom.annotation: value
|
|
|
+ webhook.metrics.service.annotations:
|
|
|
+ prometheus.io/scrape: "true"
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["custom.annotation"]
|
|
|
+ value: value
|
|
|
+ - isNull:
|
|
|
+ path: metadata.annotations["prometheus.io/scrape"]
|
|
|
+
|
|
|
+ - it: should have only metrics annotations when metrics enabled and only metrics annotations configured
|
|
|
+ set:
|
|
|
+ webhook.metrics.service.enabled: true
|
|
|
+ webhook.metrics.service.annotations:
|
|
|
+ prometheus.io/scrape: "true"
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["prometheus.io/scrape"]
|
|
|
+ value: "true"
|
|
|
+
|
|
|
+ - it: should have both annotations when everything is configured and enabled
|
|
|
+ set:
|
|
|
+ webhook.service.annotations:
|
|
|
+ custom.annotation: value
|
|
|
+ webhook.metrics.service.enabled: true
|
|
|
+ webhook.metrics.service.annotations:
|
|
|
+ prometheus.io/scrape: "true"
|
|
|
+ templates:
|
|
|
+ - webhook-service.yaml
|
|
|
+ asserts:
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["custom.annotation"]
|
|
|
+ value: value
|
|
|
+ - equal:
|
|
|
+ path: metadata.annotations["prometheus.io/scrape"]
|
|
|
+ value: "true"
|