mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-15 17:51:01 +00:00
feat: Updated check ServiceMontior check to include APIVersions check for helm charts (#2683)
* feat: Added check for APIVersions Signed-off-by: Parth Patel <p.patel81@yahoo.com> * test: unit test for the APIVersions check Signed-off-by: Parth Patel <p.patel81@yahoo.com> --------- Signed-off-by: Parth Patel <p.patel81@yahoo.com>
This commit is contained in:
parent
bb26bf8ff3
commit
0a490f9181
3 changed files with 36 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
{{- if .Values.serviceMonitor.enabled }}
|
||||
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.serviceMonitor.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
|
|
|
@ -4,7 +4,7 @@ should match snapshot of default values:
|
|||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.12.1
|
||||
controller-gen.kubebuilder.io/version: v0.13.0
|
||||
name: secretstores.external-secrets.io
|
||||
spec:
|
||||
conversion:
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
suite: test service monitor
|
||||
templates:
|
||||
- servicemonitor.yaml
|
||||
tests:
|
||||
- it: should render service monitor when APIVersions is present and serviceMonitor is enabled
|
||||
set:
|
||||
serviceMonitor.enabled: true
|
||||
capabilities:
|
||||
apiVersions:
|
||||
- "monitoring.coreos.com/v1"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 6
|
||||
- it: should not render service monitor when APIVersions is not present but serviceMonitor is enabled
|
||||
set:
|
||||
serviceMonitor.enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: should not render service monitor when APIVersions is present and serviceMonitor is disabled
|
||||
set:
|
||||
serviceMonitor.enabled: false
|
||||
capabilities:
|
||||
apiVersions:
|
||||
- "monitoring.coreos.com/v1"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: should not render service monitor when APIVersions is not present and serviceMonitor is disabled
|
||||
set:
|
||||
serviceMonitor.enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
Loading…
Reference in a new issue