diff --git a/wireproxy/.helmignore b/wireproxy/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/wireproxy/.helmignore @@ -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/ diff --git a/wireproxy/Chart.yaml b/wireproxy/Chart.yaml new file mode 100644 index 0000000..db8426f --- /dev/null +++ b/wireproxy/Chart.yaml @@ -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" diff --git a/wireproxy/README.md b/wireproxy/README.md new file mode 100644 index 0000000..2b908cf --- /dev/null +++ b/wireproxy/README.md @@ -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. \ No newline at end of file diff --git a/wireproxy/extra-values.yaml b/wireproxy/extra-values.yaml new file mode 100644 index 0000000..11d889a --- /dev/null +++ b/wireproxy/extra-values.yaml @@ -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 \ No newline at end of file diff --git a/wireproxy/helmfile.yaml b/wireproxy/helmfile.yaml new file mode 100644 index 0000000..0b66daa --- /dev/null +++ b/wireproxy/helmfile.yaml @@ -0,0 +1,6 @@ +releases: + - name: wireproxy + chart: ./ + namespace: mviewer + values: + - extra-values.yaml diff --git a/wireproxy/templates/_helpers.tpl b/wireproxy/templates/_helpers.tpl new file mode 100644 index 0000000..0a4fb06 --- /dev/null +++ b/wireproxy/templates/_helpers.tpl @@ -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 }} diff --git a/wireproxy/templates/configmap.yaml b/wireproxy/templates/configmap.yaml new file mode 100644 index 0000000..a3aeebb --- /dev/null +++ b/wireproxy/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "wireproxy.fullname" . }} +data: + wireproxy.conf: | +{{ .Values.configMap.wireproxyConf | indent 4 }} \ No newline at end of file diff --git a/wireproxy/templates/deployment.yaml b/wireproxy/templates/deployment.yaml new file mode 100644 index 0000000..acc6dde --- /dev/null +++ b/wireproxy/templates/deployment.yaml @@ -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 }} diff --git a/wireproxy/templates/service.yaml b/wireproxy/templates/service.yaml new file mode 100644 index 0000000..dd0cbae --- /dev/null +++ b/wireproxy/templates/service.yaml @@ -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 }} diff --git a/wireproxy/values.yaml b/wireproxy/values.yaml new file mode 100644 index 0000000..5d8664f --- /dev/null +++ b/wireproxy/values.yaml @@ -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 + + # --(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: {}