feat(common): Release version 1.1.0 (#81)

# Removed
- Promtail add-on has been removed

# Fixed
- Fixed httpGet probe whitespace rendering (#76)
- Fixed Secret management for ServiceAccounts (fixes #78)
- Fixed code-server add-on Service rendering

# Added
- Added support for Gateway API Routes (#59)

# Changed
- Services and their ports are now assumed enabled by default
- Updated `code-server` image to v4.8.3
- Updated `netshoot` image to v0.8

Signed-off-by: András Maróy <andras@maroy.hu>
Signed-off-by: András Maróy <andras@maroy.hu>
Co-authored-by: András Maróy <andras@maroy.hu>
Co-authored-by: pando85 <pando855@gmail.com>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-11-19 13:24:11 +01:00 committed by GitHub
parent 841d562827
commit a2a0b8ea2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 1393 additions and 320 deletions

View file

@ -1,5 +1,5 @@
mkdocs==1.4.2 mkdocs==1.4.2
mkdocs-macros-plugin ==0.7.0 mkdocs-macros-plugin ==0.7.0
mkdocs-material ==8.5.7 mkdocs-material ==8.5.9
mkdocs-minify-plugin==0.6.1 mkdocs-minify-plugin==0.6.1
mkdocs-redirects==1.2.0 mkdocs-redirects==1.2.0

View file

@ -3,7 +3,7 @@ apiVersion: v2
name: common name: common
description: Function library for Helm charts description: Function library for Helm charts
type: library type: library
version: 1.0.1 version: 1.1.0
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
keywords: keywords:
- common - common
@ -14,27 +14,25 @@ maintainers:
email: me@bjw-s.dev email: me@bjw-s.dev
annotations: annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: removed
description: "**BREAKING**: Removed support for HorizontalPodAutoscaler"
- kind: added
description: Added support for `httpGet` probes
- kind: added
description: Added support for setting labels / annotations on volumeClaimTemplates
- kind: added
description: Support services have extraSelectorLabels
- kind: changed
description: "**BREAKING**: Restructure of template components. All Helm template names have changed!"
- kind: changed
description: "**BREAKING**: Raised minimum supported k8s version to 1.22"
- kind: changed
description: "**BREAKING**: Renamed `configmap` key to `configMaps`"
- kind: changed
description: "**BREAKING**: Moved `serviceMonitor` from `service` to its own key"
- kind: changed
description: "**BREAKING**: Renamed `secret` key to `secrets`, which now works similar to `configMaps`"
- kind: changed
description: Updated code-server image to v4.8.2
- kind: changed
description: Updated gluetun image to v3.32.0
- kind: fixed - kind: fixed
description: Fix NOTES always showing ingress protocol as http description: Fixed code-server add-on Service rendering
- kind: fixed
description: Fixed httpGet probe whitespace rendering
- kind: fixed
description: Fixed serviceAccount definition to be compatible with k8s 1.25
links:
- name: Secret management for ServiceAccounts
url: https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#manual-secret-management-for-serviceaccounts
- kind: added
description: Added support for Gateway API Routes
links:
- name: Gateway API docs
url: https://gateway-api.sigs.k8s.io
- kind: changed
description: Services and their ports are now assumed enabled by default
- kind: changed
description: Updated netshoot image to v0.8
- kind: changed
description: Updated code-server image to v4.8.3
- kind: removed
description: Removed promtail add-on

View file

@ -1,6 +1,6 @@
# common # common
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
Function library for Helm charts Function library for Helm charts
@ -29,7 +29,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 1.0.0 version: 1.1.0
repository: https://bjw-s.github.io/helm-charts/ repository: https://bjw-s.github.io/helm-charts/
``` ```
@ -61,7 +61,7 @@ N/A
| addons.codeserver.git.deployKeySecret | string | `""` | Existing secret containing SSH private key The chart expects it to be present under the `id_rsa` key. | | addons.codeserver.git.deployKeySecret | string | `""` | Existing secret containing SSH private key The chart expects it to be present under the `id_rsa` key. |
| addons.codeserver.image.pullPolicy | string | `"IfNotPresent"` | Specify the code-server image pull policy | | addons.codeserver.image.pullPolicy | string | `"IfNotPresent"` | Specify the code-server image pull policy |
| addons.codeserver.image.repository | string | `"ghcr.io/coder/code-server"` | Specify the code-server image | | addons.codeserver.image.repository | string | `"ghcr.io/coder/code-server"` | Specify the code-server image |
| addons.codeserver.image.tag | string | `"4.8.2"` | Specify the code-server image tag | | addons.codeserver.image.tag | string | `"4.8.3"` | Specify the code-server image tag |
| addons.codeserver.ingress.enabled | bool | `false` | Enable an ingress for the code-server add-on. | | addons.codeserver.ingress.enabled | bool | `false` | Enable an ingress for the code-server add-on. |
| addons.codeserver.ingress.ingressClassName | string | `nil` | Set the ingressClass that is used for this ingress. | | addons.codeserver.ingress.ingressClassName | string | `nil` | Set the ingressClass that is used for this ingress. |
| addons.codeserver.service.enabled | bool | `true` | Enable a service for the code-server add-on. | | addons.codeserver.service.enabled | bool | `true` | Enable a service for the code-server add-on. |
@ -72,24 +72,14 @@ N/A
| addons.netshoot.env | object | `{}` | Set any environment variables for netshoot here | | addons.netshoot.env | object | `{}` | Set any environment variables for netshoot here |
| addons.netshoot.image.pullPolicy | string | `"IfNotPresent"` | Specify the netshoot image pull policy | | addons.netshoot.image.pullPolicy | string | `"IfNotPresent"` | Specify the netshoot image pull policy |
| addons.netshoot.image.repository | string | `"ghcr.io/nicolaka/netshoot"` | Specify the netshoot image | | addons.netshoot.image.repository | string | `"ghcr.io/nicolaka/netshoot"` | Specify the netshoot image |
| addons.netshoot.image.tag | string | `"v0.7"` | Specify the netshoot image tag | | addons.netshoot.image.tag | string | `"v0.8"` | Specify the netshoot image tag |
| addons.promtail | object | See values.yaml | The common library supports adding a promtail add-on to to access logs and ship them to loki. It can be configured under this key. |
| addons.promtail.args | list | `[]` | Set promtail command line arguments |
| addons.promtail.enabled | bool | `false` | Enable running a promtail container in the pod |
| addons.promtail.env | object | `{}` | Set any environment variables for promtail here |
| addons.promtail.image.pullPolicy | string | `"IfNotPresent"` | Specify the promtail image pull policy |
| addons.promtail.image.repository | string | `"docker.io/grafana/promtail"` | Specify the promtail image |
| addons.promtail.image.tag | string | `"2.6.1"` | Specify the promtail image tag |
| addons.promtail.logs | list | `[]` | The paths to logs on the volume |
| addons.promtail.loki | string | `""` | The URL to Loki |
| addons.promtail.volumeMounts | list | `[]` | Specify a list of volumes that get mounted in the promtail container. At least 1 volumeMount is required! |
| addons.vpn | object | See values.yaml | The common chart supports adding a VPN add-on. It can be configured under this key. | | addons.vpn | object | See values.yaml | The common chart supports adding a VPN add-on. It can be configured under this key. |
| addons.vpn.args | list | `[]` | Override the args for the vpn sidecar container | | addons.vpn.args | list | `[]` | Override the args for the vpn sidecar container |
| addons.vpn.configFile | string | `nil` | Provide a customized vpn configuration file to be used by the VPN. | | addons.vpn.configFile | string | `nil` | Provide a customized vpn configuration file to be used by the VPN. |
| addons.vpn.configFileSecret | string | `nil` | Reference an existing secret that contains the VPN configuration file The chart expects it to be present under the `vpnConfigfile` key. | | addons.vpn.configFileSecret | string | `nil` | Reference an existing secret that contains the VPN configuration file The chart expects it to be present under the `vpnConfigfile` key. |
| addons.vpn.enabled | bool | `false` | Enable running a VPN in the pod to route traffic through a VPN | | addons.vpn.enabled | bool | `false` | Enable running a VPN in the pod to route traffic through a VPN |
| addons.vpn.env | object | `{}` | All variables specified here will be added to the vpn sidecar container See the documentation of the VPN image for all config values | | addons.vpn.env | object | `{}` | All variables specified here will be added to the vpn sidecar container See the documentation of the VPN image for all config values |
| addons.vpn.gluetun | object | See below | Gluetun specific configuration -- Make sure to read the [documentation](https://github.com/qdm12/gluetun/wiki) to see how to configure this addon! | | addons.vpn.gluetun | object | See below | Make sure to read the [documentation](https://github.com/qdm12/gluetun/wiki) to see how to configure this addon! |
| addons.vpn.gluetun.image.pullPolicy | string | `"IfNotPresent"` | Specify the Gluetun image pull policy | | addons.vpn.gluetun.image.pullPolicy | string | `"IfNotPresent"` | Specify the Gluetun image pull policy |
| addons.vpn.gluetun.image.repository | string | `"docker.io/qmcgaw/gluetun"` | Specify the Gluetun image | | addons.vpn.gluetun.image.repository | string | `"docker.io/qmcgaw/gluetun"` | Specify the Gluetun image |
| addons.vpn.gluetun.image.tag | string | `"v3.32.0"` | Specify the Gluetun image tag | | addons.vpn.gluetun.image.tag | string | `"v3.32.0"` | Specify the Gluetun image tag |
@ -173,7 +163,7 @@ N/A
| podLabels | object | `{}` | Set labels on the pod | | podLabels | object | `{}` | Set labels on the pod |
| podSecurityContext | object | `{}` | Configure the Security Context for the Pod | | podSecurityContext | object | `{}` | Configure the Security Context for the Pod |
| priorityClassName | string | `nil` | Custom priority class for different treatment by the scheduler | | priorityClassName | string | `nil` | Custom priority class for different treatment by the scheduler |
| probes | object | See below | Probe configuration -- [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) | | probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) |
| probes.liveness | object | See below | Liveness probe configuration | | probes.liveness | object | See below | Liveness probe configuration |
| probes.liveness.custom | bool | `false` | Set this to `true` if you wish to specify your own livenessProbe | | probes.liveness.custom | bool | `false` | Set this to `true` if you wish to specify your own livenessProbe |
| probes.liveness.enabled | bool | `true` | Enable the liveness probe | | probes.liveness.enabled | bool | `true` | Enable the liveness probe |
@ -190,6 +180,15 @@ N/A
| probes.startup.spec | object | See below | The spec field contains the values for the default startupProbe. If you selected `custom: true`, this field holds the definition of the startupProbe. | | probes.startup.spec | object | See below | The spec field contains the values for the default startupProbe. If you selected `custom: true`, this field holds the definition of the startupProbe. |
| probes.startup.type | string | "TCP" | sets the probe type when not using a custom probe | | probes.startup.type | string | "TCP" | sets the probe type when not using a custom probe |
| resources | object | `{}` | Set the resource requests / limits for the main container. | | resources | object | `{}` | Set the resource requests / limits for the main container. |
| route | object | See below | Configure the gateway routes for the chart here. Additional routes can be added by adding a dictionary key similar to the 'main' route. [[ref]](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io%2fv1alpha2) |
| route.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| route.main.enabled | bool | `false` | Enables or disables the route |
| route.main.hostnames | list | `[]` | Host addresses |
| route.main.kind | string | `"HTTPRoute"` | Set the route kind Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute |
| route.main.labels | object | `{}` | Provide additional labels which may be required. |
| route.main.nameOverride | string | `nil` | Override the name suffix that is used for this route. |
| route.main.rules | list | `[{"backendRefs":[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]` | Configure rules for routing. Defaults to the primary service. |
| route.main.rules[0].backendRefs | list | `[{"group":"","kind":"Service","name":null,"namespace":null,"port":null,"weight":1}]` | Configure backends where matching requests should be sent. |
| runtimeClassName | string | `nil` | Allow specifying a runtimeClassName other than the default one (ie: nvidia) | | runtimeClassName | string | `nil` | Allow specifying a runtimeClassName other than the default one (ie: nvidia) |
| schedulerName | string | `nil` | Allows specifying a custom scheduler name | | schedulerName | string | `nil` | Allows specifying a custom scheduler name |
| secrets | object | See below | Use this to populate secrets with the values you specify. Be aware that these values are not encrypted by default, and could therefore visible to anybody with access to the values.yaml file. Additional Secrets can be added by adding a dictionary key similar to the 'secret' object. | | secrets | object | See below | Use this to populate secrets with the values you specify. Be aware that these values are not encrypted by default, and could therefore visible to anybody with access to the values.yaml file. Additional Secrets can be added by adding a dictionary key similar to the 'secret' object. |
@ -201,7 +200,7 @@ N/A
| service | object | See below | Configure the services for the chart here. Additional services can be added by adding a dictionary key similar to the 'main' service. | | service | object | See below | Configure the services for the chart here. Additional services can be added by adding a dictionary key similar to the 'main' service. |
| service.main.annotations | object | `{}` | Provide additional annotations which may be required. | | service.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| service.main.enabled | bool | `true` | Enables or disables the service | | service.main.enabled | bool | `true` | Enables or disables the service |
| service.main.externalTrafficPolicy | string | `nil` | Specify the externalTrafficPolicy for the service. Options: Cluster, Local -- [[ref](https://kubernetes.io/docs/tutorials/services/source-ip/)] | | service.main.externalTrafficPolicy | string | `nil` | [[ref](https://kubernetes.io/docs/tutorials/services/source-ip/)] |
| service.main.ipFamilies | list | `[]` | The ip families that should be used. Options: IPv4, IPv6 | | service.main.ipFamilies | list | `[]` | The ip families that should be used. Options: IPv4, IPv6 |
| service.main.ipFamilyPolicy | string | `nil` | Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack | | service.main.ipFamilyPolicy | string | `nil` | Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack |
| service.main.labels | object | `{}` | Provide additional labels which may be required. | | service.main.labels | object | `{}` | Provide additional labels which may be required. |
@ -226,10 +225,10 @@ N/A
| serviceMonitor.main.labels | object | `{}` | Provide additional labels which may be required. | | serviceMonitor.main.labels | object | `{}` | Provide additional labels which may be required. |
| serviceMonitor.main.nameOverride | string | `nil` | Override the name suffix that is used for this serviceMonitor. | | serviceMonitor.main.nameOverride | string | `nil` | Override the name suffix that is used for this serviceMonitor. |
| serviceMonitor.main.selector | object | `{}` | Configures a custom selector for the serviceMonitor, this takes precedence over specifying a service name. Helm templates can be used. | | serviceMonitor.main.selector | object | `{}` | Configures a custom selector for the serviceMonitor, this takes precedence over specifying a service name. Helm templates can be used. |
| serviceMonitor.main.serviceName | string | `"main"` | Configures the target Service for the serviceMonitor. Helm templates can be used. | | serviceMonitor.main.serviceName | string | `"{{ include \"bjw-s.common.lib.chart.names.fullname\" $ }}"` | Configures the target Service for the serviceMonitor. Helm templates can be used. |
| termination.gracePeriodSeconds | string | `nil` | Duration in seconds the pod needs to terminate gracefully -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] | | termination.gracePeriodSeconds | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] |
| termination.messagePath | string | `nil` | Configure the path at which the file to which the main container's termination message will be written. -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] | | termination.messagePath | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| termination.messagePolicy | string | `nil` | Indicate how the main container's termination message should be populated. Valid options are `File` and `FallbackToLogsOnError`. -- [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] | | termination.messagePolicy | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| tolerations | list | `[]` | Specify taint tolerations [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) | | tolerations | list | `[]` | Specify taint tolerations [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
| topologySpreadConstraints | list | `[]` | Defines topologySpreadConstraint rules. [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | | 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. |
@ -241,4 +240,4 @@ N/A
- Join the k8s-at-home [Discord](https://discord.gg/sTMX7Vh) community - Join the k8s-at-home [Discord](https://discord.gg/sTMX7Vh) community
---------------------------------------------- ----------------------------------------------
Autogenerated from chart metadata using [helm-docs v0.1.1](https://github.com/k8s-at-home/helm-docs/releases/v0.1.1) Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)

View file

@ -14,7 +14,7 @@ It will include / inject the required templates based on the given values.
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 -}} {{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 -}}
{{- $deployKeySecret := include "bjw-s.common.addon.codeserver.deployKeySecret" . -}} {{- $deployKeySecret := include "bjw-s.common.addon.codeserver.deployKeySecret" . -}}
{{- if $deployKeySecret -}} {{- if $deployKeySecret -}}
{{- $_ := set .Values.secrets "addon-codeserver-deploykey" (dict "enabled" "true" "stringData" ($deployKeySecret | fromYaml)) -}} {{- $_ := set .Values.secrets "addon-codeserver-deploykey" (dict "enabled" true "stringData" ($deployKeySecret | fromYaml)) -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -22,12 +22,18 @@ It will include / inject the required templates based on the given values.
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }} {{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }}
{{- $volume := include "bjw-s.common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}} {{- $volume := include "bjw-s.common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}}
{{- if $volume -}} {{- if $volume -}}
{{- $_ := set .Values.persistence "deploykey" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}} {{- $_ := set .Values.persistence "deploykey" (dict "enabled" true "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/* Add the code-server service */}} {{/* Add the code-server service */}}
{{- $_ := set .Values.service "addon-codeserver" .Values.addons.codeserver.service -}} {{- if .Values.addons.codeserver.service.enabled -}}
{{- $serviceValues := .Values.addons.codeserver.service -}}
{{- $_ := set $serviceValues "nameOverride" "addon-codeserver" -}}
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
{{- include "bjw-s.common.class.service" $ -}}
{{- $_ := unset $.ObjectValues "service" -}}
{{- end -}}
{{/* Add the code-server ingress */}} {{/* Add the code-server ingress */}}
{{- $svcName := printf "%v-addon-codeserver" (include "bjw-s.common.lib.chart.names.fullname" .) -}} {{- $svcName := printf "%v-addon-codeserver" (include "bjw-s.common.lib.chart.names.fullname" .) -}}

View file

@ -1,25 +0,0 @@
{{/*
Template to render promtail addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "bjw-s.common.addon.promtail" -}}
{{- if .Values.addons.promtail.enabled -}}
{{/* Append the promtail container to the additionalContainers */}}
{{- $container := include "bjw-s.common.addon.promtail.container" . | fromYaml -}}
{{- if $container -}}
{{- $_ := set .Values.additionalContainers "addon-promtail" $container -}}
{{- end -}}
{{/* Append the promtail configMap to the configmaps dict */}}
{{- $configmap := include "bjw-s.common.addon.promtail.configmap" . -}}
{{- if $configmap -}}
{{- $_ := set .Values.configMaps "addon-promtail" (dict "enabled" "true" "data" ($configmap | fromYaml)) -}}
{{- end -}}
{{/* Append the promtail config volume to the volumes */}}
{{- $volume := include "bjw-s.common.addon.promtail.volumeSpec" . | fromYaml -}}
{{- if $volume -}}
{{- $_ := set .Values.persistence "addon-promtail" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -1,25 +0,0 @@
{{/*
The promtail config to be included.
*/}}
{{- define "bjw-s.common.addon.promtail.configmap" -}}
promtail.yaml: |
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
{{- with .Values.addons.promtail.loki }}
client:
url: {{ . }}
{{- end }}
scrape_configs:
{{- range .Values.addons.promtail.logs }}
- job_name: {{ .name }}
static_configs:
- targets:
- localhost
labels:
job: {{ .name }}
__path__: "{{ .path }}"
{{- end }}
{{- end -}}

View file

@ -1,39 +0,0 @@
{{/*
The promtail sidecar container to be inserted.
*/}}
{{- define "bjw-s.common.addon.promtail.container" -}}
{{- if lt (len .Values.addons.promtail.volumeMounts) 1 }}
{{- fail "At least 1 volumeMount is required for the promtail container" }}
{{- end -}}
name: promtail
image: "{{ .Values.addons.promtail.image.repository }}:{{ .Values.addons.promtail.image.tag }}"
imagePullPolicy: {{ .Values.addons.promtail.pullPolicy }}
{{- with .Values.addons.promtail.securityContext }}
securityContext:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.addons.promtail.env }}
env:
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
args:
{{- range .Values.addons.promtail.args }}
- {{ . | quote }}
{{- end }}
- "-config.file=/etc/promtail/promtail.yaml"
volumeMounts:
- name: addon-promtail
mountPath: /etc/promtail/promtail.yaml
subPath: promtail.yaml
readOnly: true
{{- with .Values.addons.promtail.volumeMounts }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.addons.promtail.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -1,7 +0,0 @@
{{/*
The volume (referencing config) to be inserted into additionalVolumes.
*/}}
{{- define "bjw-s.common.addon.promtail.volumeSpec" -}}
configMap:
name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-addon-promtail
{{- end -}}

View file

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

View file

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

View file

@ -19,6 +19,9 @@ within the common library.
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
{{- with $values.type }}
type: {{ . }}
{{- end }}
metadata: metadata:
name: {{ $secretName }} name: {{ $secretName }}
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} {{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
@ -27,8 +30,8 @@ metadata:
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
stringData:
{{- with $values.stringData }} {{- with $values.stringData }}
stringData:
{{- tpl (toYaml .) $ | nindent 2 }} {{- tpl (toYaml .) $ | nindent 2 }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -15,6 +15,7 @@ within the common library.
{{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}} {{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}}
{{ end -}} {{ end -}}
{{- $svcType := $values.type | default "" -}} {{- $svcType := $values.type | default "" -}}
{{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "serviceName" $serviceName "values" $values) | fromYaml }}
{{- $primaryPort := get $values.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $values)) }} {{- $primaryPort := get $values.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $values)) }}
--- ---
apiVersion: v1 apiVersion: v1
@ -76,25 +77,23 @@ spec:
{{ toYaml . | nindent 4 }} {{ toYaml . | nindent 4 }}
{{- end }} {{- end }}
ports: ports:
{{- range $name, $port := $values.ports }} {{- range $name, $port := $enabledPorts }}
{{- if $port.enabled }} - port: {{ $port.port }}
- port: {{ $port.port }} targetPort: {{ $port.targetPort | default $name }}
targetPort: {{ $port.targetPort | default $name }} {{- if $port.protocol }}
{{- if $port.protocol }} {{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }}
{{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }} protocol: TCP
protocol: TCP {{- else }}
{{- else }} protocol: {{ $port.protocol }}
protocol: {{ $port.protocol }} {{- end }}
{{- end }} {{- else }}
{{- else }} protocol: TCP
protocol: TCP {{- end }}
{{- end }} name: {{ $name }}
name: {{ $name }} {{- if (and (eq $svcType "NodePort") (not (empty $port.nodePort))) }}
{{- if (and (eq $svcType "NodePort") (not (empty $port.nodePort))) }} nodePort: {{ $port.nodePort }}
nodePort: {{ $port.nodePort }} {{ end }}
{{ end }} {{- end -}}
{{- end }}
{{- end }}
{{- with (merge ($values.extraSelectorLabels | default dict) (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }} {{- with (merge ($values.extraSelectorLabels | default dict) (include "bjw-s.common.lib.metadata.selectorLabels" . | fromYaml)) }}
selector: {{- toYaml . | nindent 4 }} selector: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}

View file

@ -8,8 +8,12 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ include "bjw-s.common.lib.chart.names.serviceAccountName" . }} name: {{ include "bjw-s.common.lib.chart.names.serviceAccountName" . }}
labels: {{- include "bjw-s.common.lib.metadata.allLabels" $ | nindent 4 }} {{- with include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml }}
labels: {{- toYaml . | nindent 4 }}
{{- end }}
{{- with (merge (.Values.serviceAccount.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }} {{- with (merge (.Values.serviceAccount.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
secrets:
- name: {{ include "bjw-s.common.lib.chart.names.fullname" . }}-sa-token
{{- end -}} {{- end -}}

View file

@ -3,19 +3,18 @@ Ports included by the controller.
*/}} */}}
{{- define "bjw-s.common.lib.container.ports" -}} {{- define "bjw-s.common.lib.container.ports" -}}
{{- $ports := list -}} {{- $ports := list -}}
{{- range .Values.service -}} {{- range $servicename, $service := .Values.service -}}
{{- if .enabled -}} {{- $enabledPorts := include "bjw-s.common.lib.service.enabledPorts" (dict "serviceName" $servicename "values" $service) | fromYaml }}
{{- range $name, $port := .ports -}} {{- range $portname, $port := ($enabledPorts | default dict) -}}
{{- $_ := set $port "name" $name -}} {{- $_ := set $port "name" $portname -}}
{{- $ports = mustAppend $ports $port -}} {{- $ports = mustAppend $ports $port -}}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{/* export/render the list of ports */}} {{/* export/render the list of ports */}}
{{- if $ports -}} {{- if $ports -}}
{{- range $_ := $ports }} {{- range $_ := $ports }}
{{- if .enabled }} {{- if default true .enabled | }}
- name: {{ .name }} - name: {{ .name }}
{{- if and .targetPort (kindIs "string" .targetPort) }} {{- if and .targetPort (kindIs "string" .targetPort) }}
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }} {{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}

View file

@ -22,7 +22,7 @@ Probes selection logic.
{{- else -}} {{- else -}}
{{- $probeType = $probe.type | default "TCP" -}} {{- $probeType = $probe.type | default "TCP" -}}
{{- end }} {{- end }}
{{- if or ( eq $probeType "HTTPS" ) ( eq $probeType "HTTP" ) -}} {{- if or ( eq $probeType "HTTPS" ) ( eq $probeType "HTTP" ) }}
httpGet: httpGet:
path: {{ $probe.path }} path: {{ $probe.path }}
scheme: {{ $probeType }} scheme: {{ $probeType }}

View file

@ -0,0 +1,23 @@
{{/*
Return the enabled ports for a given Service object.
*/}}
{{- define "bjw-s.common.lib.service.enabledPorts" -}}
{{- $enabledPorts := dict -}}
{{- range $name, $port := .values.ports -}}
{{- if kindIs "map" $port -}}
{{- $portEnabled := true -}}
{{- if hasKey $port "enabled" -}}
{{- $portEnabled = $port.enabled -}}
{{- end -}}
{{- if $portEnabled -}}
{{- $_ := set $enabledPorts $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if eq 0 (len $enabledPorts) }}
{{- fail (printf "No ports are enabled for service \"%s\"!" (.serviceName | default "")) }}
{{- end }}
{{- $enabledPorts | toYaml -}}
{{- end -}}

View file

@ -0,0 +1,18 @@
{{/*
Return the enabled services.
*/}}
{{- define "bjw-s.common.lib.service.enabledServices" -}}
{{- $enabledServices := dict -}}
{{- range $name, $service := .Values.service -}}
{{- if kindIs "map" $service -}}
{{- $serviceEnabled := true -}}
{{- if hasKey $service "enabled" -}}
{{- $serviceEnabled = $service.enabled -}}
{{- end -}}
{{- if $serviceEnabled -}}
{{- $_ := set $enabledServices $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledServices | toYaml -}}
{{- end -}}

View file

@ -2,12 +2,7 @@
Return the primary service object Return the primary service object
*/}} */}}
{{- define "bjw-s.common.lib.service.primary" -}} {{- define "bjw-s.common.lib.service.primary" -}}
{{- $enabledServices := dict -}} {{- $enabledServices := (include "bjw-s.common.lib.service.enabledServices" $ | fromYaml ) }}
{{- range $name, $service := .Values.service -}}
{{- if $service.enabled -}}
{{- $_ := set $enabledServices $name . -}}
{{- end -}}
{{- end -}}
{{- $result := "" -}} {{- $result := "" -}}
{{- range $name, $service := $enabledServices -}} {{- range $name, $service := $enabledServices -}}

View file

@ -2,16 +2,7 @@
Return the primary port for a given Service object. Return the primary port for a given Service object.
*/}} */}}
{{- define "bjw-s.common.lib.service.primaryPort" -}} {{- define "bjw-s.common.lib.service.primaryPort" -}}
{{- $enabledPorts := dict -}} {{- $enabledPorts := (include "bjw-s.common.lib.service.enabledPorts" . | fromYaml) }}
{{- range $name, $port := .values.ports -}}
{{- if $port.enabled -}}
{{- $_ := set $enabledPorts $name . -}}
{{- end -}}
{{- end -}}
{{- if eq 0 (len $enabledPorts) }}
{{- fail (printf "No ports are enabled for service \"%s\"!" .serviceName) }}
{{- end }}
{{- $result := "" -}} {{- $result := "" -}}
{{- range $name, $port := $enabledPorts -}} {{- range $name, $port := $enabledPorts -}}

