feat(common): Release library 3.7.0 (#377)

Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Co-authored-by: Patrick Collins <Patricol@users.noreply.github.com>
Co-authored-by: Patrick Collins <patrick.collins@gainbridge.io>
Co-authored-by: Lawrence Gil <larrywtf609@gmail.com>
Co-authored-by: solidDoWant <fred.heinecke@yahoo.com>
This commit is contained in:
Bernd Schorgers 2025-02-07 20:03:04 +01:00 committed by GitHub
parent aee0d999ba
commit 8b33237e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 793 additions and 655 deletions

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

View file

@ -1,2 +0,0 @@
test:
test: "{{ .Values.configMapsFromFolderBasePath }}"

View file

@ -0,0 +1,2 @@
test:
test: "{{ .Values.global.random.nonExistentKey }}"

View file

@ -15,7 +15,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -43,7 +43,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -79,7 +79,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -99,17 +99,39 @@ tests:
helm.sh/chart: common-test-1.0.0
test_label: test
- it: default configuration from folder with binary files should fail
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
asserts:
- failedTemplate:
errorMessage: "There was an error loading ConfigMap: test_2. If it was automatically generated from a folder verify that files are properly flagged as `binary` or `escaped`"
- it: default metadata from folder should pass
set:
configMaps:
config:
data:
test: test
configMapsFromFolderBasePath: ci/configMapsFolder
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 1
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
@ -123,7 +145,7 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &SecondConfigmapDocument 2
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
@ -137,7 +159,7 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &ThirdConfigmapDocument 3
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
@ -151,3 +173,66 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata from folder should pass
set:
configMaps:
config:
data:
test: test
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
labels:
test: test_label
annotations:
test: test_annotation
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test: test_label
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.annotations
value:
test: test_annotation

View file

@ -42,13 +42,13 @@ tests:
asserts:
- hasDocuments:
count: 3
- documentIndex: &FirstConfigmapDocument 1
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
isNotNullOrEmpty:
path: metadata.name
- documentIndex: &SecondConfigmapDocument 2
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
@ -64,7 +64,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -82,7 +82,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -100,7 +100,7 @@ tests:
asserts:
- hasDocuments:
count: 2
- documentIndex: &ConfigmapDocument 1
- documentIndex: &ConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *ConfigmapDocument
@ -115,28 +115,82 @@ tests:
data:
test: test
nameOverride: "{{ .Release.Name }}"
configMapsFromFolderBasePath: ci/configMapsFolder
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 1
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: &SecondConfigmapDocument 2
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-test_1
- documentIndex: &ThirdConfigmapDocument 3
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME-test_2
- it: with templated nameOverride and from folder with forceRename should pass
set:
configMaps:
config:
data:
test: test
nameOverride: "{{ .Release.Name }}"
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_1:
forceRename: &newName1 newName1
test_2:
forceRename: &newName2 newName2
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstConfigmapDocument 0
isKind:
of: ConfigMap
- documentIndex: *FirstConfigmapDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: &SecondConfigmapDocument 1
isKind:
of: ConfigMap
- documentIndex: *SecondConfigmapDocument
equal:
path: metadata.name
value: *newName1
- documentIndex: &ThirdConfigmapDocument 2
isKind:
of: ConfigMap
- documentIndex: *ThirdConfigmapDocument
equal:
path: metadata.name
value: *newName2

View file

@ -25,7 +25,7 @@ tests:
data:
test: value 1
asserts:
- documentIndex: &ControllerDoc 0
- documentIndex: &ControllerDoc 3
isKind:
of: Deployment
- documentIndex: *ControllerDoc
@ -33,3 +33,41 @@ tests:
path: spec.template.metadata.annotations
value:
checksum/configMaps: 66d23d7a53c4e2a523ba85a969696b4ebb78ec5d79ab9c12c210c1569f48511b
- it: default metadata from folder should pass
set:
configMaps:
config:
enabled: true
data:
test: value 1
test_default_enabled:
data:
test: value 1
test_not_in_checksum:
includeInChecksum: false
data:
test: value 1
test_disabled:
enabled: false
data:
test: value 1
configMapsFromFolder:
enabled: true
basePath: ci/configMapsFolder
configMapsOverrides:
test_2:
fileAttributeOverrides:
helm.jpg:
binary: true
test_2.yaml:
escaped: true
asserts:
- documentIndex: &ControllerDoc 5
isKind:
of: Deployment
- documentIndex: *ControllerDoc
equal:
path: spec.template.metadata.annotations
value:
checksum/configMaps: e83a24569d0b4f2ccc44aec36d4e9a1c44a29bcc92eefdffe14fb1ce81dff054

View file

@ -108,7 +108,7 @@ tests:
data:
test: test
asserts:
- documentIndex: &DeploymentDoc 0
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc

View file

@ -5,119 +5,91 @@ templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
- ../_values/service_main_default.yaml
set:
controllers.main.containers.main.probes.liveness.enabled: true
controllers.main.containers.main.probes.readiness.enabled: true
controllers.main.containers.main.probes.startup.enabled: true
tests:
- it: default should pass
set:
service:
main:
controller: main
ports:
http:
enabled: true
port: &port 80
- it: default probes
documentSelector: &DeploymentSelector
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8081
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8081
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8081
timeoutSeconds: 1
- it: custom primary port should pass
- it: custom primary port gets picked up by probes
set:
service:
main:
controller: main
ports:
http:
enabled: true
port: 80
test:
enabled: true
primary: true
port: &port 8080
service.main.ports.test:
enabled: true
primary: true
port: 8080
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8080
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8080
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: 8080
timeoutSeconds: 1
- it: default with string Service port should pass
- it: probes with string Service port
set:
service:
main:
controller: main
ports:
http:
enabled: true
port: "80"
service.main.ports.http.port: "80"
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
@ -126,8 +98,7 @@ tests:
tcpSocket:
port: 80
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
@ -136,8 +107,7 @@ tests:
tcpSocket:
port: 80
timeoutSeconds: 1
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 3
@ -147,7 +117,7 @@ tests:
port: 80
timeoutSeconds: 1
- it: multiple services should pass
- it: multiple services are handled correctly
set:
controllers:
other:
@ -170,81 +140,69 @@ tests:
ports:
http:
enabled: true
port: &secondDeploymentPort 8080
main:
controller: main
ports:
http:
enabled: true
port: &firstDeploymentPort 80
port: 8080
asserts:
- documentIndex: &firstDeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *firstDeploymentDocument
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
equal:
path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port
value: *firstDeploymentPort
- documentIndex: *firstDeploymentDocument
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
equal:
path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port
value: *firstDeploymentPort
- documentIndex: *firstDeploymentDocument
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-main
equal:
path: spec.template.spec.containers[0].startupProbe.tcpSocket.port
value: *firstDeploymentPort
- documentIndex: &secondDeploymentDocument 1
isKind:
of: Deployment
- documentIndex: *secondDeploymentDocument
value: 8081
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
equal:
path: spec.template.spec.containers[0].livenessProbe.tcpSocket.port
value: *secondDeploymentPort
- documentIndex: *secondDeploymentDocument
value: 8080
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
equal:
path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port
value: *secondDeploymentPort
- documentIndex: *secondDeploymentDocument
value: 8080
- documentSelector:
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME-other
equal:
path: spec.template.spec.containers[0].startupProbe.tcpSocket.port
value: *secondDeploymentPort
value: 8080
- it: disabled service should pass
- it: no probes are defined when services are disabled
set:
service:
main:
enabled: false
controller: main
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.containers[0].livenessProbe
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.containers[0].readinessProbe
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.containers[0].startupProbe
- it: AUTO type probe should pass
- it: AUTO type probe can be configured
set:
service:
main:
controller: main
ports:
http:
protocol: HTTP
port: &port 80
service.main.ports.http.protocol: HTTP
controllers.main.containers.main.probes:
liveness:
enabled: true
type: AUTO
path: /api/version
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
@ -255,86 +213,95 @@ tests:
value:
httpGet:
path: /api/version
port: *port
port: 8081
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: HTTP type probe should pass
- it: HTTP type probe can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
liveness:
enabled: true
type: HTTP
path: /api/version
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
port: 8081
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: HTTPS type probe should pass
- it: HTTPS type probe can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
liveness:
enabled: true
type: HTTPS
path: /api/version
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
port: 8081
scheme: HTTPS
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom liveness probe should pass
- it: GRPC type probe can be configured without service
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
liveness:
enabled: true
type: GRPC
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
grpc:
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: GRPC type probe can be configured with service
set:
controllers.main.containers.main.probes:
liveness:
enabled: true
type: GRPC
service: test
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
grpc:
port: 8081
service: test
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom liveness probe can be configured
set:
controllers.main.containers.main.probes:
liveness:
enabled: true
@ -342,36 +309,26 @@ tests:
spec:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom readiness probe should pass
- it: custom readiness probe can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
readiness:
enabled: true
@ -379,36 +336,26 @@ tests:
spec:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom startup probe should pass
- it: custom startup probe can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
startup:
enabled: true
@ -416,45 +363,32 @@ tests:
spec:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].startupProbe
value:
httpGet:
path: /api/version
port: *port
port: 8081
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: User-defined liveness probe port should pass
- it: User-defined liveness probe port can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
liveness:
enabled: true
port: &port http
port: http
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
@ -463,92 +397,41 @@ tests:
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: http
timeoutSeconds: 1
- it: User-defined liveness probe port should pass
- it: User-defined readiness probe port can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
liveness:
enabled: true
port: &port http
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
timeoutSeconds: 1
- it: User-defined readiness probe port should pass
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
readiness:
enabled: true
port: &port http
port: http
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: http
timeoutSeconds: 1
- it: User-defined startup probe port should pass
- it: User-defined startup probe port can be configured
set:
service:
main:
controller: main
ports:
http:
port: &port 80
controllers.main.containers.main.probes:
startup:
enabled: true
port: &port http
port: http
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
port: http
timeoutSeconds: 1

View file

@ -54,9 +54,12 @@ tests:
identifier: mySettings
asserts:
- documentIndex: 0
isKind:
of: ConfigMap
- documentIndex: 1
isKind:
of: Deployment
- documentIndex: 0
- documentIndex: 1
equal:
path: spec.template.spec.volumes[0]
value:

View file

@ -6,16 +6,15 @@ templates:
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
- it: affinity is not present by default
documentSelector: &DeploymentSelector
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
notExists:
- notExists:
path: spec.template.spec.affinity
- it: defaultPodOption should pass
- it: affinity can be set with defaultPodOption
set:
defaultPodOptions:
affinity:
@ -28,12 +27,9 @@ tests:
values:
- antarctica-east1
- antarctica-west1
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
@ -46,7 +42,7 @@ tests:
- antarctica-east1
- antarctica-west1
- it: defaultPodOption with pod override should pass
- it: affinity can be set with defaultPodOption and overridden on pod level
set:
defaultPodOptions:
affinity:
@ -72,12 +68,9 @@ tests:
values:
- asia-east1
- asia-west1
documentSelector: *DeploymentSelector
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
- equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
@ -89,3 +82,33 @@ tests:
values:
- asia-east1
- asia-west1
- it: affinity can be configured with templated valued
set:
controllers:
main:
pod:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- "{{ .Release.Name }}"
topologyKey: kubernetes.io/hostname
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.affinity
value:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- RELEASE-NAME
topologyKey: kubernetes.io/hostname

