From 30bd5129f581eeec77c976a7835af3f02bf56287 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 24 Dec 2023 23:13:59 +0200 Subject: [PATCH] fix wg-easy interface (#1931) * fix wg-easy interface * correct device name * add upgrade strategy --- library/ix-dev/charts/wg-easy/Chart.yaml | 4 +-- library/ix-dev/charts/wg-easy/questions.yaml | 7 +++++ .../charts/wg-easy/templates/_wgeasy.tpl | 2 ++ .../ix-dev/charts/wg-easy/upgrade_strategy | 31 +++++++++++++++++++ library/ix-dev/charts/wg-easy/values.yaml | 5 +-- 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 library/ix-dev/charts/wg-easy/upgrade_strategy diff --git a/library/ix-dev/charts/wg-easy/Chart.yaml b/library/ix-dev/charts/wg-easy/Chart.yaml index a6fa069347..e4c5e1a6e7 100644 --- a/library/ix-dev/charts/wg-easy/Chart.yaml +++ b/library/ix-dev/charts/wg-easy/Chart.yaml @@ -3,9 +3,9 @@ description: WG-Easy is the easiest way to install & manage WireGuard! annotations: title: WG Easy type: application -version: 2.0.4 +version: 2.0.5 apiVersion: v2 -appVersion: "7" +appVersion: "8" kubeVersion: ">=1.16.0-0" maintainers: - name: truenas diff --git a/library/ix-dev/charts/wg-easy/questions.yaml b/library/ix-dev/charts/wg-easy/questions.yaml index 74b7dbdadd..945c6504e8 100644 --- a/library/ix-dev/charts/wg-easy/questions.yaml +++ b/library/ix-dev/charts/wg-easy/questions.yaml @@ -111,6 +111,13 @@ questions: type: int required: true default: 0 + - variable: deviceName + label: Device Name + description: Ethernet device the wireguard traffic should be forwarded through. + schema: + type: string + required: true + default: eth0 - variable: clientMTU label: Clients MTU description: The MTU the clients will use. diff --git a/library/ix-dev/charts/wg-easy/templates/_wgeasy.tpl b/library/ix-dev/charts/wg-easy/templates/_wgeasy.tpl index 7d4fc1cab7..06293a7fbd 100644 --- a/library/ix-dev/charts/wg-easy/templates/_wgeasy.tpl +++ b/library/ix-dev/charts/wg-easy/templates/_wgeasy.tpl @@ -24,6 +24,7 @@ workload: - SYS_MODULE env: WG_PORT: {{ .Values.wgNetwork.udpPort }} + WG_PATH: /etc/wireguard PORT: {{ .Values.wgNetwork.webPort }} WG_HOST: {{ .Values.wgConfig.host | quote }} PASSWORD: {{ .Values.wgConfig.password | quote }} @@ -31,6 +32,7 @@ workload: WG_MTU: {{ .Values.wgConfig.clientMTU }} WG_DEFAULT_ADDRESS: {{ .Values.wgConfig.clientAddressRange }} WG_DEFAULT_DNS: {{ .Values.wgConfig.clientDNSServer }} + WG_DEVICE: {{ .Values.wgConfig.deviceName | default "eth0" }} WG_ALLOWED_IPS: {{ join "," .Values.wgConfig.allowedIPs | default "0.0.0.0/0,::/0" | quote }} fixedEnv: PUID: 0 diff --git a/library/ix-dev/charts/wg-easy/upgrade_strategy b/library/ix-dev/charts/wg-easy/upgrade_strategy new file mode 100644 index 0000000000..f2d88937de --- /dev/null +++ b/library/ix-dev/charts/wg-easy/upgrade_strategy @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import json +import re +import sys + +from catalog_update.upgrade_strategy import semantic_versioning + + +RE_STABLE_VERSION = re.compile(r'[0-9]+') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)} + version = semantic_versioning(list(tags)) + if not version: + return {} + + return { + 'tags': {key: tags[version]}, + 'app_version': version, + } + + +if __name__ == '__main__': + try: + versions_json = json.loads(sys.stdin.read()) + except ValueError: + raise ValueError('Invalid json specified') + + print(json.dumps(newer_mapping(versions_json))) diff --git a/library/ix-dev/charts/wg-easy/values.yaml b/library/ix-dev/charts/wg-easy/values.yaml index 824b74b989..797b4e2cff 100644 --- a/library/ix-dev/charts/wg-easy/values.yaml +++ b/library/ix-dev/charts/wg-easy/values.yaml @@ -1,7 +1,7 @@ image: pullPolicy: IfNotPresent - repository: weejewel/wg-easy - tag: "7" + repository: ghcr.io/wg-easy/wg-easy + tag: "8" resources: limits: @@ -24,6 +24,7 @@ wgConfig: clientMTU: 1420 clientAddressRange: 10.8.0.x clientDNSServer: "1.1.1.1" + deviceName: eth0 allowedIPs: [] additionalEnvs: []