feat(common): Release version 2.0.0-beta.1 (#173)

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2023-09-13 11:24:23 +02:00 committed by GitHub
parent 19767d668c
commit 7b6ee00be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
189 changed files with 3110 additions and 3023 deletions

View file

@ -12,5 +12,4 @@ chart-dirs:
- charts/other - charts/other
chart-repos: chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
- bjw-s=https://bjw-s.github.io/helm-charts - bjw-s=https://bjw-s.github.io/helm-charts

View file

@ -0,0 +1,4 @@
.direnv
.private
.vscode
*.sops.*

View file

@ -0,0 +1,6 @@
---
trailingComma: "es5"
tabWidth: 2
semi: false
singleQuote: false
bracketSpacing: false

View file

@ -1,5 +1,10 @@
excluded-charts-lint: [] ---
excluded-charts-lint:
- library/common-test
excluded-charts-install: excluded-charts-install:
- apps/k8s-ycl - apps/k8s-ycl
- library/common - library/common
excluded-charts-release:
- library/common-test

View file

@ -118,7 +118,7 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16 helm plugin install https://github.com/helm-unittest/helm-unittest.git
helm dep update "charts/${{ matrix.chart }}" helm dep update "charts/${{ matrix.chart }}"
helm unittest -f "tests/**/*_test.yaml" "charts/${{ matrix.chart }}" helm unittest -f "tests/**/*_test.yaml" "charts/${{ matrix.chart }}"

View file

@ -35,13 +35,6 @@ jobs:
checkoutCommit: ${{ github.sha }} checkoutCommit: ${{ github.sha }}
chartsToLint: ${{ needs.pr-metadata.outputs.chartsToLint }} chartsToLint: ${{ needs.pr-metadata.outputs.chartsToLint }}
isRenovatePR: ${{ needs.pr-metadata.outputs.isRenovatePR }} isRenovatePR: ${{ needs.pr-metadata.outputs.isRenovatePR }}
overrideDeps: |-
${{
(
needs.pr-metadata.outputs.commonLibraryUpdated &&
'[{"name": "common", "repository": "file://../../library/common", "version": "*"}]'
) || '[]'
}}
charts-test: charts-test:
uses: ./.github/workflows/charts-test.yaml uses: ./.github/workflows/charts-test.yaml
@ -53,13 +46,6 @@ jobs:
${{ ${{
( (
(needs.pr-metadata.outputs.commonLibraryUpdated=='true') && (needs.pr-metadata.outputs.commonLibraryUpdated=='true') &&
'["other/app-template"]' '["library/common-test"]'
) || needs.pr-metadata.outputs.chartsToInstall ) || needs.pr-metadata.outputs.chartsToInstall
}} }}
overrideDeps: |-
${{
(
(needs.pr-metadata.outputs.commonLibraryUpdated=='true') &&
'[{"name": "common", "repository": "file://../../library/common", "version": "*"}]'
) || '[]'
}}

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"prettier.configPath": ".ci/prettier/.prettierrc.yaml"
}

View file

@ -0,0 +1,30 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
# helm unit tests
tests/

View file

@ -0,0 +1,13 @@
---
apiVersion: v2
description: A helper chart that is used to test the common library chart
name: common-test
version: 1.0.0
kubeVersion: ">=1.22.0-0"
maintainers:
- name: bjw-s
email: me@bjw-s.dev
dependencies:
- name: common
repository: file://../common
version: ">0.0.0-0"

View file

@ -0,0 +1,78 @@
controllers:
main:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
env:
HTTP_PORT: 8887
HTTPS_PORT: 9997
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true
second-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
env:
HTTP_PORT: 8888
HTTPS_PORT: 9998
third-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
second-controller:
type: deployment
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
env:
HTTP_PORT: 8889
HTTPS_PORT: 9999
ingress:
main:
enabled: true
configMaps:
config:
enabled: true
data:
test: value 1
persistence:
config:
enabled: true
data:
type: configMap
name: |-
{{- (include "bjw-s.common.lib.chart.names.fullname" $) -}}-config
advancedMounts:
main: # the controller with whe "main" identifier
main: # the container with whe "main" identifier
- path: /data/config.yaml
readOnly: false
subPath: config.yaml
second-container: # the container with whe "second-container" identifier
- path: /appdata/config
readOnly: true
second-controller: # the controller with whe "second-controller" identifier
main: # the container with whe "main" identifier
- path: /data/config.yaml
readOnly: false
subPath: config.yaml

View file

@ -0,0 +1,24 @@
controllers:
main:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true
ingress:
main:
enabled: true
persistence:
config:
enabled: true

View file

@ -0,0 +1,19 @@
controllers:
main:
type: cronjob
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
service:
main:
enabled: false
configMaps:
config:
enabled: true
data:
test: value 1

View file

@ -1,7 +1,11 @@
image: controllers:
repository: b4bz/homer main:
tag: latest containers:
pullPolicy: IfNotPresent main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
service: service:
main: main:

View file

@ -0,0 +1 @@
../../../../examples/helm/values.yaml

View file

@ -0,0 +1,14 @@
---
{{- include "bjw-s.common.loader.init" . }}
{{- define "app-template.hardcodedValues" -}}
# Set the nameOverride based on the release name if no override has been set
{{ if not .Values.global.nameOverride }}
global:
nameOverride: "{{ .Release.Name }}"
{{ end }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "app-template.hardcodedValues" . | fromYaml) -}}
{{/* Render the templates */}}
{{ include "bjw-s.common.loader.generate" . }}

View file

@ -23,7 +23,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -52,7 +52,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -89,5 +89,5 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -17,4 +17,4 @@ tests:
equal: equal:
path: spec.template.metadata.annotations path: spec.template.metadata.annotations
value: value:
checksum/config: afdf20f511621d5cb358c5e8b0da2d14cdbe2549fb12fa123f6a6e9baabef26e checksum/configMaps: afdf20f511621d5cb358c5e8b0da2d14cdbe2549fb12fa123f6a6e9baabef26e

View file

@ -13,7 +13,7 @@ tests:
- it: single string should pass - it: single string should pass
set: set:
args: sleep infinity controllers.main.containers.main.args: sleep infinity
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -26,7 +26,7 @@ tests:
- it: multiline string should pass - it: multiline string should pass
set: set:
args: | controllers.main.containers.main.args: |
echo hello echo hello
echo world echo world
asserts: asserts:
@ -43,7 +43,7 @@ tests:
- it: single quoted string should pass - it: single quoted string should pass
set: set:
args: "sleep infinity" controllers.main.containers.main.args: "sleep infinity"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -56,7 +56,7 @@ tests:
- it: list of strings should pass - it: list of strings should pass
set: set:
args: controllers.main.containers.main.args:
- sleep - sleep
- infinity - infinity
- "test" - "test"

View file

@ -13,7 +13,7 @@ tests:
- it: single string should pass - it: single string should pass
set: set:
command: /bin/sh controllers.main.containers.main.command: /bin/sh
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -26,7 +26,7 @@ tests:
- it: multiline string should pass - it: multiline string should pass
set: set:
command: | controllers.main.containers.main.command: |
/bin/sh /bin/sh
-c -c
asserts: asserts:
@ -43,7 +43,7 @@ tests:
- it: single quoted string should pass - it: single quoted string should pass
set: set:
command: "/bin/sh" controllers.main.containers.main.command: "/bin/sh"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -56,7 +56,7 @@ tests:
- it: list of strings should pass - it: list of strings should pass
set: set:
command: controllers.main.containers.main.command:
- /bin/sh - /bin/sh
- "-c" - "-c"
asserts: asserts:

View file

@ -13,7 +13,7 @@ tests:
- it: KeyValue string should pass - it: KeyValue string should pass
set: set:
env: controllers.main.containers.main.env:
string: value_of_env string: value_of_env
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
@ -28,7 +28,7 @@ tests:
- it: KeyValue float should pass - it: KeyValue float should pass
set: set:
env: controllers.main.containers.main.env:
string: 4.2 string: 4.2
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
@ -43,7 +43,7 @@ tests:
- it: KeyValue int should pass - it: KeyValue int should pass
set: set:
env: controllers.main.containers.main.env:
string: 1 string: 1
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
@ -58,7 +58,7 @@ tests:
- it: List should pass - it: List should pass
set: set:
env: controllers.main.containers.main.env:
- name: STATIC_ENV_FROM_LIST - name: STATIC_ENV_FROM_LIST
value: STATIC_ENV_VALUE_FROM_LIST value: STATIC_ENV_VALUE_FROM_LIST
asserts: asserts:
@ -74,7 +74,7 @@ tests:
- it: Explicit ValueFrom in list should pass - it: Explicit ValueFrom in list should pass
set: set:
env: controllers.main.containers.main.env:
- name: DYNAMIC_ENV_FROM_LIST - name: DYNAMIC_ENV_FROM_LIST
valueFrom: valueFrom:
fieldRef: fieldRef:
@ -94,7 +94,7 @@ tests:
- it: Implicit ValueFrom should pass - it: Implicit ValueFrom should pass
set: set:
env: controllers.main.containers.main.env:
DYNAMIC_ENV: DYNAMIC_ENV:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
@ -113,7 +113,7 @@ tests:
- it: Templated value should pass - it: Templated value should pass
set: set:
env: controllers.main.containers.main.env:
DYNAMIC_ENV: "{{ .Release.Name }}-admin" DYNAMIC_ENV: "{{ .Release.Name }}-admin"
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
@ -128,7 +128,7 @@ tests:
- it: Combined KeyValue with Explicit ValueFrom should pass - it: Combined KeyValue with Explicit ValueFrom should pass
set: set:
env: controllers.main.containers.main.env:
STATIC_ENV: static STATIC_ENV: static
DYNAMIC_ENV: DYNAMIC_ENV:
valueFrom: valueFrom:

View file

@ -13,7 +13,7 @@ tests:
- it: explicit envFrom should pass - it: explicit envFrom should pass
set: set:
envFrom: controllers.main.containers.main.envFrom:
- secretRef: - secretRef:
name: myCustomSecret name: myCustomSecret
asserts: asserts:

View file

@ -4,8 +4,8 @@ templates:
tests: tests:
- it: string tag should pass - it: string tag should pass
set: set:
image: controllers.main.containers.main.image:
repository: b4bz/homer repository: ghcr.io/mendhak/http-https-echo
tag: latest tag: latest
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -14,12 +14,12 @@ tests:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
value: b4bz/homer:latest value: ghcr.io/mendhak/http-https-echo:latest
- it: integer tag should pass - it: integer tag should pass
set: set:
image: controllers.main.containers.main.image:
repository: b4bz/homer repository: ghcr.io/mendhak/http-https-echo
tag: 1.23 tag: 1.23
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -28,4 +28,4 @@ tests:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
value: b4bz/homer:1.23 value: ghcr.io/mendhak/http-https-echo:1.23

View file

@ -0,0 +1,53 @@
suite: container name
templates:
- common.yaml
tests:
- it: with explicit name should pass
set:
controllers.main.containers:
main:
nameOverride: template-test
controller: main
image:
repository: ghcr.io/mendhak/http-https-echo
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
value: template-test
- it: with implicit name should pass
set:
controllers.main.containers:
main:
controller: main
image:
repository: ghcr.io/mendhak/http-https-echo
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
value: main
- it: with templated name should pass
set:
controllers.main.containers:
main:
nameOverride: "{{ .Release.Name }}-container"
controller: main
image:
repository: ghcr.io/mendhak/http-https-echo
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].name
value: RELEASE-NAME-container

View file

@ -0,0 +1,35 @@
suite: container ports
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
isNull:
path: spec.template.spec.containers[0].ports
- it: custom port should pass
set:
controllers:
main:
containers:
main:
ports:
- containerPort: 8080
name: http
protocol: TCP
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 8080
name: http
protocol: TCP

View file

@ -162,7 +162,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
type: AUTO type: AUTO
@ -193,7 +193,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
type: HTTP type: HTTP
@ -224,7 +224,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
type: HTTPS type: HTTPS
@ -255,7 +255,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
custom: true custom: true
@ -291,7 +291,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
readiness: readiness:
enabled: true enabled: true
custom: true custom: true
@ -327,7 +327,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
startup: startup:
enabled: true enabled: true
custom: true custom: true
@ -363,7 +363,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
port: &port http port: &port http
@ -391,7 +391,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
liveness: liveness:
enabled: true enabled: true
port: &port http port: &port http
@ -419,7 +419,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
readiness: readiness:
enabled: true enabled: true
port: &port http port: &port http
@ -447,7 +447,7 @@ tests:
http: http:
port: &port 80 port: &port 80
probes: controllers.main.containers.main.probes:
startup: startup:
enabled: true enabled: true
port: &port http port: &port http

View file

@ -27,11 +27,53 @@ tests:
name: config name: config
mountPath: /config mountPath: /config
- it: advanced mount config should pass
set:
controllers:
main:
containers:
second-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
persistence:
data:
type: configMap
name: myConfigMap
advancedMounts:
main:
main:
- path: /data/config.yaml
readOnly: false
subPath: config.yaml
second-container:
- path: /appdata/config
readOnly: true
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].volumeMounts[0]
value:
name: data
mountPath: /data/config.yaml
subPath: config.yaml
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[1].volumeMounts[0]
value:
name: data
mountPath: /appdata/config
readOnly: true
- it: emptyDir should pass - it: emptyDir should pass
set: set:
persistence: persistence:
cache: cache:
enabled: true
type: emptyDir type: emptyDir
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
@ -49,9 +91,10 @@ tests:
persistence: persistence:
config: config:
enabled: true enabled: true
mountPath: /custom
accessMode: ReadWriteMany accessMode: ReadWriteMany
size: 1G size: 1G
globalMounts:
- path: /custom
asserts: asserts:
- documentIndex: &DeploymentDoc 1 - documentIndex: &DeploymentDoc 1
isKind: isKind:
@ -69,7 +112,9 @@ tests:
config: config:
enabled: true enabled: true
existingClaim: myClaim existingClaim: myClaim
subPath: "mySubPath" globalMounts:
- path: /config
subPath: "mySubPath"
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
isKind: isKind:
@ -88,8 +133,9 @@ tests:
config: config:
enabled: true enabled: true
type: hostPath type: hostPath
mountPath: /data
hostPath: /tmp hostPath: /tmp
globalMounts:
- path: /data
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
isKind: isKind:
@ -108,7 +154,8 @@ tests:
enabled: true enabled: true
type: hostPath type: hostPath
hostPath: /dev hostPath: /dev
subPath: mySubPath globalMounts:
- subPath: mySubPath
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &DeploymentDoc 0
isKind: isKind:

View file

