mirror of
https://github.com/truenas/charts.git
synced 2026-11-28 07:31:00 +00:00
* Adapt charts CI and improve/fix common * add check on permissions contaienr * add postgres template * update comments * Update create_app.sh * add check * update script * auto gen item.yaml from Chart,yaml * rename readme on dest * duplicate readme from the same source * correct comment * reoder * remove extra space * keep both README and app-readme * update regex, to also allow 2 letter names, which is also valid * No need to check host network if there aren't any pod values * use same pattern as the pod.name label (not prepending release-name * update deps * add chart dirs to ci * Add a validation to check if there is any yaml errors after merging files * update charts path on ci * common/1.0.0/ -> common/ * update common-test dep path * temp update create_app script * make permissions container name configurable, incase we want to change order of execution * update naming convention * fix typo and a missed name change * do not allow `--` in names
176 lines
4.6 KiB
YAML
176 lines
4.6 KiB
YAML
suite: pod service account name test
|
|
templates:
|
|
- common.yaml
|
|
tests:
|
|
- it: should assign serviceAccount to primary pod
|
|
set:
|
|
workload:
|
|
workload-name1:
|
|
enabled: true
|
|
primary: true
|
|
type: CronJob
|
|
schedule: "* * * * *"
|
|
podSpec:
|
|
restartPolicy: Never
|
|
workload-name2:
|
|
enabled: true
|
|
primary: false
|
|
type: Deployment
|
|
podSpec: {}
|
|
serviceAccount:
|
|
sa-name1:
|
|
enabled: true
|
|
primary: true
|
|
asserts:
|
|
- documentIndex: &cronJobDoc 1
|
|
isKind:
|
|
of: CronJob
|
|
- documentIndex: *cronJobDoc
|
|
equal:
|
|
path: metadata.name
|
|
value: release-name-common-test
|
|
- documentIndex: *cronJobDoc
|
|
equal:
|
|
path: spec.jobTemplate.spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
- documentIndex: &otherDeploymentDoc 2
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: default
|
|
|
|
- it: should assign serviceAccount to all pods
|
|
set:
|
|
workload:
|
|
workload-name1:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
workload-name2:
|
|
enabled: true
|
|
primary: false
|
|
type: Deployment
|
|
podSpec: {}
|
|
serviceAccount:
|
|
sa-name1:
|
|
enabled: true
|
|
primary: true
|
|
targetSelectAll: true
|
|
asserts:
|
|
- documentIndex: &deploymentDoc 1
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
- documentIndex: &otherDeploymentDoc 2
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
|
|
- it: should assign serviceAccount to selected pods
|
|
set:
|
|
workload:
|
|
workload-name1:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
workload-name2:
|
|
enabled: true
|
|
primary: false
|
|
type: Deployment
|
|
podSpec: {}
|
|
serviceAccount:
|
|
sa-name1:
|
|
enabled: true
|
|
primary: true
|
|
targetSelector:
|
|
- workload-name1
|
|
sa-name2:
|
|
enabled: true
|
|
primary: false
|
|
targetSelector:
|
|
- workload-name2
|
|
asserts:
|
|
- documentIndex: &deploymentDoc 2
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
- documentIndex: &otherDeploymentDoc 3
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test-sa-name2
|
|
|
|
- it: should assign serviceAccount to selected pods
|
|
set:
|
|
workload:
|
|
workload-name1:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
workload-name2:
|
|
enabled: true
|
|
primary: false
|
|
type: Deployment
|
|
podSpec: {}
|
|
serviceAccount:
|
|
sa-name1:
|
|
enabled: true
|
|
primary: true
|
|
targetSelector:
|
|
- workload-name1
|
|
- workload-name2
|
|
asserts:
|
|
- documentIndex: &deploymentDoc 1
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *deploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
- documentIndex: &otherDeploymentDoc 2
|
|
isKind:
|
|
of: Deployment
|
|
- documentIndex: *otherDeploymentDoc
|
|
equal:
|
|
path: spec.template.spec.serviceAccountName
|
|
value: release-name-common-test
|
|
|
|
# Failures
|
|
- it: should fail with more than 1 SA assigned to a pod
|
|
set:
|
|
workload:
|
|
workload-name1:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
serviceAccount:
|
|
sa-name1:
|
|
enabled: true
|
|
primary: true
|
|
targetSelector:
|
|
- workload-name1
|
|
sa-name2:
|
|
enabled: true
|
|
targetSelector:
|
|
- workload-name1
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Expected at most 1 ServiceAccount to be assigned on a pod [workload-name1]. But [2] were assigned
|