View file

@ -12,23 +12,19 @@ Secondary entrypoint and primary loader for the common chart
{{- include "bjw-s.common.addon.vpn" . | nindent 0 -}} {{- include "bjw-s.common.addon.vpn" . | nindent 0 -}}
{{- end -}} {{- end -}}
{{- /* Enable promtail add-on if required */ -}}
{{- if .Values.addons.promtail.enabled -}}
{{- include "bjw-s.common.addon.promtail" . | nindent 0 -}}
{{- end -}}
{{- /* Enable netshoot add-on if required */ -}} {{- /* Enable netshoot add-on if required */ -}}
{{- if .Values.addons.netshoot.enabled -}} {{- if .Values.addons.netshoot.enabled -}}
{{- include "bjw-s.common.addon.netshoot" . | nindent 0 -}} {{- include "bjw-s.common.addon.netshoot" . | nindent 0 -}}
{{- end -}} {{- end -}}
{{- /* Build the templates */ -}} {{- /* Build the templates */ -}}
{{- include "bjw-s.common.render.configmaps" . | nindent 0 -}}
{{- include "bjw-s.common.render.secrets" . | nindent 0 -}}
{{- include "bjw-s.common.render.pvcs" . | nindent 0 -}} {{- include "bjw-s.common.render.pvcs" . | nindent 0 -}}
{{- include "bjw-s.common.render.serviceAccount" . | nindent 0 -}} {{- include "bjw-s.common.render.serviceAccount" . | nindent 0 -}}
{{- include "bjw-s.common.render.controller" . | nindent 0 -}} {{- include "bjw-s.common.render.controller" . | nindent 0 -}}
{{- include "bjw-s.common.render.services" . | nindent 0 -}} {{- include "bjw-s.common.render.services" . | nindent 0 -}}
{{- include "bjw-s.common.render.ingresses" . | nindent 0 -}} {{- include "bjw-s.common.render.ingresses" . | nindent 0 -}}
{{- include "bjw-s.common.render.serviceMonitors" . | nindent 0 -}} {{- include "bjw-s.common.render.serviceMonitors" . | nindent 0 -}}
{{- include "bjw-s.common.render.routes" . | nindent 0 -}}
{{- include "bjw-s.common.render.configmaps" . | nindent 0 -}}
{{- include "bjw-s.common.render.secrets" . | nindent 0 -}}
{{- end -}} {{- end -}}