@ -4,8 +4,9 @@ templates:
tests: tests:
- it: default cronjob configuration should pass - it: default cronjob configuration should pass
set: set:
controller: controllers:
type: cronjob main:
type: cronjob
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -36,15 +37,17 @@ tests:
- it: custom cronjob configuration should pass - it: custom cronjob configuration should pass
set: set:
controller: controllers:
type: cronjob main:
restartPolicy: OnFailure type: cronjob
cronjob: pod:
schedule: &CronJobSchedule "0 3 * * *" restartPolicy: OnFailure
concurrencyPolicy: &CronJobConcurrencyPolicy "Test" cronjob:
failedJobsHistory: &CronJobFailedJobsHistory 2 schedule: &CronJobSchedule "0 3 * * *"
successfulJobsHistory: &CronJobSuccessfulJobsHistory 3 concurrencyPolicy: &CronJobConcurrencyPolicy "Test"
ttlSecondsAfterFinished: &ttlSecondsAfterFinished 3600 failedJobsHistory: &CronJobFailedJobsHistory 2
successfulJobsHistory: &CronJobSuccessfulJobsHistory 3
ttlSecondsAfterFinished: &ttlSecondsAfterFinished 3600
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:

View file

@ -4,7 +4,7 @@ templates:
tests: tests:
- it: default metadata should pass - it: default metadata should pass
set: set:
controller.type: cronjob controllers.main.type: cronjob
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -16,19 +16,21 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
controller: controllers:
type: cronjob main:
annotations: type: cronjob
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -42,10 +44,11 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -55,12 +58,13 @@ tests:
global_label: test global_label: test
annotations: annotations:
global_annotation: test global_annotation: test
controller: controllers:
type: cronjob main:
annotations: type: cronjob
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -75,20 +79,24 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: jobTemplate metadata should pass - it: jobTemplate metadata should pass
set: set:
controller.type: cronjob controllers:
podAnnotations: main:
test_annotation: test type: cronjob
podLabels: pod:
test_label: test annotations:
test_annotation: test
labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -102,6 +110,7 @@ tests:
equal: equal:
path: spec.jobTemplate.spec.template.metadata.labels path: spec.jobTemplate.spec.template.metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
test_label: test test_label: test

View file

@ -4,7 +4,7 @@ templates:
tests: tests:
- it: default metadata should pass - it: default metadata should pass
set: set:
controller.type: daemonset controllers.main.type: daemonset
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -16,19 +16,21 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
controller: controllers:
type: daemonset main:
annotations: type: daemonset
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -42,10 +44,11 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -55,12 +58,13 @@ tests:
global_label: test global_label: test
annotations: annotations:
global_annotation: test global_annotation: test
controller: controllers:
type: daemonset main:
annotations: type: daemonset
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -75,9 +79,10 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -4,7 +4,7 @@ templates:
tests: tests:
- it: default metadata should pass - it: default metadata should pass
set: set:
controller.type: deployment controllers.main.type: deployment
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -16,19 +16,21 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
controller: controllers:
type: deployment main:
annotations: type: deployment
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -42,10 +44,11 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -55,12 +58,13 @@ tests:
global_label: test global_label: test
annotations: annotations:
global_annotation: test global_annotation: test
controller: controllers:
type: deployment main:
annotations: type: deployment
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -75,9 +79,10 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -4,7 +4,7 @@ templates:
tests: tests:
- it: default metadata should pass - it: default metadata should pass
set: set:
controller.type: statefulset controllers.main.type: statefulset
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -16,19 +16,21 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
controller: controllers:
type: statefulset main:
annotations: type: statefulset
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -42,10 +44,11 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -55,12 +58,13 @@ tests:
global_label: test global_label: test
annotations: annotations:
global_annotation: test global_annotation: test
controller: controllers:
type: statefulset main:
annotations: type: statefulset
test_annotation: test annotations:
labels: test_annotation: test
test_label: test labels:
test_label: test
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -75,9 +79,10 @@ tests:
equal: equal:
path: metadata.labels path: metadata.labels
value: value:
app.kubernetes.io/component: main
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -14,7 +14,7 @@ tests:
- it: daemonset should pass - it: daemonset should pass
set: set:
controller.type: daemonset controllers.main.type: daemonset
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -26,7 +26,7 @@ tests:
- it: statefulset should pass - it: statefulset should pass
set: set:
controller.type: statefulset controllers.main.type: statefulset
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -38,7 +38,7 @@ tests:
- it: cronjob should pass - it: cronjob should pass
set: set:
controller.type: cronjob controllers.main.type: cronjob
asserts: asserts:
- documentIndex: &ControllerDoc 0 - documentIndex: &ControllerDoc 0
isKind: isKind:
@ -50,7 +50,7 @@ tests:
- it: disabled should pass - it: disabled should pass
set: set:
controller.enabled: false controllers.main.enabled: false
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 1 count: 1

View file

@ -19,7 +19,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -45,7 +45,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -79,5 +79,5 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -16,7 +16,7 @@ tests:
service: service:
name: RELEASE-NAME name: RELEASE-NAME
port: port:
number: null number: 8080
- it: custom service reference should pass - it: custom service reference should pass
set: set:

View file

@ -26,6 +26,8 @@ tests:
- host: chart-test.local - host: chart-test.local
paths: paths:
- path: /test - path: /test
service:
name: main
asserts: asserts:
- documentIndex: &IngressDocument 2 - documentIndex: &IngressDocument 2
isKind: isKind:
@ -45,6 +47,7 @@ tests:
enabled: true enabled: true
hosts: hosts:
- host: "{{ .Release.Name }}.hostname" - host: "{{ .Release.Name }}.hostname"
asserts: asserts:
- documentIndex: &IngressDocument 2 - documentIndex: &IngressDocument 2
isKind: isKind:
@ -62,6 +65,8 @@ tests:
- host: chart-test.local - host: chart-test.local
paths: paths:
- path: "/{{ .Release.Name }}.path" - path: "/{{ .Release.Name }}.path"
service:
name: main
asserts: asserts:
- documentIndex: &IngressDocument 2 - documentIndex: &IngressDocument 2
isKind: isKind:

View file

@ -25,6 +25,10 @@ tests:
existingClaim: existingClaim:
enabled: true enabled: true
existingClaim: myClaim existingClaim: myClaim
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -45,6 +49,10 @@ tests:
nameOverride: "-" nameOverride: "-"
accessMode: ReadWriteMany accessMode: ReadWriteMany
size: 1G size: 1G
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 1 - documentIndex: 1
isKind: isKind:
@ -65,6 +73,10 @@ tests:
nameOverride: suffix nameOverride: suffix
accessMode: ReadWriteMany accessMode: ReadWriteMany
size: 1G size: 1G
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 1 - documentIndex: 1
isKind: isKind:

View file

@ -9,7 +9,10 @@ tests:
enabled: true enabled: true
type: hostPath type: hostPath
hostPath: "/tmp1" hostPath: "/tmp1"
mountPath: "/data" mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -30,7 +33,10 @@ tests:
type: hostPath type: hostPath
hostPath: "/tmp2" hostPath: "/tmp2"
hostPathType: "Directory" hostPathType: "Directory"
mountPath: "/data2" mounts:
- controllers:
- main
mountPath: "/data2"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -14,6 +14,10 @@ tests:
- path: "labels" - path: "labels"
fieldRef: fieldRef:
fieldPath: metadata.labels fieldPath: metadata.labels
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -25,9 +29,9 @@ tests:
name: custom-mount name: custom-mount
downwardAPI: downwardAPI:
items: items:
- fieldRef: - fieldRef:
fieldPath: metadata.labels fieldPath: metadata.labels
path: labels path: labels
- it: configmap persistence type should pass - it: configmap persistence type should pass
set: set:
@ -36,6 +40,10 @@ tests:
enabled: true enabled: true
type: configMap type: configMap
name: mySettings name: mySettings
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -54,7 +62,11 @@ tests:
configmap: configmap:
enabled: true enabled: true
type: configMap type: configMap
name: "{{ include \"bjw-s.common.lib.chart.names.fullname\" $ }}-config" name: '{{ include "bjw-s.common.lib.chart.names.fullname" $ }}-config'
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -74,6 +86,10 @@ tests:
enabled: true enabled: true
type: secret type: secret
name: mySettings name: mySettings
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -93,6 +109,10 @@ tests:
enabled: true enabled: true
type: secret type: secret
name: "{{ .Release.Name }}-config" name: "{{ .Release.Name }}-config"
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -113,6 +133,10 @@ tests:
type: nfs type: nfs
server: 10.10.0.8 server: 10.10.0.8
path: /tank/nas/library path: /tank/nas/library
mounts:
- controllers:
- main
mountPath: "/data"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -4,17 +4,18 @@ templates:
tests: tests:
- it: volumeClaimTemplates should pass - it: volumeClaimTemplates should pass
set: set:
controller: controllers.main:
type: statefulset type: statefulset
volumeClaimTemplates: statefulset:
- name: "storage" volumeClaimTemplates:
accessMode: "ReadWriteOnce" - name: "storage"
size: "10Gi" accessMode: "ReadWriteOnce"
storageClass: "storage" size: "10Gi"
labels: storageClass: "storage"
test: "label" labels:
annotations: test: "label"
test: "annotation" annotations:
test: "annotation"
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -8,23 +8,27 @@ tests:
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostIPC path: spec.template.spec.hostIPC
value: false
- it: hostIPC disabled should pass - it: hostIPC disabled should pass
set: set:
hostIPC: false defaultPodOptions:
hostIPC: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostIPC path: spec.template.spec.hostIPC
value: false
- it: hostIPC enabled should pass - it: hostIPC enabled should pass
set: set:
hostIPC: true defaultPodOptions:
hostIPC: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -8,23 +8,27 @@ tests:
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostPID path: spec.template.spec.hostPID
value: false
- it: hostPID disabled should pass - it: hostPID disabled should pass
set: set:
hostPID: false defaultPodOptions:
hostPID: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostPID path: spec.template.spec.hostPID
value: false
- it: hostPID enabled should pass - it: hostPID enabled should pass
set: set:
hostPID: true defaultPodOptions:
hostPID: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -2,52 +2,12 @@ suite: pod initContainers
templates: templates:
- common.yaml - common.yaml
tests: tests:
- it: with explicit name should pass
set:
initContainers:
init1:
name: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].name
value: template-test
- it: with implicit name should pass
set:
initContainers:
init1:
image: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].name
value: init1
- it: with templated name should pass
set:
initContainers:
init1:
name: "{{ .Release.Name }}-container"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.initContainers[0].name
value: RELEASE-NAME-container
- it: with custom env vars dict should pass - it: with custom env vars dict should pass
set: set:
initContainers: controllers.main.initContainers:
init1: init1:
image:
repository: ghcr.io/mendhak/http-https-echo
env: env:
int: 1 int: 1
float: 1.5 float: 1.5

View file

@ -1,4 +1,4 @@
suite: pod replicas suite: pod network
templates: templates:
- common.yaml - common.yaml
tests: tests:
@ -8,8 +8,9 @@ tests:
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostNetwork path: spec.template.spec.hostNetwork
value: false
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.dnsPolicy path: spec.template.spec.dnsPolicy
@ -17,14 +18,16 @@ tests:
- it: hostNetwork disabled should pass - it: hostNetwork disabled should pass
set: set:
hostNetwork: false defaultPodOptions:
hostNetwork: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
isNull: equal:
path: spec.template.spec.hostNetwork path: spec.template.spec.hostNetwork
value: false
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.dnsPolicy path: spec.template.spec.dnsPolicy
@ -32,7 +35,8 @@ tests:
- it: hostNetwork enabled should pass - it: hostNetwork enabled should pass
set: set:
hostNetwork: true defaultPodOptions:
hostNetwork: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
@ -48,7 +52,8 @@ tests:
- it: custom dnsPolicy should pass - it: custom dnsPolicy should pass
set: set:
dnsPolicy: None defaultPodOptions:
dnsPolicy: None
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -14,7 +14,7 @@ tests:
- it: custom replicas should pass - it: custom replicas should pass
set: set:
controller.replicas: 3 controllers.main.replicas: 3
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:

View file

@ -4,52 +4,64 @@ templates:
tests: tests:
- it: with explicit name should pass - it: with explicit name should pass
set: set:
sidecars: controllers.main.containers:
additional1: additional1:
name: template-test nameOverride: template-test
image:
repository: test
tag: test
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.containers[1].name path: spec.template.spec.containers[0].name
value: template-test value: template-test
- it: with implicit name should pass - it: with implicit name should pass
set: set:
sidecars: controllers.main.containers:
additional1: additional1:
image: template-test image:
repository: test
tag: test
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.containers[1].name path: spec.template.spec.containers[0].name
value: additional1 value: additional1
- it: with templated name should pass - it: with templated name should pass
set: set:
sidecars: controllers.main.containers:
additional1: additional1:
name: "{{ .Release.Name }}-container" nameOverride: "{{ .Release.Name }}-container"
image:
repository: test
tag: test
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.template.spec.containers[1].name path: spec.template.spec.containers[0].name
value: RELEASE-NAME-container value: RELEASE-NAME-container
- it: with custom env vars dict should pass - it: with custom env vars dict should pass
set: set:
env: controllers.main.containers:
main_env: value main:
sidecars: env:
main_env: value
additional1: additional1:
image:
repository: test
tag: test
env: env:
int: 1 int: 1
float: 1.5 float: 1.5
@ -61,52 +73,31 @@ tests:
of: Deployment of: Deployment
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
equal: equal:
path: spec.template.spec.containers[0].env[0] path: spec.template.spec.containers[1].env[0]
value: value:
name: main_env name: main_env
value: "value" value: "value"
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
equal: equal:
path: spec.template.spec.containers[1].env[0] path: spec.template.spec.containers[0].env[0]
value: value:
name: float name: float
value: "1.5" value: "1.5"
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
equal: equal:
path: spec.template.spec.containers[1].env[1] path: spec.template.spec.containers[0].env[1]
value: value:
name: int name: int
value: "1" value: "1"
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
equal: equal:
path: spec.template.spec.containers[1].env[2] path: spec.template.spec.containers[0].env[2]
value: value:
name: string name: string
value: value_of_env value: value_of_env
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
equal: equal:
path: spec.template.spec.containers[1].env[3] path: spec.template.spec.containers[0].env[3]
value: value:
name: template name: template
value: RELEASE-NAME-admin value: RELEASE-NAME-admin
- it: with legacy additionalContainers should pass
set:
sidecars:
additional1:
name: sidecar
additionalContainers:
additional2:
name: legacy-sidecar
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: sidecar
- documentIndex: 0
equal:
path: spec.template.spec.containers[2].name
value: legacy-sidecar

View file

@ -19,7 +19,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: retain enabled should pass - it: retain enabled should pass
set: set:
@ -42,7 +42,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -68,7 +68,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -102,5 +102,5 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -23,7 +23,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -52,7 +52,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -89,5 +89,5 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -21,7 +21,7 @@ tests:
kind: Service kind: Service
name: RELEASE-NAME name: RELEASE-NAME
namespace: NAMESPACE namespace: NAMESPACE
port: null port: 8080
weight: 1 weight: 1
- it: custom service reference should pass - it: custom service reference should pass
@ -33,11 +33,11 @@ tests:
namespace: parentNamespace namespace: parentNamespace
rules: rules:
- backendRefs: - backendRefs:
- group: test - group: test
name: pathService name: pathService
port: 1234 port: 1234
namespace: serviceNamespace namespace: serviceNamespace
weight: 123 weight: 123
asserts: asserts:
- documentIndex: &HTTPRouteDocument 2 - documentIndex: &HTTPRouteDocument 2
isKind: isKind:

