Take over the project
I've decided to maintain the project myself now, so I've forked it and create a drone pipeline to push image to my registry
This commit is contained in:
1
helm/templates/NOTES.txt
Normal file
1
helm/templates/NOTES.txt
Normal file
@ -0,0 +1 @@
|
||||
1. Get the application URL by running these commands:
|
62
helm/templates/_helpers.tpl
Normal file
62
helm/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "openvpn-chart.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 "openvpn-chart.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 "openvpn-chart.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "openvpn-chart.labels" -}}
|
||||
helm.sh/chart: {{ include "openvpn-chart.chart" . }}
|
||||
{{ include "openvpn-chart.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "openvpn-chart.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "openvpn-chart.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "openvpn-chart.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "openvpn-chart.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
121
helm/templates/deployment.yaml
Normal file
121
helm/templates/deployment.yaml
Normal file
@ -0,0 +1,121 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "openvpn-chart.fullname" . }}
|
||||
labels:
|
||||
{{- include "openvpn-chart.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "openvpn-chart.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "openvpn-chart.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: pvc-openvpn
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "openvpn-chart.fullname" . }}
|
||||
- name: pki-scripts
|
||||
configMap:
|
||||
name: {{ include "openvpn-chart.fullname" . }}-pki-scripts
|
||||
securityContext:
|
||||
sysctls:
|
||||
- name: net.ipv4.ip_forward
|
||||
value: "1"
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- mountPath: "/etc/openvpn"
|
||||
name: pvc-openvpn
|
||||
- mountPath: /scripts
|
||||
name: pki-scripts
|
||||
env:
|
||||
- name: OVPN_SERVER
|
||||
value: "{{ .Values.openvpn.proto }}://{{ .Values.openvpn.host }}:{{ .Values.openvpn.port }}"
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
initContainers:
|
||||
# ----------------------------------------------------------------------
|
||||
# -- This init container is generating the basic configuration
|
||||
# ----------------------------------------------------------------------
|
||||
- name: 0-ovpn-genconfig
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
volumeMounts:
|
||||
- mountPath: "/etc/openvpn"
|
||||
name: pvc-openvpn
|
||||
env:
|
||||
- name: OVPN_SERVER_URL
|
||||
value: "{{ .Values.openvpn.proto }}://{{ .Values.openvpn.host }}:{{ .Values.openvpn.port }}"
|
||||
- name: OVPN_DATA
|
||||
value: "/etc/openvpn"
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- 'if ! [ -f "/etc/openvpn/ovpn_env.sh" ]; then ovpn_genconfig -u $OVPN_SERVER_URL && touch /etc/openvpn/.init; fi'
|
||||
- name: 1-ovpn-initpki
|
||||
env:
|
||||
- name: OVPN_DATA
|
||||
value: /etc/openvpn
|
||||
- name: EASYRSA_REQ_CN
|
||||
value: {{ .Values.easyrsa.cn }}
|
||||
- name: EASYRSA_REQ_COUNTRY
|
||||
value: {{ .Values.easyrsa.country }}
|
||||
- name: EASYRSA_REQ_PROVINCE
|
||||
value: {{ .Values.easyrsa.province }}
|
||||
- name: EASYRSA_REQ_CITY
|
||||
value: {{ .Values.easyrsa.city }}
|
||||
- name: EASYRSA_REQ_ORG
|
||||
value: {{ .Values.easyrsa.org }}
|
||||
- name: EASYRSA_REQ_EMAIL
|
||||
value: {{ .Values.easyrsa.email }}
|
||||
- name: EASYRSA_REQ_OU
|
||||
value: {{ .Values.easyrsa.ou }}
|
||||
- name: EASYRSA_ALGO
|
||||
value: {{ .Values.easyrsa.algo }}
|
||||
- name: EASYRSA_DIGEST
|
||||
value: {{ .Values.easyrsa.digest }}
|
||||
- name: EASYRSA_BATCH
|
||||
value: "yes"
|
||||
- name: OVPN_SERVER_URL
|
||||
value: "{{ .Values.openvpn.proto }}://{{ .Values.openvpn.host }}:{{ .Values.openvpn.port }}"
|
||||
volumeMounts:
|
||||
- mountPath: "/etc/openvpn"
|
||||
name: pvc-openvpn
|
||||
- mountPath: /scripts
|
||||
name: pki-scripts
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
command:
|
||||
- bash
|
||||
- /scripts/init_pki.sh
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
30
helm/templates/pki-generate-scripts.yaml
Normal file
30
helm/templates/pki-generate-scripts.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "openvpn-chart.fullname" . }}-pki-scripts
|
||||
labels:
|
||||
{{- include "openvpn-chart.labels" . | nindent 4 }}
|
||||
data:
|
||||
init_pki.sh: |
|
||||
if [ ! -d /etc/openvpn/pki ]; then
|
||||
source "$OPENVPN/ovpn_env.sh"
|
||||
OVPN_DIR=/etc/openvpn
|
||||
PKI_DIR=$OVPN_DIR/pki
|
||||
cd $OVPN_DIR
|
||||
export EASYRSA_BATCH=yes
|
||||
unset EASYRSA_VARS_FILE
|
||||
/usr/share/easy-rsa/easyrsa init-pki
|
||||
/usr/share/easy-rsa/easyrsa build-ca nopass
|
||||
/usr/share/easy-rsa/easyrsa build-server-full {{ .Values.openvpn.host }} nopass
|
||||
/usr/share/easy-rsa/easyrsa gen-dh
|
||||
cd $PKI_DIR
|
||||
openvpn --genkey tls-crypt-v2-server private/{{ .Values.openvpn.host }}.pem
|
||||
openvpn --genkey secret > ta.key
|
||||
fi
|
||||
gen_client.sh: |
|
||||
source "$OPENVPN/ovpn_env.sh"
|
||||
CLIENTNAME=$1
|
||||
PASSWORD=$2
|
||||
OVPN_DIR=/etc/openvpn
|
||||
cd $OVPN_DIR
|
||||
/usr/share/easy-rsa/easyrsa build-client-full $CLIENTNAME $PASSWORD
|
13
helm/templates/pvc.yaml
Normal file
13
helm/templates/pvc.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "openvpn-chart.fullname" . }}
|
||||
labels:
|
||||
{{- include "openvpn-chart.labels" . | nindent 4 }}
|
||||
spec:
|
||||
storageClassName: {{ .Values.storage.class }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.storage.size }}
|
18
helm/templates/service.yaml
Normal file
18
helm/templates/service.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "openvpn-chart.fullname" . }}
|
||||
labels:
|
||||
{{- include "openvpn-chart.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
{{- if .Values.service.nodePort }}
|
||||
nodePort: {{ int .Values.service.nodePort }}
|
||||
{{- end}}
|
||||
targetPort: {{ .Values.service.port | default 1194 }}
|
||||
protocol: {{ .Values.service.protocol | default "UDP" | quote }}
|
||||
name: openvpn
|
||||
selector:
|
||||
{{- include "openvpn-chart.selectorLabels" . | nindent 4 }}
|
15
helm/templates/tests/test-connection.yaml
Normal file
15
helm/templates/tests/test-connection.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "openvpn-chart.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "openvpn-chart.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "openvpn-chart.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
Reference in New Issue
Block a user