From cbec64606411780efffe00816dbce4da762bf935 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Mon, 7 Nov 2022 16:18:58 +0200 Subject: [PATCH] add deployment/service and test values --- test/wg-easy/1.0.0/ix_values.yaml | 2 +- test/wg-easy/1.0.0/questions.yaml | 8 ++- test/wg-easy/1.0.0/templates/deployment.yaml | 66 ++++++++++++++++++++ test/wg-easy/1.0.0/templates/service.yaml | 10 +++ test/wg-easy/1.0.0/test_values.yaml | 25 ++++++++ 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 test/wg-easy/1.0.0/templates/deployment.yaml create mode 100644 test/wg-easy/1.0.0/templates/service.yaml diff --git a/test/wg-easy/1.0.0/ix_values.yaml b/test/wg-easy/1.0.0/ix_values.yaml index 869ce8aa79..9fa0a8f646 100644 --- a/test/wg-easy/1.0.0/ix_values.yaml +++ b/test/wg-easy/1.0.0/ix_values.yaml @@ -1,4 +1,4 @@ image: pullPolicy: IfNotPresent repository: weejewel/wg-easy - tag: 7 + tag: "7" diff --git a/test/wg-easy/1.0.0/questions.yaml b/test/wg-easy/1.0.0/questions.yaml index 637a18b0f3..f4d0f022db 100644 --- a/test/wg-easy/1.0.0/questions.yaml +++ b/test/wg-easy/1.0.0/questions.yaml @@ -39,6 +39,12 @@ questions: max: 65535 default: 20921 required: true + - variable: hostNetwork + label: Host Network + group: Networking + schema: + type: boolean + default: false - variable: dnsConfig label: DNS Configuration @@ -67,7 +73,7 @@ questions: type: string required: true - - variable: wg_easy + - variable: wgeasy label: WG-Easy Configuration group: Configuration schema: diff --git a/test/wg-easy/1.0.0/templates/deployment.yaml b/test/wg-easy/1.0.0/templates/deployment.yaml new file mode 100644 index 0000000000..21886549ff --- /dev/null +++ b/test/wg-easy/1.0.0/templates/deployment.yaml @@ -0,0 +1,66 @@ +{{ include "common.storage.hostPathValidate" .Values }} +apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" . }} + labels: + app: {{ template "common.names.name" . }} + chart: {{ template "common.names.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + rollme: {{ randAlphaNum 5 | quote }} +spec: + replicas: {{ (default 1 .Values.replicas) }} + strategy: + type: "Recreate" + selector: + matchLabels: + app: {{ template "common.names.name" . }} + release: {{ .Release.Name }} + template: + metadata: + name: {{ template "common.names.fullname" . }} + labels: + {{- include "common.labels.selectorLabels" . | nindent 8 }} + annotations: {{ include "common.annotations" . | nindent 8 }} + spec: + hostNetwork: {{ .Values.hostNetwork }} + hostname: {{ .Release.Name }} + containers: + - name: {{ .Chart.Name }} + {{ include "common.resources.limitation" . | nindent 10 }} + {{ include "common.containers.imageConfig" .Values.image | nindent 10 }} + volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }} + {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $index }} + mountPath: {{ $hostPathConfiguration.mountPath }} + {{ end }} + ports: + - name: udp + containerPort: 51820 + protocol: UDP + - name: web + containerPort: 51821 + env: + {{ $wgeasy := .Values.wgeasy }} + {{ $envList := (default list .Values.environmentVariables) }} + {{ $envList = mustAppend $envList (dict "name" "WG_HOST" "value" $wgeasy.host) }} + {{ $envList = mustAppend $envList (dict "name" "PASSWORD" "value" $wgeasy.password) }} + {{ $envList = mustAppend $envList (dict "name" "WG_PORT" "value" .Values.wgUDPPort) }} + {{ $envList = mustAppend $envList (dict "name" "WG_PERSISTENT_KEEPALIVE" "value" $wgeasy.keep_alive) }} + {{ $envList = mustAppend $envList (dict "name" "WG_DEFAULT_ADDRESS" "value" $wgeasy.client_address_range) }} + {{ $envList = mustAppend $envList (dict "name" "WG_DEFAULT_DNS" "value" $wgeasy.client_dns_server) }} + {{ if $wgeasy.allowed_ips }} + {{ $envList = mustAppend $envList (dict "name" "WG_ALLOWED_IPS" "value" (join "," $wgeasy.allowed_ips)) }} + {{ else }} + {{ $envList = mustAppend $envList (dict "name" "WG_ALLOWED_IPS" "value" ("0.0.0.0/0,::/0")) }} + {{ end }} + {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }} +{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }} + volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }} + {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $index }} + hostPath: + path: {{ $hostPathConfiguration.hostPath }} + {{ end }} diff --git a/test/wg-easy/1.0.0/templates/service.yaml b/test/wg-easy/1.0.0/templates/service.yaml new file mode 100644 index 0000000000..b8eb8b9cc4 --- /dev/null +++ b/test/wg-easy/1.0.0/templates/service.yaml @@ -0,0 +1,10 @@ +{{ $selectors := list }} +{{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }} +{{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }} +{{ $ports := list }} +{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.webUIPort "nodePort" .Values.webUIPort "targetPort" 51821) }} +{{ $ports = mustAppend $ports (dict "name" "udp" "port" .Values.wgUDPPort "nodePort" .Values.wgUDPPort "targetPort" 51820 "protocol" "UDP") }} +{{ $params := . }} +{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }} +{{ $_1 := set .Values "extraSelectorLabels" $selectors }} +{{ include "common.classes.service" $params }} diff --git a/test/wg-easy/1.0.0/test_values.yaml b/test/wg-easy/1.0.0/test_values.yaml index e69de29bb2..033a07befe 100644 --- a/test/wg-easy/1.0.0/test_values.yaml +++ b/test/wg-easy/1.0.0/test_values.yaml @@ -0,0 +1,25 @@ +image: + pullPolicy: IfNotPresent + repository: weejewel/wg-easy + tag: "7" +appVolumeMounts: + config: + emptyDir: true + mountPath: /etc/wireguard +dnsConfig: + options: [] +emptyDirVolumes: true +environmentVariables: [] +extraAppVolumeMounts: [] +hostNetwork: true +wgUDPPort: 20290 +webUIPort: 20921 +wgeasy: + host: wg.domain.com + password: secret + keep_alive: 5 + client_address_range: 10.10.0.x + client_dns_server: "8.8.8.8" + allowed_ips: + - 10.10.10.0/24 + - 10.10.12.0/24