View file

@ -23,7 +23,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -52,7 +52,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -89,7 +89,7 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom secret type should pass - it: custom secret type should pass

View file

@ -22,4 +22,4 @@ tests:
equal: equal:
path: spec.template.metadata.annotations path: spec.template.metadata.annotations
value: value:
checksum/secrets: cd4e5076088172611ca1c43c659a275232d9eeb887acc20575ac141038b9aacb checksum/secrets: 4107837201f46be5279f7accdf3942edabd38f0eb534a61c91d2d7cba7ffc557

View file

@ -18,7 +18,7 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -45,7 +45,7 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -80,5 +80,5 @@ tests:
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/service: RELEASE-NAME app.kubernetes.io/service: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test_label: test test_label: test

View file

@ -64,8 +64,3 @@ tests:
equal: equal:
path: spec.ports[0].protocol path: spec.ports[0].protocol
value: TCP value: TCP
- documentIndex: *ServiceDocument
equal:
path: metadata.annotations
value:
traefik.ingress.kubernetes.io/service.serversscheme: https

View file

@ -1,4 +1,4 @@
suite: service port names suite: service ports
templates: templates:
- common.yaml - common.yaml
tests: tests:
@ -14,9 +14,9 @@ tests:
path: spec.ports[0] path: spec.ports[0]
value: value:
name: http name: http
port: null port: 8080
protocol: TCP protocol: TCP
targetPort: http targetPort: 8080
- it: custom name should pass - it: custom name should pass
set: set:
@ -39,7 +39,7 @@ tests:
name: server name: server
port: 8080 port: 8080
protocol: TCP protocol: TCP
targetPort: server targetPort: 8080
- it: custom target port should pass - it: custom target port should pass
set: set:
@ -58,6 +58,6 @@ tests:
path: spec.ports[0] path: spec.ports[0]
value: value:
name: http name: http
port: null port: 8080
protocol: TCP protocol: TCP
targetPort: 80 targetPort: 80

View file

@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: service values suite: service values
templates: templates:
- common.yaml - common.yaml
@ -7,6 +9,7 @@ tests:
service: service:
second: second:
type: ClusterIP type: ClusterIP
controller: main
ports: ports:
first: first:
port: 80 port: 80
@ -19,6 +22,9 @@ tests:
- documentIndex: &SecondServiceDocument 2 - documentIndex: &SecondServiceDocument 2
isKind: isKind:
of: Service of: Service
- documentIndex: *FirstServiceDocument
notExists:
path: spec.allocateLoadBalancerNodePorts
- it: services can be disabled - it: services can be disabled
set: set:
@ -61,3 +67,33 @@ tests:
equal: equal:
path: spec.externalTrafficPolicy path: spec.externalTrafficPolicy
value: Local value: Local
- it: allocateLoadBalancerNodePorts can be set to true
set:
service:
main:
type: LoadBalancer
allocateLoadBalancerNodePorts: true
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.allocateLoadBalancerNodePorts
value: true
- it: allocateLoadBalancerNodePorts can be set to false
set:
service:
main:
type: LoadBalancer
allocateLoadBalancerNodePorts: false
asserts:
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *ServiceDocument
equal:
path: spec.allocateLoadBalancerNodePorts
value: false

View file

@ -74,7 +74,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.5.1 helm.sh/chart: common-test-1.0.0
test.label: testvalue test.label: testvalue
- it: a serviceMonitor is created with nameOverride - it: a serviceMonitor is created with nameOverride

View file

@ -0,0 +1,15 @@
---
controllers:
main:
containers:
main:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 29
pullPolicy: IfNotPresent
service:
main:
ports:
http:
port: 8080

View file

@ -3,7 +3,7 @@ apiVersion: v2
name: common name: common
description: Function library for Helm charts description: Function library for Helm charts
type: library type: library
version: 1.5.1 version: 2.0.0-beta.1
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
keywords: keywords:
- common - common
@ -13,12 +13,7 @@ maintainers:
- name: bjw-s - name: bjw-s
email: me@bjw-s.dev email: me@bjw-s.dev
annotations: annotations:
# TODO: Update this before releasing
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: fixed
description: Ingress secret name template is evaluated before deciding whether to omit it
- kind: changed - kind: changed
description: Updated code-server image tag to v4.13.0 description: Many things :P
- kind: changed
description: Updated netshoot image tag to v0.11
- kind: changed
description: Updated gluetun image tag to v3.34.3

View file