View file

@ -0,0 +1,35 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pod security
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: shareProcessNamespace should not be present by default
documentSelector: &DeploymentSelector
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
asserts:
- notExists:
path: spec.template.spec.shareProcessNamespace
- it: shareProcessNamespace disabled should pass
set:
defaultPodOptions:
shareProcessNamespace: false
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.shareProcessNamespace
value: false
- it: shareProcessNamespace enabled should pass
set:
defaultPodOptions:
shareProcessNamespace: true
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.shareProcessNamespace
value: true

View file

@ -13,18 +13,14 @@ set:
spec:
test: test
tests:
- it: default metadata should pass
- it: default metadata should be present
documentSelector: &EndpointSelector
path: $[?(@.kind == "Endpoint")].metadata.name
value: RELEASE-NAME-config
asserts:
- hasDocuments:
count: 2
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
notExists:
- notExists:
path: metadata.annotations
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -32,7 +28,7 @@ tests:
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
- it: custom metadata can be configured
set:
rawResources:
config:
@ -40,19 +36,13 @@ tests:
test_annotation: test
labels:
test_label: test
documentSelector: *EndpointSelector
asserts:
- hasDocuments:
count: 2
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -61,7 +51,7 @@ tests:
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
- it: global metadata can be configured with local overrides
set:
global:
labels:
@ -74,20 +64,14 @@ tests:
test_annotation: test
labels:
test_label: test
documentSelector: *EndpointSelector
asserts:
- hasDocuments:
count: 2
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME

View file

@ -19,28 +19,24 @@ set:
port: 443
protocol: TCP
tests:
- it: default should pass
- it: raw resources can be configured
documentSelector: &EndpointSelector
path: $[?(@.kind == "Endpoint")].metadata.name
value: RELEASE-NAME-endpoint
asserts:
- hasDocuments:
count: 2
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: subsets[0].addresses[0].ip
value: 127.0.0.1
- it: nameOverride should pass
- it: nameOverride can be configured
set:
rawResources.endpoint:
nameOverride: test
documentSelector:
path: $[?(@.kind == "Endpoint")].metadata.name
value: RELEASE-NAME-test
asserts:
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.name
value: RELEASE-NAME-test
@ -48,16 +44,15 @@ tests:
set:
rawResources.endpoint:
nameOverride: "{{ .Release.Name }}"
documentSelector:
path: $[?(@.kind == "Endpoint")].metadata.name
value: RELEASE-NAME
asserts:
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: metadata.name
value: RELEASE-NAME
- it: spec with template should pass
- it: spec can render Helm template
set:
rawResources.endpoint:
spec:
@ -68,11 +63,8 @@ tests:
- name: "{{ .Release.Name }}"
port: 443
protocol: TCP
documentSelector: *EndpointSelector
asserts:
- documentIndex: &rawResourceDocument 1
isKind:
of: Endpoint
- documentIndex: *rawResourceDocument
equal:
- equal:
path: subsets[0].ports[0].name
value: RELEASE-NAME

View file

@ -6,18 +6,16 @@ templates:
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default metadata should pass
- it: default metadata
values:
- ../_values/service_main_default.yaml
documentSelector: &ServiceSelector
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
notExists:
- notExists:
path: metadata.annotations
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -26,7 +24,7 @@ tests:
app.kubernetes.io/service: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
- it: custom metadata
values:
- ../_values/service_main_default.yaml
set:
@ -36,17 +34,13 @@ tests:
test_annotation: test
labels:
test_label: test
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -56,7 +50,7 @@ tests:
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
- it: custom metadata with global metadata
values:
- ../_values/service_main_default.yaml
set:
@ -71,18 +65,14 @@ tests:
test_annotation: test
labels:
test_label: test
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME

View file

@ -6,49 +6,42 @@ templates:
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
- it: default name
values:
- ../_values/service_main_default.yaml
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: metadata.name
value: RELEASE-NAME
- it: custom name suffix should pass
- it: custom name suffix
values:
- ../_values/service_main_default.yaml
set:
service.main.nameOverride: http
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME-http
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- exists:
path: metadata.name
value: RELEASE-NAME-http
- it: custom name suffix with template should pass
- it: custom name suffix with template
values:
- ../_values/service_main_default.yaml
set:
service.main.nameOverride: "{{ .Release.Name }}"
service.main.nameOverride: "{{ .Chart.Name }}"
documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME-common-test
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- exists:
path: metadata.name
value: RELEASE-NAME
- it: multiple should pass
- it: multiple services
values:
- ../_values/service_main_default.yaml
set:
@ -59,19 +52,13 @@ tests:
ui:
port: 8082
asserts:
- hasDocuments:
count: 3
- documentIndex: &ServiceDocumentFirst 1
isKind:
of: Service
- documentIndex: *ServiceDocumentFirst
equal:
path: metadata.name
- documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME-main
- documentIndex: &ServiceDocumentSecond 2
isKind:
of: Service
- documentIndex: *ServiceDocumentSecond
equal:
exists:
path: metadata.name
- documentSelector:
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME-second
exists:
path: metadata.name

View file