View file

@ -0,0 +1,18 @@
{{/* Renders the Route objects required by the chart */}}
{{- define "bjw-s.common.render.routes" -}}
{{- /* Generate named routes as required */ -}}
{{- range $name, $route := .Values.route }}
{{- if $route.enabled -}}
{{- $routeValues := $route -}}
{{/* set defaults */}}
{{- if not $routeValues.nameOverride -}}
{{- $_ := set $routeValues "nameOverride" $name -}}
{{- end -}}
{{- $_ := set $ "ObjectValues" (dict "route" $routeValues) -}}
{{- include "bjw-s.common.class.route" $ | nindent 0 -}}
{{- $_ := unset $.ObjectValues "route" -}}
{{- end }}
{{- end }}
{{- end }}

View file

@ -3,6 +3,21 @@ Renders the serviceAccount object required by the chart.
*/}} */}}
{{- define "bjw-s.common.render.serviceAccount" -}} {{- define "bjw-s.common.render.serviceAccount" -}}
{{- if .Values.serviceAccount.create -}} {{- if .Values.serviceAccount.create -}}
{{- /* Create a service account secret */ -}}
{{- $_ := set .Values.secrets "sa-token" (dict "enabled" true "type" "kubernetes.io/service-account-token") -}}
{{- include "bjw-s.common.class.serviceAccount" $ | nindent 0 -}} {{- include "bjw-s.common.class.serviceAccount" $ | nindent 0 -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
# serviceAccount:
# # -- Specifies whether a service account should be created
# create: false
# # -- Annotations to add to the service account
# annotations: {}
# # -- The name of the service account to use.
# # If not set and create is true, a name is generated using the fullname template
# name: ""

View file

@ -4,7 +4,7 @@ Renders the Service objects required by the chart.
{{- define "bjw-s.common.render.services" -}} {{- define "bjw-s.common.render.services" -}}
{{- /* Generate named services as required */ -}} {{- /* Generate named services as required */ -}}
{{- range $name, $service := .Values.service -}} {{- range $name, $service := .Values.service -}}
{{- if $service.enabled -}} {{- if ($service.enabled | default true ) -}}
{{- $serviceValues := $service -}} {{- $serviceValues := $service -}}
{{/* set the default nameOverride to the service name */}} {{/* set the default nameOverride to the service name */}}

View file

@ -400,6 +400,60 @@ ingress:
# hosts: # hosts:
# - chart-example.local # - chart-example.local
# -- Configure the gateway routes for the chart here.
# Additional routes can be added by adding a dictionary key similar to the 'main' route.
# [[ref]](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io%2fv1alpha2)
# @default -- See below
route:
main:
# -- Enables or disables the route
enabled: false
# -- Set the route kind
# Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute
kind: HTTPRoute
# -- Override the name suffix that is used for this route.
nameOverride:
# -- Provide additional annotations which may be required.
annotations: {}
# -- Provide additional labels which may be required.
labels: {}
## -- Configure the resource the route attaches to.
parentRefs:
- # Group of the referent resource.
group: gateway.networking.k8s.io
# Kind of the referent resource.
kind: Gateway
# Name of the referent resource
name:
# Namespace of the referent resource
namespace:
# Name of the section within the target resource.
sectionName: ""
# -- Host addresses
hostnames: []
# -- Configure rules for routing. Defaults to the primary service.
rules:
- # -- Configure backends where matching requests should be sent.
backendRefs:
- group: ""
kind: Service
name:
namespace:
port:
weight: 1
## Configure conditions used for matching incoming requests. Only for HTTPRoutes
matches:
- path:
type: PathPrefix
value: /
# -- Configure persistence for the chart here. # -- Configure persistence for the chart here.
# Additional items can be added by adding a dictionary key similar to the 'config' key. # Additional items can be added by adding a dictionary key similar to the 'config' key.
# [[ref]](https://bjw-s.github.io/helm-charts/docs/common-library/common-library-storage) # [[ref]](https://bjw-s.github.io/helm-charts/docs/common-library/common-library-storage)
@ -639,7 +693,7 @@ addons:
# -- Specify the code-server image # -- Specify the code-server image
repository: ghcr.io/coder/code-server repository: ghcr.io/coder/code-server
# -- Specify the code-server image tag # -- Specify the code-server image tag
tag: 4.8.2 tag: 4.8.3
# -- Specify the code-server image pull policy # -- Specify the code-server image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@ -720,44 +774,6 @@ addons:
securityContext: securityContext:
runAsUser: 0 runAsUser: 0
# -- The common library supports adding a promtail add-on to to access logs and ship them to loki. It can be configured under this key.
# @default -- See values.yaml
promtail:
# -- Enable running a promtail container in the pod
enabled: false
image:
# -- Specify the promtail image
repository: docker.io/grafana/promtail
# -- Specify the promtail image tag
tag: 2.6.1
# -- Specify the promtail image pull policy
pullPolicy: IfNotPresent
# -- Set any environment variables for promtail here
env: {}
# -- Set promtail command line arguments
args: []
# -- The URL to Loki
loki: ""
# -- The paths to logs on the volume
logs: []
# - name: log
# path: /config/logs/*.log
# -- Specify a list of volumes that get mounted in the promtail container.
# At least 1 volumeMount is required!
volumeMounts: []
# - name: config
# mountPath: /config
# readOnly: true
securityContext:
runAsUser: 0
# -- The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. It can be configured under this key. # -- The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. It can be configured under this key.
# @default -- See values.yaml # @default -- See values.yaml
netshoot: netshoot:
@ -768,7 +784,7 @@ addons:
# -- Specify the netshoot image # -- Specify the netshoot image
repository: ghcr.io/nicolaka/netshoot repository: ghcr.io/nicolaka/netshoot
# -- Specify the netshoot image tag # -- Specify the netshoot image tag
tag: v0.7 tag: v0.8
# -- Specify the netshoot image pull policy # -- Specify the netshoot image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent

View file

@ -2,7 +2,7 @@
apiVersion: v2 apiVersion: v2
description: A common powered chart template. This can be useful for small projects that don't have their own chart. description: A common powered chart template. This can be useful for small projects that don't have their own chart.
name: app-template name: app-template
version: 1.0.1 version: 1.1.0
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
maintainers: maintainers:
- name: bjw-s - name: bjw-s
@ -10,12 +10,12 @@ maintainers:
dependencies: dependencies:
- name: common - name: common
repository: https://bjw-s.github.io/helm-charts repository: https://bjw-s.github.io/helm-charts
version: 1.0.1 version: 1.1.0
annotations: annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: changed - kind: changed
description: | description: |
**BREAKING**: Updated library version to 1.0.1. Updated library version to 1.1.0.
links: links:
- name: Common library chart definition - name: Common library chart definition
url: https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/Chart.yaml url: https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/Chart.yaml

View file

@ -1,29 +0,0 @@
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

@ -29,13 +29,13 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: &DeploymentDocument 0 - documentIndex: &DeploymentDocument 1
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: &AddonServiceDocument 2 - documentIndex: &AddonServiceDocument 0
isKind: isKind:
of: Service of: Service
- documentIndex: 1 - documentIndex: &ApplicationServiceDocument 2
isKind: isKind:
of: Service of: Service
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
@ -45,7 +45,7 @@ tests:
- documentIndex: *AddonServiceDocument - documentIndex: *AddonServiceDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME value: RELEASE-NAME-addon-codeserver
- it: addon enabled with deployKey should pass - it: addon enabled with deployKey should pass
set: set:
@ -60,7 +60,7 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 4 count: 4
- documentIndex: &AddonDeployKeySecretDocument 0 - documentIndex: &AddonDeployKeySecretDocument 3
isKind: isKind:
of: Secret of: Secret
- documentIndex: &DeploymentDocument 1 - documentIndex: &DeploymentDocument 1
@ -102,7 +102,7 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 4 count: 4
- documentIndex: &AddonDeployKeySecretDocument 0 - documentIndex: &AddonDeployKeySecretDocument 3
isKind: isKind:
of: Secret of: Secret
- documentIndex: &DeploymentDocument 1 - documentIndex: &DeploymentDocument 1
@ -144,7 +144,7 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: &DeploymentDocument 0 - documentIndex: &DeploymentDocument 1
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument

View file

@ -46,10 +46,10 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: &AddonVPNConfigSecretDocument 0 - documentIndex: &AddonVPNConfigSecretDocument 2
isKind: isKind:
of: Secret of: Secret
- documentIndex: &DeploymentDocument 1 - documentIndex: &DeploymentDocument 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument
@ -87,10 +87,10 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: &AddonVPNConfigConfigMapDocument 0 - documentIndex: &AddonVPNConfigConfigMapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: &DeploymentDocument 1 - documentIndex: &DeploymentDocument 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: *DeploymentDocument - documentIndex: *DeploymentDocument

View file

@ -8,7 +8,9 @@ tests:
config: config:
enabled: true enabled: true
asserts: asserts:
- documentIndex: &ConfigmapDocument 0 - hasDocuments:
count: 3
- documentIndex: &ConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: *ConfigmapDocument - documentIndex: *ConfigmapDocument
@ -21,7 +23,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.0.1 helm.sh/chart: app-template-1.1.0
- it: custom metadata should pass - it: custom metadata should pass
set: set:
@ -33,7 +35,9 @@ tests:
labels: labels:
test_label: test test_label: test
asserts: asserts:
- documentIndex: &ConfigmapDocument 0 - hasDocuments:
count: 3
- documentIndex: &ConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: *ConfigmapDocument - documentIndex: *ConfigmapDocument
@ -48,7 +52,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.0.1 helm.sh/chart: app-template-1.1.0
test_label: test test_label: test
- it: custom metadata with global metadata should pass - it: custom metadata with global metadata should pass
@ -66,7 +70,9 @@ tests:
labels: labels:
test_label: test test_label: test
asserts: asserts:
- documentIndex: &ConfigmapDocument 0 - hasDocuments:
count: 3
- documentIndex: &ConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: *ConfigmapDocument - documentIndex: *ConfigmapDocument
@ -83,5 +89,5 @@ tests:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME app.kubernetes.io/name: RELEASE-NAME
global_label: test global_label: test
helm.sh/chart: app-template-1.0.1 helm.sh/chart: app-template-1.1.0
test_label: test test_label: test

View file

@ -44,16 +44,16 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 4 count: 4
- documentIndex: 0 - documentIndex: &FirstConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: 0 - documentIndex: *FirstConfigmapDocument
isNotNull: isNotNull:
path: metadata.name path: metadata.name
- documentIndex: 1 - documentIndex: &SecondConfigmapDocument 3
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: 1 - documentIndex: *SecondConfigmapDocument
isNotNull: isNotNull:
path: metadata.name path: metadata.name
@ -65,10 +65,10 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: 0 - documentIndex: &ConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: 0 - documentIndex: *ConfigmapDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-config value: RELEASE-NAME-config
@ -82,10 +82,10 @@ tests:
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 3 count: 3
- documentIndex: 0 - documentIndex: &ConfigmapDocument 2
isKind: isKind:
of: ConfigMap of: ConfigMap
- documentIndex: 0 - documentIndex: *ConfigmapDocument
equal: equal:
path: metadata.name path: metadata.name
value: RELEASE-NAME-http value: RELEASE-NAME-http

View file

@ -10,7 +10,7 @@ tests:
data: data:
test: value 1 test: value 1
asserts: asserts:
- documentIndex: &ControllerDoc 1 - documentIndex: &ControllerDoc 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: *ControllerDoc - documentIndex: *ControllerDoc

View file

@ -0,0 +1,313 @@
suite: container probes
templates:
- common.yaml
tests:
- it: default should pass
set:
service:
main:
ports:
http:
enabled: true
port: &port 80
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
timeoutSeconds: 1
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
timeoutSeconds: 1
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 30
initialDelaySeconds: 0
periodSeconds: 5
tcpSocket:
port: *port
timeoutSeconds: 1
- it: custom primary port should pass
set:
service:
main:
ports:
http:
enabled: true
port: 80
test:
enabled: true
primary: true
port: &port 8080
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
timeoutSeconds: 1
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].readinessProbe
value:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: *port
timeoutSeconds: 1
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].startupProbe
value:
failureThreshold: 30
initialDelaySeconds: 0
periodSeconds: 5
tcpSocket:
port: *port
timeoutSeconds: 1
- it: disabled service should pass
set:
service:
main:
enabled: false
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
isNull:
path: spec.template.spec.containers[0].livenessProbe
- documentIndex: 0
isNull:
path: spec.template.spec.containers[0].readinessProbe
- documentIndex: 0
isNull:
path: spec.template.spec.containers[0].startupProbe
- it: AUTO type probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
liveness:
enabled: true
type: AUTO
path: /api/version
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: HTTP type probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
liveness:
enabled: true
type: HTTP
path: /api/version
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: HTTPS type probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
liveness:
enabled: true
type: HTTPS
path: /api/version
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
scheme: HTTPS
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom liveness probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
liveness:
enabled: true
custom: true
spec:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom readiness probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
readiness:
enabled: true
custom: true
spec:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].readinessProbe
value:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
- it: custom startup probe should pass
set:
service:
main:
ports:
http:
port: &port 80
probes:
startup:
enabled: true
custom: true
spec:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].startupProbe
value:
httpGet:
path: /api/version
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,93 @@
suite: route metadata
templates:
- common.yaml
tests:
- it: default metadata should pass
set:
route.main:
enabled: true
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 2
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
isNull:
path: metadata.annotations
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.1.0
- it: custom metadata should pass
set:
route.main:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 2
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.1.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
route.main:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
parentRefs:
- name: test
namespace: test
asserts:
- documentIndex: &routeDocument 2
isKind:
of: HTTPRoute
- documentIndex: *routeDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *routeDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: app-template-1.1.0
test_label: test