@ -1,6 +1,6 @@
# common # common
![Version: 1.5.0](https://img.shields.io/badge/Version-1.5.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
Function library for Helm charts Function library for Helm charts
@ -29,7 +29,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 1.5.0 version: 2.0.0
repository: https://bjw-s.github.io/helm-charts/ repository: https://bjw-s.github.io/helm-charts/
``` ```
@ -49,147 +49,111 @@ N/A
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| |-----|------|---------|-------------|
| addons | object | See below | The common chart supports several add-ons. These can be configured under this key. |
| addons.codeserver | object | See values.yaml | The common library supports adding a code-server add-on to access files. It can be configured under this key. |
| addons.codeserver.args | list | `["--auth","none"]` | Set codeserver command line arguments. Consider setting --user-data-dir to a persistent location to preserve code-server setting changes |
| addons.codeserver.enabled | bool | `false` | Enable running a code-server container in the pod |
| addons.codeserver.env | object | `{}` | Set any environment variables for code-server here |
| addons.codeserver.git | object | See below | Optionally allow access a Git repository by passing in a private SSH key |
| addons.codeserver.git.deployKey | string | `""` | Raw SSH private key |
| addons.codeserver.git.deployKeyBase64 | string | `""` | Base64-encoded SSH private key. When both variables are set, the raw SSH key takes precedence. |
| addons.codeserver.git.deployKeySecret | string | `""` | Existing secret containing SSH private key The chart expects it to be present under the `id_rsa` key. |
| addons.codeserver.image.pullPolicy | string | `"IfNotPresent"` | Specify the code-server image pull policy |
| addons.codeserver.image.repository | string | `"ghcr.io/coder/code-server"` | Specify the code-server image |
| addons.codeserver.image.tag | string | `"4.12.0"` | Specify the code-server image tag |
| addons.codeserver.ingress.enabled | bool | `false` | Enable an ingress for the code-server add-on. |
| addons.codeserver.ingress.ingressClassName | string | `nil` | Set the ingressClass that is used for this ingress. |
| addons.codeserver.service.enabled | bool | `true` | Enable a service for the code-server add-on. |
| addons.codeserver.volumeMounts | list | `[]` | Specify a list of volumes that get mounted in the code-server container. At least 1 volumeMount is required! |
| addons.codeserver.workingDir | string | `""` | Specify the working dir that will be opened when code-server starts If not given, the app will default to the mountpah of the first specified volumeMount |
| addons.netshoot | object | See values.yaml | The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. It can be configured under this key. |
| addons.netshoot.enabled | bool | `false` | Enable running a netshoot container in the pod |
| addons.netshoot.env | object | `{}` | Set any environment variables for netshoot here |
| addons.netshoot.image.pullPolicy | string | `"IfNotPresent"` | Specify the netshoot image pull policy |
| addons.netshoot.image.repository | string | `"ghcr.io/nicolaka/netshoot"` | Specify the netshoot image |
| addons.netshoot.image.tag | string | `"v0.10"` | Specify the netshoot image tag |
| addons.vpn | object | See values.yaml | The common chart supports adding a VPN add-on. It can be configured under this key. |
| addons.vpn.args | list | `[]` | Override the args for the vpn sidecar container |
| addons.vpn.configFile | string | `nil` | Provide a customized vpn configuration file to be used by the VPN. |
| addons.vpn.configFileSecret | string | `nil` | Reference an existing secret that contains the VPN configuration file The chart expects it to be present under the `vpnConfigfile` key. |
| addons.vpn.enabled | bool | `false` | Enable running a VPN in the pod to route traffic through a VPN |
| addons.vpn.env | object | `{}` | All variables specified here will be added to the vpn sidecar container See the documentation of the VPN image for all config values |
| addons.vpn.gluetun | object | See below | Make sure to read the [documentation](https://github.com/qdm12/gluetun/wiki) to see how to configure this addon! |
| addons.vpn.gluetun.image.pullPolicy | string | `"IfNotPresent"` | Specify the Gluetun image pull policy |
| addons.vpn.gluetun.image.repository | string | `"docker.io/qmcgaw/gluetun"` | Specify the Gluetun image |
| addons.vpn.gluetun.image.tag | string | `"v3.33.0"` | Specify the Gluetun image tag |
| addons.vpn.livenessProbe | object | `{}` | Optionally specify a livenessProbe, e.g. to check if the connection is still being protected by the VPN |
| addons.vpn.networkPolicy.annotations | object | `{}` | Provide additional annotations which may be required. |
| addons.vpn.networkPolicy.egress | string | `nil` | The egress configuration for your network policy, All outbound traffic from the pod will be blocked unless specified here. [[ref]](https://kubernetes.io/docs/concepts/services-networking/network-policies/) [[recipes]](https://github.com/ahmetb/kubernetes-network-policy-recipes) |
| addons.vpn.networkPolicy.enabled | bool | `false` | If set to true, will deploy a network policy that blocks all outbound traffic except traffic specified as allowed |
| addons.vpn.networkPolicy.labels | object | `{}` | Provide additional labels which may be required. |
| addons.vpn.networkPolicy.podSelectorLabels | object | `{}` | Provide additional podSelector labels which may be required. |
| addons.vpn.scripts | object | See values.yaml | Provide custom up/down scripts that can be used by the vpn configuration. |
| addons.vpn.securityContext | object | See values.yaml | Set the VPN container securityContext |
| addons.vpn.type | string | `"gluetun"` | Specify the VPN type. Valid options are `gluetun`. |
| affinity | object | `{}` | Defines affinity constraint rules. [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
| args | list | `[]` | Override the args for the default container |
| automountServiceAccountToken | bool | `true` | Specifies whether a service account token should be automatically mounted. |
| command | list | `[]` | Override the command(s) for the default container |
| configMaps | object | See below | Configure configMaps for the chart here. Additional configMaps can be added by adding a dictionary key similar to the 'config' object. | | configMaps | object | See below | Configure configMaps for the chart here. Additional configMaps can be added by adding a dictionary key similar to the 'config' object. |
| configMaps.config.annotations | object | `{}` | Annotations to add to the configMap | | configMaps.config.annotations | object | `{}` | Annotations to add to the configMap |
| configMaps.config.data | object | `{}` | configMap data content. Helm template enabled. | | configMaps.config.data | object | `{}` | configMap data content. Helm template enabled. |
| configMaps.config.enabled | bool | `false` | Enables or disables the configMap | | configMaps.config.enabled | bool | `false` | Enables or disables the configMap |
| configMaps.config.labels | object | `{}` | Labels to add to the configMap | | configMaps.config.labels | object | `{}` | Labels to add to the configMap |
| controller.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset/cronjob | | controllers.main.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset/cronjob |
| controller.cronjob | object | See below | CronJob configuration. Required only when using `controller.type: cronjob`. | | controllers.main.containers.main.args | list | `[]` | Override the args for the default container |
| controller.cronjob.backoffLimit | int | `6` | Limits the number of times a failed job will be retried | | controllers.main.containers.main.command | list | `[]` | Override the command(s) for the default container |
| controller.cronjob.concurrencyPolicy | string | `"Forbid"` | Specifies how to treat concurrent executions of a job that is created by this cron job valid values are Allow, Forbid or Replace | | controllers.main.containers.main.env | string | `nil` | Environment variables. Template enabled. Syntax options: A) TZ: UTC B) PASSWD: '{{ .Release.Name }}' C) PASSWD: configMapKeyRef: name: config-map-name key: key-name D) PASSWD: valueFrom: secretKeyRef: name: secret-name key: key-name ... E) - name: TZ value: UTC F) - name: TZ value: '{{ .Release.Name }}' |
| controller.cronjob.failedJobsHistory | int | `1` | The number of failed Jobs to keep | | controllers.main.containers.main.envFrom | list | `[]` | Secrets and/or ConfigMaps that will be loaded as environment variables. [[ref]](https://unofficial-kubernetes.readthedocs.io/en/latest/tasks/configure-pod-container/configmap/#use-case-consume-configmap-in-environment-variables) |
| controller.cronjob.schedule | string | `"*/20 * * * *"` | Sets the CronJob time when to execute your jobs | | controllers.main.containers.main.image.pullPolicy | string | `nil` | image pull policy |
| controller.cronjob.startingDeadlineSeconds | int | `30` | The deadline in seconds for starting the job if it misses its scheduled time for any reason | | controllers.main.containers.main.image.repository | string | `nil` | image repository |
| controller.cronjob.successfulJobsHistory | int | `1` | The number of succesful Jobs to keep | | controllers.main.containers.main.image.tag | string | `nil` | image tag |
| controller.cronjob.ttlSecondsAfterFinished | string | `nil` | If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. | | controllers.main.containers.main.lifecycle | object | `{}` | Configure the lifecycle for the container |
| controller.enabled | bool | `true` | enable the controller. | | controllers.main.containers.main.nameOverride | string | `nil` | Override the container name |
| controller.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset/cronjob | | controllers.main.containers.main.probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) |
| controller.podManagementPolicy | string | `nil` | Set statefulset podManagementPolicy, valid values are Parallel and OrderedReady (default). | | controllers.main.containers.main.probes.liveness | object | See below | Liveness probe configuration |
| controller.replicas | int | `1` | Number of desired pods. When using a HorizontalPodAutoscaler, set this to `null`. | | controllers.main.containers.main.probes.liveness.custom | bool | `false` | Set this to `true` if you wish to specify your own livenessProbe |
| controller.restartPolicy | string | `Always`. When `controller.type` is `cronjob` it defaults to `Never`. | Set Container restart policy. | | controllers.main.containers.main.probes.liveness.enabled | bool | `true` | Enable the liveness probe |
| controller.revisionHistoryLimit | int | `3` | ReplicaSet revision history limit | | controllers.main.containers.main.probes.liveness.spec | object | See below | The spec field contains the values for the default livenessProbe. If you selected `custom: true`, this field holds the definition of the livenessProbe. |
| controller.rollingUpdate.partition | string | `nil` | Set statefulset RollingUpdate partition | | controllers.main.containers.main.probes.liveness.type | string | "TCP" | sets the probe type when not using a custom probe |
| controller.rollingUpdate.surge | string | `nil` | Set deployment RollingUpdate max surge | | controllers.main.containers.main.probes.readiness | object | See below | Redainess probe configuration |
| controller.rollingUpdate.unavailable | string | `nil` | Set deployment RollingUpdate max unavailable | | controllers.main.containers.main.probes.readiness.custom | bool | `false` | Set this to `true` if you wish to specify your own readinessProbe |
| controller.strategy | string | `nil` | Set the controller upgrade strategy For Deployments, valid values are Recreate (default) and RollingUpdate. For StatefulSets, valid values are OnDelete and RollingUpdate (default). DaemonSets/CronJobs ignore this. | | controllers.main.containers.main.probes.readiness.enabled | bool | `true` | Enable the readiness probe |
| controller.type | string | `"deployment"` | Set the controller type. Valid options are deployment, daemonset, statefulset or cronjob | | controllers.main.containers.main.probes.readiness.spec | object | See below | The spec field contains the values for the default readinessProbe. If you selected `custom: true`, this field holds the definition of the readinessProbe. |
| dnsConfig | object | `{}` | Configuring the ndots option may resolve nslookup issues on some Kubernetes setups. | | controllers.main.containers.main.probes.readiness.type | string | "TCP" | sets the probe type when not using a custom probe |
| dnsPolicy | string | `nil` | Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. | | controllers.main.containers.main.probes.startup | object | See below | Startup probe configuration |
| enableServiceLinks | bool | `true` | Enable/disable the generation of environment variables for services. [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service) | | controllers.main.containers.main.probes.startup.custom | bool | `false` | Set this to `true` if you wish to specify your own startupProbe |
| env | string | `nil` | Main environment variables. Template enabled. Syntax options: A) TZ: UTC B) PASSWD: '{{ .Release.Name }}' C) PASSWD: configMapKeyRef: name: config-map-name key: key-name D) PASSWD: valueFrom: secretKeyRef: name: secret-name key: key-name ... E) - name: TZ value: UTC F) - name: TZ value: '{{ .Release.Name }}' | | controllers.main.containers.main.probes.startup.enabled | bool | `true` | Enable the startup probe |
| envFrom | list | `[]` | Secrets and/or ConfigMaps that will be loaded as environment variables. [[ref]](https://unofficial-kubernetes.readthedocs.io/en/latest/tasks/configure-pod-container/configmap/#use-case-consume-configmap-in-environment-variables) | | controllers.main.containers.main.probes.startup.spec | object | See below | The spec field contains the values for the default startupProbe. If you selected `custom: true`, this field holds the definition of the startupProbe. |
| controllers.main.containers.main.probes.startup.type | string | "TCP" | sets the probe type when not using a custom probe |
| controllers.main.containers.main.resources | object | `{}` | Set the resource requests / limits for the container. |
| controllers.main.containers.main.securityContext | object | `{}` | Configure the Security Context for the container |
| controllers.main.containers.main.terminationMessagePath | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| controllers.main.containers.main.terminationMessagePolicy | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| controllers.main.cronjob | object | See below | CronJob configuration. Required only when using `controller.type: cronjob`. |
| controllers.main.cronjob.backoffLimit | int | `6` | Limits the number of times a failed job will be retried |
| controllers.main.cronjob.concurrencyPolicy | string | `"Forbid"` | Specifies how to treat concurrent executions of a job that is created by this cron job valid values are Allow, Forbid or Replace |
| controllers.main.cronjob.failedJobsHistory | int | `1` | The number of failed Jobs to keep |
| controllers.main.cronjob.schedule | string | `"*/20 * * * *"` | Sets the CronJob time when to execute your jobs |
| controllers.main.cronjob.startingDeadlineSeconds | int | `30` | The deadline in seconds for starting the job if it misses its scheduled time for any reason |
| controllers.main.cronjob.successfulJobsHistory | int | `1` | The number of succesful Jobs to keep |
| controllers.main.cronjob.ttlSecondsAfterFinished | string | `nil` | If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. |
| controllers.main.enabled | bool | `true` | enable the controller. |
| controllers.main.initContainers | object | `{}` | Specify any initContainers here as dictionary items. Each initContainer should have its own key. The dictionary item key will determine the order. Helm templates can be used. |
| controllers.main.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset/cronjob |
| controllers.main.replicas | int | `1` | Number of desired pods. When using a HorizontalPodAutoscaler, set this to `null`. |
| controllers.main.revisionHistoryLimit | int | `3` | ReplicaSet revision history limit |
| controllers.main.rollingUpdate.partition | string | `nil` | Set statefulset RollingUpdate partition |
| controllers.main.rollingUpdate.surge | string | `nil` | Set deployment RollingUpdate max surge |
| controllers.main.rollingUpdate.unavailable | string | `nil` | Set deployment RollingUpdate max unavailable |
| controllers.main.statefulset | object | `{"podManagementPolicy":null,"volumeClaimTemplates":[]}` | StatefulSet configuration. Required only when using `controller.type: statefulset`. |
| controllers.main.statefulset.podManagementPolicy | string | `nil` | Set podManagementPolicy, valid values are Parallel and OrderedReady (default). |
| controllers.main.statefulset.volumeClaimTemplates | list | `[]` | Used to create individual disks for each instance. |
| controllers.main.strategy | string | `nil` | Set the controller upgrade strategy For Deployments, valid values are Recreate (default) and RollingUpdate. For StatefulSets, valid values are OnDelete and RollingUpdate (default). DaemonSets/CronJobs ignore this. |
| controllers.main.type | string | `"deployment"` | Set the controller type. Valid options are deployment, daemonset, statefulset or cronjob |
| defaultPodOptions | object | `{"affinity":{},"annotations":{},"automountServiceAccountToken":true,"dnsConfig":{},"dnsPolicy":null,"enableServiceLinks":true,"hostAliases":[],"hostIPC":false,"hostNetwork":false,"hostPID":false,"hostname":null,"imagePullSecrets":[],"labels":{},"nodeSelector":{},"priorityClassName":null,"restartPolicy":null,"runtimeClassName":null,"schedulerName":null,"securityContext":{},"terminationGracePeriodSeconds":null,"tolerations":[],"topologySpreadConstraints":[]}` | Set default options for all controllers / pods here Each of these options can be overridden on a Pod level |
| defaultPodOptions.affinity | object | `{}` | Defines affinity constraint rules. [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
| defaultPodOptions.annotations | object | `{}` | Set annotations on the Pod. Pod-specific values will be merged with this. |
| defaultPodOptions.automountServiceAccountToken | bool | `true` | Specifies whether a service account token should be automatically mounted. |
| defaultPodOptions.dnsConfig | object | `{}` | Configuring the ndots option may resolve nslookup issues on some Kubernetes setups. |
| defaultPodOptions.dnsPolicy | string | `nil` | Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. |
| defaultPodOptions.enableServiceLinks | bool | `true` | Enable/disable the generation of environment variables for services. [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service) |
| defaultPodOptions.hostAliases | list | `[]` | Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames. [[ref]](https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/) |
| defaultPodOptions.hostIPC | bool | `false` | Use the host's ipc namespace |
| defaultPodOptions.hostNetwork | bool | `false` | When using hostNetwork make sure you set dnsPolicy to `ClusterFirstWithHostNet` |
| defaultPodOptions.hostPID | bool | `false` | Use the host's pid namespace |
| defaultPodOptions.hostname | string | `nil` | Allows specifying explicit hostname setting |
| defaultPodOptions.imagePullSecrets | list | `[]` | Set image pull secrets |
| defaultPodOptions.labels | object | `{}` | Set labels on the Pod. Pod-specific values will be merged with this. |
| defaultPodOptions.nodeSelector | object | `{}` | Node selection constraint [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) |
| defaultPodOptions.priorityClassName | string | `nil` | Custom priority class for different treatment by the scheduler |
| defaultPodOptions.restartPolicy | string | `Always`. When `controller.type` is `cronjob` it defaults to `Never`. | Set Container restart policy. |
| defaultPodOptions.runtimeClassName | string | `nil` | Allow specifying a runtimeClassName other than the default one (ie: nvidia) |
| defaultPodOptions.schedulerName | string | `nil` | Allows specifying a custom scheduler name |
| defaultPodOptions.securityContext | object | `{}` | Configure the Security Context for the Pod |
| defaultPodOptions.terminationGracePeriodSeconds | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] |
| defaultPodOptions.tolerations | list | `[]` | Specify taint tolerations [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
| defaultPodOptions.topologySpreadConstraints | list | `[]` | Defines topologySpreadConstraint rules. [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) |
| global.annotations | object | `{}` | Set additional global annotations. Helm templates can be used. | | global.annotations | object | `{}` | Set additional global annotations. Helm templates can be used. |
| global.fullnameOverride | string | `nil` | Set the entire name definition | | global.fullnameOverride | string | `nil` | Set the entire name definition |
| global.labels | object | `{}` | Set additional global labels. Helm templates can be used. | | global.labels | object | `{}` | Set additional global labels. Helm templates can be used. |
| global.nameOverride | string | `nil` | Set an override for the prefix of the fullname | | global.nameOverride | string | `nil` | Set an override for the prefix of the fullname |
| hostAliases | list | `[]` | Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames. [[ref]](https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/) |
| hostIPC | bool | `false` | Use the host's ipc namespace |
| hostNetwork | bool | `false` | When using hostNetwork make sure you set dnsPolicy to `ClusterFirstWithHostNet` |
| hostPID | bool | `false` | Use the host's pid namespace |
| hostname | string | `nil` | Allows specifying explicit hostname setting |
| image.pullPolicy | string | `nil` | image pull policy |
| image.repository | string | `nil` | image repository |
| image.tag | string | `nil` | image tag |
| imagePullSecrets | list | `[]` | Set image pull secrets |
| ingress | object | See below | Configure the ingresses for the chart here. Additional ingresses can be added by adding a dictionary key similar to the 'main' ingress. | | ingress | object | See below | Configure the ingresses for the chart here. Additional ingresses can be added by adding a dictionary key similar to the 'main' ingress. |
| ingress.main.annotations | object | `{}` | Provide additional annotations which may be required. | | ingress.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| ingress.main.className | string | `nil` | Set the ingressClass that is used for this ingress. |
| ingress.main.enabled | bool | `false` | Enables or disables the ingress | | ingress.main.enabled | bool | `false` | Enables or disables the ingress |
| ingress.main.hosts[0].host | string | `"chart-example.local"` | Host address. Helm template can be passed. | | ingress.main.hosts[0].host | string | `"chart-example.local"` | Host address. Helm template can be passed. |
| ingress.main.hosts[0].paths[0].path | string | `"/"` | Path. Helm template can be passed. | | ingress.main.hosts[0].paths[0].path | string | `"/"` | Path. Helm template can be passed. |
| ingress.main.hosts[0].paths[0].service.name | string | `nil` | Overrides the service name reference for this path | | ingress.main.hosts[0].paths[0].service.name | string | `"main"` | Overrides the service name reference for this path This can be an actual service name, or reference a service identifier from this values.yaml |
| ingress.main.hosts[0].paths[0].service.port | string | `nil` | Overrides the service port reference for this path | | ingress.main.hosts[0].paths[0].service.port | string | `nil` | Overrides the service port number reference for this path |
| ingress.main.ingressClassName | string | `nil` | Set the ingressClass that is used for this ingress. |
| ingress.main.labels | object | `{}` | Provide additional labels which may be required. | | ingress.main.labels | object | `{}` | Provide additional labels which may be required. |
| ingress.main.nameOverride | string | `nil` | Override the name suffix that is used for this ingress. | | ingress.main.nameOverride | string | `nil` | Override the name suffix that is used for this ingress. |
| ingress.main.primary | bool | `true` | Make this the primary ingress (used in probes, notes, etc...). If there is more than 1 ingress, make sure that only 1 ingress is marked as primary. | | ingress.main.primary | bool | `true` | Make this the primary ingress (used in probes, notes, etc...). If there is more than 1 ingress, make sure that only 1 ingress is marked as primary. |
| ingress.main.tls | list | `[]` | Configure TLS for the ingress. Both secretName and hosts can process a Helm template. | | ingress.main.tls | list | `[]` | Configure TLS for the ingress. Both secretName and hosts can process a Helm template. |
| initContainers | object | `{}` | Specify any initContainers here as dictionary items. Each initContainer should have its own key. The dictionary item key will determine the order. Helm templates can be used. |
| lifecycle | object | `{}` | Configure the lifecycle for the main container |
| nodeSelector | object | `{}` | Node selection constraint [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) |
| persistence | object | See below | Configure persistence for the chart here. Additional items can be added by adding a dictionary key similar to the 'config' key. [[ref]](https://bjw-s.github.io/helm-charts/docs/common-library/common-library-storage) | | persistence | object | See below | Configure persistence for the chart here. Additional items can be added by adding a dictionary key similar to the 'config' key. [[ref]](https://bjw-s.github.io/helm-charts/docs/common-library/common-library-storage) |
| persistence.config | object | See below | Default persistence for configuration files. |
| persistence.config.accessMode | string | `"ReadWriteOnce"` | AccessMode for the persistent volume. Make sure to select an access mode that is supported by your storage provider! [[ref]](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) | | persistence.config.accessMode | string | `"ReadWriteOnce"` | AccessMode for the persistent volume. Make sure to select an access mode that is supported by your storage provider! [[ref]](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) |
| persistence.config.enabled | bool | `false` | Enables or disables the persistence item | | persistence.config.advancedMounts | object | `{}` | Explicitly configure mounts for specific controllers and containers. Example: advancedMounts: main: # the controller with whe "main" identifier main: # the container with whe "main" identifier - path: /data/config.yaml readOnly: true subPath: config.yaml second-container: # the container with whe "second-container" identifier - path: /appdata/config readOnly: true second-controller: # the controller with whe "second-controller" identifier main: # the container with whe "main" identifier - path: /data/config.yaml readOnly: false subPath: config.yaml |
| persistence.config.enabled | bool | `false` | Enables or disables the persistence item. Defaults to true |
| persistence.config.existingClaim | string | `nil` | If you want to reuse an existing claim, the name of the existing PVC can be passed here. | | persistence.config.existingClaim | string | `nil` | If you want to reuse an existing claim, the name of the existing PVC can be passed here. |
| persistence.config.mountPath | string | `nil` | Where to mount the volume in the main container. Defaults to `/<name_of_the_volume>`, setting to '-' creates the volume but disables the volumeMount. | | persistence.config.globalMounts | list | `[]` | Configure mounts to all controllers and containers. By default the persistence item will be mounted to `/<name_of_the_peristence_item>`. Example: globalMounts: - path: /config readOnly: false |
| persistence.config.nameOverride | string | `nil` | Override the name suffix that is used for this volume. |
| persistence.config.readOnly | bool | `false` | Specify if the volume should be mounted read-only. |
| persistence.config.retain | bool | `false` | Set to true to retain the PVC upon `helm uninstall` | | persistence.config.retain | bool | `false` | Set to true to retain the PVC upon `helm uninstall` |
| persistence.config.size | string | `"1Gi"` | The amount of storage that is requested for the persistent volume. | | persistence.config.size | string | `"1Gi"` | The amount of storage that is requested for the persistent volume. |
| persistence.config.storageClass | string | `nil` | Storage Class for the config volume. If set to `-`, dynamic provisioning is disabled. If set to something else, the given storageClass is used. If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. | | persistence.config.storageClass | string | `nil` | Storage Class for the config volume. If set to `-`, dynamic provisioning is disabled. If set to something else, the given storageClass is used. If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| persistence.config.subPath | string | `nil` | Used in conjunction with `existingClaim`. Specifies a sub-path inside the referenced volume instead of its root | | persistence.config.type | string | `"persistentVolumeClaim"` | Sets the persistence type Valid options are persistentVolumeClaim, emptyDir, hostPath, secret, configMap or custom |
| persistence.config.type | string | `"pvc"` | Sets the persistence type Valid options are pvc, emptyDir, hostPath, secret, configMap or custom |
| persistence.shared | object | See below | Create an emptyDir volume to share between all containers [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) |
| persistence.shared.medium | string | `nil` | Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead of the storage medium that backs the node. |
| persistence.shared.sizeLimit | string | `nil` | If the `SizeMemoryBackedVolumes` feature gate is enabled, you can specify a size for memory backed volumes. |
| podAnnotations | object | `{}` | Set annotations on the pod |
| podLabels | object | `{}` | Set labels on the pod |
| podSecurityContext | object | `{}` | Configure the Security Context for the Pod |
| priorityClassName | string | `nil` | Custom priority class for different treatment by the scheduler |
| probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) |
| probes.liveness | object | See below | Liveness probe configuration |
| probes.liveness.custom | bool | `false` | Set this to `true` if you wish to specify your own livenessProbe |
| probes.liveness.enabled | bool | `true` | Enable the liveness probe |
| probes.liveness.spec | object | See below | The spec field contains the values for the default livenessProbe. If you selected `custom: true`, this field holds the definition of the livenessProbe. |
| probes.liveness.type | string | "TCP" | sets the probe type when not using a custom probe |
| probes.readiness | object | See below | Redainess probe configuration |
| probes.readiness.custom | bool | `false` | Set this to `true` if you wish to specify your own readinessProbe |
| probes.readiness.enabled | bool | `true` | Enable the readiness probe |
| probes.readiness.spec | object | See below | The spec field contains the values for the default readinessProbe. If you selected `custom: true`, this field holds the definition of the readinessProbe. |
| probes.readiness.type | string | "TCP" | sets the probe type when not using a custom probe |
| probes.startup | object | See below | Startup probe configuration |
| probes.startup.custom | bool | `false` | Set this to `true` if you wish to specify your own startupProbe |
| probes.startup.enabled | bool | `true` | Enable the startup probe |
| probes.startup.spec | object | See below | The spec field contains the values for the default startupProbe. If you selected `custom: true`, this field holds the definition of the startupProbe. |
| probes.startup.type | string | "TCP" | sets the probe type when not using a custom probe |
| resources | object | `{}` | Set the resource requests / limits for the main container. |
| route | object | See below | Configure the gateway routes for the chart here. Additional routes can be added by adding a dictionary key similar to the 'main' route. [[ref]](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io%2fv1alpha2) | | route | object | See below | Configure the gateway routes for the chart here. Additional routes can be added by adding a dictionary key similar to the 'main' route. [[ref]](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io%2fv1alpha2) |
| route.main.annotations | object | `{}` | Provide additional annotations which may be required. | | route.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| route.main.enabled | bool | `false` | Enables or disables the route | | route.main.enabled | bool | `false` | Enables or disables the route |
@ -198,36 +162,35 @@ N/A
| route.main.labels | object | `{}` | Provide additional labels which may be required. | | route.main.labels | object | `{}` | Provide additional labels which may be required. |
| route.main.nameOverride | string | `nil` | Override the name suffix that is used for this route. | | route.main.nameOverride | string | `nil` | Override the name suffix that is used for this route. |
| route.main.parentRefs | list | `[{"group":"gateway.networking.k8s.io","kind":"Gateway","name":null,"namespace":null,"sectionName":null}]` | Configure the resource the route attaches to. | | route.main.parentRefs | list | `[{"group":"gateway.networking.k8s.io","kind":"Gateway","name":null,"namespace":null,"sectionName":null}]` | Configure the resource the route attaches to. |
| route.main.rules | list | `[{"backendRefs":[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]` | Configure rules for routing. Defaults to the primary service. | | route.main.rules | list | `[{"backendRefs":[{"group":"","kind":"Service","name":"main","namespace":null,"port":null,"weight":1}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]` | Configure rules for routing. Defaults to the primary service. |
| route.main.rules[0].backendRefs | list | `[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}]` | Configure backends where matching requests should be sent. | | route.main.rules[0].backendRefs | list | `[{"group":"","kind":"Service","name":"main","namespace":null,"port":null,"weight":1}]` | Configure backends where matching requests should be sent. |
| runtimeClassName | string | `nil` | Allow specifying a runtimeClassName other than the default one (ie: nvidia) |
| schedulerName | string | `nil` | Allows specifying a custom scheduler name |
| secrets | object | See below | Use this to populate secrets with the values you specify. Be aware that these values are not encrypted by default, and could therefore visible to anybody with access to the values.yaml file. Additional Secrets can be added by adding a dictionary key similar to the 'secret' object. | | secrets | object | See below | Use this to populate secrets with the values you specify. Be aware that these values are not encrypted by default, and could therefore visible to anybody with access to the values.yaml file. Additional Secrets can be added by adding a dictionary key similar to the 'secret' object. |
| secrets.secret.annotations | object | `{}` | Annotations to add to the Secret | | secrets.secret.annotations | object | `{}` | Annotations to add to the Secret |
| secrets.secret.enabled | bool | `false` | Enables or disables the Secret | | secrets.secret.enabled | bool | `false` | Enables or disables the Secret |
| secrets.secret.labels | object | `{}` | Labels to add to the Secret | | secrets.secret.labels | object | `{}` | Labels to add to the Secret |
| secrets.secret.stringData | object | `{}` | Secret stringData content. Helm template enabled. | | secrets.secret.stringData | object | `{}` | Secret stringData content. Helm template enabled. |
| securityContext | object | `{}` | Configure the Security Context for the main container |
| service | object | See below | Configure the services for the chart here. Additional services can be added by adding a dictionary key similar to the 'main' service. | | service | object | See below | Configure the services for the chart here. Additional services can be added by adding a dictionary key similar to the 'main' service. |
| service.main.annotations | object | `{}` | Provide additional annotations which may be required. | | service.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| service.main.controller | string | `"main"` | Configure which controller this service should target |
| service.main.enabled | bool | `true` | Enables or disables the service | | service.main.enabled | bool | `true` | Enables or disables the service |
| service.main.externalTrafficPolicy | string | `nil` | [[ref](https://kubernetes.io/docs/tutorials/services/source-ip/)] | | service.main.externalTrafficPolicy | string | `nil` | [[ref](https://kubernetes.io/docs/tutorials/services/source-ip/)] |
| service.main.extraSelectorLabels | object | `{}` | Allow adding additional match labels |
| service.main.ipFamilies | list | `[]` | The ip families that should be used. Options: IPv4, IPv6 | | service.main.ipFamilies | list | `[]` | The ip families that should be used. Options: IPv4, IPv6 |
| service.main.ipFamilyPolicy | string | `nil` | Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack | | service.main.ipFamilyPolicy | string | `nil` | Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack |
| service.main.labels | object | `{}` | Provide additional labels which may be required. | | service.main.labels | object | `{}` | Provide additional labels which may be required. |
| service.main.nameOverride | string | `nil` | Override the name suffix that is used for this service | | service.main.nameOverride | string | `nil` | Override the name suffix that is used for this service |
| service.main.ports | object | See below | Configure the Service port information here. Additional ports can be added by adding a dictionary key similar to the 'http' service. | | service.main.ports | object | See below | Configure the Service port information here. Additional ports can be added by adding a dictionary key similar to the 'http' service. |
| service.main.ports.http.enabled | bool | `true` | Enables or disables the port | | service.main.ports.http.enabled | bool | `true` | Enables or disables the port |
| service.main.ports.http.extraSelectorLabels | object | `{}` | Allow adding additional match labels |
| service.main.ports.http.nodePort | string | `nil` | Specify the nodePort value for the LoadBalancer and NodePort service types. [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) | | service.main.ports.http.nodePort | string | `nil` | Specify the nodePort value for the LoadBalancer and NodePort service types. [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) |
| service.main.ports.http.port | string | `nil` | The port number | | service.main.ports.http.port | string | `nil` | The port number |
| service.main.ports.http.primary | bool | `true` | Make this the primary port (used in probes, notes, etc...) If there is more than 1 service, make sure that only 1 port is marked as primary. | | service.main.ports.http.primary | bool | `true` | Make this the primary port (used in probes, notes, etc...) If there is more than 1 service, make sure that only 1 port is marked as primary. |
| service.main.ports.http.protocol | string | `"HTTP"` | Port protocol. Support values are `HTTP`, `HTTPS`, `TCP` and `UDP`. HTTPS and HTTPS spawn a TCP service and get used for internal URL and name generation | | service.main.ports.http.protocol | string | `"HTTP"` | Port protocol. Support values are `HTTP`, `HTTPS`, `TCP` and `UDP`. HTTP and HTTPS spawn a TCP service and get used for internal URL and name generation |
| service.main.ports.http.targetPort | string | `nil` | Specify a service targetPort if you wish to differ the service port from the application port. If `targetPort` is specified, this port number is used in the container definition instead of the `port` value. Therefore named ports are not supported for this field. | | service.main.ports.http.targetPort | string | `nil` | Specify a service targetPort if you wish to differ the service port from the application port. If `targetPort` is specified, this port number is used in the container definition instead of the `port` value. Therefore named ports are not supported for this field. |
| service.main.primary | bool | `true` | Make this the primary service (used in probes, notes, etc...). If there is more than 1 service, make sure that only 1 service is marked as primary. | | service.main.primary | bool | `true` | Make this the primary service for this controller (used in probes, notes, etc...). If there is more than 1 service targeting the controller, make sure that only 1 service is marked as primary. |
| service.main.type | string | `"ClusterIP"` | Set the service type | | service.main.type | string | `"ClusterIP"` | Set the service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `false` | Specifies whether a service account should be created | | serviceAccount.create | bool | `false` | Specifies whether a service account should be created |
| serviceAccount.labels | object | `{}` | Labels to add to the service account |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | | serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| serviceMonitor | object | See below | Configure the ServiceMonitors for the chart here. Additional ServiceMonitors can be added by adding a dictionary key similar to the 'main' ServiceMonitors. | | serviceMonitor | object | See below | Configure the ServiceMonitors for the chart here. Additional ServiceMonitors can be added by adding a dictionary key similar to the 'main' ServiceMonitors. |
| serviceMonitor.main.annotations | object | `{}` | Provide additional annotations which may be required. | | serviceMonitor.main.annotations | object | `{}` | Provide additional annotations which may be required. |
@ -237,13 +200,6 @@ N/A
| serviceMonitor.main.nameOverride | string | `nil` | Override the name suffix that is used for this serviceMonitor. | | serviceMonitor.main.nameOverride | string | `nil` | Override the name suffix that is used for this serviceMonitor. |
| serviceMonitor.main.selector | object | `{}` | Configures a custom selector for the serviceMonitor, this takes precedence over specifying a service name. Helm templates can be used. | | serviceMonitor.main.selector | object | `{}` | Configures a custom selector for the serviceMonitor, this takes precedence over specifying a service name. Helm templates can be used. |
| serviceMonitor.main.serviceName | string | `"{{ include \"bjw-s.common.lib.chart.names.fullname\" $ }}"` | Configures the target Service for the serviceMonitor. Helm templates can be used. | | serviceMonitor.main.serviceName | string | `"{{ include \"bjw-s.common.lib.chart.names.fullname\" $ }}"` | Configures the target Service for the serviceMonitor. Helm templates can be used. |
| sidecars | object | `{}` | Specify any sidecar containers here as dictionary items. Each sidecar container should have its own key. The dictionary item key will determine the order. Helm templates can be used. |
| termination.gracePeriodSeconds | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] |
| termination.messagePath | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| termination.messagePolicy | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| tolerations | list | `[]` | Specify taint tolerations [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
| topologySpreadConstraints | list | `[]` | Defines topologySpreadConstraint rules. [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) |
| volumeClaimTemplates | list | `[]` | Used in conjunction with `controller.type: statefulset` to create individual disks for each instance. |
## Support ## Support

View file

@ -1,46 +0,0 @@
{{/*
Template to render code-server addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "bjw-s.common.addon.codeserver" -}}
{{- if .Values.addons.codeserver.enabled -}}
{{/* Append the code-server container to the sidecars */}}
{{- $container := include "bjw-s.common.addon.codeserver.container" . | fromYaml -}}
{{- if $container -}}
{{- $_ := set .Values.sidecars "addon-codeserver" $container -}}
{{- end -}}
{{/* Include the deployKeySecret if not empty */}}
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 -}}
{{- $deployKeySecret := include "bjw-s.common.addon.codeserver.deployKeySecret" . -}}
{{- if $deployKeySecret -}}
{{- $_ := set .Values.secrets "addon-codeserver-deploykey" (dict "enabled" true "stringData" ($deployKeySecret | fromYaml)) -}}
{{- end -}}
{{- end -}}
{{/* Append the secret volume to the volumes */}}
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }}
{{- $volume := include "bjw-s.common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}}
{{- if $volume -}}
{{- $_ := set .Values.persistence "deploykey" (dict "enabled" true "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
{{- end -}}
{{- end -}}
{{/* Add the code-server service */}}
{{- if .Values.addons.codeserver.service.enabled -}}
{{- $serviceValues := .Values.addons.codeserver.service -}}
{{- $_ := set $serviceValues "nameOverride" "addon-codeserver" -}}
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
{{- include "bjw-s.common.class.service" $ -}}
{{- $_ := unset $.ObjectValues "service" -}}
{{- end -}}
{{/* Add the code-server ingress */}}
{{- $svcName := printf "%v-addon-codeserver" (include "bjw-s.common.lib.chart.names.fullname" .) -}}
{{- $svcPort := .Values.addons.codeserver.service.ports.codeserver.port -}}
{{- range $_, $host := .Values.addons.codeserver.ingress.hosts -}}
{{- $_ := set (index $host.paths 0) "service" (dict "name" $svcName "port" $svcPort) -}}
{{- end -}}
{{- $_ := set .Values.ingress "addon-codeserver" .Values.addons.codeserver.ingress -}}
{{- end -}}
{{- end -}}

View file

@ -1,46 +0,0 @@
{{/*
The code-server sidecar container to be inserted.
*/}}
{{- define "bjw-s.common.addon.codeserver.container" -}}
{{- if lt (len .Values.addons.codeserver.volumeMounts) 1 }}
{{- fail "At least 1 volumeMount is required for codeserver container" }}
{{- end -}}
name: codeserver
image: "{{ .Values.addons.codeserver.image.repository }}:{{ .Values.addons.codeserver.image.tag }}"
imagePullPolicy: {{ .Values.addons.codeserver.pullPolicy }}
{{- with .Values.addons.codeserver.securityContext }}
securityContext:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.addons.codeserver.env }}
env:
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
ports:
- name: codeserver
containerPort: {{ .Values.addons.codeserver.service.ports.codeserver.port }}
protocol: TCP
args:
{{- range .Values.addons.codeserver.args }}
- {{ . | quote }}
{{- end }}
- "--port"
- "{{ .Values.addons.codeserver.service.ports.codeserver.port }}"
- {{ .Values.addons.codeserver.workingDir | default (first .Values.addons.codeserver.volumeMounts).mountPath }}
volumeMounts:
{{- with .Values.addons.codeserver.volumeMounts }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }}
- name: deploykey
mountPath: /root/.ssh/id_rsa
subPath: id_rsa
{{- end }}
{{- with .Values.addons.codeserver.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -1,10 +0,0 @@
{{/*
The deployKey secret to be included.
*/}}
{{- define "bjw-s.common.addon.codeserver.deployKeySecret" -}}
{{- $deployKeyValue := .Values.addons.codeserver.git.deployKey -}}
{{- if .Values.addons.codeserver.git.deployKeyBase64 -}}
{{- $deployKeyValue = .Values.addons.codeserver.git.deployKeyBase64 | b64dec -}}
{{- end -}}
id_rsa: {{ $deployKeyValue | quote }}
{{- end -}}

View file

@ -1,15 +0,0 @@
{{/*
The volume (referencing git deploykey) to be inserted into additionalVolumes.
*/}}
{{- define "bjw-s.common.addon.codeserver.deployKeyVolumeSpec" -}}
secret:
{{- if .Values.addons.codeserver.git.deployKeySecret }}
secretName: {{ .Values.addons.codeserver.git.deployKeySecret }}
{{- else }}
secretName: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-addon-codeserver-deploykey
{{- end }}
defaultMode: {{ "0400" | toDecimal }}
items:
- key: id_rsa
path: id_rsa
{{- end -}}

View file

@ -1,13 +0,0 @@
{{/*
Template to render netshoot addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "bjw-s.common.addon.netshoot" -}}
{{- if .Values.addons.netshoot.enabled -}}
{{/* Append the netshoot container to the sidecars */}}
{{- $container := include "bjw-s.common.addon.netshoot.container" . | fromYaml -}}
{{- if $container -}}
{{- $_ := set .Values.sidecars "addon-netshoot" $container -}}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -1,27 +0,0 @@
{{/*
The netshoot sidecar container to be inserted.
*/}}
{{- define "bjw-s.common.addon.netshoot.container" -}}
name: netshoot
image: "{{ .Values.addons.netshoot.image.repository }}:{{ .Values.addons.netshoot.image.tag }}"
imagePullPolicy: {{ .Values.addons.netshoot.pullPolicy }}
{{- with .Values.addons.netshoot.securityContext }}
securityContext:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.addons.netshoot.env }}
env:
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
command:
- /bin/sh
- -c
- sleep infinity
{{- with .Values.addons.netshoot.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -1,45 +0,0 @@
{{/*
Template to render VPN addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "bjw-s.common.addon.vpn" -}}
{{- if .Values.addons.vpn.enabled -}}
{{- if eq "gluetun" .Values.addons.vpn.type -}}
{{- include "bjw-s.common.addon.gluetun" . }}
{{- end -}}
{{/* Include the configmap if not empty */}}
{{- if or .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down }}
{{- $configmap := include "bjw-s.common.addon.vpn.configmap" . -}}
{{- if $configmap -}}
{{- $_ := set .Values.configMaps "addon-vpn" (dict "enabled" true "data" ($configmap | fromYaml)) -}}
{{- end -}}
{{- end -}}
{{/* Include the secret if not empty */}}
{{- if and .Values.addons.vpn.configFile (not .Values.addons.vpn.configFileSecret) }}
{{- $secret := include "bjw-s.common.addon.vpn.secret" . -}}
{{- if $secret -}}
{{- $_ := set .Values.secrets "addon-vpn-config" (dict "enabled" true "stringData" ($secret | fromYaml)) -}}
{{- end -}}
{{- end -}}
{{/* Append the vpn scripts volume to the volumes */}}
{{- $scriptVolume := include "bjw-s.common.addon.vpn.scriptsVolumeSpec" . | fromYaml -}}
{{- if $scriptVolume -}}
{{- $_ := set .Values.persistence "vpnscript" (dict "enabled" true "mountPath" "-" "type" "custom" "volumeSpec" $scriptVolume) -}}
{{- end -}}
{{/* Append the vpn config volume to the volumes */}}
{{- $configVolume := include "bjw-s.common.addon.vpn.configVolumeSpec" . | fromYaml }}
{{ if $configVolume -}}
{{- $_ := set .Values.persistence "vpnconfig" (dict "enabled" true "mountPath" "-" "type" "custom" "volumeSpec" $configVolume) -}}
{{- end -}}
{{/* Include the networkpolicy if not empty */}}
{{- $networkpolicy := include "bjw-s.common.addon.vpn.networkpolicy" . -}}
{{- if $networkpolicy -}}
{{- $networkpolicy | nindent 0 -}}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -1,14 +0,0 @@
{{/*
The VPN config and scripts to be included.
*/}}
{{- define "bjw-s.common.addon.vpn.configmap" -}}
{{- with .Values.addons.vpn.scripts.up }}
up.sh: |-
{{- . | nindent 2}}
{{- end }}
{{- with .Values.addons.vpn.scripts.down }}
down.sh: |-
{{- . | nindent 2}}
{{- end -}}
{{- end -}}

View file

@ -1,29 +0,0 @@
{{/*
Blueprint for the NetworkPolicy object that can be included in the addon.
*/}}
{{- define "bjw-s.common.addon.vpn.networkpolicy" -}}
{{- if .Values.addons.vpn.networkPolicy.enabled }}
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}
{{- with (merge (.Values.addons.vpn.networkPolicy.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
labels: {{- toYaml . | nindent 4 }}
{{- end }}
{{- with (merge (.Values.addons.vpn.networkPolicy.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
podSelector:
{{- with (merge .Values.addons.vpn.networkPolicy.podSelectorLabels (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }}
matchLabels: {{- toYaml . | nindent 6 }}
{{- end }}
policyTypes:
- Egress
egress:
{{- with .Values.addons.vpn.networkPolicy.egress }}
{{- . | toYaml | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -1,9 +0,0 @@
{{/*
The OpenVPN config secret to be included.
*/}}
{{- define "bjw-s.common.addon.vpn.secret" -}}
{{- if and .Values.addons.vpn.configFile (not .Values.addons.vpn.configFileSecret) -}}
vpnConfigfile: |-
{{- .Values.addons.vpn.configFile | nindent 2 }}
{{- end -}}
{{- end -}}

View file

@ -1,37 +0,0 @@
{{/*
The volume (referencing VPN scripts) to be inserted into additionalVolumes.
*/}}
{{- define "bjw-s.common.addon.vpn.scriptsVolumeSpec" -}}
{{- if or .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}}
configMap:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-addon-vpn
items:
{{- if .Values.addons.vpn.scripts.up }}
- key: up.sh
path: up.sh
mode: 0777
{{- end }}
{{- if .Values.addons.vpn.scripts.down }}
- key: down.sh
path: down.sh
mode: 0777
{{- end }}
{{- end -}}
{{- end -}}
{{/*
The volume (referencing VPN config) to be inserted into additionalVolumes.
*/}}
{{- define "bjw-s.common.addon.vpn.configVolumeSpec" -}}
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret -}}
secret:
{{- if .Values.addons.vpn.configFileSecret }}
secretName: {{ .Values.addons.vpn.configFileSecret }}
{{- else }}
secretName: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-addon-vpn-config
{{- end }}
items:
- key: vpnConfigfile
path: vpnConfigfile
{{- end -}}
{{- end -}}

View file

@ -1,11 +0,0 @@
{{/*
Template to render gluetun addon. It will add the container to the list of additionalContainers.
*/}}
*/}}
{{- define "bjw-s.common.addon.gluetun" -}}
{{/* Append the gluetun container to the sidecars */}}
{{- $container := fromYaml (include "bjw-s.common.addon.gluetun.container" .) -}}
{{- if $container -}}
{{- $_ := set .Values.sidecars "addon-gluetun" $container -}}
{{- end -}}
{{- end -}}

View file

@ -1,57 +0,0 @@
{{/*
The gluetun sidecar container to be inserted.
*/}}
{{- define "bjw-s.common.addon.gluetun.container" -}}
name: gluetun
image: "{{ .Values.addons.vpn.gluetun.image.repository }}:{{ .Values.addons.vpn.gluetun.image.tag }}"
imagePullPolicy: {{ .Values.addons.vpn.gluetun.pullPolicy }}
{{- with .Values.addons.vpn.securityContext }}
securityContext:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.addons.vpn.env }}
env:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- with .Values.addons.vpn.envFrom }}
envFrom:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- with .Values.addons.vpn.args }}
args:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }}
volumeMounts:
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.configFileSecret }}
- name: vpnconfig
mountPath: /gluetun/config.conf
subPath: vpnConfigfile
{{- end }}
{{- if .Values.addons.vpn.scripts.up }}
- name: vpnscript
mountPath: /gluetun/scripts/up.sh
subPath: up.sh
{{- end }}
{{- if .Values.addons.vpn.scripts.down }}
- name: vpnscript
mountPath: /gluetun/scripts/down.sh
subPath: down.sh
{{- end }}
{{- if .Values.persistence.shared.enabled }}
- mountPath: {{ .Values.persistence.shared.mountPath }}
name: shared
{{- end }}
{{- with .Values.addons.vpn.additionalVolumeMounts }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
{{- with .Values.addons.vpn.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- with .Values.addons.vpn.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -2,33 +2,31 @@
This template serves as a blueprint for all configMap objects that are created This template serves as a blueprint for all configMap objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.configmap" -}} {{- define "bjw-s.common.class.configMap" -}}
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}} {{- $rootContext := .rootContext -}}
{{- $configMapName := $fullName -}} {{- $configMapObject := .object -}}
{{- $values := .Values.configmap -}}
{{- if hasKey . "ObjectValues" -}} {{- $labels := merge
{{- with .ObjectValues.configmap -}} ($configMapObject.labels | default dict)
{{- $values = . -}} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{- end -}} -}}
{{ end -}} {{- $annotations := merge
($configMapObject.annotations | default dict)
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} (include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
{{- $configMapName = printf "%v-%v" $configMapName $values.nameOverride -}} -}}
{{- end }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ $configMapName }} name: {{ $configMapObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
data: data:
{{- with $values.data }} {{- with $configMapObject.data }}
{{- tpl (toYaml .) $ | nindent 2 }} {{- tpl (toYaml .) $rootContext | nindent 2 }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -3,45 +3,48 @@ This template serves as a blueprint for Cronjob objects that are created
using the common library. using the common library.
*/}} */}}
{{- define "bjw-s.common.class.cronjob" -}} {{- define "bjw-s.common.class.cronjob" -}}
{{- $restartPolicy := default "Never" .Values.controller.restartPolicy -}} {{- $rootContext := .rootContext -}}
{{- if and (ne $restartPolicy "Never") (ne $restartPolicy "OnFailure") -}} {{- $cronjobObject := .object -}}
{{- fail (printf "Not a valid restartPolicy for CronJob (%s)" $restartPolicy) -}}
{{- end -}} {{- $labels := merge
{{- $_ := set .Values.controller "restartPolicy" $restartPolicy -}} (dict "app.kubernetes.io/component" $cronjobObject.identifier)
($cronjobObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($cronjobObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: batch/v1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} name: {{ $cronjobObject.name }}
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }} {{- with $labels }}
labels: {{- . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }} {{- with $annotations }}
annotations: {{- . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
concurrencyPolicy: "{{ .Values.controller.cronjob.concurrencyPolicy }}" concurrencyPolicy: "{{ $cronjobObject.cronjob.concurrencyPolicy }}"
startingDeadlineSeconds: {{ .Values.controller.cronjob.startingDeadlineSeconds }} startingDeadlineSeconds: {{ $cronjobObject.cronjob.startingDeadlineSeconds }}
schedule: "{{ .Values.controller.cronjob.schedule }}" schedule: "{{ $cronjobObject.cronjob.schedule }}"
successfulJobsHistoryLimit: {{ .Values.controller.cronjob.successfulJobsHistory }} successfulJobsHistoryLimit: {{ $cronjobObject.cronjob.successfulJobsHistory }}
failedJobsHistoryLimit: {{ .Values.controller.cronjob.failedJobsHistory }} failedJobsHistoryLimit: {{ $cronjobObject.cronjob.failedJobsHistory }}
jobTemplate: jobTemplate:
spec: spec:
{{- with .Values.controller.cronjob.ttlSecondsAfterFinished }} {{- with $cronjobObject.cronjob.ttlSecondsAfterFinished }}
ttlSecondsAfterFinished: {{ . }} ttlSecondsAfterFinished: {{ . }}
{{- end }} {{- end }}
backoffLimit: {{ .Values.controller.cronjob.backoffLimit }} backoffLimit: {{ $cronjobObject.cronjob.backoffLimit }}
template: template:
metadata: metadata:
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }} {{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
annotations: annotations: {{ . | nindent 12 }}
{{- . | nindent 12 }} {{- end -}}
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $cronjobObject)) }}
labels: {{ . | nindent 12 }}
{{- end }} {{- end }}
labels: spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $cronjobObject) | nindent 10 }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 12 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 12 }}
{{- end }}
spec:
{{- include "bjw-s.common.lib.controller.pod" . | nindent 10 }}
{{- end -}} {{- end -}}

