Skip to content

Commit

Permalink
Option to leave out server cider (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryopsida authored Dec 13, 2023
1 parent 2a26dba commit aa5a855
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion helm/wireguard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: wireguard
description: A Helm chart for managing a wireguard vpn in kubernetes
type: application
version: 0.17.0
version: 0.18.0
appVersion: "0.0.0"
maintainers:
- name: bryopsida
3 changes: 2 additions & 1 deletion helm/wireguard/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# wireguard

![Version: 0.17.0](https://img.shields.io/badge/Version-0.17.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)
![Version: 0.18.0](https://img.shields.io/badge/Version-0.18.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)

A Helm chart for managing a wireguard vpn in kubernetes

Expand Down Expand Up @@ -107,6 +107,7 @@ A Helm chart for managing a wireguard vpn in kubernetes
| volumeMounts | object | `{}` | Passthrough pod volume mounts |
| volumes | object | `{}` | Passthrough pod volumes |
| wireguard.clients | list | `[]` | A collection of clients that will be added to wg0.conf, accepts objects with keys PublicKey and AllowedIPs (mandatory) and optional FriendlyName or FriendlyJson (https://github.com/MindFlavor/prometheus_wireguard_exporter#friendly-tags), stored in secret |
| wireguard.natAddSourceNet | bool | `true` | Add the serverCidr to the nat source net option |
| wireguard.serverAddress | string | `"10.34.0.1/24"` | Address of the VPN server |
| wireguard.serverCidr | string | `"10.34.0.0/24"` | Subnet for your VPN, take care not to clash with cluster POD cidr |

Expand Down
5 changes: 3 additions & 2 deletions helm/wireguard/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{- define "wg-config-template" -}}
{{- $natSourceNetOption := .Values.wireguard.natAddSourceNet | ternary (printf "%s %s" "-s" .Values.wireguard.serverCidr) ("") -}}
[Interface]
Address = {{ .Values.wireguard.serverAddress }}
ListenPort = 51820
PostUp = wg set wg0 private-key /etc/wireguard/privatekey && iptables -t nat -A POSTROUTING -s {{ .Values.wireguard.serverCidr }} -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -s {{ .Values.wireguard.serverCidr }} -o eth0 -j MASQUERADE
PostUp = wg set wg0 private-key /etc/wireguard/privatekey && iptables -t nat -A POSTROUTING {{ $natSourceNetOption }} -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -s {{ $natSourceNetOption }} -o eth0 -j MASQUERADE

# Clients
{{- range .Values.wireguard.clients }}
Expand Down
2 changes: 2 additions & 0 deletions helm/wireguard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ wireguard:
serverAddress: 10.34.0.1/24
# -- Subnet for your VPN, take care not to clash with cluster POD cidr
serverCidr: 10.34.0.0/24
# -- Add the serverCidr to the nat source net option
natAddSourceNet: true
# -- A collection of clients that will be added to wg0.conf, accepts objects with keys PublicKey and AllowedIPs (mandatory) and optional FriendlyName or FriendlyJson (https://github.com/MindFlavor/prometheus_wireguard_exporter#friendly-tags), stored in secret
clients: []
# - FriendlyName: username1
Expand Down

0 comments on commit aa5a855

Please sign in to comment.