improv: improve dns and vpn values.yaml syntaxis (#970)
* improv: improve dns and vpn values.yaml syntaxis * hmm * fix tests * no message
This commit is contained in:
@@ -18,4 +18,4 @@ maintainers:
|
|||||||
name: common
|
name: common
|
||||||
sources: null
|
sources: null
|
||||||
type: library
|
type: library
|
||||||
version: 7.0.3
|
version: 7.0.4
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* Enable VPN add-on if required */ -}}
|
{{- /* Enable VPN add-on if required */ -}}
|
||||||
{{- if .Values.addons.vpn.enabled }}
|
{{- if ne "disabled" .Values.addons.vpn.type -}}
|
||||||
{{- include "common.addon.vpn" . }}
|
{{- include "common.addon.vpn" . }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Template to render VPN addon
|
|||||||
It will include / inject the required templates based on the given values.
|
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 ne "disabled" .Values.addons.vpn.type -}}
|
||||||
{{- if eq "openvpn" .Values.addons.vpn.type -}}
|
{{- if eq "openvpn" .Values.addons.vpn.type -}}
|
||||||
{{- include "common.addon.openvpn" . }}
|
{{- include "common.addon.openvpn" . }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -5,12 +5,24 @@ The OpenVPN sidecar container to be inserted.
|
|||||||
name: openvpn
|
name: openvpn
|
||||||
image: "{{ .Values.openvpnImage.repository }}:{{ .Values.openvpnImage.tag }}"
|
image: "{{ .Values.openvpnImage.repository }}:{{ .Values.openvpnImage.tag }}"
|
||||||
imagePullPolicy: {{ .Values.openvpnImage.pullPolicy }}
|
imagePullPolicy: {{ .Values.openvpnImage.pullPolicy }}
|
||||||
{{- with .Values.addons.vpn.securityContext }}
|
|
||||||
securityContext:
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_MODULE
|
||||||
|
{{- with .Values.addons.vpn.securityContext }}
|
||||||
{{- toYaml . | nindent 2 }}
|
{{- toYaml . | nindent 2 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.addons.vpn.env }}
|
|
||||||
env:
|
env:
|
||||||
|
{{- range $envList := .Values.addons.vpn.envList }}
|
||||||
|
{{- if and $envList.name $envList.value }}
|
||||||
|
- name: {{ $envList.name }}
|
||||||
|
value: {{ $envList.value | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{- fail "Please specify name/value for VPN environment variable" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end}}
|
||||||
|
{{- with .Values.addons.vpn.env }}
|
||||||
{{- range $k, $v := . }}
|
{{- range $k, $v := . }}
|
||||||
- name: {{ $k }}
|
- name: {{ $k }}
|
||||||
value: {{ $v | quote }}
|
value: {{ $v | quote }}
|
||||||
|
|||||||
@@ -5,16 +5,46 @@ The Wireguard sidecar container to be inserted.
|
|||||||
name: wireguard
|
name: wireguard
|
||||||
image: "{{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}"
|
image: "{{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}"
|
||||||
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
|
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
|
||||||
{{- with .Values.addons.vpn.securityContext }}
|
|
||||||
securityContext:
|
securityContext:
|
||||||
|
runAsUser: 568
|
||||||
|
runAsGroup: 568
|
||||||
|
fsGroup: 568
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_MODULE
|
||||||
|
{{- with .Values.addons.vpn.securityContext }}
|
||||||
{{- toYaml . | nindent 2 }}
|
{{- toYaml . | nindent 2 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.addons.vpn.env }}
|
|
||||||
env:
|
env:
|
||||||
|
{{- range $envList := .Values.addons.vpn.envList }}
|
||||||
|
{{- if and $envList.name $envList.value }}
|
||||||
|
- name: {{ $envList.name }}
|
||||||
|
value: {{ $envList.value | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{- fail "Please specify name/value for VPN environment variable" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end}}
|
||||||
|
{{- with .Values.addons.vpn.env }}
|
||||||
{{- range $k, $v := . }}
|
{{- range $k, $v := . }}
|
||||||
- name: {{ $k }}
|
- name: {{ $k }}
|
||||||
value: {{ $v | quote }}
|
value: {{ $v | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
- name: SEPARATOR
|
||||||
|
value: ";"
|
||||||
|
{{- if .Values.addons.vpn.wireguard.KILLSWITCH }}
|
||||||
|
- name: KILLSWITCH
|
||||||
|
value: "true"
|
||||||
|
{{- if .Values.addons.vpn.wireguard.KILLSWITCH_EXCLUDEDNETWORKS_IPV4 }}
|
||||||
|
- name: KILLSWITCH_EXCLUDEDNETWORKS_IPV4
|
||||||
|
value: {{ .Values.addons.vpn.wireguard.KILLSWITCH_EXCLUDEDNETWORKS_IPV4 | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.addons.vpn.wireguard.KILLSWITCH_EXCLUDEDNETWORKS_IPV6 }}
|
||||||
|
- name: KILLSWITCH_EXCLUDEDNETWORKS_IPV4
|
||||||
|
value: {{ .Values.addons.vpn.wireguard.KILLSWITCH_EXCLUDEDNETWORKS_IPV6 | quote }}
|
||||||
|
{{- 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 }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
|||||||
@@ -30,9 +30,20 @@ dnsPolicy: ClusterFirstWithHostNet
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
dnsPolicy: ClusterFirst
|
dnsPolicy: ClusterFirst
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.dnsConfig }}
|
{{- if or .Values.dnsConfig.options .Values.dnsConfig.nameservers .Values.dnsConfig.searches }}
|
||||||
dnsConfig:
|
dnsConfig:
|
||||||
{{- toYaml . | nindent 2 }}
|
{{- with .Values.dnsConfig.options }}
|
||||||
|
options:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.dnsConfig.nameservers }}
|
||||||
|
nameservers: []
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.dnsConfig.searches }}
|
||||||
|
searches: []
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
enableServiceLinks: {{ .Values.enableServiceLinks }}
|
enableServiceLinks: {{ .Values.enableServiceLinks }}
|
||||||
{{- with .Values.termination.gracePeriodSeconds }}
|
{{- with .Values.termination.gracePeriodSeconds }}
|
||||||
@@ -51,7 +62,6 @@ initContainers:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
|
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
{{- include "common.controller.mainContainer" . | nindent 2 }}
|
{{- include "common.controller.mainContainer" . | nindent 2 }}
|
||||||
{{- with .Values.additionalContainers }}
|
{{- with .Values.additionalContainers }}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type AddonVpnTestSuite struct {
|
|||||||
func (suite *AddonVpnTestSuite) SetupSuite() {
|
func (suite *AddonVpnTestSuite) SetupSuite() {
|
||||||
suite.Chart = helmunit.New("common-test", "../../common-test")
|
suite.Chart = helmunit.New("common-test", "../../common-test")
|
||||||
suite.Chart.UpdateDependencies()
|
suite.Chart.UpdateDependencies()
|
||||||
suite.baseValues = []string{"addons.vpn.enabled=true"}
|
suite.baseValues = []string{"addons.vpn.type=openvpn"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need this function to kick off the test suite, otherwise
|
// We need this function to kick off the test suite, otherwise
|
||||||
|
|||||||
@@ -237,10 +237,10 @@ hostNetwork: false
|
|||||||
dnsPolicy: # ClusterFirst
|
dnsPolicy: # ClusterFirst
|
||||||
|
|
||||||
# -- Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups.
|
# -- Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups.
|
||||||
dnsConfig: {}
|
dnsConfig:
|
||||||
# options:
|
options: []
|
||||||
# - name: ndots
|
nameservers: []
|
||||||
# value: "1"
|
searches: []
|
||||||
|
|
||||||
# -- Enable/disable the generation of environment variables for services.
|
# -- Enable/disable the generation of environment variables for services.
|
||||||
# [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service)
|
# [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service)
|
||||||
@@ -686,11 +686,9 @@ addons:
|
|||||||
# For more info, check out [our docs](http://docs.k8s-at-home.com/our-helm-charts/common-library-add-ons/#wireguard-vpn)
|
# For more info, check out [our docs](http://docs.k8s-at-home.com/our-helm-charts/common-library-add-ons/#wireguard-vpn)
|
||||||
# @default -- See values.yaml
|
# @default -- See values.yaml
|
||||||
vpn:
|
vpn:
|
||||||
# -- Enable running a VPN in the pod to route traffic through a VPN
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
# -- Specify the VPN type. Valid options are openvpn or wireguard
|
# -- Specify the VPN type. Valid options are disabled, openvpn or wireguard
|
||||||
type: openvpn
|
type: disabled
|
||||||
|
|
||||||
# -- OpenVPN specific configuration
|
# -- OpenVPN specific configuration
|
||||||
# @default -- See below
|
# @default -- See below
|
||||||
@@ -700,23 +698,27 @@ addons:
|
|||||||
# -- Optionally specify an existing secret that contains the credentials.
|
# -- Optionally specify an existing secret that contains the credentials.
|
||||||
# Credentials should be stored under the `VPN_AUTH` key
|
# Credentials should be stored under the `VPN_AUTH` key
|
||||||
authSecret: # my-vpn-secret
|
authSecret: # my-vpn-secret
|
||||||
# -- WireGuard specific configuration
|
|
||||||
# @default -- See below
|
|
||||||
wireguard: {}
|
|
||||||
|
|
||||||
# -- Set the VPN container securityContext
|
wireguard:
|
||||||
|
KILLSWITCH: true
|
||||||
|
KILLSWITCH_EXCLUDEDNETWORKS_IPV4:
|
||||||
|
- 192.168.0.0.1
|
||||||
|
# -- Set the VPN container specific securityContext
|
||||||
# @default -- See values.yaml
|
# @default -- See values.yaml
|
||||||
securityContext:
|
securityContext: {}
|
||||||
capabilities:
|
|
||||||
add:
|
|
||||||
- NET_ADMIN
|
|
||||||
- SYS_MODULE
|
|
||||||
|
|
||||||
# -- All variables specified here will be added to the vpn sidecar container
|
# -- All variables specified here will be added to the vpn sidecar container
|
||||||
# See the documentation of the VPN image for all config values
|
# See the documentation of the VPN image for all config values
|
||||||
env: {}
|
env: {}
|
||||||
# TZ: UTC
|
# TZ: UTC
|
||||||
|
|
||||||
|
# -- All variables specified here will be added to the vpn sidecar container
|
||||||
|
# See the documentation of the VPN image for all config values
|
||||||
|
envList: []
|
||||||
|
# name: someenv
|
||||||
|
# value: somevalue
|
||||||
|
|
||||||
|
|
||||||
# -- Provide a customized vpn configuration file to be used by the VPN.
|
# -- Provide a customized vpn configuration file to be used by the VPN.
|
||||||
configFile:
|
configFile:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
Reference in New Issue
Block a user