View file

@ -3,33 +3,38 @@ This template serves as the blueprint for the DaemonSet objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.daemonset" -}} {{- define "bjw-s.common.class.daemonset" -}}
{{- $rootContext := .rootContext -}}
{{- $daemonsetObject := .object -}}
{{- $labels := merge
(dict "app.kubernetes.io/component" $daemonsetObject.identifier)
($daemonsetObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($daemonsetObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} name: {{ $daemonsetObject.name }}
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }} {{- with $labels }}
labels: {{- . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }} {{- with $annotations }}
annotations: {{- . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} revisionHistoryLimit: {{ $daemonsetObject.revisionHistoryLimit }}
selector: selector:
matchLabels: matchLabels:
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: {{ $daemonsetObject.identifier }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
template: template:
metadata: metadata:
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }} annotations: {{ include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 8 }}
annotations: labels: {{ include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 8 }}
{{- . | nindent 8 }} spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $daemonsetObject) | nindent 6 }}
{{- end }}
labels:
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
{{- end }} {{- end }}

View file

@ -3,30 +3,38 @@ This template serves as a blueprint for Deployment objects that are created
using the common library. using the common library.
*/}} */}}
{{- define "bjw-s.common.class.deployment" -}} {{- define "bjw-s.common.class.deployment" -}}
{{- $strategy := default "Recreate" .Values.controller.strategy -}} {{- $rootContext := .rootContext -}}
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") -}} {{- $deploymentObject := .object -}}
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) -}}
{{- end -}} {{- $labels := merge
(dict "app.kubernetes.io/component" $deploymentObject.identifier)
($deploymentObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($deploymentObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} name: {{ $deploymentObject.name }}
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }} {{- with $labels }}
labels: {{- . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }} {{- with $annotations }}
annotations: {{- . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} revisionHistoryLimit: {{ $deploymentObject.revisionHistoryLimit }}
{{- if not (eq .Values.controller.replicas nil) }} {{- if not (eq $deploymentObject.replicas nil) }}
replicas: {{ .Values.controller.replicas }} replicas: {{ $deploymentObject.replicas }}
{{- end }} {{- end }}
strategy: strategy:
type: {{ $strategy }} type: {{ $deploymentObject.strategy }}
{{- with .Values.controller.rollingUpdate }} {{- with $deploymentObject.rollingUpdate }}
{{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }} {{- if and (eq $deploymentObject.strategy "RollingUpdate") (or .surge .unavailable) }}
rollingUpdate: rollingUpdate:
{{- with .unavailable }} {{- with .unavailable }}
maxUnavailable: {{ . }} maxUnavailable: {{ . }}
@ -38,18 +46,15 @@ spec:
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: {{ $deploymentObject.identifier }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
template: template:
metadata: metadata:
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }} {{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $deploymentObject)) }}
annotations: annotations: {{ . | nindent 8 }}
{{- . | nindent 8 }} {{- end -}}
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $deploymentObject)) }}
labels: {{ . | nindent 8 }}
{{- end }} {{- end }}
labels: spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $deploymentObject) | nindent 6 }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
{{- end -}} {{- end -}}

