Skip to content

Commit

Permalink
add wireproxy helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
edevosc2c committed Jan 16, 2025
1 parent b11f747 commit 89239a2
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 0 deletions.
23 changes: 23 additions & 0 deletions wireproxy/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions wireproxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: wireproxy
description: Wireguard client that exposes itself as a socks5 proxy

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.9"
5 changes: 5 additions & 0 deletions wireproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Wireproxy

Helm chart for wireproxy: https://github.com/pufferffish/wireproxy

An easy way to deploy a wireguard VPN without root. Can be used to secure communication between two servers.
18 changes: 18 additions & 0 deletions wireproxy/extra-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
environment:
- name: WIREGUARD_KEY
value: QLwVsC9gXoOBVO8IFOJGrp1GEzLFxe+sKw55d0KAtHg=

configMap:
wireproxyConf: |
[Interface]
PrivateKey = $WIREGUARD_KEY
Address = 192.168.100.1/32
ListenPort = 51820
[Peer]
PublicKey = n21LuUwLDByVqlh1Q6YFgzwfE/7ndWsh5BLdxTw6vlI=
AllowedIPs = 192.168.100.0/24
[TCPServerTunnel]
ListenPort = 8181
Target = test-studio-svc:8000
6 changes: 6 additions & 0 deletions wireproxy/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
releases:
- name: wireproxy
chart: ./
namespace: mviewer
values:
- extra-values.yaml
62 changes: 62 additions & 0 deletions wireproxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "wireproxy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "wireproxy.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "wireproxy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "wireproxy.labels" -}}
helm.sh/chart: {{ include "wireproxy.chart" . }}
{{ include "wireproxy.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "wireproxy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "wireproxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "wireproxy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "wireproxy.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions wireproxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "wireproxy.fullname" . }}
data:
wireproxy.conf: |
{{ .Values.configMap.wireproxyConf | indent 4 }}
73 changes: 73 additions & 0 deletions wireproxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "wireproxy.fullname" . }}
labels:
{{- include "wireproxy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "wireproxy.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "wireproxy.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
args: ["-s", "-i", "0.0.0.0:9080"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- toYaml .Values.environment | nindent 12 }}
ports:
- name: wireguard
containerPort: {{ .Values.service.port }}
protocol: UDP
- name: healthcheck
containerPort: 9080
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: wireproxy-conf
mountPath: /etc/wireproxy/wireproxy.conf
subPath: wireproxy.conf
readOnly: true
volumes:
- name: wireproxy-conf
configMap:
name: {{ include "wireproxy.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions wireproxy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "wireproxy.fullname" . }}
labels:
{{- include "wireproxy.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: wireguard
protocol: UDP
name: wireguard
selector:
{{- include "wireproxy.selectorLabels" . | nindent 4 }}
104 changes: 104 additions & 0 deletions wireproxy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
replicaCount: 1

# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
image:
repository: edevosc2c/wireproxy
# This sets the pull policy for images.
pullPolicy: IfNotPresent
tag: "latest"

# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: []
# This is to override the chart name.
nameOverride: ""
fullnameOverride: ""

# This is for setting Kubernetes Annotations to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podAnnotations: {}
# This is for setting Kubernetes Labels to a Pod.
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10000

# generate key with wg genkey | tee privatekey | wg pubkey > publickey
environment:
- name: WIREGUARD_KEY
value: replaceme

configMap:
wireproxyConf: |
[Interface]
PrivateKey = $WIREGUARD_KEY
Address = 192.168.100.1/32
ListenPort = 51820
[Peer]
PublicKey = replace_me_with_key_of_peer
AllowedIPs = 192.168.100.0/24
# <an app on the wireguard network> --(wireguard)--> host 8181 -> georchestra-console-svc:8080
[TCPServerTunnel]
ListenPort = 8181
Target = georchestra-console-svc:8080
# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
type: NodePort
nodePort: 30820
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
port: 51820

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
livenessProbe:
httpGet:
path: /readyz
port: healthcheck
readinessProbe:
httpGet:
path: /readyz
port: healthcheck

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit 89239a2

Please sign in to comment.