[common] 1.6.0 (#178)

Co-authored-by: Bernd Schörgers <bernd@bjws.nl>
Co-authored-by: bjws <bernd@bjws.nl>
This commit is contained in:
ᗪєνιη ᗷυнʟ 2020-11-23 07:55:12 -05:00 committed by GitHub
parent 158674fc45
commit 5f17e040e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 305 additions and 58 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: common name: common
description: Function library for k8s-at-home charts description: Function library for k8s-at-home charts
type: library type: library
version: 1.5.1 version: 1.6.0
keywords: keywords:
- k8s-at-home - k8s-at-home
- common - common

View File

@ -1,7 +1,10 @@
# Library chart for k8s@home media charts # Library chart for k8s@home media charts
## **THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY**
This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between k8s@home charts. **WARNING: THIS CHART IS NOT MEANT TO BE INSTALLED DIRECTLY**
This is a [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm). It's purpose is for grouping common logic between the k8s@home charts.
Since a lot of charts follow the same pattern this library was built to reduce maintenance cost between the charts that use it and try achieve a goal of being DRY.
## Introduction ## Introduction
@ -9,22 +12,84 @@ This chart provides common template helpers which can be used to develop new cha
## TL;DR ## TL;DR
When using one of the many charts that uses this library be sure to view this [values.yaml](./values.yaml) for configuration options. Any setting here can be used to define what values your helm deployment will use.
For example using the helm CLI tool
```bash
helm install node-red \
--set image.repository="nodered/node-red" \
--set image.tag="1.2.5" \
--set env.TZ="America/New_York" \
k8s-at-home/node-red
```
or
```yaml ```yaml
dependencies: # node-red-values.yaml
- name: common image:
version: 0.x.x repository: nodered/node-red
repository: https://k8s-at-home.com/charts/ tag: 1.2.5
env:
TZ: America/New_York
``` ```
```bash ```bash
$ helm dependency update helm install node-red \
--values=./node-red-values.yaml \
k8s-at-home/node-red
``` ```
## Creating a new chart
First be sure to checkout the many charts that already use this like [qBittorrent](../qbittorrent/), [node-red](../node-red/) or the many others in this repository.
Include this chart as a dependency in your `Chart.yaml` e.g.
```yaml ```yaml
apiVersion: v1 # Chart.yaml
kind: ConfigMap dependencies:
metadata: - name: common
name: {{ include "common.names.fullname" . }} version: x.x.x
data: repository: https://k8s-at-home.com/charts/
myvalue: "Hello World" ```
Write a `values.yaml` with some basic defaults you want to present to the user e.g.
```yaml
# Default values for node-red.
image:
repository: nodered/node-red
pullPolicy: IfNotPresent
tag: 1.2.5
strategy:
type: Recreate
# See more environment varaibles in the node-red documentation
# https://nodered.org/docs/getting-started/docker
env: {}
# TZ:
# NODE_OPTIONS:
# NODE_RED_ENABLE_PROJECTS:
# NODE_RED_ENABLE_SAFE_MODE:
# FLOWS:
service:
port:
port: 1880
persistence:
data:
enabled: false
emptyDir: false
mountPath: /data
```
If testing locally make sure you update the dependencies with:
```bash
helm dependency update
``` ```

View File

@ -1,3 +1,6 @@
{{/*
Main entrypoint for the common library chart. It will render all underlying templates based on the provided values.
*/}}
{{- define "common.all" -}} {{- define "common.all" -}}
{{- /* Merge the local chart values and the common chart defaults */ -}} {{- /* Merge the local chart values and the common chart defaults */ -}}
{{- include "common.values.setup" . }} {{- include "common.values.setup" . }}
@ -10,10 +13,16 @@
{{- /* Build the templates */ -}} {{- /* Build the templates */ -}}
{{- include "common.pvc" . }} {{- include "common.pvc" . }}
{{- print "---" | nindent 0 -}} {{- print "---" | nindent 0 -}}
{{- if eq .Values.controllerType "statefulset" }} {{- if .Values.serviceAccount.create -}}
{{- include "common.statefulset" . | nindent 0 }} {{- include "common.serviceAccount" . }}
{{ else }} {{- print "---" | nindent 0 -}}
{{- end -}}
{{- if eq .Values.controllerType "deployment" }}
{{- include "common.deployment" . | nindent 0 }} {{- include "common.deployment" . | nindent 0 }}
{{ else if eq .Values.controllerType "daemonset" }}
{{- include "common.daemonset" . | nindent 0 }}
{{ else if eq .Values.controllerType "statefulset" }}
{{- include "common.statefulset" . | nindent 0 }}
{{- end -}} {{- end -}}
{{- print "---" | nindent 0 -}} {{- print "---" | nindent 0 -}}
{{ include "common.service" . | nindent 0 }} {{ include "common.service" . | nindent 0 }}

View File

@ -0,0 +1,74 @@
{{/*
This template serves as the blueprint for the DaemonSet objects that are created
within the common library.
*/}}
{{- define "common.daemonset" -}}
apiVersion: {{ include "common.capabilities.daemonset.apiVersion" . }}
kind: DaemonSet
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.controllerLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controllerAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "common.labels.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostNetwork }}
hostNetwork: {{ . }}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- include "common.controller.mainContainer" . | nindent 6 }}
{{- with .Values.additionalContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
volumes:
{{- include "common.controller.volumes" . | trim | nindent 6 }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@ -1,8 +1,12 @@
{{/*
This template serves as the blueprint for the Deployment objects that are created
within the common library.
*/}}
{{- define "common.deployment" -}} {{- define "common.deployment" -}}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ template "common.names.fullname" . }} name: {{ include "common.names.fullname" . }}
labels: labels:
{{- include "common.labels" . | nindent 4 }} {{- include "common.labels" . | nindent 4 }}
{{- with .Values.controllerLabels }} {{- with .Values.controllerLabels }}
@ -34,10 +38,17 @@ spec:
imagePullSecrets: imagePullSecrets:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
{{- with .Values.podSecurityContext }} {{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.hostNetwork }}
hostNetwork: {{ . }}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.initContainers }} {{- with .Values.initContainers }}
initContainers: initContainers:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@ -51,6 +62,10 @@ spec:
volumes: volumes:
{{- include "common.controller.volumes" . | trim | nindent 6 }} {{- include "common.controller.volumes" . | trim | nindent 6 }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -1,3 +1,7 @@
{{/*
Renders the Ingress objects required by the chart by returning a concatinated list
of the main Ingress and any additionalIngresses.
*/}}
{{- define "common.ingress" -}} {{- define "common.ingress" -}}
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $svcPort := .Values.service.port.port -}} {{- $svcPort := .Values.service.port.port -}}