View file

@ -2,74 +2,65 @@
This template serves as a blueprint for all Ingress objects that are created This template serves as a blueprint for all Ingress objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.ingress" -}} {{- define "bjw-s.common.class.ingress" -}}
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}} {{- $rootContext := .rootContext -}}
{{- $ingressName := $fullName -}} {{- $ingressObject := .object -}}
{{- $values := .Values.ingress -}}
{{- if hasKey . "ObjectValues" -}} {{- $labels := merge
{{- with .ObjectValues.ingress -}} ($ingressObject.labels | default dict)
{{- $values = . -}} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{- end -}} -}}
{{ end -}} {{- $annotations := merge
($ingressObject.annotations | default dict)
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} (include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
{{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} -}}
{{- end -}}
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}}
{{- $defaultServiceName := $fullName -}}
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
{{- end -}}
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $ingressName }} name: {{ $ingressObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
{{- if $values.ingressClassName }} {{- if $ingressObject.className }}
ingressClassName: {{ $values.ingressClassName }} ingressClassName: {{ $ingressObject.className }}
{{- end }} {{- end }}
{{- if $values.tls }} {{- if $ingressObject.tls }}
tls: tls:
{{- range $values.tls }} {{- range $ingressObject.tls }}
- hosts: - hosts:
{{- range .hosts }} {{- range .hosts }}
- {{ tpl . $ | quote }} - {{ tpl . $rootContext | quote }}
{{- end }} {{- end }}
{{- $secretName := tpl (default "" .secretName) $ }} {{- $secretName := tpl (default "" .secretName) $rootContext }}
{{- if $secretName }} {{- if $secretName }}
secretName: {{ $secretName | quote}} secretName: {{ $secretName | quote}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range $values.hosts }} {{- range $ingressObject.hosts }}
- host: {{ tpl .host $ | quote }} - host: {{ tpl .host $rootContext | quote }}
http: http:
paths: paths:
{{- range .paths }} {{- range .paths }}
{{- $service := $defaultServiceName -}} - path: {{ tpl .path $rootContext | quote }}
{{- $port := $defaultServicePort.port -}}
{{- if .service -}}
{{- $service = default $service .service.name -}}
{{- $port = default $port .service.port -}}
{{- end }}
- path: {{ tpl .path $ | quote }}
pathType: {{ default "Prefix" .pathType }} pathType: {{ default "Prefix" .pathType }}
backend: backend:
service: service:
name: {{ $service }} {{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .service.name) | fromYaml -}}
{{ $servicePrimaryPort := dict -}}
{{ if $service -}}
{{ $servicePrimaryPort = include "bjw-s.common.lib.service.primaryPort" (dict "rootContext" $rootContext "serviceObject" $service) | fromYaml -}}
{{ end -}}
name: {{ default .service.name $service.name }}
port: port:
number: {{ $port }} number: {{ default .service.port $servicePrimaryPort.port }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -3,43 +3,45 @@ This template serves as a blueprint for all PersistentVolumeClaim objects that a
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.pvc" -}} {{- define "bjw-s.common.class.pvc" -}}
{{- $values := .Values.persistence -}} {{- $rootContext := .rootContext -}}
{{- if hasKey . "ObjectValues" -}} {{- $pvcObject := .object -}}
{{- with .ObjectValues.persistence -}}
{{- $values = . -}} {{- $labels := merge
($pvcObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($pvcObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- if $pvcObject.retain }}
{{- $annotations = merge
(dict "helm.sh/resource-policy" "keep")
$annotations
-}}
{{- end -}} {{- end -}}
{{ end -}}
{{- $pvcName := include "bjw-s.common.lib.chart.names.fullname" . -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
{{- if not (eq $values.nameOverride "-") -}}
{{- $pvcName = printf "%v-%v" $pvcName $values.nameOverride -}}
{{ end -}}
{{ end }}
--- ---
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
apiVersion: v1 apiVersion: v1
metadata: metadata:
name: {{ $pvcName }} name: {{ $pvcObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
annotations:
{{- if $values.retain }}
"helm.sh/resource-policy": keep
{{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
accessModes: accessModes:
- {{ required (printf "accessMode is required for PVC %v" $pvcName) $values.accessMode | quote }} - {{ required (printf "accessMode is required for PVC %v" $pvcObject.name) $pvcObject.accessMode | quote }}
resources: resources:
requests: requests:
storage: {{ required (printf "size is required for PVC %v" $pvcName) $values.size | quote }} storage: {{ required (printf "size is required for PVC %v" $pvcObject.name) $pvcObject.size | quote }}
{{- if $values.storageClass }} {{- if $pvcObject.storageClass }}
storageClassName: {{ if (eq "-" $values.storageClass) }}""{{- else }}{{ $values.storageClass | quote }}{{- end }} storageClassName: {{ if (eq "-" $pvcObject.storageClass) }}""{{- else }}{{ $pvcObject.storageClass | quote }}{{- end }}
{{- end }} {{- end }}
{{- if $values.volumeName }} {{- if $pvcObject.volumeName }}
volumeName: {{ $values.volumeName | quote }} volumeName: {{ $pvcObject.volumeName | quote }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -3,24 +3,18 @@ This template serves as a blueprint for all Route objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.route" -}} {{- define "bjw-s.common.class.route" -}}
{{- $values := .Values.route -}} {{- $rootContext := .rootContext -}}
{{- if hasKey . "ObjectValues" -}} {{- $routeObject := .object -}}
{{- with .ObjectValues.route -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}} {{- $routeKind := $routeObject.kind | default "HTTPRoute" -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} {{- $labels := merge
{{- $fullName = printf "%v-%v" $fullName $values.nameOverride -}} ($routeObject.labels | default dict)
{{ end -}} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{- $routeKind := $values.kind | default "HTTPRoute" -}} -}}
{{- $primaryService := get .Values.service (include "bjw-s.common.lib.service.primary" .) -}} {{- $annotations := merge
{{- $defaultServiceName := $fullName -}} ($routeObject.annotations | default dict)
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}} (include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}} -}}
{{- end -}}
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
--- ---
apiVersion: gateway.networking.k8s.io/v1alpha2 apiVersion: gateway.networking.k8s.io/v1alpha2
{{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }} {{- if and (ne $routeKind "GRPCRoute") (ne $routeKind "HTTPRoute") (ne $routeKind "TCPRoute") (ne $routeKind "TLSRoute") (ne $routeKind "UDPRoute") }}
@ -28,39 +22,44 @@ apiVersion: gateway.networking.k8s.io/v1alpha2
{{- end }} {{- end }}
kind: {{ $routeKind }} kind: {{ $routeKind }}
metadata: metadata:
name: {{ $fullName }} name: {{ $routeObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
parentRefs: parentRefs:
{{- range $values.parentRefs }} {{- range $routeObject.parentRefs }}
- group: {{ default "gateway.networking.k8s.io" .group }} - group: {{ default "gateway.networking.k8s.io" .group }}
kind: {{ default "Gateway" .kind }} kind: {{ default "Gateway" .kind }}
name: {{ required (printf "parentRef name is required for %v %v" $routeKind $fullName) .name }} name: {{ required (printf "parentRef name is required for %v %v" $routeKind $routeObject.name) .name }}
namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $fullName) .namespace }} namespace: {{ required (printf "parentRef namespace is required for %v %v" $routeKind $routeObject.name) .namespace }}
{{- if .sectionName }} {{- if .sectionName }}
sectionName: {{ .sectionName | quote }} sectionName: {{ .sectionName | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $values.hostnames }} {{- if and (ne $routeKind "TCPRoute") (ne $routeKind "UDPRoute") $routeObject.hostnames }}
hostnames: hostnames:
{{- with $values.hostnames }} {{- with $routeObject.hostnames }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range $values.rules }} {{- range $routeObject.rules }}
- backendRefs: - backendRefs:
{{- range .backendRefs }} {{- range .backendRefs }}
{{ $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .name) | fromYaml -}}
{{ $servicePrimaryPort := dict -}}
{{ if $service -}}
{{ $servicePrimaryPort = include "bjw-s.common.lib.service.primaryPort" (dict "rootContext" $rootContext "serviceObject" $service) | fromYaml -}}
{{- end }}
- group: {{ default "" .group | quote}} - group: {{ default "" .group | quote}}
kind: {{ default "Service" .kind }} kind: {{ default "Service" .kind }}
name: {{ default $defaultServiceName .name }} name: {{ default .name $service.name }}
namespace: {{ default $.Release.Namespace .namespace }} namespace: {{ default $rootContext.Release.Namespace .namespace }}
port: {{ default $defaultServicePort.port .port }} port: {{ default .port $servicePrimaryPort.port }}
weight: {{ default 1 .weight }} weight: {{ default 1 .weight }}
{{- end }} {{- end }}
{{- if (eq $routeKind "HTTPRoute") }} {{- if (eq $routeKind "HTTPRoute") }}

View file

@ -3,35 +3,37 @@ This template serves as a blueprint for all Secret objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.secret" -}} {{- define "bjw-s.common.class.secret" -}}
{{- $fullName := include "bjw-s.common.lib.chart.names.fullname" . -}} {{- $rootContext := .rootContext -}}
{{- $secretName := $fullName -}} {{- $secretObject := .object -}}
{{- $values := .Values.configmap -}}
{{- if hasKey . "ObjectValues" -}} {{- $labels := merge
{{- with .ObjectValues.secret -}} ($secretObject.labels | default dict)
{{- $values = . -}} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{- end -}} -}}
{{ end -}} {{- $annotations := merge
($secretObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} {{- $stringData := "" -}}
{{- $secretName = printf "%v-%v" $secretName $values.nameOverride -}} {{- with $secretObject.stringData -}}
{{- end }} {{- $stringData = (toYaml $secretObject.stringData) | trim -}}
{{- end -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
{{- with $values.type }} {{- with $secretObject.type }}
type: {{ . }} type: {{ . }}
{{- end }} {{- end }}
metadata: metadata:
name: {{ $secretName }} name: {{ $secretObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with $values.stringData }} {{- with $stringData }}
stringData: stringData: {{- tpl $stringData $rootContext | nindent 2 }}
{{- tpl (toYaml .) $ | nindent 2 }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -3,83 +3,80 @@ This template serves as a blueprint for all Service objects that are created
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.service" -}} {{- define "bjw-s.common.class.service" -}}
{{- $values := .Values.service -}} {{- $rootContext := .rootContext -}}
{{- if hasKey . "ObjectValues" -}} {{- $serviceObject := .object -}}
{{- with .ObjectValues.service -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- $serviceName := include "bjw-s.common.lib.chart.names.fullname" . -}} {{- $svcType := $serviceObject.type | default "" -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} {{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "rootContext" $rootContext "serviceObject" $serviceObject) | fromYaml }}
{{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}} {{- $labels := merge
{{ end -}} (dict "app.kubernetes.io/service" $serviceObject.name)
{{- $svcType := $values.type | default "" -}} ($serviceObject.labels | default dict)
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "serviceName" $serviceName "values" $values) | fromYaml }} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{- $primaryPort := get $values.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $values)) }} -}}
{{- $annotations := merge
($serviceObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ $serviceName }} name: {{ $serviceObject.name }}
labels: {{- with $labels }}
app.kubernetes.io/service: {{ $serviceName }} labels: {{- toYaml . | nindent 4 -}}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- if eq ( $primaryPort.protocol | default "" ) "HTTPS" }}
traefik.ingress.kubernetes.io/service.serversscheme: https
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
{{ toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
{{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }} {{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }}
type: ClusterIP type: ClusterIP
{{- if $values.clusterIP }} {{- if $serviceObject.clusterIP }}
clusterIP: {{ $values.clusterIP }} clusterIP: {{ $serviceObject.clusterIP }}
{{end}} {{end}}
{{- else if eq $svcType "LoadBalancer" }} {{- else if eq $svcType "LoadBalancer" }}
type: {{ $svcType }} type: {{ $svcType }}
{{- if $values.loadBalancerIP }} {{- if $serviceObject.loadBalancerIP }}
loadBalancerIP: {{ $values.loadBalancerIP }} loadBalancerIP: {{ $serviceObject.loadBalancerIP }}
{{- end }} {{- end }}
{{- if $values.loadBalancerSourceRanges }} {{- if $serviceObject.loadBalancerSourceRanges }}
loadBalancerSourceRanges: loadBalancerSourceRanges:
{{ toYaml $values.loadBalancerSourceRanges | nindent 4 }} {{ toYaml $serviceObject.loadBalancerSourceRanges | nindent 4 }}
{{- end -}} {{- end -}}
{{- else }} {{- else }}
type: {{ $svcType }} type: {{ $svcType }}
{{- end }} {{- end }}
{{- if $values.externalTrafficPolicy }} {{- if $serviceObject.externalTrafficPolicy }}
externalTrafficPolicy: {{ $values.externalTrafficPolicy }} externalTrafficPolicy: {{ $serviceObject.externalTrafficPolicy }}
{{- end }} {{- end }}
{{- if $values.sessionAffinity }} {{- if hasKey $serviceObject "allocateLoadBalancerNodePorts" }}
sessionAffinity: {{ $values.sessionAffinity }} allocateLoadBalancerNodePorts: {{ $serviceObject.allocateLoadBalancerNodePorts }}
{{- if $values.sessionAffinityConfig }} {{- end }}
{{- if $serviceObject.sessionAffinity }}
sessionAffinity: {{ $serviceObject.sessionAffinity }}
{{- if $serviceObject.sessionAffinityConfig }}
sessionAffinityConfig: sessionAffinityConfig:
{{ toYaml $values.sessionAffinityConfig | nindent 4 }} {{ toYaml $serviceObject.sessionAffinityConfig | nindent 4 }}
{{- end -}} {{- end -}}
{{- end }} {{- end }}
{{- with $values.externalIPs }} {{- with $serviceObject.externalIPs }}
externalIPs: externalIPs:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if $values.publishNotReadyAddresses }} {{- if $serviceObject.publishNotReadyAddresses }}
publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }} publishNotReadyAddresses: {{ $serviceObject.publishNotReadyAddresses }}
{{- end }} {{- end }}
{{- if $values.ipFamilyPolicy }} {{- if $serviceObject.ipFamilyPolicy }}
ipFamilyPolicy: {{ $values.ipFamilyPolicy }} ipFamilyPolicy: {{ $serviceObject.ipFamilyPolicy }}
{{- end }} {{- end }}
{{- with $values.ipFamilies }} {{- with $serviceObject.ipFamilies }}
ipFamilies: ipFamilies:
{{ toYaml . | nindent 4 }} {{ toYaml . | nindent 4 }}
{{- end }} {{- end }}
ports: ports:
{{- range $name, $port := $enabledPorts }} {{- range $name, $port := $enabledPorts }}
- port: {{ $port.port }} - port: {{ $port.port }}
targetPort: {{ $port.targetPort | default $name }} targetPort: {{ $port.targetPort | default $port.port }}
{{- if $port.protocol }} {{- if $port.protocol }}
{{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }} {{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }}
protocol: TCP protocol: TCP
@ -94,7 +91,11 @@ spec:
nodePort: {{ $port.nodePort }} nodePort: {{ $port.nodePort }}
{{ end }} {{ end }}
{{- end -}} {{- end -}}
{{- with (merge ($values.extraSelectorLabels | default dict) (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }} {{- with (merge
($serviceObject.extraSelectorLabels | default dict)
(dict "app.kubernetes.io/component" $serviceObject.controller)
(include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | fromYaml)
) }}
selector: {{- toYaml . | nindent 4 }} selector: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -3,17 +3,28 @@ This template serves as a blueprint for ServiceAccount objects that are created
using the common library. using the common library.
*/}} */}}
{{- define "bjw-s.common.class.serviceAccount" -}} {{- define "bjw-s.common.class.serviceAccount" -}}
{{- $rootContext := .rootContext -}}
{{- $serviceAccountObject := .object -}}
{{- $labels := merge
($serviceAccountObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($serviceAccountObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.serviceAccountName" . }} name: {{ $serviceAccountObject.name }}
{{- with include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge (.Values.serviceAccount.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
secrets: secrets:
- name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-sa-token - name: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}-sa-token
{{- end -}} {{- end -}}

View file

@ -1,34 +1,33 @@
{{- define "bjw-s.common.class.serviceMonitor" -}} {{- define "bjw-s.common.class.serviceMonitor" -}}
{{- $values := dict -}} {{- $rootContext := .rootContext -}}
{{- if hasKey . "ObjectValues" -}} {{- $serviceMonitorObject := .object -}}
{{- with .ObjectValues.serviceMonitor -}} {{- $labels := merge
{{- $values = . -}} ($serviceMonitorObject.labels | default dict)
{{- end -}} (include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
{{ end -}} -}}
{{- $annotations := merge
{{- $serviceMonitorName := include "bjw-s.common.lib.chart.names.fullname" . -}} ($serviceMonitorObject.annotations | default dict)
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} (include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
{{- $serviceMonitorName = printf "%v-%v" $serviceMonitorName $values.nameOverride -}} -}}
{{ end -}}
--- ---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: {{ $serviceMonitorName }} name: {{ $serviceMonitorObject.name }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with $labels }}
labels: {{- toYaml . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with $annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
selector: selector:
{{- if $values.selector -}} {{- if $serviceMonitorObject.selector -}}
{{- tpl ($values.selector | toYaml) $ | nindent 4}} {{- tpl ($serviceMonitorObject.selector | toYaml) $rootContext | nindent 4}}
{{- else }} {{- else }}
matchLabels: matchLabels:
app.kubernetes.io/service: {{ tpl $values.serviceName $ }} app.kubernetes.io/service: {{ tpl $serviceMonitorObject.serviceName $rootContext }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }} {{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
{{- end }} {{- end }}
endpoints: {{- toYaml (required (printf "endpoints are required for serviceMonitor %v" $serviceMonitorName) $values.endpoints) | nindent 4 }} endpoints: {{- toYaml $serviceMonitorObject.endpoints | nindent 4 }}
{{- end }} {{- end }}

View file

@ -3,66 +3,54 @@ This template serves as the blueprint for the StatefulSet objects that are creat
within the common library. within the common library.
*/}} */}}
{{- define "bjw-s.common.class.statefulset" -}} {{- define "bjw-s.common.class.statefulset" -}}
{{- $strategy := default "RollingUpdate" .Values.controller.strategy -}} {{- $rootContext := .rootContext -}}
{{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") -}} {{- $statefulsetObject := .object -}}
{{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) -}}
{{- end -}} {{- $labels := merge
(dict "app.kubernetes.io/component" $statefulsetObject.identifier)
($statefulsetObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($statefulsetObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} name: {{ $statefulsetObject.name }}
{{- with include "bjw-s.common.lib.controller.metadata.labels" . }} {{- with $labels }}
labels: {{- . | nindent 4 }} labels: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
{{- with include "bjw-s.common.lib.controller.metadata.annotations" . }} {{- with $annotations }}
annotations: {{- . | nindent 4 }} annotations: {{- toYaml . | nindent 4 -}}
{{- end }} {{- end }}
spec: spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }} revisionHistoryLimit: {{ $statefulsetObject.revisionHistoryLimit }}
replicas: {{ .Values.controller.replicas }} replicas: {{ $statefulsetObject.replicas }}
podManagementPolicy: {{ default "OrderedReady" .Values.controller.podManagementPolicy }} podManagementPolicy: {{ default "OrderedReady" $statefulsetObject.statefulset.podManagementPolicy }}
updateStrategy: updateStrategy:
type: {{ $strategy }} type: {{ $statefulsetObject.strategy }}
{{- if and (eq $strategy "RollingUpdate") .Values.controller.rollingUpdate.partition }} {{- if and (eq $statefulsetObject.strategy "RollingUpdate") $statefulsetObject.rollingUpdate.partition }}
rollingUpdate: rollingUpdate:
partition: {{ .Values.controller.rollingUpdate.partition }} partition: {{ $statefulsetObject.rollingUpdate.partition }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: {{ $statefulsetObject.identifier }}
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" . }} {{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}
template: template:
metadata: metadata:
{{- with include ("bjw-s.common.lib.metadata.podAnnotations") . }} {{- with (include "bjw-s.common.lib.pod.metadata.annotations" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject)) }}
annotations: annotations: {{ . | nindent 8 }}
{{- . | nindent 8 }} {{- end -}}
{{- with (include "bjw-s.common.lib.pod.metadata.labels" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject)) }}
labels: {{ . | nindent 8 }}
{{- end }} {{- end }}
labels: spec: {{ include "bjw-s.common.lib.pod.spec" (dict "rootContext" $rootContext "controllerObject" $statefulsetObject) | nindent 6 }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 8 }} {{- with (include "bjw-s.common.lib.statefulset.volumeclaimtemplates" (dict "rootContext" $rootContext "statefulsetObject" $statefulsetObject)) }}
{{- with .Values.podLabels }} volumeClaimTemplates: {{ . | nindent 4 }}
{{- toYaml . | nindent 8 }} {{- end }}
{{- end }}
spec:
{{- include "bjw-s.common.lib.controller.pod" . | nindent 6 }}
volumeClaimTemplates:
{{- range $index, $volumeClaimTemplate := .Values.volumeClaimTemplates }}
- metadata:
name: {{ $volumeClaimTemplate.name }}
{{- with ($volumeClaimTemplate.labels | default dict) }}
labels: {{- toYaml . | nindent 10 }}
{{- end }}
{{- with ($volumeClaimTemplate.annotations | default dict) }}
annotations: {{- toYaml . | nindent 10 }}
{{- end }}
spec:
accessModes:
- {{ required (printf "accessMode is required for volumeClaimTemplate %v" $volumeClaimTemplate.name) $volumeClaimTemplate.accessMode | quote }}
resources:
requests:
storage: {{ required (printf "size is required for PVC %v" $volumeClaimTemplate.name) $volumeClaimTemplate.size | quote }}
{{- if $volumeClaimTemplate.storageClass }}
storageClassName: {{ if (eq "-" $volumeClaimTemplate.storageClass) }}""{{- else }}{{ $volumeClaimTemplate.storageClass | quote }}{{- end }}
{{- end }}
{{- end }}
{{- end }} {{- end }}

View file

@ -1,10 +1,9 @@
{{/* Expand the name of the chart */}} {{/* Expand the name of the chart */}}
{{- define "bjw-s.common.lib.chart.names.name" -}} {{- define "bjw-s.common.lib.chart.names.name" -}}
{{- $globalNameOverride := "" -}} {{- $globalNameOverride := get .Values.global "nameOverride" -}}
{{- if hasKey .Values "global" -}} {{- $nameOverride := get .Values "nameOverride" -}}
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}} {{- $name := $globalNameOverride | default $nameOverride | default .Chart.Name -}}
{{- end -}} {{- $name | toString | trunc 63 | trimSuffix "-" -}}
{{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* {{/*
@ -14,12 +13,11 @@ If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "bjw-s.common.lib.chart.names.fullname" -}} {{- define "bjw-s.common.lib.chart.names.fullname" -}}
{{- $name := include "bjw-s.common.lib.chart.names.name" . -}} {{- $name := include "bjw-s.common.lib.chart.names.name" . -}}
{{- $globalFullNameOverride := "" -}} {{- $globalFullNameOverride := get .Values.global "fullnameOverride" -}}
{{- if hasKey .Values "global" -}} {{- $fullNameOverride := get .Values "fullnameOverride" -}}
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}}
{{- end -}} {{- if or $fullNameOverride $globalFullNameOverride -}}
{{- if or .Values.fullnameOverride $globalFullNameOverride -}} {{- $name = ($globalFullNameOverride | default $fullNameOverride) -}}
{{- $name = default .Values.fullnameOverride $globalFullNameOverride -}}
{{- else -}} {{- else -}}
{{- if contains $name .Release.Name -}} {{- if contains $name .Release.Name -}}
{{- $name = .Release.Name -}} {{- $name = .Release.Name -}}
@ -27,19 +25,11 @@ If release name contains chart name it will be used as a full name.
{{- $name = printf "%s-%s" .Release.Name $name -}} {{- $name = printf "%s-%s" .Release.Name $name -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- trunc 63 $name | trimSuffix "-" -}}
{{- $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* Create chart name and version as used by the chart label */}} {{/* Create chart name and version as used by the chart label */}}
{{- define "bjw-s.common.lib.chart.names.chart" -}} {{- define "bjw-s.common.lib.chart.names.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/* Create the name of the ServiceAccount to use */}}
{{- define "bjw-s.common.lib.chart.names.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "bjw-s.common.lib.chart.names.fullname" .) .Values.serviceAccount.name -}}
{{- else -}}
{{- default "default" .Values.serviceAccount.name -}}
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,7 @@
{{/*
Validate configMap values
*/}}
{{- define "bjw-s.common.lib.configMap.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $configMapValues := .object -}}
{{- end -}}

View file

@ -0,0 +1,24 @@
{{/*
Convert configMap values to an object
*/}}
{{- define "bjw-s.common.lib.configMap.valuesToObject" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $objectValues := .values -}}
{{- /* Determine and inject the configMap name */ -}}
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
{{- if $objectValues.nameOverride -}}
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
{{- else -}}
{{- if ne $identifier "main" -}}
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
{{- end -}}
{{- end -}}
{{- $_ := set $objectValues "name" $objectName -}}
{{- $_ := set $objectValues "identifier" $identifier -}}
{{- /* Return the configMap object */ -}}
{{- $objectValues | toYaml -}}
{{- end -}}

View file

@ -1,15 +0,0 @@
{{/*
Image used by the main container.
*/}}
{{- define "bjw-s.common.lib.container.image" -}}
{{- $imageRepo := .Values.image.repository -}}
{{- $imageTag := default .Chart.AppVersion .Values.image.tag -}}
{{- if kindIs "float64" .Values.image.tag -}}
{{- $imageTag = .Values.image.tag | toString -}}
{{- end -}}
{{- if and $imageRepo $imageTag -}}
{{- printf "%s:%s" $imageRepo $imageTag -}}
{{- end -}}
{{- end -}}

View file

@ -1,43 +0,0 @@
{{/*
Environment variables used by containers.
*/}}
{{- define "bjw-s.common.lib.container.envVars" -}}
{{- $values := .Values.env -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.envVars -}}
{{- $values = . -}}
{{- end -}}
{{- end -}}
{{- with $values -}}
{{- $result := list -}}
{{- range $k, $v := . -}}
{{- $name := $k -}}
{{- $value := $v -}}
{{- if kindIs "int" $name -}}
{{- $name = required "environment variables as a list of maps require a name field" $value.name -}}
{{- end -}}
{{- if kindIs "map" $value -}}
{{- if hasKey $value "value" -}}
{{- $envValue := $value.value | toString -}}
{{- $result = append $result (dict "name" $name "value" (tpl $envValue $)) -}}
{{- else if hasKey $value "valueFrom" -}}
{{- $result = append $result (dict "name" $name "valueFrom" $value.valueFrom) -}}
{{- else -}}
{{- $result = append $result (dict "name" $name "valueFrom" $value) -}}
{{- end -}}
{{- end -}}
{{- if not (kindIs "map" $value) -}}
{{- if kindIs "string" $value -}}
{{- $result = append $result (dict "name" $name "value" (tpl $value $)) -}}
{{- else if or (kindIs "float64" $value) (kindIs "bool" $value) -}}
{{- $result = append $result (dict "name" $name "value" ($value | toString)) -}}
{{- else -}}
{{- $result = append $result (dict "name" $name "value" $value) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- toYaml (dict "env" $result) | nindent 0 -}}
{{- end -}}
{{- end -}}

Some files were not shown because too many files have changed in this diff Show more