mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 16:37:04 +02:00
feat(common)!: Release v3.0.0-beta4 (#282)
This commit is contained in:
parent
ea9484a7fd
commit
a27c4f6124
16 changed files with 283 additions and 157 deletions
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
# yaml-language-server: $schema=../../common/values.schema.json
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
|
@ -53,7 +55,7 @@ service:
|
|||
controller: main
|
||||
ports:
|
||||
http:
|
||||
port: 8081
|
||||
port: 8887
|
||||
|
||||
ingress:
|
||||
main:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
# yaml-language-server: $schema=../../common/values.schema.json
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
|
@ -28,6 +30,13 @@ ingress:
|
|||
- hosts:
|
||||
- "test.local"
|
||||
|
||||
service:
|
||||
main:
|
||||
controller: main
|
||||
ports:
|
||||
http:
|
||||
port: 8080
|
||||
|
||||
persistence:
|
||||
media:
|
||||
type: persistentVolumeClaim
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
# yaml-language-server: $schema=../../common/values.schema.json
|
||||
controllers:
|
||||
main:
|
||||
type: cronjob
|
||||
|
@ -11,10 +13,6 @@ controllers:
|
|||
tag: 31
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
|
||||
configMaps:
|
||||
config:
|
||||
enabled: true
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
# yaml-language-server: $schema=../../common/values.schema.json
|
||||
controllers:
|
||||
main:
|
||||
containers:
|
||||
|
@ -6,15 +8,3 @@ controllers:
|
|||
repository: ghcr.io/mendhak/http-https-echo
|
||||
tag: 31
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
main:
|
||||
enabled: false
|
||||
|
||||
probes:
|
||||
liveness:
|
||||
enabled: false
|
||||
readiness:
|
||||
enabled: false
|
||||
startup:
|
||||
enabled: false
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
# yaml-language-server: $schema=../../common/values.schema.json
|
||||
controllers:
|
||||
main:
|
||||
strategy: Recreate
|
||||
|
@ -22,6 +24,7 @@ controllers:
|
|||
# -- Configures service settings for the chart.
|
||||
service:
|
||||
main:
|
||||
controller: main
|
||||
ports:
|
||||
http:
|
||||
port: 80
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence configmap
|
||||
templates:
|
||||
- common.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: Deployment
|
||||
- documentIndex: 0
|
||||
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')"
|
32
charts/library/common-test/tests/persistence/custom.yaml
Normal file
32
charts/library/common-test/tests/persistence/custom.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence custom
|
||||
templates:
|
||||
- common.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
|
26
charts/library/common-test/tests/persistence/nfs_test.yaml
Normal file
26
charts/library/common-test/tests/persistence/nfs_test.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence nfs
|
||||
templates:
|
||||
- common.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,75 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence secret
|
||||
templates:
|
||||
- common.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')"
|
|
@ -1,129 +0,0 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: persistence types
|
||||
templates:
|
||||
- common.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
|
||||
|
||||
- it: configmap persistence type should pass
|
||||
set:
|
||||
persistence:
|
||||
configmap:
|
||||
enabled: true
|
||||
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:
|
||||
enabled: true
|
||||
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: 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: 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
|
|
@ -3,7 +3,7 @@ apiVersion: v2
|
|||
name: common
|
||||
description: Function library for Helm charts
|
||||
type: library
|
||||
version: 3.0.0-beta3
|
||||
version: 3.0.0-beta4
|
||||
kubeVersion: ">=1.22.0-0"
|
||||
keywords:
|
||||
- common
|
||||
|
@ -19,10 +19,13 @@ annotations:
|
|||
Default objects (they used to be called main) have been commented out and will therefore no longer provide any (both expected and unexpected) default values.
|
||||
- kind: changed
|
||||
description: |-
|
||||
enableServiceLinks is disabled by default
|
||||
enableServiceLinks is now disabled by default
|
||||
- kind: added
|
||||
description: |-
|
||||
Added support for restartPolicy field on container level
|
||||
- kind: added
|
||||
description: |-
|
||||
Added json-schema to the chart
|
||||
- kind: added
|
||||
description: |-
|
||||
Allow referencing secrets and configMaps by identifier in persistence section
|
||||
|
|
|
@ -93,10 +93,21 @@
|
|||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"identifier": {
|
||||
"type": "string"
|
||||
},
|
||||
"advancedMounts": {"$ref": "#/advancedMounts"},
|
||||
"globalMounts": {"$ref": "#/globalMounts"}
|
||||
},
|
||||
"required": ["name"]
|
||||
"oneOf": [{"required": ["name"]}, {"required": ["identifier"]}],
|
||||
"dependencies": {
|
||||
"name": {
|
||||
"not": {"required": ["identifier"]}
|
||||
},
|
||||
"identifier": {
|
||||
"not": {"required": ["name"]}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"secretItem": {
|
||||
|
@ -114,10 +125,21 @@
|
|||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"identifier": {
|
||||
"type": "string"
|
||||
},
|
||||
"advancedMounts": {"$ref": "#/advancedMounts"},
|
||||
"globalMounts": {"$ref": "#/globalMounts"}
|
||||
},
|
||||
"required": ["name"]
|
||||
"oneOf": [{"required": ["name"]}, {"required": ["identifier"]}],
|
||||
"dependencies": {
|
||||
"name": {
|
||||
"not": {"required": ["identifier"]}
|
||||
},
|
||||
"identifier": {
|
||||
"not": {"required": ["name"]}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"nfsItem": {
|
||||
|
|
|
@ -58,8 +58,16 @@ Returns the value for volumes
|
|||
|
||||
{{- /* configMap persistence type */ -}}
|
||||
{{- else if eq $persistenceValues.type "configMap" -}}
|
||||
{{- $objectName := (required (printf "name not set for persistence item %s" $identifier) $persistenceValues.name) -}}
|
||||
{{- $objectName = tpl $objectName $rootContext -}}
|
||||
{{- $objectName := "" -}}
|
||||
{{- if $persistenceValues.name -}}
|
||||
{{- $objectName = tpl $persistenceValues.name $rootContext -}}
|
||||
{{- else if $persistenceValues.identifier -}}
|
||||
{{- $object := (include "bjw-s.common.lib.configMap.getByIdentifier" (dict "rootContext" $rootContext "id" $persistenceValues.identifier) | fromYaml ) -}}
|
||||
{{- if not $object -}}
|
||||
{{fail (printf "No configmap found with this identifier. (persistence item '%s', identifier '%s')" $identifier $persistenceValues.identifier)}}
|
||||
{{- end -}}
|
||||
{{- $objectName = $object.name -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $volume "configMap" dict -}}
|
||||
{{- $_ := set $volume.configMap "name" $objectName -}}
|
||||
{{- with $persistenceValues.defaultMode -}}
|
||||
|
@ -71,8 +79,16 @@ Returns the value for volumes
|
|||
|
||||
{{- /* Secret persistence type */ -}}
|
||||
{{- else if eq $persistenceValues.type "secret" -}}
|
||||
{{- $objectName := (required (printf "name not set for persistence item %s" $identifier) $persistenceValues.name) -}}
|
||||
{{- $objectName = tpl $objectName $rootContext -}}
|
||||
{{- $objectName := "" -}}
|
||||
{{- if $persistenceValues.name -}}
|
||||
{{- $objectName = tpl $persistenceValues.name $rootContext -}}
|
||||
{{- else if $persistenceValues.identifier -}}
|
||||
{{- $object := (include "bjw-s.common.lib.secret.getByIdentifier" (dict "rootContext" $rootContext "id" $persistenceValues.identifier) | fromYaml ) -}}
|
||||
{{- if not $object -}}
|
||||
{{fail (printf "No secret found with this identifier. (persistence item '%s', identifier '%s')" $identifier $persistenceValues.identifier)}}
|
||||
{{- end -}}
|
||||
{{- $objectName = $object.name -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $volume "secret" dict -}}
|
||||
{{- $_ := set $volume.secret "secretName" $objectName -}}
|
||||
{{- with $persistenceValues.defaultMode -}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.0.0-beta3/charts/library/common/values.schema.json",
|
||||
"$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.0.0-beta4/charts/library/common/values.schema.json",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -10,10 +10,13 @@ In order to mount a configMap to a mount point within the Pod you can use the
|
|||
|
||||
| Field | Mandatory | Docs / Description |
|
||||
| ------------- | --------- | -------------------------------------------------------------------------- |
|
||||
| `name` | Yes | Which configMap should be mounted. Supports Helm templating. |
|
||||
| `name` | No | Which configMap should be mounted. Supports Helm templating. |
|
||||
| `identifier` | No | Reference a configMap from the `configMaps` key by its identifier. |
|
||||
| `defaultMode` | No | The default file access permission bit. |
|
||||
| `items` | No | Specify item-specific configuration. Will be passed 1:1 to the volumeSpec. |
|
||||
|
||||
Either `name` or `identifier` is required.
|
||||
|
||||
!!! note
|
||||
|
||||
Even if not specified, the configMap will be read-only.
|
||||
|
|
|
@ -10,10 +10,13 @@ In order to mount a Secret to a mount point within the Pod you can use the
|
|||
|
||||
| Field | Mandatory | Docs / Description |
|
||||
| ------------- | --------- | -------------------------------------------------------------------------- |
|
||||
| `name` | Yes | Which Secret should be mounted. Supports Helm templating. |
|
||||
| `name` | No | Which Secret should be mounted. Supports Helm templating. |
|
||||
| `identifier` | No | Reference a Secret from the `secrets` key by its identifier. |
|
||||
| `defaultMode` | No | The default file access permission bit. |
|
||||
| `items` | No | Specify item-specific configuration. Will be passed 1:1 to the volumeSpec. |
|
||||
|
||||
Either `name` or `identifier` is required.
|
||||
|
||||
!!! note
|
||||
|
||||
Even if not specified, the Secret will be read-only.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue