Add helm chart tests for admission-webhooks (#11375)
Signed-off-by: Reddysekhar Gaduputi <gsekhar73@gmail.com>
This commit is contained in:
parent
3ba71ecb48
commit
4a74fee06d
5 changed files with 91 additions and 0 deletions
|
@ -0,0 +1,11 @@
|
||||||
|
suite: AdmissionWebhooks > RBAC > ClusterRole
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/clusterrole.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create ClusterRole if `controller.admissionWebhooks.rbac.create` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.rbac.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
|
@ -0,0 +1,11 @@
|
||||||
|
suite: AdmissionWebhooks > RBAC > ClusterRoleBinding
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/clusterrolebinding.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create ClusterRoleBinding if `controller.admissionWebhooks.rbac.create` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.rbac.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
|
@ -0,0 +1,11 @@
|
||||||
|
suite: AdmissionWebhooks > RBAC > Role
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/role.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create Role if `controller.admissionWebhooks.rbac.create` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.rbac.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
|
@ -0,0 +1,11 @@
|
||||||
|
suite: AdmissionWebhooks > RBAC > RoleBinding
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/rolebinding.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create RoleBinding if `controller.admissionWebhooks.rbac.create` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.rbac.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
|
@ -0,0 +1,47 @@
|
||||||
|
suite: AdmissionWebhooks > ServiceAccount
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/serviceaccount.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should not create a ServiceAccount if `controller.admissionWebhooks.serviceAccount.create` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.serviceAccount.create: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: should create a ServiceAccount if `controller.admissionWebhooks.serviceAccount.create` is true
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.serviceAccount.create: true
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: ServiceAccount
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: ingress-nginx-admission
|
||||||
|
|
||||||
|
- it: should create a ServiceAccount with specified name if `controller.admissionWebhooks.serviceAccount.name` is set to non-empty value
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.serviceAccount.name: ingress-nginx-admission-test-sa
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: ServiceAccount
|
||||||
|
- equal:
|
||||||
|
path: metadata.name
|
||||||
|
value: ingress-nginx-admission-test-sa
|
||||||
|
|
||||||
|
- it: automountServiceAccountToken in ServiceAccount should be false if `controller.admissionWebhooks.serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 1
|
||||||
|
- isKind:
|
||||||
|
of: ServiceAccount
|
||||||
|
- equal:
|
||||||
|
path: automountServiceAccountToken
|
||||||
|
value: false
|
Loading…
Reference in a new issue