Explorar o código

add deployment/service and test values

Stavros kois %!s(int64=2) %!d(string=hai) anos
pai
achega
cbec646064

+ 1 - 1
test/wg-easy/1.0.0/ix_values.yaml

@@ -1,4 +1,4 @@
 image:
   pullPolicy: IfNotPresent
   repository: weejewel/wg-easy
-  tag: 7
+  tag: "7"

+ 7 - 1
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:

+ 66 - 0
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 }}

+ 10 - 0
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 }}

+ 25 - 0
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