View file

@ -0,0 +1,84 @@
suite: route presence
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
not: true
isKind:
of: HTTPRoute
- it: explicitly disabled should pass
set:
route.main.enabled: false
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
not: true
isKind:
of: HTTPRoute
- it: explicitly enabled should pass
set:
route.main:
enabled: true
parentRefs:
- name: test
namespace: test
asserts:
- hasDocuments:
count: 3
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
not: true
isKind:
of: HTTPRoute
- documentIndex: 2
isKind:
of: HTTPRoute
- it: multiple enabled should pass
set:
route:
main:
enabled: true
parentRefs:
- name: main
namespace: main
test:
enabled: true
parentRefs:
- name: test
namespace: test
asserts:
- hasDocuments:
count: 4
- documentIndex: 0
not: true
isKind:
of: HTTPRoute
- documentIndex: 1
not: true
isKind:
of: HTTPRoute
- documentIndex: 2
isKind:
of: HTTPRoute
- documentIndex: 3
isKind:
of: HTTPRoute

View file

@ -0,0 +1,54 @@
suite: ingress service reference
templates:
- common.yaml
tests:
- it: default should pass
set:
route.main:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].backendRefs[0]
value:
group: ""
kind: Service
name: RELEASE-NAME-main
namespace: NAMESPACE
port: null
weight: 1
- it: custom service reference should pass
set:
route.main:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- group: test
name: pathService
port: 1234
namespace: serviceNamespace
weight: 123
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.rules[0].backendRefs[0]
value:
group: test
kind: Service
name: pathService
namespace: serviceNamespace
port: 1234
weight: 123