@ -6,89 +6,91 @@ templates:
values:
- ../_values/controllers_main_default_container.yaml
tests:
- it: default should pass
- it: default should render
values:
- ../_values/service_main_default.yaml
documentSelector: &ServiceSelector
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].protocol
value: TCP
- it: explicit TCP should pass
- it: explicit TCP should render
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: TCP
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].protocol
value: TCP
- it: explicit UDP should pass
- it: explicit UDP should render
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: UDP
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].protocol
value: UDP
- it: explicit HTTP should pass
- it: explicit HTTP should render
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: HTTP
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].protocol
value: TCP
- documentIndex: *ServiceDocument
notExists:
- notExists:
path: metadata.annotations
- it: explicit HTTPS should pass
- it: explicit HTTPS should render
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.protocol: HTTPS
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].protocol
value: TCP
- it: explicit appProtocol should pass
- it: explicit appProtocol should render
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.http.appProtocol: kubernetes.io/h2c
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0].appProtocol
value: kubernetes.io/h2c
- it: mixed protocols can be configured on the same port number
values:
- ../_values/service_main_default.yaml
set:
service.main.ports.udptest:
port: 8081
protocol: UDP
documentSelector: *ServiceSelector
asserts:
- equal:
path: spec.ports
value:
- name: http
port: 8081
protocol: TCP
targetPort: 8081
- name: udptest
port: 8081
protocol: UDP
targetPort: 8081

View file

@ -9,14 +9,11 @@ tests:
- it: default should pass
values:
- ../_values/service_main_default.yaml
documentSelector: &ServiceSelector
path: $[?(@.kind == "Service")].metadata.name
value: RELEASE-NAME
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0]
value:
name: http
@ -36,12 +33,9 @@ tests:
server:
enabled: true
port: 8080
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0]
value:
name: server
@ -59,12 +53,9 @@ tests:
http:
enabled: true
targetPort: 80
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.ports[0]
value:
name: http

View file

@ -15,17 +15,16 @@ tests:
ports:
first:
port: 80
documentSelector: &ServiceSelector
path: kind
value: Service
asserts:
- hasDocuments:
count: 2
- documentIndex: &FirstServiceDocument 1
isKind:
of: Service
- documentIndex: *FirstServiceDocument
notExists:
path: spec.allocateLoadBalancerNodePorts
- containsDocument:
kind: Service
apiVersion: v1
name: RELEASE-NAME
- it: services can be disabled
- it: service not present when disabled
values:
- ../_values/service_main_default.yaml
set:
@ -33,13 +32,13 @@ tests:
main:
enabled: false
asserts:
- hasDocuments:
count: 1
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- not: true
containsDocument:
kind: Service
apiVersion: v1
name: RELEASE-NAME
- it: externalTrafficPolicy should pass for NodePort service
- it: externalTrafficPolicy can be configured for NodePort service
values:
- ../_values/service_main_default.yaml
set:
@ -47,32 +46,26 @@ tests:
main:
type: NodePort
externalTrafficPolicy: Local
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.externalTrafficPolicy
value: Local
- it: internalTrafficPolicy should pass
- it: internalTrafficPolicy can be configured
values:
- ../_values/service_main_default.yaml
set:
service:
main:
internalTrafficPolicy: Local
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.internalTrafficPolicy
value: Local
- it: externalTrafficPolicy should pass for LoadBalancer service
- it: externalTrafficPolicy can be configured for LoadBalancer service
values:
- ../_values/service_main_default.yaml
set:
@ -80,12 +73,9 @@ tests:
main:
type: LoadBalancer
externalTrafficPolicy: Local
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.externalTrafficPolicy
value: Local
@ -97,12 +87,9 @@ tests:
main:
type: LoadBalancer
allocateLoadBalancerNodePorts: true
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.allocateLoadBalancerNodePorts
value: true
@ -114,16 +101,13 @@ tests:
main:
type: LoadBalancer
allocateLoadBalancerNodePorts: false
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.allocateLoadBalancerNodePorts
value: false
- it: externalName should pass for ExternalName service
- it: externalName can be configured for ExternalName service
values:
- ../_values/service_main_default.yaml
set:
@ -131,11 +115,8 @@ tests:
main:
type: ExternalName
externalName: my.database.example.com
documentSelector: *ServiceSelector
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
- equal:
path: spec.externalName
value: my.database.example.com

View file

