mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
feat(common): Release common library 3.7.1 (#383)
Co-authored-by: Aisling McGinn <me@aisling.dev>
This commit is contained in:
parent
c94a28baa3
commit
433f6d132b
146 changed files with 232 additions and 222 deletions
|
@ -0,0 +1,80 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence claimnames
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 1Gi
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-config
|
||||
|
||||
- it: with existingClaim should pass
|
||||
set:
|
||||
persistence:
|
||||
existingClaim:
|
||||
existingClaim: myClaim
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: existingClaim
|
||||
persistentVolumeClaim:
|
||||
claimName: myClaim
|
||||
|
||||
- it: disabled suffix should pass
|
||||
set:
|
||||
persistence:
|
||||
claimWithoutSuffix:
|
||||
nameOverride: "-"
|
||||
accessMode: ReadWriteMany
|
||||
size: 1G
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: claimWithoutSuffix
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME
|
||||
|
||||
- it: custom suffix should pass
|
||||
set:
|
||||
persistence:
|
||||
claimWithNameOverride:
|
||||
nameOverride: suffix
|
||||
accessMode: ReadWriteMany
|
||||
size: 1G
|
||||
asserts:
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: claimWithNameOverride
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-suffix
|
|
@ -0,0 +1,78 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence configmap
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: configmap persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
type: configMap
|
||||
name: mySettings
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: configmap
|
||||
configMap:
|
||||
name: mySettings
|
||||
|
||||
- it: configmap persistence type with name template should pass
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
type: configMap
|
||||
name: '{{ include "bjw-s.common.lib.chart.names.fullname" $ }}-config'
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: configmap
|
||||
configMap:
|
||||
name: RELEASE-NAME-config
|
||||
|
||||
- it: configmap persistence type with identifier reference should pass
|
||||
set:
|
||||
configMaps:
|
||||
mySettings:
|
||||
data:
|
||||
test: testvalue
|
||||
persistence:
|
||||
configmap:
|
||||
type: configMap
|
||||
identifier: mySettings
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: ConfigMap
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: configmap
|
||||
configMap:
|
||||
name: RELEASE-NAME-mySettings
|
||||
|
||||
- it: configmap persistence type with invalid identifier reference should fail
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
type: configMap
|
||||
identifier: doesNotExist
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "No configmap found with this identifier. (persistence item 'configmap', identifier 'doesNotExist')"
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence custom
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: custom persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
custom-mount:
|
||||
enabled: true
|
||||
type: custom
|
||||
volumeSpec:
|
||||
downwardAPI:
|
||||
items:
|
||||
- path: "labels"
|
||||
fieldRef:
|
||||
fieldPath: metadata.labels
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: custom-mount
|
||||
downwardAPI:
|
||||
items:
|
||||
- fieldRef:
|
||||
fieldPath: metadata.labels
|
||||
path: labels
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence emptydir
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default emptyDir should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir: {}
|
||||
|
||||
- it: emptyDir with medium should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: memory
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir:
|
||||
medium: memory
|
||||
|
||||
- it: emptyDir with medium and sizeLimit should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: memory
|
||||
sizeLimit: 1Gi
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: config
|
||||
emptyDir:
|
||||
medium: memory
|
||||
sizeLimit: 1Gi
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence hostpath
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: hostPath should pass
|
||||
set:
|
||||
persistence:
|
||||
hostpathmounts-data:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: "/tmp1"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: hostpathmounts-data
|
||||
hostPath:
|
||||
path: /tmp1
|
||||
|
||||
- it: hostPath with type should pass
|
||||
set:
|
||||
persistence:
|
||||
hostpathmounts-with-type:
|
||||
enabled: true
|
||||
type: hostPath
|
||||
hostPath: "/tmp2"
|
||||
hostPathType: "Directory"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: hostpathmounts-with-type
|
||||
hostPath:
|
||||
path: /tmp2
|
||||
type: Directory
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence nfs
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: nfs persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
nfs:
|
||||
enabled: true
|
||||
type: nfs
|
||||
server: 10.10.0.8
|
||||
path: /tank/nas/library
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: nfs
|
||||
nfs:
|
||||
path: /tank/nas/library
|
||||
server: 10.10.0.8
|
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence secret
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: secret persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
secret:
|
||||
enabled: true
|
||||
type: secret
|
||||
name: mySettings
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: secret
|
||||
secret:
|
||||
secretName: mySettings
|
||||
|
||||
- it: secret persistence type with name template should pass
|
||||
set:
|
||||
persistence:
|
||||
secret:
|
||||
enabled: true
|
||||
type: secret
|
||||
name: "{{ .Release.Name }}-config"
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: secret
|
||||
secret:
|
||||
secretName: RELEASE-NAME-config
|
||||
|
||||
- it: secret persistence type with identifier reference should pass
|
||||
set:
|
||||
secrets:
|
||||
mySettings:
|
||||
stringData:
|
||||
test: testvalue
|
||||
persistence:
|
||||
secret:
|
||||
type: secret
|
||||
identifier: mySettings
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: spec.template.spec.volumes[0]
|
||||
value:
|
||||
name: secret
|
||||
secret:
|
||||
secretName: RELEASE-NAME-mySettings
|
||||
|
||||
- it: secret persistence type with invalid identifier reference should fail
|
||||
set:
|
||||
persistence:
|
||||
secret:
|
||||
type: secret
|
||||
identifier: doesNotExist
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "No secret found with this identifier. (persistence item 'secret', identifier 'doesNotExist')"
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence volumeclaimtemplates
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
controllers.main:
|
||||
type: statefulset
|
||||
asserts:
|
||||
- documentIndex: &StatefulSetDoc 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *StatefulSetDoc
|
||||
notExists:
|
||||
path: spec.volumeClaimTemplates
|
||||
|
||||
- it: volumeClaimTemplates should pass
|
||||
set:
|
||||
controllers.main:
|
||||
type: statefulset
|
||||
statefulset:
|
||||
volumeClaimTemplates:
|
||||
- name: "storage"
|
||||
size: "10Gi"
|
||||
accessMode: "ReadWriteOnce"
|
||||
asserts:
|
||||
- documentIndex: &StatefulSetDoc 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *StatefulSetDoc
|
||||
equal:
|
||||
path: spec.volumeClaimTemplates[0]
|
||||
value:
|
||||
metadata:
|
||||
name: storage
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
|
||||
- it: volumeClaimTemplates with dataSource should pass
|
||||
set:
|
||||
controllers.main:
|
||||
type: statefulset
|
||||
statefulset:
|
||||
volumeClaimTemplates:
|
||||
- name: "storage"
|
||||
size: "10Gi"
|
||||
accessMode: "ReadWriteOnce"
|
||||
dataSource:
|
||||
apiGroup: snapshot.storage.k8s.io
|
||||
kind: VolumeSnapshot
|
||||
name: MySnapshot
|
||||
asserts:
|
||||
- documentIndex: &StatefulSetDoc 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *StatefulSetDoc
|
||||
equal:
|
||||
path: spec.volumeClaimTemplates[0].spec.dataSource
|
||||
value:
|
||||
apiGroup: snapshot.storage.k8s.io
|
||||
kind: VolumeSnapshot
|
||||
name: MySnapshot
|
||||
|
||||
- it: volumeClaimTemplates with templated dataSource name should pass
|
||||
set:
|
||||
controllers.main:
|
||||
type: statefulset
|
||||
statefulset:
|
||||
volumeClaimTemplates:
|
||||
- name: "storage"
|
||||
size: "10Gi"
|
||||
accessMode: "ReadWriteOnce"
|
||||
dataSource:
|
||||
apiGroup: snapshot.storage.k8s.io
|
||||
kind: VolumeSnapshot
|
||||
name: "{{ .Release.Name }}-config"
|
||||
asserts:
|
||||
- documentIndex: &StatefulSetDoc 0
|
||||
isKind:
|
||||
of: StatefulSet
|
||||
- documentIndex: *StatefulSetDoc
|
||||
equal:
|
||||
path: spec.volumeClaimTemplates[0].spec.dataSource.name
|
||||
value: RELEASE-NAME-config
|
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence volumes
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: no persistence should pass
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
notExists:
|
||||
path: spec.template.spec.volumes
|
||||
|
||||
- it: default should pass
|
||||
set:
|
||||
persistence:
|
||||
config:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 1Gi
|
||||
asserts:
|
||||
- documentIndex: &DeploymentDoc 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *DeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.volumes
|
||||
value:
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: RELEASE-NAME-config
|
||||
|
||||
- it: advanced mount config should pass
|
||||
set:
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
second-container:
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: 31
|
||||
second:
|
||||
containers:
|
||||
first-container:
|
||||
image:
|
||||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: 31
|
||||
|
||||
persistence:
|
||||
config:
|
||||
existingClaim: test
|
||||
advancedMounts:
|
||||
main:
|
||||
main:
|
||||
- path: /config
|
||||
readOnly: false
|
||||
data:
|
||||
type: configMap
|
||||
name: myConfigMap
|
||||
globalMounts:
|
||||
- path: /globalTest
|
||||
advancedMounts:
|
||||
main:
|
||||
main:
|
||||
- path: /data/config.yaml
|
||||
readOnly: false
|
||||
subPath: config.yaml
|
||||
second-container:
|
||||
- path: /appdata/config
|
||||
readOnly: true
|
||||
second:
|
||||
first-container:
|
||||
- path: /second-pod/config.yaml
|
||||
readOnly: false
|
||||
subPath: config.yaml
|
||||
no-mounts:
|
||||
existingClaim: test
|
||||
|
||||
asserts:
|
||||
- documentIndex: &FirstDeploymentDoc 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *FirstDeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.volumes
|
||||
value:
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: test
|
||||
- configMap:
|
||||
name: myConfigMap
|
||||
name: data
|
||||
- name: no-mounts
|
||||
persistentVolumeClaim:
|
||||
claimName: test
|
||||
- documentIndex: &SecondDeploymentDoc 1
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: *SecondDeploymentDoc
|
||||
equal:
|
||||
path: spec.template.spec.volumes
|
||||
value:
|
||||
- configMap:
|
||||
name: myConfigMap
|
||||
name: data
|
||||
- name: no-mounts
|
||||
persistentVolumeClaim:
|
||||
claimName: test
|
Loading…
Add table
Add a link
Reference in a new issue