View file

@ -0,0 +1,183 @@
suite: route values
templates:
- common.yaml
tests:
- it: setting gateway should pass
set:
route.main:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.parentRefs[0].name
value: parentName
- documentIndex: *HTTPRouteDocument
equal:
path: spec.parentRefs[0].namespace
value: parentNamespace
- it: custom host and path should pass
set:
route.main:
enabled: true
parentRefs:
- name: parentName
namespace: parentNamespace
hostnames:
- chart-test.local
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: HTTPRoute
- documentIndex: *HTTPRouteDocument
equal:
path: spec.hostnames[0]
value: chart-test.local
- it: path matches should only be used for HTTPRoutes
set:
route:
main:
enabled: true
kind: HTTPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
grpc:
enabled: true
kind: GRPCRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
tcp:
enabled: true
kind: TCPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
tls:
enabled: true
kind: TLSRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
udp:
enabled: true
kind: UDPRoute
parentRefs:
- name: parentName
namespace: parentNamespace
rules:
- backendRefs:
- name: test
namespace: test
matches:
- path:
type: PathPrefix
value: /test
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: GRPCRoute
- documentIndex: &HTTPRouteDocument 2
isNull:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 3
isKind:
of: HTTPRoute
- documentIndex: &HTTPRouteDocument 3
equal:
path: spec.rules[0].matches
value:
- path:
type: PathPrefix
value: /test
- documentIndex: &HTTPRouteDocument 4
isKind:
of: TCPRoute
- documentIndex: &HTTPRouteDocument 4
isNull:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 5
isKind:
of: TLSRoute
- documentIndex: &HTTPRouteDocument 5
isNull:
path: spec.rules[0].matches
- documentIndex: &HTTPRouteDocument 6
isKind:
of: UDPRoute
- documentIndex: &HTTPRouteDocument 6
isNull:
path: spec.rules[0].matches
- it: hostnames shouldn't be used for TCPRoutes and UDPRoutes
set:
route:
main:
enabled: true
kind: TCPRoute
hostnames:
- chart-test.local
parentRefs:
- name: parentName
namespace: parentNamespace
udp:
enabled: true
kind: UDPRoute
hostnames:
- chart-test.local
parentRefs:
- name: parentName
namespace: parentNamespace
asserts:
- documentIndex: &HTTPRouteDocument 2
isKind:
of: TCPRoute
- documentIndex: &HTTPRouteDocument 2
isNull:
path: spec.hostnames
- documentIndex: &HTTPRouteDocument 3
isKind:
of: UDPRoute
- documentIndex: &HTTPRouteDocument 3
isNull:
path: spec.hostnames