@ -8,12 +8,11 @@ values:
tests:
- it: a serviceMonitor is not created by default
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: ServiceMonitor
- not: true
containsDocument:
kind: ServiceMonitor
apiVersion: monitoring.coreos.com/v1
name: RELEASE-NAME
- it: a serviceMonitor is not created when disabled
set:
@ -22,14 +21,13 @@ tests:
enabled: false
serviceName: "{{ .Release.Name }}"
asserts:
- hasDocuments:
count: 1
- documentIndex: 0
not: true
isKind:
of: ServiceMonitor
- not: true
containsDocument:
kind: ServiceMonitor
apiVersion: monitoring.coreos.com/v1
name: RELEASE-NAME
- it: a serviceMonitor is created
- it: a serviceMonitor can be configured
set:
serviceMonitor:
main:
@ -42,35 +40,25 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
documentSelector: &ServiceMonitorSelector
path: $[?(@.kind == "ServiceMonitor")].metadata.name
value: RELEASE-NAME
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceMonitorDocument 1
isKind:
of: ServiceMonitor
- documentIndex: *ServiceMonitorDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.namespaceSelector
value:
matchNames:
- NAMESPACE
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.jobLabel
value: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.endpoints
value:
- port: http
@ -78,8 +66,7 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
@ -88,7 +75,7 @@ tests:
helm.sh/chart: common-test-1.0.0
test.label: testvalue
- it: a serviceMonitor is created with nameOverride
- it: a serviceMonitor can be created with a nameOverride
set:
serviceMonitor:
main:
@ -100,25 +87,18 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
documentSelector:
path: $[?(@.kind == "ServiceMonitor")].metadata.name
value: RELEASE-NAME-test
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceMonitorDocument 1
isKind:
of: ServiceMonitor
- documentIndex: *ServiceMonitorDocument
equal:
path: metadata.name
value: RELEASE-NAME-test
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME
- it: a serviceMonitor is created with a templated service
- it: a templated service can be configured
set:
serviceMonitor:
main:
@ -129,25 +109,16 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
documentSelector: *ServiceMonitorSelector
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceMonitorDocument 1
isKind:
of: ServiceMonitor
- documentIndex: *ServiceMonitorDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME
- it: a serviceMonitor is created with a custom selector
- it: a custom selector can be configured
set:
serviceMonitor:
main:
@ -160,25 +131,16 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
documentSelector: *ServiceMonitorSelector
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceMonitorDocument 1
isKind:
of: ServiceMonitor
- documentIndex: *ServiceMonitorDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.selector
value:
matchExpressions:
- key: k8s-app
operator: Exists
- it: a serviceMonitor is created with targetLabels
- it: targetLabels can be configured
set:
serviceMonitor:
main:
@ -193,25 +155,15 @@ tests:
targetLabels:
- testlabel1
- testlabel2
documentSelector: *ServiceMonitorSelector
asserts:
- hasDocuments:
count: 2
- documentIndex: &ServiceMonitorDocument 1
isKind:
of: ServiceMonitor
- documentIndex: *ServiceMonitorDocument
equal:
path: metadata.name
value: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.endpoints
value:
- port: http
@ -219,9 +171,48 @@ tests:
path: /metrics
interval: 1m
scrapeTimeout: 10s
- documentIndex: *ServiceMonitorDocument
equal:
- equal:
path: spec.targetLabels
value:
- testlabel1
- testlabel2
- it: a serviceMonitor can be configured with templated endpoints
set:
serviceMonitor:
main:
labels:
test.label: testvalue
serviceName: "{{ .Release.Name }}"
endpoints:
- port: http
scheme: http
path: /metrics
interval: 1m
scrapeTimeout: 10s
basicAuth:
username:
name: "{{.Release.Name}}-secret"
key: USERNAME
password:
name: "{{.Release.Name}}-secret"
key: PASSWORD
documentSelector: &ServiceMonitorSelector
path: $[?(@.kind == "ServiceMonitor")].metadata.name
value: RELEASE-NAME
asserts:
- equal:
path: spec.endpoints
value:
- port: http
scheme: http
path: /metrics
interval: 1m
scrapeTimeout: 10s
basicAuth:
username:
name: RELEASE-NAME-secret
key: USERNAME
password:
name: RELEASE-NAME-secret
key: PASSWORD