View File

@ -1,3 +1,7 @@
{{/*
Renders the PersistentVolumeClaim objects required by the chart by returning a concatinated list
of all the entries of the persistence key.
*/}}
{{- define "common.pvc" -}} {{- define "common.pvc" -}}
{{- /* Generate pvc as required */ -}} {{- /* Generate pvc as required */ -}}
{{- range $index, $PVC := .Values.persistence }} {{- range $index, $PVC := .Values.persistence }}

View File

@ -1,3 +1,7 @@
{{/*
Renders the Service objects required by the chart by returning a concatinated list
of the main Service and any additionalServices.
*/}}
{{- define "common.service" -}} {{- define "common.service" -}}
{{- if .Values.service.enabled -}} {{- if .Values.service.enabled -}}
{{- /* Generate primary service */ -}} {{- /* Generate primary service */ -}}

View File

@ -0,0 +1,15 @@
{{/*
The ServiceAccount object to be created.
*/}}
{{- define "common.serviceAccount" -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "common.names.serviceAccountName" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -1,8 +1,12 @@
{{/*
This template serves as the blueprint for the StatefulSet objects that are created
within the common library.
*/}}
{{- define "common.statefulset" -}} {{- define "common.statefulset" -}}
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }} apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: {{ template "common.names.fullname" . }} name: {{ include "common.names.fullname" . }}
labels: labels:
{{- include "common.labels" . | nindent 4 }} {{- include "common.labels" . | nindent 4 }}
{{- with .Values.controllerLabels }} {{- with .Values.controllerLabels }}
@ -35,6 +39,7 @@ spec:
imagePullSecrets: imagePullSecrets:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
{{- with .Values.podSecurityContext }} {{- with .Values.podSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -1,12 +1,12 @@
{{/* {{/*
The OpenVPN configmaps to be included The VPN config and scripts to be included.
*/}} */}}
{{- define "common.addon.vpn.configmap" -}} {{- define "common.addon.vpn.configmap" -}}
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down }} {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down }}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "common.names.fullname" . }}-vpn name: {{ include "common.names.fullname" . }}-vpn
labels: labels:
{{- include "common.labels" . | nindent 4 }} {{- include "common.labels" . | nindent 4 }}
data: data:

View File

@ -1,12 +1,12 @@
{{/* {{/*
The OpenVPN networkpolicy to be included Blueprint for the NetworkPolicy object that can be included in the addon.
*/}} */}}
{{- define "common.addon.vpn.networkpolicy" -}} {{- define "common.addon.vpn.networkpolicy" -}}
{{- if .Values.addons.vpn.networkPolicy.enabled -}} {{- if .Values.addons.vpn.networkPolicy.enabled -}}
kind: NetworkPolicy kind: NetworkPolicy
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
metadata: metadata:
name: {{ template "common.names.fullname" . }} name: {{ include "common.names.fullname" . }}
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels:

View File

@ -1,11 +1,11 @@
{{/* {{/*
The OpenVPN shared volume to be inserted The volume (referencing VPN config and scripts) to be inserted into additionalVolumes.
*/}} */}}
{{- define "common.addon.vpn.volume" -}} {{- define "common.addon.vpn.volume" -}}
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}} {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down -}}
name: vpnconfig name: vpnconfig
configMap: configMap:
name: {{ template "common.names.fullname" . }}-vpn name: {{ include "common.names.fullname" . }}-vpn
items: items:
{{- if .Values.addons.vpn.configFile }} {{- if .Values.addons.vpn.configFile }}
- key: vpnConfigfile - key: vpnConfigfile

View File

@ -1,5 +1,6 @@
{{/* {{/*
Template to render VPN addon Template to render VPN addon
It will include / inject the required templates based on the given values.
*/}} */}}
{{- define "common.addon.vpn" -}} {{- define "common.addon.vpn" -}}
{{- if .Values.addons.vpn.enabled -}} {{- if .Values.addons.vpn.enabled -}}

View File

@ -1,5 +1,6 @@
{{/* {{/*
Template to render OpenVPN addon Template to render OpenVPN addon. It will add the container to the list of additionalContainers
and add a credentials secret if speciffied.
*/}} */}}
{{- define "common.addon.openvpn" -}} {{- define "common.addon.openvpn" -}}
{{/* Append the openVPN container to the additionalContainers */}} {{/* Append the openVPN container to the additionalContainers */}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
The OpenVPN container(s) to be inserted The OpenVPN sidecar container to be inserted.
*/}} */}}
{{- define "common.addon.openvpn.container" -}} {{- define "common.addon.openvpn.container" -}}
name: openvpn name: openvpn
@ -22,7 +22,7 @@ envFrom:
{{- if .Values.addons.vpn.openvpn.authSecret }} {{- if .Values.addons.vpn.openvpn.authSecret }}
name: {{ .Values.addons.vpn.openvpn.authSecret }} name: {{ .Values.addons.vpn.openvpn.authSecret }}
{{- else }} {{- else }}
name: {{ template "common.names.fullname" . }}-openvpn name: {{ include "common.names.fullname" . }}-openvpn
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }} {{- if or .Values.addons.vpn.configFile .Values.addons.vpn.scripts.up .Values.addons.vpn.scripts.down .Values.addons.vpn.additionalVolumeMounts .Values.persistence.shared.enabled }}

View File

@ -1,12 +1,12 @@
{{/* {{/*
The OpenVPN secrets to be included The OpenVPN credentials secrets to be included.
*/}} */}}
{{- define "common.addon.openvpn.secret" -}} {{- define "common.addon.openvpn.secret" -}}
{{- with .Values.addons.vpn.openvpn.auth -}} {{- with .Values.addons.vpn.openvpn.auth -}}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "common.names.fullname" $ }}-openvpn name: {{ include "common.names.fullname" $ }}-openvpn
labels: labels:
{{- include "common.labels" $ | nindent 4 }} {{- include "common.labels" $ | nindent 4 }}
data: data:

View File

@ -1,5 +1,6 @@
{{/* {{/*
Template to render Wireguard addon Template to render Wireguard addon. It will add the container to the list of additionalContainers.
*/}}
*/}} */}}
{{- define "common.addon.wireguard" -}} {{- define "common.addon.wireguard" -}}
{{/* Append the Wireguard container to the additionalContainers */}} {{/* Append the Wireguard container to the additionalContainers */}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
The Wireguard container(s) to be inserted The Wireguard sidecar container to be inserted.
*/}} */}}
{{- define "common.addon.wireguard.container" -}} {{- define "common.addon.wireguard.container" -}}
name: wireguard name: wireguard