View file

@ -0,0 +1,110 @@
suite: secret metadata
templates:
- common.yaml
tests:
- it: default metadata should pass
set:
secrets:
secret:
enabled: true
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
isNull:
path: metadata.annotations
- documentIndex: *SecretDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.1.0
- it: custom metadata should pass
set:
secrets:
secret:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *SecretDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: app-template-1.1.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
secrets:
secret:
enabled: true
annotations:
test_annotation: test
labels:
test_label: test
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.annotations
value:
global_annotation: test
test_annotation: test
- documentIndex: *SecretDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: app-template-1.1.0
test_label: test
- it: custom secret type should pass
set:
secrets:
secret:
enabled: true
type: &type kubernetes.io/service-account-token
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: type
value: *type

View file

@ -0,0 +1,91 @@
suite: secret names
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: Secret
- documentIndex: 1
not: true
isKind:
of: Secret
- it: with disabled secret should pass
set:
secrets:
secret:
enabled: false
asserts:
- hasDocuments:
count: 2
- documentIndex: 0
not: true
isKind:
of: Secret
- documentIndex: 1
not: true
isKind:
of: Secret
- it: with multiple secrets should pass
set:
secrets:
secret:
enabled: true
data:
foo: bar
secondary:
enabled: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &FirstSecretDocument 2
isKind:
of: Secret
- documentIndex: *FirstSecretDocument
isNotNull:
path: metadata.name
- documentIndex: &SecondSecretDocument 3
isKind:
of: Secret
- documentIndex: *SecondSecretDocument
isNotNull:
path: metadata.name
- it: default name should pass
set:
secrets:
secret:
enabled: true
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.name
value: RELEASE-NAME-secret
- it: with nameOverride should pass
set:
secrets:
secret:
enabled: true
nameOverride: http
asserts:
- hasDocuments:
count: 3
- documentIndex: &SecretDocument 2
isKind:
of: Secret
- documentIndex: *SecretDocument
equal:
path: metadata.name
value: RELEASE-NAME-http

