| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- suite: test cert controller deployment
- templates:
- - cert-controller-deployment.yaml
- - cert-controller-service.yaml
- tests:
- - it: should match snapshot of default values
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - matchSnapshot: {}
- - it: should set imagePullPolicy to Always
- set:
- certController.image.pullPolicy: Always
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].imagePullPolicy
- value: Always
- - it: should imagePullPolicy to be default value IfNotPresent
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].imagePullPolicy
- value: IfNotPresent
- - it: should add a init container
- templates:
- - cert-controller-deployment.yaml
- set:
- certController.extraInitContainers:
- - name: foo
- image: example.com/external-secrets/init-image:{{ .Chart.Version }}
- restartPolicy: Always
- asserts:
- - equal:
- path: spec.template.spec.initContainers[0].name
- value: foo
- - matchRegex:
- path: spec.template.spec.initContainers[0].image
- pattern: ^example\.com/external-secrets/init-image:[0-9]+\.[0-9]+\.[0-9]+$
- - equal:
- path: spec.template.spec.initContainers[0].restartPolicy
- value: Always
- - it: should override the deployment strategy
- templates:
- - cert-controller-deployment.yaml
- set:
- certController.strategy:
- rollingUpdate:
- maxSurge: 1
- maxUnavailable: 0
- asserts:
- - equal:
- path: spec.strategy.rollingUpdate.maxSurge
- value: 1
- - equal:
- path: spec.strategy.rollingUpdate.maxUnavailable
- value: 0
- - it: should override securityContext
- set:
- certController.podSecurityContext:
- runAsUser: 2000
- certController.securityContext:
- runAsUser: 3000
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.securityContext
- value:
- runAsUser: 2000
- - equal:
- path: spec.template.spec.containers[0].securityContext
- value:
- allowPrivilegeEscalation: false
- capabilities:
- drop:
- - ALL
- readOnlyRootFilesystem: true
- runAsNonRoot: true
- runAsUser: 3000
- seccompProfile:
- type: RuntimeDefault
- - it: should override hostNetwork
- set:
- certController.hostNetwork: true
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.hostNetwork
- value: true
- - it: should override readinessProbe port
- set:
- certController.readinessProbe.port: 8082
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].args[7]
- value: "--healthz-addr=:8082"
- - equal:
- path: spec.template.spec.containers[0].ports[1].name
- value: ready
- - equal:
- path: spec.template.spec.containers[0].ports[1].protocol
- value: TCP
- - equal:
- path: spec.template.spec.containers[0].ports[1].containerPort
- value: 8082
- - notExists:
- path: spec.template.spec.containers[0].ports[2]
- - it: should override metrics port
- set:
- certController.metrics.listen.port: 8888
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].args[6]
- value: "--metrics-addr=:8888"
- - it: should override image flavour
- set:
- certController.image.repository: ghcr.io/external-secrets/external-secrets
- certController.image.tag: v0.9.8
- certController.image.flavour: ubi-boringssl
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].image
- value: ghcr.io/external-secrets/external-secrets:v0.9.8-ubi-boringssl
- - it: should override image flavour
- set:
- certController.image.repository: example.com/external-secrets/external-secrets
- certController.image.tag: v0.9.9-ubi
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].image
- value: example.com/external-secrets/external-secrets:v0.9.9-ubi
- - it: should render service without metrics label when metrics is enabled
- set:
- certController.metrics.service.enabled: true
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 1
- - isNull:
- path: metadata.labels["app.kubernetes.io/metrics"]
- - it: should render service with metrics label when APIVersions are present and serviceMonitor is enabled
- set:
- serviceMonitor.enabled: true
- capabilities:
- apiVersions:
- - "monitoring.coreos.com/v1/ServiceMonitor"
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 1
- - equal:
- path: metadata.labels["app.kubernetes.io/metrics"]
- value: "cert-controller"
- - it: should render service with metrics label when APIVersions are not present, serviceMonitor is enabled, and serviceMonitor.renderMode is alwaysRender
- set:
- serviceMonitor.enabled: true
- serviceMonitor.renderMode: alwaysRender
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 1
- - equal:
- path: metadata.labels["app.kubernetes.io/metrics"]
- value: "cert-controller"
- - it: should fail if APIVersions is missing, serviceMonitor is enabled, and serviceMonitor.renderMode is failIfMissing
- set:
- serviceMonitor.enabled: true
- serviceMonitor.renderMode: failIfMissing
- templates:
- - cert-controller-service.yaml
- asserts:
- - failedTemplate: {}
- - it: should not render service when APIVersions is not present, serviceMonitor is enabled, and and serviceMonitor.renderMode is skipIfMissing
- set:
- serviceMonitor.enabled: true
- serviceMonitor.renderMode: skipIfMissing
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 0
- - it: should not render service when APIVersions is not present but serviceMonitor is enabled
- set:
- serviceMonitor.enabled: true
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 0
- - it: should not render service when APIVersions is present and serviceMonitor is disabled
- set:
- serviceMonitor.enabled: false
- capabilities:
- apiVersions:
- - "monitoring.coreos.com/v1/ServiceMonitor"
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 0
- - it: should not render service when APIVersions is not present and serviceMonitor is disabled
- set:
- serviceMonitor.enabled: false
- templates:
- - cert-controller-service.yaml
- asserts:
- - hasDocuments:
- count: 0
- - it: should not have enableHTTP2 flag by default
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - notContains:
- path: spec.template.spec.containers[0].args
- content: "--enable-http2"
- - it: should have startup Probe if enabled
- set:
- certController.startupProbe.enabled: true
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].startupProbe
- value:
- httpGet:
- path: /readyz
- port: ready
- initialDelaySeconds: 20
- periodSeconds: 5
- - equal:
- path: spec.template.spec.containers[0].ports[1].name
- value: ready
- - notExists:
- path: spec.template.spec.containers[0].ports[2]
- - it: should override the startup Probe port
- set:
- certController.startupProbe.enabled: true
- certController.startupProbe.useReadinessProbePort: false
- certController.startupProbe.port: "8083"
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.containers[0].ports[2]
- value:
- containerPort: 8083
- protocol: TCP
- name: startup
- - equal:
- path: spec.template.spec.containers[0].startupProbe
- value:
- httpGet:
- port: startup
- path: /readyz
- initialDelaySeconds: 20
- periodSeconds: 5
- - equal:
- path: spec.template.spec.containers[0].ports[2].name
- value: startup
- - equal:
- path: spec.template.spec.containers[0].ports[2].protocol
- value: TCP
- - equal:
- path: spec.template.spec.containers[0].ports[2].containerPort
- value: 8083
- - it: should default to hostUsers absent
- set:
- certController.create: true
- capabilities:
- majorVersion: '1'
- minorVersion: '33'
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - notExists:
- path: spec.template.spec.hostUsers
- - it: should permit override of hostUsers
- set:
- certController.create: true
- certController.hostUsers: false
- capabilities:
- majorVersion: '1'
- minorVersion: '33'
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - equal:
- path: spec.template.spec.hostUsers
- value: false
- - it: should ignore hostUsers on older k8s
- set:
- certController.create: true
- certController.hostUsers: false
- capabilities:
- majorVersion: '1'
- minorVersion: '32'
- templates:
- - cert-controller-deployment.yaml
- asserts:
- - notExists:
- path: spec.template.spec.hostUsers
|