diff --git a/.gitignore b/.gitignore index b03fafed..a01a9070 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # Compiled Helm chart dependencies charts/**/Chart.lock charts/**/charts/ + +# Testing +__snapshot__/ diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index ca933de7..e477da1d 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -1,15 +1,17 @@ apiVersion: v2 name: common -description: Function library for k8s-at-home charts +description: Function library for Helm charts type: library -version: 4.5.0 +version: 0.1.0 kubeVersion: ">=1.16.0-0" keywords: - - k8s-at-home - 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: - name: bjw-s email: me@bjw-s.dev - - name: onedr0p - email: devin.kray@gmail.com +annotations: + artifacthub.io/changes: |- + - kind: changed + description: Initial version diff --git a/charts/library/common/README.md b/charts/library/common/README.md index f2b0c858..430f9b3f 100644 --- a/charts/library/common/README.md +++ b/charts/library/common/README.md @@ -1,10 +1,10 @@ # 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 @@ -29,8 +29,8 @@ Include this chart as a dependency in your `Chart.yaml` e.g. # Chart.yaml dependencies: - name: common - version: 3.0.0 - repository: https://k8s-at-home.com/charts/ + version: 0.1.0 + 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/). @@ -45,7 +45,7 @@ N/A ## 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 | |-----|------|---------|-------------| @@ -230,331 +230,11 @@ N/A | 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. | -## 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 - 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) -- Ask a [question](https://github.com/k8s-at-home/organization/discussions) -- Join our [Discord](https://discord.gg/sTMX7Vh) community +- Open an [issue](https://github.com/bjw-s/helm-charts/issues/new/choose) +- Join the k8s-at-home [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) diff --git a/charts/library/common/README.md.gotmpl b/charts/library/common/README.md.gotmpl index a5d5a8cc..82d2a616 100644 --- a/charts/library/common/README.md.gotmpl +++ b/charts/library/common/README.md.gotmpl @@ -1,13 +1,13 @@ {{- define "custom.repository.organization" -}} -k8s-at-home +bjw-s {{- end -}} {{- define "custom.repository.url" -}} -https://github.com/k8s-at-home/charts +https://github.com/bjw-s/helm-charts {{- end -}} {{- define "custom.helm.url" -}} -https://k8s-at-home.com/charts/ +https://bjw-s.github.io/helm-charts/ {{- end -}} {{- define "custom.helm.path" -}} @@ -51,7 +51,7 @@ Read through the [values.yaml](./values.yaml) file. It has several commented out {{- define "custom.valuesSection" -}} ## 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" . }} {{- end -}} @@ -60,9 +60,8 @@ Read through the [values.yaml](./values.yaml) file. It has several commented out ## Support - 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) -- Ask a [question](https://github.com/k8s-at-home/organization/discussions) -- Join our [Discord](https://discord.gg/sTMX7Vh) community +- Open an [issue](https://github.com/bjw-s/helm-charts/issues/new/choose) +- Join the k8s-at-home [Discord](https://discord.gg/sTMX7Vh) community {{- end -}} {{ 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.changelog" . }} - {{ template "custom.support" . }} {{ template "helm-docs.versionFooter" . }} -{{ "" }} diff --git a/charts/library/common/README_CHANGELOG.md.gotmpl b/charts/library/common/README_CHANGELOG.md.gotmpl deleted file mode 100644 index 543e51a8..00000000 --- a/charts/library/common/README_CHANGELOG.md.gotmpl +++ /dev/null @@ -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 -}} diff --git a/charts/library/common/README_CONFIG.md.gotmpl b/charts/library/common/README_CONFIG.md.gotmpl index a5502497..4a8db25e 100644 --- a/charts/library/common/README_CONFIG.md.gotmpl +++ b/charts/library/common/README_CONFIG.md.gotmpl @@ -21,7 +21,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g. # Chart.yaml dependencies: - name: common - version: 3.0.0 + version: 0.1.0 repository: {{ template "custom.helm.url" }} ``` diff --git a/charts/library/common/templates/lib/controller/_container.tpl b/charts/library/common/templates/lib/controller/_container.tpl index ff507295..9c7ba81d 100644 --- a/charts/library/common/templates/lib/controller/_container.tpl +++ b/charts/library/common/templates/lib/controller/_container.tpl @@ -36,29 +36,7 @@ {{- with .Values.env }} env: - {{- 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 }} - - 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 }} + {{- get (fromYaml (include "common.controller.env_vars" $)) "env" | toYaml | nindent 4 -}} {{- end }} {{- if or .Values.envFrom .Values.secret }} envFrom: diff --git a/charts/library/common/templates/lib/controller/_env_vars.tpl b/charts/library/common/templates/lib/controller/_env_vars.tpl new file mode 100644 index 00000000..ab4ed68e --- /dev/null +++ b/charts/library/common/templates/lib/controller/_env_vars.tpl @@ -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 -}} diff --git a/charts/library/common/templates/lib/controller/_pod.tpl b/charts/library/common/templates/lib/controller/_pod.tpl index 82ee2d15..a6e21998 100644 --- a/charts/library/common/templates/lib/controller/_pod.tpl +++ b/charts/library/common/templates/lib/controller/_pod.tpl @@ -50,6 +50,12 @@ initContainers: {{- if not $container.name -}} {{- $_ := set $container "name" $key }} {{- 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 }} {{- end }} {{- tpl (toYaml $initContainers) $ | nindent 2 }} @@ -62,6 +68,12 @@ containers: {{- if not $container.name -}} {{- $_ := set $container "name" $name }} {{- 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 }} {{- end }} {{- tpl (toYaml $additionalContainers) $ | nindent 2 }} diff --git a/charts/other/kah-common-chart/.helmignore b/charts/other/common-chart/.helmignore similarity index 100% rename from charts/other/kah-common-chart/.helmignore rename to charts/other/common-chart/.helmignore diff --git a/charts/other/common-chart/Chart.yaml b/charts/other/common-chart/Chart.yaml new file mode 100644 index 00000000..b6eac021 --- /dev/null +++ b/charts/other/common-chart/Chart.yaml @@ -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 diff --git a/charts/other/kah-common-chart/README_CONFIG.md.gotmpl b/charts/other/common-chart/README_CONFIG.md.gotmpl similarity index 100% rename from charts/other/kah-common-chart/README_CONFIG.md.gotmpl rename to charts/other/common-chart/README_CONFIG.md.gotmpl diff --git a/charts/other/common-chart/ci/basic-values.yaml b/charts/other/common-chart/ci/basic-values.yaml new file mode 100644 index 00000000..9816acdd --- /dev/null +++ b/charts/other/common-chart/ci/basic-values.yaml @@ -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 diff --git a/charts/other/common-chart/ci/codeserver-values.yaml b/charts/other/common-chart/ci/codeserver-values.yaml new file mode 100644 index 00000000..61af9eeb --- /dev/null +++ b/charts/other/common-chart/ci/codeserver-values.yaml @@ -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 diff --git a/charts/other/common-chart/ci/netshoot-values.yaml b/charts/other/common-chart/ci/netshoot-values.yaml new file mode 100644 index 00000000..ab78c9b1 --- /dev/null +++ b/charts/other/common-chart/ci/netshoot-values.yaml @@ -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 diff --git a/charts/other/common-chart/ci/promtail-values.yaml b/charts/other/common-chart/ci/promtail-values.yaml new file mode 100644 index 00000000..0d6e837e --- /dev/null +++ b/charts/other/common-chart/ci/promtail-values.yaml @@ -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 diff --git a/charts/other/kah-common-chart/templates/common.yaml b/charts/other/common-chart/templates/common.yaml similarity index 100% rename from charts/other/kah-common-chart/templates/common.yaml rename to charts/other/common-chart/templates/common.yaml diff --git a/charts/other/kah-common-chart/tests/addons/codeserver_test.yaml b/charts/other/common-chart/tests/addons/codeserver_test.yaml similarity index 93% rename from charts/other/kah-common-chart/tests/addons/codeserver_test.yaml rename to charts/other/common-chart/tests/addons/codeserver_test.yaml index 0c0e2085..47a80036 100644 --- a/charts/other/kah-common-chart/tests/addons/codeserver_test.yaml +++ b/charts/other/common-chart/tests/addons/codeserver_test.yaml @@ -45,7 +45,7 @@ tests: - documentIndex: *AddonServiceDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: addon enabled with deployKey should pass set: @@ -83,11 +83,11 @@ tests: items: - key: id_rsa path: id_rsa - secretName: RELEASE-NAME-kah-common-chart-deploykey + secretName: RELEASE-NAME-common-chart-deploykey - documentIndex: *AddonDeployKeySecretDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-deploykey + value: RELEASE-NAME-common-chart-deploykey - it: addon enabled with InlineBase64 deployKey should pass set: @@ -125,11 +125,11 @@ tests: items: - key: id_rsa path: id_rsa - secretName: RELEASE-NAME-kah-common-chart-deploykey + secretName: RELEASE-NAME-common-chart-deploykey - documentIndex: *AddonDeployKeySecretDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-deploykey + value: RELEASE-NAME-common-chart-deploykey - it: addon enabled with existingSecret deployKey should pass set: diff --git a/charts/other/kah-common-chart/tests/addons/netshoot_test.yaml b/charts/other/common-chart/tests/addons/netshoot_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/addons/netshoot_test.yaml rename to charts/other/common-chart/tests/addons/netshoot_test.yaml diff --git a/charts/other/kah-common-chart/tests/addons/vpn_test.yaml b/charts/other/common-chart/tests/addons/vpn_test.yaml similarity index 68% rename from charts/other/kah-common-chart/tests/addons/vpn_test.yaml rename to charts/other/common-chart/tests/addons/vpn_test.yaml index 7549ba3b..664f8baa 100644 --- a/charts/other/kah-common-chart/tests/addons/vpn_test.yaml +++ b/charts/other/common-chart/tests/addons/vpn_test.yaml @@ -68,11 +68,11 @@ tests: items: - key: vpnConfigfile path: vpnConfigfile - secretName: RELEASE-NAME-kah-common-chart-vpnconfig + secretName: RELEASE-NAME-common-chart-vpnconfig - documentIndex: *AddonVPNConfigSecretDocument equal: 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 set: @@ -129,3 +129,52 @@ tests: equal: path: spec.template.spec.containers[0].name 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 diff --git a/charts/other/kah-common-chart/tests/configmap/metadata_test.yaml b/charts/other/common-chart/tests/configmap/metadata_test.yaml similarity index 87% rename from charts/other/kah-common-chart/tests/configmap/metadata_test.yaml rename to charts/other/common-chart/tests/configmap/metadata_test.yaml index 61b3517f..f7f81a29 100644 --- a/charts/other/kah-common-chart/tests/configmap/metadata_test.yaml +++ b/charts/other/common-chart/tests/configmap/metadata_test.yaml @@ -20,8 +20,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -47,8 +47,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -81,7 +81,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/configmap/names_test.yaml b/charts/other/common-chart/tests/configmap/names_test.yaml similarity index 94% rename from charts/other/kah-common-chart/tests/configmap/names_test.yaml rename to charts/other/common-chart/tests/configmap/names_test.yaml index 817f9436..a59f9ce6 100644 --- a/charts/other/kah-common-chart/tests/configmap/names_test.yaml +++ b/charts/other/common-chart/tests/configmap/names_test.yaml @@ -71,7 +71,7 @@ tests: - documentIndex: 0 equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-config + value: RELEASE-NAME-common-chart-config - it: with nameOverride should pass set: @@ -88,4 +88,4 @@ tests: - documentIndex: 0 equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-http + value: RELEASE-NAME-common-chart-http diff --git a/charts/other/kah-common-chart/tests/configmap/pod_metadata_test.yaml b/charts/other/common-chart/tests/configmap/pod_metadata_test.yaml similarity index 80% rename from charts/other/kah-common-chart/tests/configmap/pod_metadata_test.yaml rename to charts/other/common-chart/tests/configmap/pod_metadata_test.yaml index 1de2f7ab..25da583d 100644 --- a/charts/other/kah-common-chart/tests/configmap/pod_metadata_test.yaml +++ b/charts/other/common-chart/tests/configmap/pod_metadata_test.yaml @@ -15,4 +15,4 @@ tests: equal: path: spec.template.metadata.annotations value: - checksum/config: 08f1047e9078ea3a6e593bffc1bf2d1b7db4163b9bb0c8203d8c70f2a6a5e551 + checksum/config: 3cd90a9f7d2c08b3d9d41d1be650110f4974009dcaf0a3d9e0616c90d80e1d38 diff --git a/charts/other/kah-common-chart/tests/container/args_test.yaml b/charts/other/common-chart/tests/container/args_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/container/args_test.yaml rename to charts/other/common-chart/tests/container/args_test.yaml diff --git a/charts/other/kah-common-chart/tests/container/command_test.yaml b/charts/other/common-chart/tests/container/command_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/container/command_test.yaml rename to charts/other/common-chart/tests/container/command_test.yaml diff --git a/charts/other/kah-common-chart/tests/container/env_test.yaml b/charts/other/common-chart/tests/container/env_test.yaml similarity index 91% rename from charts/other/kah-common-chart/tests/container/env_test.yaml rename to charts/other/common-chart/tests/container/env_test.yaml index 11e5a7af..244b5ba8 100644 --- a/charts/other/kah-common-chart/tests/container/env_test.yaml +++ b/charts/other/common-chart/tests/container/env_test.yaml @@ -56,21 +56,6 @@ tests: name: string 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 set: env: diff --git a/charts/other/kah-common-chart/tests/container/envfrom_test.yaml b/charts/other/common-chart/tests/container/envfrom_test.yaml similarity index 95% rename from charts/other/kah-common-chart/tests/container/envfrom_test.yaml rename to charts/other/common-chart/tests/container/envfrom_test.yaml index 8ec61989..17e1cdf0 100644 --- a/charts/other/kah-common-chart/tests/container/envfrom_test.yaml +++ b/charts/other/common-chart/tests/container/envfrom_test.yaml @@ -40,4 +40,4 @@ tests: path: spec.template.spec.containers[0].envFrom[0] value: secretRef: - name: RELEASE-NAME-kah-common-chart + name: RELEASE-NAME-common-chart diff --git a/charts/other/kah-common-chart/tests/container/ports_test.yaml b/charts/other/common-chart/tests/container/ports_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/container/ports_test.yaml rename to charts/other/common-chart/tests/container/ports_test.yaml diff --git a/charts/other/kah-common-chart/tests/container/volumemounts_test.yaml b/charts/other/common-chart/tests/container/volumemounts_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/container/volumemounts_test.yaml rename to charts/other/common-chart/tests/container/volumemounts_test.yaml diff --git a/charts/other/kah-common-chart/tests/controller/metadata_daemonset_test.yaml b/charts/other/common-chart/tests/controller/metadata_daemonset_test.yaml similarity index 86% rename from charts/other/kah-common-chart/tests/controller/metadata_daemonset_test.yaml rename to charts/other/common-chart/tests/controller/metadata_daemonset_test.yaml index b115a9e2..c9fdd35d 100644 --- a/charts/other/kah-common-chart/tests/controller/metadata_daemonset_test.yaml +++ b/charts/other/common-chart/tests/controller/metadata_daemonset_test.yaml @@ -18,8 +18,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -44,8 +44,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -77,7 +77,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/controller/metadata_deployment_test.yaml b/charts/other/common-chart/tests/controller/metadata_deployment_test.yaml similarity index 86% rename from charts/other/kah-common-chart/tests/controller/metadata_deployment_test.yaml rename to charts/other/common-chart/tests/controller/metadata_deployment_test.yaml index 2992fc32..3a24ed12 100644 --- a/charts/other/kah-common-chart/tests/controller/metadata_deployment_test.yaml +++ b/charts/other/common-chart/tests/controller/metadata_deployment_test.yaml @@ -18,8 +18,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -44,8 +44,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -77,7 +77,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/controller/metadata_statefulset_test.yaml b/charts/other/common-chart/tests/controller/metadata_statefulset_test.yaml similarity index 86% rename from charts/other/kah-common-chart/tests/controller/metadata_statefulset_test.yaml rename to charts/other/common-chart/tests/controller/metadata_statefulset_test.yaml index f65cd590..caed2378 100644 --- a/charts/other/kah-common-chart/tests/controller/metadata_statefulset_test.yaml +++ b/charts/other/common-chart/tests/controller/metadata_statefulset_test.yaml @@ -18,8 +18,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -44,8 +44,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -77,7 +77,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/controller/type_test.yaml b/charts/other/common-chart/tests/controller/type_test.yaml similarity index 89% rename from charts/other/kah-common-chart/tests/controller/type_test.yaml rename to charts/other/common-chart/tests/controller/type_test.yaml index bf2a0ba4..621bf558 100644 --- a/charts/other/kah-common-chart/tests/controller/type_test.yaml +++ b/charts/other/common-chart/tests/controller/type_test.yaml @@ -10,7 +10,7 @@ tests: - documentIndex: *ControllerDoc equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: daemonset should pass set: @@ -22,7 +22,7 @@ tests: - documentIndex: *ControllerDoc equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: statefulset should pass set: @@ -34,7 +34,7 @@ tests: - documentIndex: *ControllerDoc equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: disabled should pass set: diff --git a/charts/other/kah-common-chart/tests/ingress/metadata_test.yaml b/charts/other/common-chart/tests/ingress/metadata_test.yaml similarity index 86% rename from charts/other/kah-common-chart/tests/ingress/metadata_test.yaml rename to charts/other/common-chart/tests/ingress/metadata_test.yaml index 40491e00..c37f8697 100644 --- a/charts/other/kah-common-chart/tests/ingress/metadata_test.yaml +++ b/charts/other/common-chart/tests/ingress/metadata_test.yaml @@ -18,8 +18,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -44,8 +44,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -77,7 +77,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/ingress/presence_test.yaml b/charts/other/common-chart/tests/ingress/presence_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/ingress/presence_test.yaml rename to charts/other/common-chart/tests/ingress/presence_test.yaml diff --git a/charts/other/kah-common-chart/tests/ingress/service_reference_test.yaml b/charts/other/common-chart/tests/ingress/service_reference_test.yaml similarity index 94% rename from charts/other/kah-common-chart/tests/ingress/service_reference_test.yaml rename to charts/other/common-chart/tests/ingress/service_reference_test.yaml index 0021f7b5..f46d3627 100644 --- a/charts/other/kah-common-chart/tests/ingress/service_reference_test.yaml +++ b/charts/other/common-chart/tests/ingress/service_reference_test.yaml @@ -13,7 +13,7 @@ tests: equal: path: spec.rules[0].http.paths[0].backend value: - serviceName: RELEASE-NAME-kah-common-chart + serviceName: RELEASE-NAME-common-chart servicePort: null - it: custom service reference should pass diff --git a/charts/other/kah-common-chart/tests/ingress/tls_test.yaml b/charts/other/common-chart/tests/ingress/tls_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/ingress/tls_test.yaml rename to charts/other/common-chart/tests/ingress/tls_test.yaml diff --git a/charts/other/kah-common-chart/tests/ingress/values_test.yaml b/charts/other/common-chart/tests/ingress/values_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/ingress/values_test.yaml rename to charts/other/common-chart/tests/ingress/values_test.yaml diff --git a/charts/other/kah-common-chart/tests/persistence/claimnames_test.yaml b/charts/other/common-chart/tests/persistence/claimnames_test.yaml similarity index 90% rename from charts/other/kah-common-chart/tests/persistence/claimnames_test.yaml rename to charts/other/common-chart/tests/persistence/claimnames_test.yaml index de9891d7..33e063cf 100644 --- a/charts/other/kah-common-chart/tests/persistence/claimnames_test.yaml +++ b/charts/other/common-chart/tests/persistence/claimnames_test.yaml @@ -17,7 +17,7 @@ tests: value: name: config persistentVolumeClaim: - claimName: RELEASE-NAME-kah-common-chart-config + claimName: RELEASE-NAME-common-chart-config - it: with existingClaim should pass set: @@ -55,7 +55,7 @@ tests: value: name: claimWithoutSuffix persistentVolumeClaim: - claimName: RELEASE-NAME-kah-common-chart + claimName: RELEASE-NAME-common-chart - it: custom suffix should pass set: @@ -75,4 +75,4 @@ tests: value: name: claimWithNameOverride persistentVolumeClaim: - claimName: RELEASE-NAME-kah-common-chart-suffix + claimName: RELEASE-NAME-common-chart-suffix diff --git a/charts/other/kah-common-chart/tests/persistence/emptydir_test.yaml b/charts/other/common-chart/tests/persistence/emptydir_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/persistence/emptydir_test.yaml rename to charts/other/common-chart/tests/persistence/emptydir_test.yaml diff --git a/charts/other/kah-common-chart/tests/persistence/hostpath_test.yaml b/charts/other/common-chart/tests/persistence/hostpath_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/persistence/hostpath_test.yaml rename to charts/other/common-chart/tests/persistence/hostpath_test.yaml diff --git a/charts/other/kah-common-chart/tests/persistence/types_test.yaml b/charts/other/common-chart/tests/persistence/types_test.yaml similarity index 98% rename from charts/other/kah-common-chart/tests/persistence/types_test.yaml rename to charts/other/common-chart/tests/persistence/types_test.yaml index 6c9ee0d3..84e544af 100644 --- a/charts/other/kah-common-chart/tests/persistence/types_test.yaml +++ b/charts/other/common-chart/tests/persistence/types_test.yaml @@ -65,7 +65,7 @@ tests: value: name: configmap configMap: - name: RELEASE-NAME-kah-common-chart-config + name: RELEASE-NAME-common-chart-config - it: secret persistence type should pass set: diff --git a/charts/other/kah-common-chart/tests/persistence/volumeclaimtemplates_test.yaml b/charts/other/common-chart/tests/persistence/volumeclaimtemplates_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/persistence/volumeclaimtemplates_test.yaml rename to charts/other/common-chart/tests/persistence/volumeclaimtemplates_test.yaml diff --git a/charts/other/common-chart/tests/pod/additionalcontainers_test.yaml b/charts/other/common-chart/tests/pod/additionalcontainers_test.yaml new file mode 100644 index 00000000..8785832e --- /dev/null +++ b/charts/other/common-chart/tests/pod/additionalcontainers_test.yaml @@ -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 diff --git a/charts/other/common-chart/tests/pod/initcontainers_test.yaml b/charts/other/common-chart/tests/pod/initcontainers_test.yaml new file mode 100644 index 00000000..45d69ff4 --- /dev/null +++ b/charts/other/common-chart/tests/pod/initcontainers_test.yaml @@ -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 diff --git a/charts/other/kah-common-chart/tests/pod/network_test.yaml b/charts/other/common-chart/tests/pod/network_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/pod/network_test.yaml rename to charts/other/common-chart/tests/pod/network_test.yaml diff --git a/charts/other/kah-common-chart/tests/pod/replicas_test.yaml b/charts/other/common-chart/tests/pod/replicas_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/pod/replicas_test.yaml rename to charts/other/common-chart/tests/pod/replicas_test.yaml diff --git a/charts/other/kah-common-chart/tests/pvc/metadata_test.yaml b/charts/other/common-chart/tests/pvc/metadata_test.yaml similarity index 87% rename from charts/other/kah-common-chart/tests/pvc/metadata_test.yaml rename to charts/other/common-chart/tests/pvc/metadata_test.yaml index 115ecd21..228302f4 100644 --- a/charts/other/kah-common-chart/tests/pvc/metadata_test.yaml +++ b/charts/other/common-chart/tests/pvc/metadata_test.yaml @@ -18,8 +18,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: retain enabled should pass set: @@ -41,8 +41,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -67,8 +67,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -100,7 +100,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/pvc/names_test.yaml b/charts/other/common-chart/tests/pvc/names_test.yaml similarity index 90% rename from charts/other/kah-common-chart/tests/pvc/names_test.yaml rename to charts/other/common-chart/tests/pvc/names_test.yaml index 489f1c56..fd7ca8b5 100644 --- a/charts/other/kah-common-chart/tests/pvc/names_test.yaml +++ b/charts/other/common-chart/tests/pvc/names_test.yaml @@ -35,7 +35,7 @@ tests: - documentIndex: *PersistentVolumeClaimDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-config + value: RELEASE-NAME-common-chart-config - it: without suffix should pass set: @@ -49,7 +49,7 @@ tests: - documentIndex: *PersistentVolumeClaimDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: with custom suffix should pass set: @@ -63,4 +63,4 @@ tests: - documentIndex: *PersistentVolumeClaimDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-custom + value: RELEASE-NAME-common-chart-custom diff --git a/charts/other/kah-common-chart/tests/pvc/storageclass_test.yaml b/charts/other/common-chart/tests/pvc/storageclass_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/pvc/storageclass_test.yaml rename to charts/other/common-chart/tests/pvc/storageclass_test.yaml diff --git a/charts/other/kah-common-chart/tests/service/metadata_test.yaml b/charts/other/common-chart/tests/service/metadata_test.yaml similarity index 86% rename from charts/other/kah-common-chart/tests/service/metadata_test.yaml rename to charts/other/common-chart/tests/service/metadata_test.yaml index 00e799e6..35acf1d2 100644 --- a/charts/other/kah-common-chart/tests/service/metadata_test.yaml +++ b/charts/other/common-chart/tests/service/metadata_test.yaml @@ -16,8 +16,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 - it: custom metadata should pass set: @@ -42,8 +42,8 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart - helm.sh/chart: kah-common-chart-1.1.2 + app.kubernetes.io/name: common-chart + helm.sh/chart: common-chart-0.1.0 test_label: test - it: custom metadata with global metadata should pass @@ -75,7 +75,7 @@ tests: value: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: kah-common-chart + app.kubernetes.io/name: common-chart global_label: test - helm.sh/chart: kah-common-chart-1.1.2 + helm.sh/chart: common-chart-0.1.0 test_label: test diff --git a/charts/other/kah-common-chart/tests/service/names_test.yaml b/charts/other/common-chart/tests/service/names_test.yaml similarity index 85% rename from charts/other/kah-common-chart/tests/service/names_test.yaml rename to charts/other/common-chart/tests/service/names_test.yaml index d3bea399..a3665998 100644 --- a/charts/other/kah-common-chart/tests/service/names_test.yaml +++ b/charts/other/common-chart/tests/service/names_test.yaml @@ -12,7 +12,7 @@ tests: - documentIndex: *ServiceDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart + value: RELEASE-NAME-common-chart - it: custom name suffix should pass set: @@ -26,4 +26,4 @@ tests: - documentIndex: *ServiceDocument equal: path: metadata.name - value: RELEASE-NAME-kah-common-chart-http + value: RELEASE-NAME-common-chart-http diff --git a/charts/other/kah-common-chart/tests/service/port_names_test.yaml b/charts/other/common-chart/tests/service/port_names_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/service/port_names_test.yaml rename to charts/other/common-chart/tests/service/port_names_test.yaml diff --git a/charts/other/kah-common-chart/tests/service/port_protocols_test.yaml b/charts/other/common-chart/tests/service/port_protocols_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/service/port_protocols_test.yaml rename to charts/other/common-chart/tests/service/port_protocols_test.yaml diff --git a/charts/other/kah-common-chart/tests/service/values_test.yaml b/charts/other/common-chart/tests/service/values_test.yaml similarity index 100% rename from charts/other/kah-common-chart/tests/service/values_test.yaml rename to charts/other/common-chart/tests/service/values_test.yaml diff --git a/charts/other/kah-common-chart/values.yaml b/charts/other/common-chart/values.yaml similarity index 100% rename from charts/other/kah-common-chart/values.yaml rename to charts/other/common-chart/values.yaml diff --git a/charts/other/kah-common-chart/Chart.yaml b/charts/other/kah-common-chart/Chart.yaml deleted file mode 100644 index 87b07bec..00000000 --- a/charts/other/kah-common-chart/Chart.yaml +++ /dev/null @@ -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 diff --git a/charts/other/kah-common-chart/tests/pod/additionalcontainers_test.yaml b/charts/other/kah-common-chart/tests/pod/additionalcontainers_test.yaml deleted file mode 100644 index 30a1043e..00000000 --- a/charts/other/kah-common-chart/tests/pod/additionalcontainers_test.yaml +++ /dev/null @@ -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 diff --git a/charts/other/kah-common-chart/tests/pod/initcontainers_test.yaml b/charts/other/kah-common-chart/tests/pod/initcontainers_test.yaml deleted file mode 100644 index fee293d5..00000000 --- a/charts/other/kah-common-chart/tests/pod/initcontainers_test.yaml +++ /dev/null @@ -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