View file

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

View file

@ -2,6 +2,24 @@ suite: service values
templates: templates:
- common.yaml - common.yaml
tests: tests:
- it: ports and services are enabled by default
set:
service:
second:
type: ClusterIP
ports:
first:
port: 80
asserts:
- hasDocuments:
count: 3
- documentIndex: &FirstServiceDocument 1
isKind:
of: Service
- documentIndex: &SecondServiceDocument 2
isKind:
of: Service
- it: externalTrafficPolicy should pass for NodePort service - it: externalTrafficPolicy should pass for NodePort service
set: set:
service: service:

View file

@ -0,0 +1,95 @@
suite: serviceAccount values
templates:
- common.yaml
tests:
- it: a serviceAccount is not created by default
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- it: a serviceAccount is not created when disabled
set:
serviceAccount:
create: false
asserts:
- hasDocuments:
count: 2
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: &ServiceDocument 1
isKind:
of: Service
- it: a serviceAccount and Secret are created when enabled
set:
serviceAccount:
create: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &ServiceAccountDocument 0
isKind:
of: ServiceAccount
- documentIndex: &DeploymentDocument 1
isKind:
of: Deployment
- documentIndex: &ServiceDocument 2
isKind:
of: Service
- documentIndex: &SecretDocument 3
isKind:
of: Secret
- documentIndex: *ServiceAccountDocument
equal:
path: metadata.name
value: &ServiceAccountName RELEASE-NAME
- documentIndex: *ServiceAccountDocument
equal:
path: secrets
value:
- name: RELEASE-NAME-sa-token
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: *ServiceAccountName
- it: a serviceAccount and Secret are created with custom name
set:
serviceAccount:
create: true
name: &ServiceAccountName myAccount
asserts:
- hasDocuments:
count: 4
- documentIndex: &ServiceAccountDocument 0
isKind:
of: ServiceAccount
- documentIndex: &DeploymentDocument 1
isKind:
of: Deployment
- documentIndex: &ServiceDocument 2
isKind:
of: Service
- documentIndex: &SecretDocument 3
isKind:
of: Secret
- documentIndex: *ServiceAccountDocument
equal:
path: metadata.name
value: *ServiceAccountName
- documentIndex: *ServiceAccountDocument
equal:
path: secrets
value:
- name: RELEASE-NAME-sa-token
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.serviceAccountName
value: *ServiceAccountName