mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common): Release v2.2.0 (#223)
This commit is contained in:
parent
8b21e9f6c7
commit
8bfc33eb8a
11 changed files with 244 additions and 47 deletions
|
@ -2,7 +2,6 @@ controllers:
|
||||||
main:
|
main:
|
||||||
containers:
|
containers:
|
||||||
main:
|
main:
|
||||||
order: 1
|
|
||||||
image:
|
image:
|
||||||
repository: ghcr.io/mendhak/http-https-echo
|
repository: ghcr.io/mendhak/http-https-echo
|
||||||
tag: 30
|
tag: 30
|
||||||
|
@ -21,6 +20,9 @@ controllers:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
a-container:
|
a-container:
|
||||||
|
dependsOn:
|
||||||
|
- main
|
||||||
|
- third-container
|
||||||
image:
|
image:
|
||||||
repository: ghcr.io/mendhak/http-https-echo
|
repository: ghcr.io/mendhak/http-https-echo
|
||||||
tag: 30
|
tag: 30
|
||||||
|
@ -29,6 +31,7 @@ controllers:
|
||||||
HTTPS_PORT: 9998
|
HTTPS_PORT: 9998
|
||||||
|
|
||||||
third-container:
|
third-container:
|
||||||
|
dependsOn: main
|
||||||
image:
|
image:
|
||||||
repository: ghcr.io/mendhak/http-https-echo
|
repository: ghcr.io/mendhak/http-https-echo
|
||||||
tag: 30
|
tag: 30
|
||||||
|
|
|
@ -19,7 +19,7 @@ tests:
|
||||||
- documentIndex: &DeploymentDocument 0
|
- documentIndex: &DeploymentDocument 0
|
||||||
isKind:
|
isKind:
|
||||||
of: Deployment
|
of: Deployment
|
||||||
- documentIndex: &DeploymentDocument 0
|
- documentIndex: *DeploymentDocument
|
||||||
lengthEqual:
|
lengthEqual:
|
||||||
path: spec.template.spec.containers
|
path: spec.template.spec.containers
|
||||||
count: 3
|
count: 3
|
||||||
|
@ -36,6 +36,7 @@ tests:
|
||||||
path: spec.template.spec.containers[2].name
|
path: spec.template.spec.containers[2].name
|
||||||
value: additional2
|
value: additional2
|
||||||
|
|
||||||
|
# TODO: Remove this test case after "order" removal in v3
|
||||||
- it: with custom order
|
- it: with custom order
|
||||||
set:
|
set:
|
||||||
controllers.main.containers:
|
controllers.main.containers:
|
||||||
|
@ -59,7 +60,7 @@ tests:
|
||||||
- documentIndex: &DeploymentDocument 0
|
- documentIndex: &DeploymentDocument 0
|
||||||
isKind:
|
isKind:
|
||||||
of: Deployment
|
of: Deployment
|
||||||
- documentIndex: &DeploymentDocument 0
|
- documentIndex: *DeploymentDocument
|
||||||
lengthEqual:
|
lengthEqual:
|
||||||
path: spec.template.spec.containers
|
path: spec.template.spec.containers
|
||||||
count: 4
|
count: 4
|
||||||
|
@ -79,3 +80,91 @@ tests:
|
||||||
equal:
|
equal:
|
||||||
path: spec.template.spec.containers[3].name
|
path: spec.template.spec.containers[3].name
|
||||||
value: additional3
|
value: additional3
|
||||||
|
|
||||||
|
- it: with dependsOn
|
||||||
|
set:
|
||||||
|
controllers.main.containers:
|
||||||
|
additional1:
|
||||||
|
dependsOn: additional3
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
additional2:
|
||||||
|
dependsOn: additional3
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
additional3:
|
||||||
|
dependsOn: main
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &DeploymentDocument 0
|
||||||
|
isKind:
|
||||||
|
of: Deployment
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
lengthEqual:
|
||||||
|
path: spec.template.spec.containers
|
||||||
|
count: 4
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[0].name
|
||||||
|
value: main
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[1].name
|
||||||
|
value: additional3
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[2].name
|
||||||
|
value: additional1
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[3].name
|
||||||
|
value: additional2
|
||||||
|
|
||||||
|
# TODO: Remove this test case after "order" removal in v3
|
||||||
|
- it: with both order and dependsOn
|
||||||
|
set:
|
||||||
|
controllers.main.containers:
|
||||||
|
additional1:
|
||||||
|
dependsOn: additional3
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
additional2:
|
||||||
|
dependsOn: additional3
|
||||||
|
order: 1
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
additional3:
|
||||||
|
dependsOn: main
|
||||||
|
image:
|
||||||
|
repository: test
|
||||||
|
tag: test
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &DeploymentDocument 0
|
||||||
|
isKind:
|
||||||
|
of: Deployment
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
lengthEqual:
|
||||||
|
path: spec.template.spec.containers
|
||||||
|
count: 4
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[0].name
|
||||||
|
value: main
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[1].name
|
||||||
|
value: additional3
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[2].name
|
||||||
|
value: additional1
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.containers[3].name
|
||||||
|
value: additional2
|
||||||
|
|
|
@ -60,6 +60,7 @@ tests:
|
||||||
notExists:
|
notExists:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers
|
||||||
|
|
||||||
|
# TODO: Remove this test case after "order" removal in v3
|
||||||
- it: custom order should pass
|
- it: custom order should pass
|
||||||
set:
|
set:
|
||||||
controllers.main.initContainers:
|
controllers.main.initContainers:
|
||||||
|
@ -89,3 +90,32 @@ tests:
|
||||||
equal:
|
equal:
|
||||||
path: spec.template.spec.initContainers[1].name
|
path: spec.template.spec.initContainers[1].name
|
||||||
value: init1
|
value: init1
|
||||||
|
|
||||||
|
- it: with dependsOn
|
||||||
|
set:
|
||||||
|
controllers.main.initContainers:
|
||||||
|
init1:
|
||||||
|
dependsOn: init2
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/mendhak/http-https-echo
|
||||||
|
tag: latest
|
||||||
|
init2:
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/mendhak/http-https-echo
|
||||||
|
tag: latest
|
||||||
|
asserts:
|
||||||
|
- documentIndex: &DeploymentDocument 0
|
||||||
|
isKind:
|
||||||
|
of: Deployment
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
lengthEqual:
|
||||||
|
path: spec.template.spec.initContainers
|
||||||
|
count: 2
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.initContainers[0].name
|
||||||
|
value: init2
|
||||||
|
- documentIndex: *DeploymentDocument
|
||||||
|
equal:
|
||||||
|
path: spec.template.spec.initContainers[1].name
|
||||||
|
value: init1
|
||||||
|
|
|
@ -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: 2.1.1
|
version: 2.2.0
|
||||||
kubeVersion: ">=1.22.0-0"
|
kubeVersion: ">=1.22.0-0"
|
||||||
keywords:
|
keywords:
|
||||||
- common
|
- common
|
||||||
|
@ -16,27 +16,6 @@ annotations:
|
||||||
artifacthub.io/changes: |-
|
artifacthub.io/changes: |-
|
||||||
- kind: added
|
- kind: added
|
||||||
description: |-
|
description: |-
|
||||||
Support v1 of Gateway APIs Route types
|
Add support for dependsOn to initContainers and containers.
|
||||||
- kind: added
|
Note that using dependsOn completely disables the "order" field within the controller.
|
||||||
description: |-
|
The "order" field will be removed in v3.
|
||||||
Support setting CronJob timezones in Kubernetes versions >= 1.27
|
|
||||||
- kind: added
|
|
||||||
description: |-
|
|
||||||
Support setting a defaultBackend per ingress
|
|
||||||
- kind: added
|
|
||||||
description: |-
|
|
||||||
Support using templates in Route hostnames
|
|
||||||
- kind: added
|
|
||||||
description: |-
|
|
||||||
Added support for dependsOn in environment variables
|
|
||||||
links:
|
|
||||||
- name: GitHub repo
|
|
||||||
url: https://github.com/dastrobu/helm-charts/tree/main/environment-variables
|
|
||||||
- name: Related blogpost
|
|
||||||
url: https://dastrobu.medium.com/an-advanced-api-for-environment-variables-in-helm-charts-e0bb1e0aa58a
|
|
||||||
- kind: fixed
|
|
||||||
description: |-
|
|
||||||
Improved "isEmpty" checks to be compatible with more Helm versions
|
|
||||||
- kind: fixed
|
|
||||||
description: |-
|
|
||||||
No longer quote numeric ports in probes
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# common
|
# common
|
||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Function library for Helm charts
|
Function library for Helm charts
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
|
||||||
# Chart.yaml
|
# Chart.yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: common
|
- name: common
|
||||||
version: 2.1.1
|
version: 2.2.0
|
||||||
repository: https://bjw-s.github.io/helm-charts/
|
repository: https://bjw-s.github.io/helm-charts/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ The following table contains an overview of available values and their descripti
|
||||||
| controllers.main.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset/cronjob |
|
| controllers.main.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset/cronjob |
|
||||||
| controllers.main.containers.main.args | list | `[]` | Override the args for the default container |
|
| controllers.main.containers.main.args | list | `[]` | Override the args for the default container |
|
||||||
| controllers.main.containers.main.command | list | `[]` | Override the command(s) for the default container |
|
| controllers.main.containers.main.command | list | `[]` | Override the command(s) for the default container |
|
||||||
|
| controllers.main.containers.main.dependsOn | list | `[]` | Specify if this container depends on any other containers This is used to determine the order in which the containers are rendered. The use of "dependsOn" completely disables the "order" field within the controller. |
|
||||||
| controllers.main.containers.main.env | string | `nil` | Environment variables. Template enabled. Syntax options: A) TZ: UTC B) PASSWD: '{{ .Release.Name }}' B) TZ: value: UTC dependsOn: otherVar D) PASSWD: configMapKeyRef: name: config-map-name key: key-name E) PASSWD: dependsOn: - otherVar1 - otherVar2 valueFrom: secretKeyRef: name: secret-name key: key-name ... F) - name: TZ value: UTC G) - name: TZ value: '{{ .Release.Name }}' |
|
| controllers.main.containers.main.env | string | `nil` | Environment variables. Template enabled. Syntax options: A) TZ: UTC B) PASSWD: '{{ .Release.Name }}' B) TZ: value: UTC dependsOn: otherVar D) PASSWD: configMapKeyRef: name: config-map-name key: key-name E) PASSWD: dependsOn: - otherVar1 - otherVar2 valueFrom: secretKeyRef: name: secret-name key: key-name ... F) - name: TZ value: UTC G) - name: TZ value: '{{ .Release.Name }}' |
|
||||||
| 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) |
|
| 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) |
|
||||||
| controllers.main.containers.main.image.pullPolicy | string | `nil` | image pull policy |
|
| controllers.main.containers.main.image.pullPolicy | string | `nil` | image pull policy |
|
||||||
|
@ -94,7 +95,7 @@ The following table contains an overview of available values and their descripti
|
||||||
| controllers.main.cronjob.timeZone | string | `nil` | Sets the CronJob timezone (only works in Kubernetes >= 1.27) |
|
| controllers.main.cronjob.timeZone | string | `nil` | Sets the CronJob timezone (only works in Kubernetes >= 1.27) |
|
||||||
| 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.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.enabled | bool | `true` | enable the controller. |
|
||||||
| controllers.main.initContainers | object | `{}` | Specify any initContainers here as dictionary items. Each initContainer should have its own key initContainers get sorted alphanumerically by the `<order>-<identifier>` combination. |
|
| controllers.main.initContainers | object | `{}` | Specify any initContainers here as dictionary items. Each initContainer should have its own key initContainers get sorted alphanumerically by the `<order>-<identifier>` combination if no order or dependsOn has been configured for them. |
|
||||||
| controllers.main.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset/cronjob |
|
| controllers.main.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset/cronjob |
|
||||||
| controllers.main.pod | object | `{}` | |
|
| controllers.main.pod | object | `{}` | |
|
||||||
| controllers.main.replicas | int | `1` | Number of desired pods. When using a HorizontalPodAutoscaler, set this to `null`. |
|
| controllers.main.replicas | int | `1` | Number of desired pods. When using a HorizontalPodAutoscaler, set this to `null`. |
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{{/*
|
||||||
|
Returns the items in a map that have a certain key
|
||||||
|
*/}}
|
||||||
|
{{- define "bjw-s.common.lib.getMapItemsWithKey" -}}
|
||||||
|
{{- $map := .map -}}
|
||||||
|
{{- $keyToFind := .key -}}
|
||||||
|
{{- $output := dict -}}
|
||||||
|
|
||||||
|
{{- if not (empty $keyToFind) -}}
|
||||||
|
{{- range $key, $item := $map -}}
|
||||||
|
{{- if not (empty (dig $keyToFind nil $item)) -}}
|
||||||
|
{{- $_ := set $output $key $item -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $output | toYaml -}}
|
||||||
|
{{- end }}
|
|
@ -6,11 +6,17 @@ Returns the value for containers
|
||||||
{{- $controllerObject := .ctx.controllerObject -}}
|
{{- $controllerObject := .ctx.controllerObject -}}
|
||||||
|
|
||||||
{{- /* Default to empty list */ -}}
|
{{- /* Default to empty list */ -}}
|
||||||
{{- $orderedContainers := dict -}}
|
{{- $graph := dict -}}
|
||||||
{{- $containers := list -}}
|
{{- $containers := list -}}
|
||||||
|
|
||||||
{{- /* Fetch configured containers for this controller */ -}}
|
{{- /* Fetch configured containers for this controller */ -}}
|
||||||
{{- $enabledContainers := include "bjw-s.common.lib.controller.enabledContainers" (dict "rootContext" $rootContext "controllerObject" $controllerObject) | fromYaml }}
|
{{- $enabledContainers := include "bjw-s.common.lib.controller.enabledContainers" (dict "rootContext" $rootContext "controllerObject" $controllerObject) | fromYaml }}
|
||||||
|
{{- $renderedContainers := dict -}}
|
||||||
|
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $containersWithDependsOn := include "bjw-s.common.lib.getMapItemsWithKey" (dict "map" $enabledContainers "key" "dependsOn") | fromYaml | keys -}}
|
||||||
|
{{- $useDependsOn := gt (len $containersWithDependsOn) 0 -}}
|
||||||
|
|
||||||
{{- range $key, $containerValues := $enabledContainers -}}
|
{{- range $key, $containerValues := $enabledContainers -}}
|
||||||
{{- /* Create object from the container values */ -}}
|
{{- /* Create object from the container values */ -}}
|
||||||
{{- $containerObject := (include "bjw-s.common.lib.container.valuesToObject" (dict "rootContext" $ "id" $key "values" $containerValues)) | fromYaml -}}
|
{{- $containerObject := (include "bjw-s.common.lib.container.valuesToObject" (dict "rootContext" $ "id" $key "values" $containerValues)) | fromYaml -}}
|
||||||
|
@ -20,13 +26,43 @@ Returns the value for containers
|
||||||
|
|
||||||
{{- /* Generate the Container spec */ -}}
|
{{- /* Generate the Container spec */ -}}
|
||||||
{{- $renderedContainer := include "bjw-s.common.lib.container.spec" (dict "rootContext" $rootContext "controllerObject" $controllerObject "containerObject" $containerObject) | fromYaml -}}
|
{{- $renderedContainer := include "bjw-s.common.lib.container.spec" (dict "rootContext" $rootContext "controllerObject" $controllerObject "containerObject" $containerObject) | fromYaml -}}
|
||||||
|
{{- $_ := set $renderedContainers $key $renderedContainer -}}
|
||||||
|
|
||||||
{{- $containerOrder := (dig "order" 99 $containerValues) -}}
|
{{- /* Determine the Container order */ -}}
|
||||||
{{- $_ := set $orderedContainers (printf "%v-%s" $containerOrder $key) $renderedContainer -}}
|
{{- if $useDependsOn -}}
|
||||||
|
{{- if empty (dig "dependsOn" nil $containerValues) -}}
|
||||||
|
{{- $_ := set $graph $key ( list ) -}}
|
||||||
|
{{- else if kindIs "string" $containerValues.dependsOn -}}
|
||||||
|
{{- $_ := set $graph $key ( list $containerValues.dependsOn ) -}}
|
||||||
|
{{- else if kindIs "slice" $containerValues.dependsOn -}}
|
||||||
|
{{- $_ := set $graph $key $containerValues.dependsOn -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $containerOrder := (dig "order" 99 $containerValues) -}}
|
||||||
|
{{- $_ := set $graph $key $containerOrder -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- range $key, $containerValues := $orderedContainers -}}
|
{{- /* Process graph */ -}}
|
||||||
{{- $containers = append $containers $containerValues -}}
|
{{- if $useDependsOn -}}
|
||||||
|
{{- $args := dict "graph" $graph "out" list -}}
|
||||||
|
{{- include "bjw-s.common.lib.kahn" $args -}}
|
||||||
|
|
||||||
|
{{- range $name := $args.out -}}
|
||||||
|
{{- $containerItem := get $renderedContainers $name -}}
|
||||||
|
{{- $containers = append $containers $containerItem -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $orderedContainers := dict -}}
|
||||||
|
{{- range $key, $order := $graph -}}
|
||||||
|
{{- $containerItem := get $renderedContainers $key -}}
|
||||||
|
{{- $_ := set $orderedContainers (printf "%v-%s" $order $key) $containerItem -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- range $key, $containerValues := $orderedContainers -}}
|
||||||
|
{{- $containers = append $containers $containerValues -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if not (empty $containers) -}}
|
{{- if not (empty $containers) -}}
|
||||||
|
|
|
@ -6,10 +6,16 @@ Returns the value for initContainers
|
||||||
{{- $controllerObject := .ctx.controllerObject -}}
|
{{- $controllerObject := .ctx.controllerObject -}}
|
||||||
|
|
||||||
{{- /* Default to empty list */ -}}
|
{{- /* Default to empty list */ -}}
|
||||||
{{- $orderedContainers := dict -}}
|
{{- $graph := dict -}}
|
||||||
{{- $containers := list -}}
|
{{- $containers := list -}}
|
||||||
|
|
||||||
{{- /* Fetch configured containers for this controller */ -}}
|
{{- /* Fetch configured containers for this controller */ -}}
|
||||||
|
{{- $renderedContainers := dict -}}
|
||||||
|
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $containersWithDependsOn := include "bjw-s.common.lib.getMapItemsWithKey" (dict "map" $controllerObject.initContainers "key" "dependsOn") | fromYaml | keys -}}
|
||||||
|
{{- $useDependsOn := gt (len $containersWithDependsOn) 0 -}}
|
||||||
|
|
||||||
{{- range $key, $containerValues := $controllerObject.initContainers -}}
|
{{- range $key, $containerValues := $controllerObject.initContainers -}}
|
||||||
{{- /* Enable container by default, but allow override */ -}}
|
{{- /* Enable container by default, but allow override */ -}}
|
||||||
{{- $containerEnabled := true -}}
|
{{- $containerEnabled := true -}}
|
||||||
|
@ -26,14 +32,44 @@ Returns the value for initContainers
|
||||||
|
|
||||||
{{- /* Generate the Container spec */ -}}
|
{{- /* Generate the Container spec */ -}}
|
||||||
{{- $renderedContainer := include "bjw-s.common.lib.container.spec" (dict "rootContext" $rootContext "controllerObject" $controllerObject "containerObject" $containerObject) | fromYaml -}}
|
{{- $renderedContainer := include "bjw-s.common.lib.container.spec" (dict "rootContext" $rootContext "controllerObject" $controllerObject "containerObject" $containerObject) | fromYaml -}}
|
||||||
|
{{- $_ := set $renderedContainers $key $renderedContainer -}}
|
||||||
|
|
||||||
{{- $containerOrder := (dig "order" 99 $containerValues) -}}
|
{{- /* Determine the Container order */ -}}
|
||||||
{{- $_ := set $orderedContainers (printf "%v-%s" $containerOrder $key) $renderedContainer -}}
|
{{- if $useDependsOn -}}
|
||||||
|
{{- if empty (dig "dependsOn" nil $containerValues) -}}
|
||||||
|
{{- $_ := set $graph $key ( list ) -}}
|
||||||
|
{{- else if kindIs "string" $containerValues.dependsOn -}}
|
||||||
|
{{- $_ := set $graph $key ( list $containerValues.dependsOn ) -}}
|
||||||
|
{{- else if kindIs "slice" $containerValues.dependsOn -}}
|
||||||
|
{{- $_ := set $graph $key $containerValues.dependsOn -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $containerOrder := (dig "order" 99 $containerValues) -}}
|
||||||
|
{{- $_ := set $graph $key $containerOrder -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- range $key, $containerValues := $orderedContainers -}}
|
{{- /* Process graph */ -}}
|
||||||
{{- $containers = append $containers $containerValues -}}
|
{{- if $useDependsOn -}}
|
||||||
|
{{- $args := dict "graph" $graph "out" list -}}
|
||||||
|
{{- include "bjw-s.common.lib.kahn" $args -}}
|
||||||
|
|
||||||
|
{{- range $name := $args.out -}}
|
||||||
|
{{- $containerItem := get $renderedContainers $name -}}
|
||||||
|
{{- $containers = append $containers $containerItem -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- /* TODO: Remove this logic after "order" removal in v3 */ -}}
|
||||||
|
{{- $orderedContainers := dict -}}
|
||||||
|
{{- range $key, $order := $graph -}}
|
||||||
|
{{- $containerItem := get $renderedContainers $key -}}
|
||||||
|
{{- $_ := set $orderedContainers (printf "%v-%s" $order $key) $containerItem -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- range $key, $containerValues := $orderedContainers -}}
|
||||||
|
{{- $containers = append $containers $containerValues -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if not (empty $containers) -}}
|
{{- if not (empty $containers) -}}
|
||||||
|
|
|
@ -186,6 +186,11 @@ controllers:
|
||||||
# @default -- 99
|
# @default -- 99
|
||||||
order: 1
|
order: 1
|
||||||
|
|
||||||
|
# -- Specify if this container depends on any other containers
|
||||||
|
# This is used to determine the order in which the containers are rendered.
|
||||||
|
# The use of "dependsOn" completely disables the "order" field within the controller.
|
||||||
|
dependsOn: []
|
||||||
|
|
||||||
image:
|
image:
|
||||||
# -- image repository
|
# -- image repository
|
||||||
repository:
|
repository:
|
||||||
|
@ -327,7 +332,8 @@ controllers:
|
||||||
|
|
||||||
# -- Specify any initContainers here as dictionary items.
|
# -- Specify any initContainers here as dictionary items.
|
||||||
# Each initContainer should have its own key
|
# Each initContainer should have its own key
|
||||||
# initContainers get sorted alphanumerically by the `<order>-<identifier>` combination.
|
# initContainers get sorted alphanumerically by the `<order>-<identifier>` combination
|
||||||
|
# if no order or dependsOn has been configured for them.
|
||||||
initContainers: {}
|
initContainers: {}
|
||||||
|
|
||||||
serviceAccount:
|
serviceAccount:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
description: A common powered chart template. This can be useful for small projects that don't have their own chart.
|
description: A common powered chart template. This can be useful for small projects that don't have their own chart.
|
||||||
name: app-template
|
name: app-template
|
||||||
version: 2.1.1
|
version: 2.2.0
|
||||||
kubeVersion: ">=1.22.0-0"
|
kubeVersion: ">=1.22.0-0"
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: bjw-s
|
- name: bjw-s
|
||||||
|
@ -10,12 +10,12 @@ maintainers:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: common
|
- name: common
|
||||||
repository: https://bjw-s.github.io/helm-charts
|
repository: https://bjw-s.github.io/helm-charts
|
||||||
version: 2.1.1
|
version: 2.2.0
|
||||||
annotations:
|
annotations:
|
||||||
artifacthub.io/changes: |-
|
artifacthub.io/changes: |-
|
||||||
- kind: changed
|
- kind: changed
|
||||||
description: |
|
description: |
|
||||||
Updated library version to 2.1.1.
|
Updated library version to 2.2.0.
|
||||||
links:
|
links:
|
||||||
- name: Upgrade instructions from v1.x
|
- name: Upgrade instructions from v1.x
|
||||||
url: https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template#from-1xx-to-20x
|
url: https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template#from-1xx-to-20x
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# app-template
|
# app-template
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
A common powered chart template. This can be useful for small projects that don't have their own chart.
|
A common powered chart template. This can be useful for small projects that don't have their own chart.
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Kubernetes: `>=1.22.0-0`
|
||||||
|
|
||||||
| Repository | Name | Version |
|
| Repository | Name | Version |
|
||||||
|------------|------|---------|
|
|------------|------|---------|
|
||||||
| https://bjw-s.github.io/helm-charts | common | 2.0.3 |
|
| https://bjw-s.github.io/helm-charts | common | 2.2.0 |
|
||||||
|
|
||||||
## Installing the Chart
|
## Installing the Chart
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue