feat(common)!: Migrate library chart

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-08-07 11:45:41 +02:00
parent 49ebc2bb2f
commit a1a80f5ff5
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
59 changed files with 499 additions and 885 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Compiled Helm chart dependencies # Compiled Helm chart dependencies
charts/**/Chart.lock charts/**/Chart.lock
charts/**/charts/ charts/**/charts/
# Testing
__snapshot__/

View file

@ -1,15 +1,17 @@
apiVersion: v2 apiVersion: v2
name: common name: common
description: Function library for k8s-at-home charts description: Function library for Helm charts
type: library type: library
version: 4.5.0 version: 0.1.0
kubeVersion: ">=1.16.0-0" kubeVersion: ">=1.16.0-0"
keywords: keywords:
- k8s-at-home
- common - common
home: https://github.com/k8s-at-home/library-charts/tree/main/stable/common - library
home: https://github.com/bjw-s/helm-charts/tree/main/charts/library/common
maintainers: maintainers:
- name: bjw-s - name: bjw-s
email: me@bjw-s.dev email: me@bjw-s.dev
- name: onedr0p annotations:
email: devin.kray@gmail.com artifacthub.io/changes: |-
- kind: changed
description: Initial version

View file

@ -1,10 +1,10 @@
# common # common
![Version: 4.5.0](https://img.shields.io/badge/Version-4.5.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
Function library for k8s-at-home charts Function library for Helm charts
Since a lot of the k8s-at-home charts follow a similar pattern, this library was built to reduce maintenance cost between the charts that use it and try achieve a goal of being DRY. Since a lot of the bjw-s charts follow a similar pattern, this library was built to reduce maintenance cost between the charts that use it and try achieve a goal of being DRY.
## Requirements ## Requirements
@ -29,8 +29,8 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 3.0.0 version: 0.1.0
repository: https://k8s-at-home.com/charts/ repository: https://bjw-s.github.io/helm-charts/
``` ```
For more information, take a look at the [Docs](http://docs.k8s-at-home.com/our-helm-charts/common-library/). For more information, take a look at the [Docs](http://docs.k8s-at-home.com/our-helm-charts/common-library/).
@ -45,7 +45,7 @@ N/A
## Values ## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common) **Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common)
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| |-----|------|---------|-------------|
@ -230,331 +230,11 @@ N/A
| topologySpreadConstraints | list | `[]` | Defines topologySpreadConstraint rules. [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | | 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. | | volumeClaimTemplates | list | `[]` | Used in conjunction with `controller.type: statefulset` to create individual disks for each instance. |
## Changelog
All notable changes to this library Helm chart will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [4.5.0]
#### Added
- Support checksum/config annotations for configMaps to automate roll deployments/daemonsets/statefulsets after config changes.
- Support Gluetun VPN client add-on. Please see [the project repository](https://github.com/qdm12/gluetun) for more information and how to configure.
- Added support for the `envFrom` field in the VPN add-on.
#### Changed
- Updated and pinned `netshoot` add-on image to `v0.7`.
- Updated `code-server` add-on image to `4.5.1`.
- Updated `promtail` add-on image to `2.6.1`.
#### Fixed
- Added `ingressClassName` description under the `code-server` add-on.
- `valueFrom` now works correctly when `env` is a list of variables.
### [4.4.2]
#### Fixed
- Change the scope for some of the annotation/label includes.
### [4.4.1]
#### Fixed
- Fix a typo that would make charts / objects containing annotations not render correctly.
### [4.4.0]
#### Added
- Support for `nfs` as a persistence type. [[ref](https://docs.k8s-at-home.com/our-helm-charts/common-library-storage/#nfs-volume)].
- Support for setting custom `args` for VPN containers.
- Support setting additional global labels. These will be applied to all objects rendered by the chart.
- Support setting additional global annotations. These will be applied to all objects rendered by the chart.
- Support Helm templating in `podAnnotations`.
#### Changed
- `externalTrafficPolicy` (when a value is specified) is now set for all Service types. (fixes https://github.com/k8s-at-home/library-charts/issues/125)
- Changed the unit test framework to an easier and more readable solution.
#### Fixed
- Fix a typo in the generated Notes.
- Explicitly add `imagePullSecrets` to `values.yaml` to improve discoverability of the setting.
### [4.3.0]
#### Added
- Support setting `podManagementPolicy` on StatefulSet
- Support setting the `runtimeClassName` of pods
#### Changed
- Improved environment variables documentation to correctly reflect the available syntax options.
### [4.2.0]
#### Added
- Support for defining ipFamilyPolicy and ipFamilies in service resources
### [4.1.0]
#### Changed
- Updated Wireguard add-on image tag to `v1.0.20210914`.
#### Added
- Support for specifying whether a pod should auto mount a service account token.
- Support for specifying configMaps directly in values.yaml.
- Support for specifying annotations/labels on the VPN add-on `NetworkPolicy`.
- Support for specifying custom podSelector labels on the VPN add-on `NetworkPolicy`.
- Added `secret` and `configMap` as persistence types. [[ref]](http://docs.k8s-at-home.com/our-helm-charts/common-library-storage/).
### [4.0.1]
#### Fixed
- Fixed an issue where users weren't able to set custom ingress labels.
### [4.0.0]
#### Added
- Support for specifying container termination message path and policy (#77).
- Support for specifying Pod termination grace period.
- Support for specifying PVC labels for `persistence` items.
#### Changed
- **BREAKING**: Renamed the `skipuninstall` key to `retain` for `persistence` items.
- **BREAKING**: `initContainers` now expects a dictionary instead of a list to make merging less error-prone. initContainers are ordered by their key.
- **BREAKING**: `additionalContainers` now expects a dictionary instead of a list to make merging less error-prone.
### [3.3.0]
#### Added
- Support ability to specify the [mountPropagation](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation) key under persistence items (https://github.com/k8s-at-home/library-charts/issues/74).
#### Changed
- Changed the docstring for `persistence` to better reference [our documentation](http://docs.k8s-at-home.com/our-helm-charts/common-library-storage/) regarding Storage options.
#### Fixed
- Fixed an issue where the default `repository` value for the Wireguard addon was incorrect (https://github.com/k8s-at-home/library-charts/issues/69).
- Fixed an issue where probes were not referencing the service `targetPort`.
### [3.2.0]
#### Added
- Support for specifying [topologySpreadConstraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) for a pod.
- Support for specifying multiple `subPath` items under `persistence` keys.
#### Removed
- Removed persistence examples from the `values.yaml` file. These will be documented instead in [our documentation](http://docs.k8s-at-home.com/our-helm-charts/common-library/).
### [3.1.1]
#### Fixed
- Fixed an issue where the default service would not be determined correctly for Ingress objects.
- Fixed an issue where the code-server addon ingress would reference the wrong service when multiple hosts were specified (https://github.com/k8s-at-home/library-charts/issues/64).
### [3.1.0]
#### Added
- Support to disable the controller when no container is deployed.
#### Fixed
- Fixed an issue where the code-server addon ingress would reference the wrong service.
### [3.0.2]
#### Fixed
- Fixed an issue where the `common.names.fullname` template would not properly render.
### [3.0.1]
#### Fixed
- Fixed an issue where the `nameOverride` and `fullnameOverride` could throw an error.
### [3.0.0]
#### Added
- It is now possible to flag an ingress / service / port as primary. This will then be used
by default in the chart notes, probes, etc.
- Individual ports can now be enabled / disabled.
- Allow setting Pod labels using the `podLabels` field.
- Allow setting `volumeName` for PVC's.
- Annotated the values.yaml to better describe what fields do. This is also reflected in the [README.md](README.md) file.
- Added a [netshoot](https://github.com/nicolaka/netshoot) add-on. This allows for injecting a network trouble-shooting swiss-army sidecar container.
#### Changed
- Probes are now automatically disabled (except for custom defined probes) when no service is enabled.
- Moved the primary ingress from `ingress` to `ingress.main`.
- Moved the primary service from `service` to `service.main`.
- Multiple ingress objects can now be specified under the `ingress` key.
- Multiple service objects can now be specified under the `service` key.
- `nameSuffix` has been renamed to `nameOverride`.
- `hostPathMounts` has been integrated with `persistence`.
- `additionalVolumes` has been integrated with `persistence`.
- Test framework has been rewritten from Ruby to Go.
#### Fixed
- Cleaned up YAML document separators (`---`).
- Fixed indenting of the `lifecycle` field.
#### Removed
- Removed support for `ingress.additionalIngresses`.
- Removed support for `services.additionalServices`.
- Removed support for TrueNAS SCALE features. These are out of scope for our project.
### [2.5.0]
#### Added
- Added `Horizontal Pod Autoscaler`
- Can now use "HTTP" or "HTTPS" as port protocol (which use TCP under-the-hood)
- Setting the port protocol to "HTTPS" adds traefik annotation to use https towards the backend service
- Add option to automatically generate a configmap for use with the TrueNAS SCALE UI portal-button
- Added option to use TrueNAS SCALE default storageClass by using `SCALE-ZFS` storageClass
- It is now possible to set the `serviceName` and `servicePort` per Ingress path
#### Changed
- Port protocol gets used to determine install-notes URL (http or https)
### [2.4.0]
#### Added
- `hostPathMounts` to mount hostPaths with a single values.yaml setting
- Automated ownership fixing job for `hostPathMounts`
- `envList` to use a list of environment variables in addition to the current dict or template
#### Changed
- Set `dnsPolicy` default based on `hostNetwork` setting
#### Fixed
- Fixed unit-tests not correctly testing no-env scenario's
### [2.3.1]
#### Fixed
- Fixed the VPN addon secret name when providing inline VPN configuration.
### [2.3.0]
#### Added
- Allow `configFileSecret` to be specified under the VPN add-on, to reference an existing secret.
- Allow `git.deployKey` to be specified under the codeserver add-on. Please refer to `values.yaml` for more details.
#### Changed
- Modified unit tests to no longer depend on `jq`.
#### Fixed
- `secretName` is now truly optional under Ingress TLS configuration.
### [2.2.0]
#### Added
- Persistence `nameSuffix` can now be set to `-` to disable suffixing that PVC.
- Support for configuring `lifecycle`
- Support for configuring `pathTpl` in Ingress (#15).
#### Fixed
- Ingress `pathType` is now actually configurable. Fixes #16.
- PVC's are always forced to a newline. Fixes #17.
### [2.1.0]
#### Added
- Added support for shipping logs to Loki using the new `promtail` add-on.
#### Changed
- Upgraded the default image in the `codeserver` add-on to `v3.9.2`
### [2.0.1]
#### Fixed
- Volumes referencing persistentVolumeClaims actually reference the PVC again.
- Items under persistence now default their `mountPath` to the item name, as they should have been doing.
### [2.0.0]
#### Added
- Added support for using Helm template language in `additionalContainers`.
#### Changed
- **Breaking:** `persistence.emptyDir` was changed to allow more configuration options, such as `medium` and `sizeLimit`.
### [1.0.0]
#### Changed
- Moved common library chart to separate repository
#### Fixed
- The `command` and `args` values now properly support both string and list values.
[4.0.0]: #400
[3.3.0]: #330
[3.2.0]: #320
[3.1.1]: #311
[3.1.0]: #310
[3.0.2]: #302
[3.0.1]: #301
[3.0.0]: #300
[2.5.0]: #250
[2.4.0]: #240
[2.3.1]: #231
[2.3.0]: #230
[2.2.0]: #220
[2.1.0]: #210
[2.0.1]: #201
[2.0.0]: #200
[1.0.0]: #100
## Support ## Support
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/) - See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose) - Open an [issue](https://github.com/bjw-s/helm-charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/organization/discussions) - Join the k8s-at-home [Discord](https://discord.gg/sTMX7Vh) community
- Join our [Discord](https://discord.gg/sTMX7Vh) community
---------------------------------------------- ----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) Autogenerated from chart metadata using [helm-docs v0.1.1](https://github.com/k8s-at-home/helm-docs/releases/v0.1.1)

View file

@ -1,13 +1,13 @@
{{- define "custom.repository.organization" -}} {{- define "custom.repository.organization" -}}
k8s-at-home bjw-s
{{- end -}} {{- end -}}
{{- define "custom.repository.url" -}} {{- define "custom.repository.url" -}}
https://github.com/k8s-at-home/charts https://github.com/bjw-s/helm-charts
{{- end -}} {{- end -}}
{{- define "custom.helm.url" -}} {{- define "custom.helm.url" -}}
https://k8s-at-home.com/charts/ https://bjw-s.github.io/helm-charts/
{{- end -}} {{- end -}}
{{- define "custom.helm.path" -}} {{- define "custom.helm.path" -}}
@ -51,7 +51,7 @@ Read through the [values.yaml](./values.yaml) file. It has several commented out
{{- define "custom.valuesSection" -}} {{- define "custom.valuesSection" -}}
## Values ## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common) **Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common)
{{ template "chart.valuesTable" . }} {{ template "chart.valuesTable" . }}
{{- end -}} {{- end -}}
@ -60,9 +60,8 @@ Read through the [values.yaml](./values.yaml) file. It has several commented out
## Support ## Support
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/) - See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose) - Open an [issue](https://github.com/bjw-s/helm-charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/organization/discussions) - Join the k8s-at-home [Discord](https://discord.gg/sTMX7Vh) community
- Join our [Discord](https://discord.gg/sTMX7Vh) community
{{- end -}} {{- end -}}
{{ template "chart.header" . }} {{ template "chart.header" . }}
@ -91,9 +90,6 @@ Read through the [values.yaml](./values.yaml) file. It has several commented out
{{ template "custom.valuesSection" . }} {{ template "custom.valuesSection" . }}
{{ template "custom.changelog" . }}
{{ template "custom.support" . }} {{ template "custom.support" . }}
{{ template "helm-docs.versionFooter" . }} {{ template "helm-docs.versionFooter" . }}
{{ "" }}

View file

@ -1,324 +0,0 @@
{{- define "custom.changelog.header" -}}
## Changelog
{{- end -}}
{{- define "custom.changelog" -}}
{{ template "custom.changelog.header" . }}
All notable changes to this library Helm chart will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [4.5.0]
#### Added
- Support checksum/config annotations for configMaps to automate roll deployments/daemonsets/statefulsets after config changes.
- Support Gluetun VPN client add-on. Please see [the project repository](https://github.com/qdm12/gluetun) for more information and how to configure.
- Added support for the `envFrom` field in the VPN add-on.
#### Changed
- Updated and pinned `netshoot` add-on image to `v0.7`.
- Updated `code-server` add-on image to `4.5.1`.
- Updated `promtail` add-on image to `2.6.1`.
#### Fixed
- Added `ingressClassName` description under the `code-server` add-on.
- `valueFrom` now works correctly when `env` is a list of variables.
### [4.4.2]
#### Fixed
- Change the scope for some of the annotation/label includes.
### [4.4.1]
#### Fixed
- Fix a typo that would make charts / objects containing annotations not render correctly.
### [4.4.0]
#### Added
- Support for `nfs` as a persistence type. [[ref](https://docs.k8s-at-home.com/our-helm-charts/common-library-storage/#nfs-volume)].
- Support for setting custom `args` for VPN containers.
- Support setting additional global labels. These will be applied to all objects rendered by the chart.
- Support setting additional global annotations. These will be applied to all objects rendered by the chart.
- Support Helm templating in `podAnnotations`.
#### Changed
- `externalTrafficPolicy` (when a value is specified) is now set for all Service types. (fixes https://github.com/k8s-at-home/library-charts/issues/125)
- Changed the unit test framework to an easier and more readable solution.
#### Fixed
- Fix a typo in the generated Notes.
- Explicitly add `imagePullSecrets` to `values.yaml` to improve discoverability of the setting.
### [4.3.0]
#### Added
- Support setting `podManagementPolicy` on StatefulSet
- Support setting the `runtimeClassName` of pods
#### Changed
- Improved environment variables documentation to correctly reflect the available syntax options.
### [4.2.0]
#### Added
- Support for defining ipFamilyPolicy and ipFamilies in service resources
### [4.1.0]
#### Changed
- Updated Wireguard add-on image tag to `v1.0.20210914`.
#### Added
- Support for specifying whether a pod should auto mount a service account token.
- Support for specifying configMaps directly in values.yaml.
- Support for specifying annotations/labels on the VPN add-on `NetworkPolicy`.
- Support for specifying custom podSelector labels on the VPN add-on `NetworkPolicy`.
- Added `secret` and `configMap` as persistence types. [[ref]](http://docs.k8s-at-home.com/our-helm-charts/common-library-storage/).
### [4.0.1]
#### Fixed
- Fixed an issue where users weren't able to set custom ingress labels.
### [4.0.0]
#### Added
- Support for specifying container termination message path and policy (#77).
- Support for specifying Pod termination grace period.
- Support for specifying PVC labels for `persistence` items.
#### Changed
- **BREAKING**: Renamed the `skipuninstall` key to `retain` for `persistence` items.
- **BREAKING**: `initContainers` now expects a dictionary instead of a list to make merging less error-prone. initContainers are ordered by their key.
- **BREAKING**: `additionalContainers` now expects a dictionary instead of a list to make merging less error-prone.
### [3.3.0]
#### Added
- Support ability to specify the [mountPropagation](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation) key under persistence items (https://github.com/k8s-at-home/library-charts/issues/74).
#### Changed
- Changed the docstring for `persistence` to better reference [our documentation](http://docs.k8s-at-home.com/our-helm-charts/common-library-storage/) regarding Storage options.
#### Fixed
- Fixed an issue where the default `repository` value for the Wireguard addon was incorrect (https://github.com/k8s-at-home/library-charts/issues/69).
- Fixed an issue where probes were not referencing the service `targetPort`.
### [3.2.0]
#### Added
- Support for specifying [topologySpreadConstraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) for a pod.
- Support for specifying multiple `subPath` items under `persistence` keys.
#### Removed
- Removed persistence examples from the `values.yaml` file. These will be documented instead in [our documentation](http://docs.k8s-at-home.com/our-helm-charts/common-library/).
### [3.1.1]
#### Fixed
- Fixed an issue where the default service would not be determined correctly for Ingress objects.
- Fixed an issue where the code-server addon ingress would reference the wrong service when multiple hosts were specified (https://github.com/k8s-at-home/library-charts/issues/64).
### [3.1.0]
#### Added
- Support to disable the controller when no container is deployed.
#### Fixed
- Fixed an issue where the code-server addon ingress would reference the wrong service.
### [3.0.2]
#### Fixed
- Fixed an issue where the `common.names.fullname` template would not properly render.
### [3.0.1]
#### Fixed
- Fixed an issue where the `nameOverride` and `fullnameOverride` could throw an error.
### [3.0.0]
#### Added
- It is now possible to flag an ingress / service / port as primary. This will then be used
by default in the chart notes, probes, etc.
- Individual ports can now be enabled / disabled.
- Allow setting Pod labels using the `podLabels` field.
- Allow setting `volumeName` for PVC's.
- Annotated the values.yaml to better describe what fields do. This is also reflected in the [README.md](README.md) file.
- Added a [netshoot](https://github.com/nicolaka/netshoot) add-on. This allows for injecting a network trouble-shooting swiss-army sidecar container.
#### Changed
- Probes are now automatically disabled (except for custom defined probes) when no service is enabled.
- Moved the primary ingress from `ingress` to `ingress.main`.
- Moved the primary service from `service` to `service.main`.
- Multiple ingress objects can now be specified under the `ingress` key.
- Multiple service objects can now be specified under the `service` key.
- `nameSuffix` has been renamed to `nameOverride`.
- `hostPathMounts` has been integrated with `persistence`.
- `additionalVolumes` has been integrated with `persistence`.
- Test framework has been rewritten from Ruby to Go.
#### Fixed
- Cleaned up YAML document separators (`---`).
- Fixed indenting of the `lifecycle` field.
#### Removed
- Removed support for `ingress.additionalIngresses`.
- Removed support for `services.additionalServices`.
- Removed support for TrueNAS SCALE features. These are out of scope for our project.
### [2.5.0]
#### Added
- Added `Horizontal Pod Autoscaler`
- Can now use "HTTP" or "HTTPS" as port protocol (which use TCP under-the-hood)
- Setting the port protocol to "HTTPS" adds traefik annotation to use https towards the backend service
- Add option to automatically generate a configmap for use with the TrueNAS SCALE UI portal-button
- Added option to use TrueNAS SCALE default storageClass by using `SCALE-ZFS` storageClass
- It is now possible to set the `serviceName` and `servicePort` per Ingress path
#### Changed
- Port protocol gets used to determine install-notes URL (http or https)
### [2.4.0]
#### Added
- `hostPathMounts` to mount hostPaths with a single values.yaml setting
- Automated ownership fixing job for `hostPathMounts`
- `envList` to use a list of environment variables in addition to the current dict or template
#### Changed
- Set `dnsPolicy` default based on `hostNetwork` setting
#### Fixed
- Fixed unit-tests not correctly testing no-env scenario's
### [2.3.1]
#### Fixed
- Fixed the VPN addon secret name when providing inline VPN configuration.
### [2.3.0]
#### Added
- Allow `configFileSecret` to be specified under the VPN add-on, to reference an existing secret.
- Allow `git.deployKey` to be specified under the codeserver add-on. Please refer to `values.yaml` for more details.
#### Changed
- Modified unit tests to no longer depend on `jq`.
#### Fixed
- `secretName` is now truly optional under Ingress TLS configuration.
### [2.2.0]
#### Added
- Persistence `nameSuffix` can now be set to `-` to disable suffixing that PVC.
- Support for configuring `lifecycle`
- Support for configuring `pathTpl` in Ingress (#15).
#### Fixed
- Ingress `pathType` is now actually configurable. Fixes #16.
- PVC's are always forced to a newline. Fixes #17.
### [2.1.0]
#### Added
- Added support for shipping logs to Loki using the new `promtail` add-on.
#### Changed
- Upgraded the default image in the `codeserver` add-on to `v3.9.2`
### [2.0.1]
#### Fixed
- Volumes referencing persistentVolumeClaims actually reference the PVC again.
- Items under persistence now default their `mountPath` to the item name, as they should have been doing.
### [2.0.0]
#### Added
- Added support for using Helm template language in `additionalContainers`.
#### Changed
- **Breaking:** `persistence.emptyDir` was changed to allow more configuration options, such as `medium` and `sizeLimit`.
### [1.0.0]
#### Changed
- Moved common library chart to separate repository
#### Fixed
- The `command` and `args` values now properly support both string and list values.
[4.0.0]: #400
[3.3.0]: #330
[3.2.0]: #320
[3.1.1]: #311
[3.1.0]: #310
[3.0.2]: #302
[3.0.1]: #301
[3.0.0]: #300
[2.5.0]: #250
[2.4.0]: #240
[2.3.1]: #231
[2.3.0]: #230
[2.2.0]: #220
[2.1.0]: #210
[2.0.1]: #201
[2.0.0]: #200
[1.0.0]: #100
{{- end -}}

View file

@ -21,7 +21,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 3.0.0 version: 0.1.0
repository: {{ template "custom.helm.url" }} repository: {{ template "custom.helm.url" }}
``` ```

View file

@ -36,29 +36,7 @@
{{- with .Values.env }} {{- with .Values.env }}
env: env:
{{- range $k, $v := . }} {{- get (fromYaml (include "common.controller.env_vars" $)) "env" | toYaml | nindent 4 -}}
{{- $name := $k }}
{{- $value := $v }}
{{- if kindIs "int" $name }}
{{- $name = required "environment variables as a list of maps require a name field" $value.name }}
{{- end }}
- name: {{ quote $name }}
{{- if kindIs "map" $value -}}
{{- if hasKey $value "value" }}
{{- $value = $value.value -}}
{{- else if hasKey $value "valueFrom" }}
{{- dict "valueFrom" $value.valueFrom | toYaml | nindent 6 }}
{{- else }}
{{- dict "valueFrom" $value | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- if not (kindIs "map" $value) }}
{{- if kindIs "string" $value }}
{{- $value = tpl $value $ }}
{{- end }}
value: {{ quote $value }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
{{- if or .Values.envFrom .Values.secret }} {{- if or .Values.envFrom .Values.secret }}
envFrom: envFrom:

View file

@ -0,0 +1,43 @@
{{/*
Environment variables used by containers.
*/}}
{{- define "common.controller.env_vars" -}}
{{- $values := .Values.env -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.env -}}
{{- $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 -}}

View file

@ -50,6 +50,12 @@ initContainers:
{{- if not $container.name -}} {{- if not $container.name -}}
{{- $_ := set $container "name" $key }} {{- $_ := set $container "name" $key }}
{{- end }} {{- end }}
{{- if $container.env -}}
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}}
{{- $_ := unset $.ObjectValues "env" -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- end }}
{{- $initContainers = append $initContainers $container }} {{- $initContainers = append $initContainers $container }}
{{- end }} {{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }} {{- tpl (toYaml $initContainers) $ | nindent 2 }}
@ -62,6 +68,12 @@ containers:
{{- if not $container.name -}} {{- if not $container.name -}}
{{- $_ := set $container "name" $name }} {{- $_ := set $container "name" $name }}
{{- end }} {{- end }}
{{- if $container.env -}}
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- $_ := unset $.ObjectValues "env" -}}
{{- end }}
{{- $additionalContainers = append $additionalContainers $container }} {{- $additionalContainers = append $additionalContainers $container }}
{{- end }} {{- end }}
{{- tpl (toYaml $additionalContainers) $ | nindent 2 }} {{- tpl (toYaml $additionalContainers) $ | nindent 2 }}

View file

@ -0,0 +1,16 @@
---
apiVersion: v2
description: A common powered chart template. This can be useful for small projects that don't have their own chart.
name: common-chart
version: 0.1.0
maintainers:
- name: bjw-s
email: me@bjw-s.dev
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 0.1.0
annotations:
artifacthub.io/changes: |-
- kind: changed
description: Set `common` chart dependency to version 0.1.0

View file

@ -0,0 +1,22 @@
image:
repository: b4bz/homer
tag: latest
pullPolicy: IfNotPresent
service:
main:
ports:
http:
port: 8080
ingress:
main:
enabled: true
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true

View file

@ -0,0 +1,32 @@
image:
repository: b4bz/homer
tag: latest
pullPolicy: IfNotPresent
service:
main:
ports:
http:
port: 8080
ingress:
main:
enabled: true
persistence:
config:
enabled: true
emptyDir:
enabled: true
mountPath: /www/assets
addons:
codeserver:
enabled: true
workingDir: "/www/assets"
ingress:
main:
enabled: true
volumeMounts:
- name: config
mountPath: /www/assets

View file

@ -0,0 +1,26 @@
image:
repository: b4bz/homer
tag: latest
pullPolicy: IfNotPresent
service:
main:
ports:
http:
port: 8080
ingress:
main:
enabled: true
probes:
liveness:
enabled: true
readiness:
enabled: true
startup:
enabled: true
addons:
netshoot:
enabled: true

View file

@ -0,0 +1,29 @@
image:
repository: ghcr.io/k8s-at-home/qbittorrent
tag: latest
pullPolicy: IfNotPresent
service:
main:
ports:
http:
port: 8080
persistence:
config:
enabled: true
emptyDir:
enabled: true
mountPath: /config
addons:
promtail:
enabled: true
loki: http://loki.monitoring.svc.cluster.local:3100/loki/api/v1/push
logs:
- name: qbittorrent
path: /config/data/qBittorrent/logs/*.log
volumeMounts:
- name: config
mountPath: /config
readOnly: true

View file

@ -45,7 +45,7 @@ tests:
- documentIndex: *AddonServiceDocument - documentIndex: *AddonServiceDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: addon enabled with deployKey should pass - it: addon enabled with deployKey should pass
set: set:
@ -83,11 +83,11 @@ tests:
items: items:
- key: id_rsa - key: id_rsa
path: id_rsa path: id_rsa
secretName: RELEASE-NAME-kah-common-chart-deploykey secretName: RELEASE-NAME-common-chart-deploykey
- documentIndex: *AddonDeployKeySecretDocument - documentIndex: *AddonDeployKeySecretDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-deploykey value: RELEASE-NAME-common-chart-deploykey
- it: addon enabled with InlineBase64 deployKey should pass - it: addon enabled with InlineBase64 deployKey should pass
set: set:
@ -125,11 +125,11 @@ tests:
items: items:
- key: id_rsa - key: id_rsa
path: id_rsa path: id_rsa
secretName: RELEASE-NAME-kah-common-chart-deploykey secretName: RELEASE-NAME-common-chart-deploykey
- documentIndex: *AddonDeployKeySecretDocument - documentIndex: *AddonDeployKeySecretDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-deploykey value: RELEASE-NAME-common-chart-deploykey
- it: addon enabled with existingSecret deployKey should pass - it: addon enabled with existingSecret deployKey should pass
set: set:

View file

@ -68,11 +68,11 @@ tests:
items: items:
- key: vpnConfigfile - key: vpnConfigfile
path: vpnConfigfile path: vpnConfigfile
secretName: RELEASE-NAME-kah-common-chart-vpnconfig secretName: RELEASE-NAME-common-chart-vpnconfig
- documentIndex: *AddonVPNConfigSecretDocument - documentIndex: *AddonVPNConfigSecretDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-vpnconfig value: RELEASE-NAME-common-chart-vpnconfig
- it: addon enabled with existing configFile secret should pass - it: addon enabled with existing configFile secret should pass
set: set:
@ -129,3 +129,52 @@ tests:
equal: equal:
path: spec.template.spec.containers[0].name path: spec.template.spec.containers[0].name
value: vpn value: vpn
- it: addon enabled with custom env vars dict should pass
set:
addons:
vpn:
enabled: true
env:
int: 1
float: 1.5
string: value_of_env
template: "{{ .Release.Name }}-admin"
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- documentIndex: *DeploymentDocument
not: true
equal:
path: spec.template.spec.containers[1].name
value: vpn
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[3]
value:
name: template
value: RELEASE-NAME-admin

View file

@ -20,8 +20,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -47,8 +47,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -81,7 +81,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -71,7 +71,7 @@ tests:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-config value: RELEASE-NAME-common-chart-config
- it: with nameOverride should pass - it: with nameOverride should pass
set: set:
@ -88,4 +88,4 @@ tests:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-http value: RELEASE-NAME-common-chart-http

View file

@ -15,4 +15,4 @@ tests:
equal: equal:
path: spec.template.metadata.annotations path: spec.template.metadata.annotations
value: value:
checksum/config: 08f1047e9078ea3a6e593bffc1bf2d1b7db4163b9bb0c8203d8c70f2a6a5e551 checksum/config: 3cd90a9f7d2c08b3d9d41d1be650110f4974009dcaf0a3d9e0616c90d80e1d38

View file

@ -56,21 +56,6 @@ tests:
name: string name: string
value: "1" value: "1"
- it: KeyValue float should pass
set:
env:
string: 4.2
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: string
value: "4.2"
- it: List should pass - it: List should pass
set: set:
env: env:

View file

@ -40,4 +40,4 @@ tests:
path: spec.template.spec.containers[0].envFrom[0] path: spec.template.spec.containers[0].envFrom[0]
value: value:
secretRef: secretRef:
name: RELEASE-NAME-kah-common-chart name: RELEASE-NAME-common-chart

View file

@ -18,8 +18,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -44,8 +44,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -77,7 +77,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -18,8 +18,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -44,8 +44,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -77,7 +77,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -18,8 +18,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -44,8 +44,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -77,7 +77,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -10,7 +10,7 @@ tests:
- documentIndex: *ControllerDoc - documentIndex: *ControllerDoc
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: daemonset should pass - it: daemonset should pass
set: set:
@ -22,7 +22,7 @@ tests:
- documentIndex: *ControllerDoc - documentIndex: *ControllerDoc
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: statefulset should pass - it: statefulset should pass
set: set:
@ -34,7 +34,7 @@ tests:
- documentIndex: *ControllerDoc - documentIndex: *ControllerDoc
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: disabled should pass - it: disabled should pass
set: set:

View file

@ -18,8 +18,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -44,8 +44,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -77,7 +77,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -13,7 +13,7 @@ tests:
equal: equal:
path: spec.rules[0].http.paths[0].backend path: spec.rules[0].http.paths[0].backend
value: value:
serviceName: RELEASE-NAME-kah-common-chart serviceName: RELEASE-NAME-common-chart
servicePort: null servicePort: null
- it: custom service reference should pass - it: custom service reference should pass

View file

@ -17,7 +17,7 @@ tests:
value: value:
name: config name: config
persistentVolumeClaim: persistentVolumeClaim:
claimName: RELEASE-NAME-kah-common-chart-config claimName: RELEASE-NAME-common-chart-config
- it: with existingClaim should pass - it: with existingClaim should pass
set: set:
@ -55,7 +55,7 @@ tests:
value: value:
name: claimWithoutSuffix name: claimWithoutSuffix
persistentVolumeClaim: persistentVolumeClaim:
claimName: RELEASE-NAME-kah-common-chart claimName: RELEASE-NAME-common-chart
- it: custom suffix should pass - it: custom suffix should pass
set: set:
@ -75,4 +75,4 @@ tests:
value: value:
name: claimWithNameOverride name: claimWithNameOverride
persistentVolumeClaim: persistentVolumeClaim:
claimName: RELEASE-NAME-kah-common-chart-suffix claimName: RELEASE-NAME-common-chart-suffix

View file

@ -65,7 +65,7 @@ tests:
value: value:
name: configmap name: configmap
configMap: configMap:
name: RELEASE-NAME-kah-common-chart-config name: RELEASE-NAME-common-chart-config
- it: secret persistence type should pass - it: secret persistence type should pass
set: set:

View file

@ -0,0 +1,91 @@
suite: pod additional containers
templates:
- common.yaml
tests:
- it: with explicit name should pass
set:
additionalContainers:
additional1:
name: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: template-test
- it: with implicit name should pass
set:
additionalContainers:
additional1:
image: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: additional1
- it: with templated name should pass
set:
additionalContainers:
additional1:
name: "{{ .Release.Name }}-container"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-container
- it: with custom env vars dict should pass
set:
env:
main_env: value
additionalContainers:
additional1:
env:
int: 1
float: 1.5
string: value_of_env
template: "{{ .Release.Name }}-admin"
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: main_env
value: "value"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[3]
value:
name: template
value: RELEASE-NAME-admin

View file

@ -0,0 +1,83 @@
suite: pod initContainers
templates:
- common.yaml
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
set:
initContainers:
init1:
env:
int: 1
float: 1.5
string: value_of_env
template: "{{ .Release.Name }}-admin"
asserts:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].env[0]
value:
name: float
value: "1.5"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].env[1]
value:
name: int
value: "1"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].env[2]
value:
name: string
value: value_of_env
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.initContainers[0].env[3]
value:
name: template
value: RELEASE-NAME-admin

View file

@ -18,8 +18,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: retain enabled should pass - it: retain enabled should pass
set: set:
@ -41,8 +41,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -67,8 +67,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -100,7 +100,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -35,7 +35,7 @@ tests:
- documentIndex: *PersistentVolumeClaimDocument - documentIndex: *PersistentVolumeClaimDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-config value: RELEASE-NAME-common-chart-config
- it: without suffix should pass - it: without suffix should pass
set: set:
@ -49,7 +49,7 @@ tests:
- documentIndex: *PersistentVolumeClaimDocument - documentIndex: *PersistentVolumeClaimDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: with custom suffix should pass - it: with custom suffix should pass
set: set:
@ -63,4 +63,4 @@ tests:
- documentIndex: *PersistentVolumeClaimDocument - documentIndex: *PersistentVolumeClaimDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-custom value: RELEASE-NAME-common-chart-custom

View file

@ -16,8 +16,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -42,8 +42,8 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -75,7 +75,7 @@ tests:
value: value:
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: kah-common-chart app.kubernetes.io/name: common-chart
global_label: test global_label: test
helm.sh/chart: kah-common-chart-1.1.2 helm.sh/chart: common-chart-0.1.0
test_label: test test_label: test

View file

@ -12,7 +12,7 @@ tests:
- documentIndex: *ServiceDocument - documentIndex: *ServiceDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart value: RELEASE-NAME-common-chart
- it: custom name suffix should pass - it: custom name suffix should pass
set: set:
@ -26,4 +26,4 @@ tests:
- documentIndex: *ServiceDocument - documentIndex: *ServiceDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-kah-common-chart-http value: RELEASE-NAME-common-chart-http

View file

@ -1,19 +0,0 @@
---
apiVersion: v2
description: A KaH-common powered chart template. This can be useful for small projects that don't have their own chart.
name: kah-common-chart
version: 1.1.3
maintainers:
- name: bjw-s
email: me@bjw-s.dev
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 4.4.2
annotations:
artifacthub.io/changes: |-
- kind: changed
description: Upgraded `common` chart dependency to version 4.4.2
links:
- name: GitHub Issue
url: https://github.com/issue-url

View file

@ -1,45 +0,0 @@
suite: pod additional containers
templates:
- common.yaml
tests:
- it: with explicit name should pass
set:
additionalContainers:
additional1:
name: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: template-test
- it: with implicit name should pass
set:
additionalContainers:
additional1:
image: template-test
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: additional1
- it: with templated name should pass
set:
additionalContainers:
additional1:
name: "{{ .Release.Name }}-container"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-container

View file

@ -1,45 +0,0 @@
suite: pod initContainers
templates:
- common.yaml
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