View File

@ -1,3 +1,7 @@
{{/*
This template serves as a blueprint for all Ingress objects that are created
within the common library.
*/}}
{{- define "common.classes.ingress" -}} {{- define "common.classes.ingress" -}}
{{- $ingressName := include "common.names.fullname" . -}} {{- $ingressName := include "common.names.fullname" . -}}
{{- $values := .Values.ingress -}} {{- $values := .Values.ingress -}}

View File

@ -1,3 +1,7 @@
{{/*
This template serves as a blueprint for all PersistentVolumeClaim objects that are created
within the common library.
*/}}
{{- define "common.classes.pvc" -}} {{- define "common.classes.pvc" -}}
{{- $values := .Values.persistence -}} {{- $values := .Values.persistence -}}
{{- if hasKey . "ObjectValues" -}} {{- if hasKey . "ObjectValues" -}}

View File

@ -1,5 +1,6 @@
{{/* {{/*
service class: all services should adhere to this This template serves as a blueprint for all Service objects that are created
within the common library.
*/}} */}}
{{- define "common.classes.service" -}} {{- define "common.classes.service" -}}
{{- $values := .Values.service -}} {{- $values := .Values.service -}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
logic that lists the ports and additionalPorts for a service Render all the ports and additionalPorts for a Service object.
*/}} */}}
{{- define "common.classes.service.ports" -}} {{- define "common.classes.service.ports" -}}
{{- $ports := list -}} {{- $ports := list -}}
@ -12,9 +12,9 @@ logic that lists the ports and additionalPorts for a service
ports: ports:
{{- range $_ := $ports }} {{- range $_ := $ports }}
- port: {{ .port }} - port: {{ .port }}
targetPort: {{ .targetPort | default .name }} targetPort: {{ .targetPort | default "http" }}
protocol: {{ .protocol | default "TCP" }} protocol: {{ .protocol | default "TCP" }}
name: {{ .name }} name: {{ .name | default "http" }}
{{- if (and (eq $.svcType "NodePort") (not (empty .nodePort))) }} {{- if (and (eq $.svcType "NodePort") (not (empty .nodePort))) }}
nodePort: {{ .nodePort }} nodePort: {{ .nodePort }}
{{ end }} {{ end }}

View File

@ -1,5 +1,16 @@
{{/* {{/*
Return the appropriate apiVersion for deployment. Return the appropriate apiVersion for DaemonSet objects.
*/}}
{{- define "common.capabilities.daemonset.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for Deployment objects.
*/}} */}}
{{- define "common.capabilities.deployment.apiVersion" -}} {{- define "common.capabilities.deployment.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} {{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
@ -10,7 +21,7 @@ Return the appropriate apiVersion for deployment.
{{- end -}} {{- end -}}
{{/* {{/*
Return the appropriate apiVersion for statefulset. Return the appropriate apiVersion for StatefulSet objects.
*/}} */}}
{{- define "common.capabilities.statefulset.apiVersion" -}} {{- define "common.capabilities.statefulset.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} {{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
@ -21,7 +32,7 @@ Return the appropriate apiVersion for statefulset.
{{- end -}} {{- end -}}
{{/* {{/*
Return the appropriate apiVersion for ingress. Return the appropriate apiVersion for Ingress objects.
*/}} */}}
{{- define "common.capabilities.ingress.apiVersion" -}} {{- define "common.capabilities.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} {{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
Common labels Common labels shared across objects.
*/}} */}}
{{- define "common.labels" -}} {{- define "common.labels" -}}
helm.sh/chart: {{ include "common.names.chart" . }} helm.sh/chart: {{ include "common.names.chart" . }}
@ -11,7 +11,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }} {{- end }}
{{/* {{/*
Selector labels Selector labels shared across objects.
*/}} */}}
{{- define "common.labels.selectorLabels" -}} {{- define "common.labels.selectorLabels" -}}
app.kubernetes.io/name: {{ include "common.names.name" . }} app.kubernetes.io/name: {{ include "common.names.name" . }}

View File

@ -31,12 +31,12 @@ Create chart name and version as used by the chart label.
{{- end }} {{- end }}
{{/* {{/*
Create the name of the service account to use Create the name of the ServiceAccount to use.
*/}} */}}
{{- define "common.names.serviceAccountName" -}} {{- define "common.names.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }} {{- if .Values.serviceAccount.create }}
{{- default (include "k8s-at-home.fullname" .) .Values.serviceAccount.name }} {{- default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else }} {{- else }}
{{- default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -1,5 +1,7 @@
{{/*
Merge the local chart values and the common chart defaults.
*/}}
{{- define "common.values.setup" -}} {{- define "common.values.setup" -}}
{{- /* Merge the local chart values and the common chart defaults */ -}}
{{- if .Values.common -}} {{- if .Values.common -}}
{{- $defaultValues := deepCopy .Values.common -}} {{- $defaultValues := deepCopy .Values.common -}}
{{- $userValues := deepCopy (omit .Values "common") -}} {{- $userValues := deepCopy (omit .Values "common") -}}

View File

@ -1,8 +1,8 @@
{{- /* {{- /*
The main containter that will be included in the controller The main container included in the controller.
*/ -}} */ -}}
{{- define "common.controller.mainContainer" -}} {{- define "common.controller.mainContainer" -}}
- name: {{ template "common.names.fullname" . }} - name: {{ include "common.names.fullname" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }} {{- with .Values.securityContext }}

View File

@ -1,5 +1,5 @@
{{/* {{/*
ports included by the controller Ports included by the controller.
*/}} */}}
{{- define "common.controller.ports" -}} {{- define "common.controller.ports" -}}
{{- $ports := list -}} {{- $ports := list -}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
Default liveness/readiness/startup probes Liveness/readiness/startup probes based on tcpSocket checks.
*/}} */}}
{{- define "common.controller.probes.tcpSocket" -}} {{- define "common.controller.probes.tcpSocket" -}}
{{- if .Values.probes.liveness.enabled -}} {{- if .Values.probes.liveness.enabled -}}

View File

@ -1,5 +1,5 @@
{{/* {{/*
volumes included by the controller Volumes included by the controller.
*/}} */}}
{{- define "common.controller.volumes" -}} {{- define "common.controller.volumes" -}}
{{- range $index, $persistence := .Values.persistence }} {{- range $index, $persistence := .Values.persistence }}

View File

@ -1,21 +1,36 @@
# type: options are statefulset or deployment # type: options are deployment, daemonset or statefulset
controllerType: deployment controllerType: deployment
# Set annotations on the deployment/statefulset # Set annotations on the deployment/statefulset/daemonset
controllerAnnotations: {} controllerAnnotations: {}
# Set labels on the deployment/statefulset # Set labels on the deployment/statefulset/daemonset
controllerLabels: {} controllerLabels: {}
replicas: 1 replicas: 1
strategy: strategy:
## For Deployments, valid values are Recreate and RollingUpdate ## For Deployments, valid values are Recreate and RollingUpdate
## For StatefulSets, valid values are OnDelete and RollingUpdate ## For StatefulSets, valid values are OnDelete and RollingUpdate
## DaemonSets ignore this
type: RollingUpdate type: RollingUpdate
# Set annotations on the pod # Set annotations on the pod
podAnnotations: {} podAnnotations: {}
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: ""
env: {} env: {}
# When using hostNetwork make sure you set dnsPolicy to ClusterFirstWithHostNet
hostNetwork: false
dnsPolicy: Default
initContainers: [] initContainers: []
additionalContainers: [] additionalContainers: []
@ -44,9 +59,11 @@ service:
# Specify the default port information # Specify the default port information
port: port:
port: port:
name: http # name defaults to http
name:
protocol: TCP protocol: TCP
targetPort: http # targetPort defaults to http
targetPort:
## Specify the nodePort value for the LoadBalancer and NodePort service types. ## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
## ##
@ -66,10 +83,12 @@ service:
# type: ClusterIP # type: ClusterIP
# # Specify the default port information # # Specify the default port information
# port: # port:
# port: "" # port:
# name: http # # name defaults to http
# name:
# protocol: TCP # protocol: TCP
# targetPort: http # # targetPort defaults to http
# targetPort:
# # nodePort: # # nodePort:
# additionalPorts: [] # additionalPorts: []
# annotations: {} # annotations: {}
@ -147,6 +166,14 @@ affinity: {}
tolerations: [] tolerations: []
hostAliases: []
# Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames.
# ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
# - ip: "192.168.1.100"
# hostnames:
# - "example.com"
# - "www.example.com"
addons: addons:
vpn: vpn:
enabled: false enabled: false