From 5b3a68dcaf26edce33d2ec106fc6c5a49abe0265 Mon Sep 17 00:00:00 2001 From: Zihao Zhang Date: Sat, 24 Aug 2019 05:54:23 -0700 Subject: [PATCH] Make openvpn work in Headless Services and HostPort mode (#15469) Signed-off-by: Zihao Zhang --- stable/openvpn/Chart.yaml | 2 +- stable/openvpn/README.md | 4 +++- stable/openvpn/templates/openvpn-deployment.yaml | 3 +++ stable/openvpn/templates/openvpn-service.yaml | 3 +++ stable/openvpn/values.yaml | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stable/openvpn/Chart.yaml b/stable/openvpn/Chart.yaml index 65e8d8c34a..1584351e2f 100755 --- a/stable/openvpn/Chart.yaml +++ b/stable/openvpn/Chart.yaml @@ -3,7 +3,7 @@ description: A Helm chart to install an openvpn server inside a kubernetes clust generation is also part of the deployment, and this chart will generate client keys as needed. name: openvpn -version: 3.13.7 +version: 3.13.8 appVersion: 1.1.0 maintainers: - name: jasongwartz diff --git a/stable/openvpn/README.md b/stable/openvpn/README.md index de11b9b029..a58adc11eb 100644 --- a/stable/openvpn/README.md +++ b/stable/openvpn/README.md @@ -43,7 +43,7 @@ kubectl -n "$NAMESPACE" exec -it "$POD_NAME" /etc/openvpn/setup/newClientCert.sh kubectl -n "$NAMESPACE" exec -it "$POD_NAME" cat "/etc/openvpn/certs/pki/$KEY_NAME.ovpn" > "$KEY_NAME.ovpn" ``` -In order to revoke certificates in later steps: +In order to revoke certificates in later steps: ```bash #!/bin/bash @@ -78,7 +78,9 @@ Parameter | Description | Default `service.type` | k8s service type exposing ports, e.g. `NodePort` | `LoadBalancer` `service.externalPort` | TCP port reported when creating configuration files | `443` `service.internalPort` | TCP port on which the service works | `443` +`service.hostPort` | Expose openvpn directly using host port | `nil` `service.nodePort` | NodePort value if service.type is `NodePort` | `nil` (auto-assigned) +`service.clusterIP` | clusterIP value if service.type is `ClusterIP` | `nil` `service.externalIPs` | External IPs to listen on | `[]` `resources.requests.cpu` | OpenVPN cpu request | `300m` `resources.requests.memory` | OpenVPN memory request | `128Mi` diff --git a/stable/openvpn/templates/openvpn-deployment.yaml b/stable/openvpn/templates/openvpn-deployment.yaml index fa83634891..928d9ae8af 100644 --- a/stable/openvpn/templates/openvpn-deployment.yaml +++ b/stable/openvpn/templates/openvpn-deployment.yaml @@ -35,6 +35,9 @@ spec: command: ["/etc/openvpn/setup/configure.sh"] ports: - containerPort: {{ .Values.service.internalPort }} + {{- if .Values.service.hostPort }} + hostPort: {{ .Values.service.hostPort }} + {{- end }} name: openvpn securityContext: capabilities: diff --git a/stable/openvpn/templates/openvpn-service.yaml b/stable/openvpn/templates/openvpn-service.yaml index ef4a56fbb9..a52e0eb1ec 100644 --- a/stable/openvpn/templates/openvpn-service.yaml +++ b/stable/openvpn/templates/openvpn-service.yaml @@ -28,6 +28,9 @@ spec: app: {{ template "openvpn.name" . }} release: {{ .Release.Name }} type: {{ .Values.service.type }} +{{- if .Values.service.clusterIP }} + clusterIP: {{ .Values.service.clusterIP }} +{{- end }} {{- if .Values.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} diff --git a/stable/openvpn/values.yaml b/stable/openvpn/values.yaml index 10dc2b5d5b..86acfc77ab 100644 --- a/stable/openvpn/values.yaml +++ b/stable/openvpn/values.yaml @@ -17,8 +17,10 @@ service: type: LoadBalancer externalPort: 443 internalPort: 443 + # hostPort: 443 externalIPs: [] nodePort: 32085 + # clusterIP: None # LoadBalancerSourceRanges: 0.0.0.0/0 # loadBalancerIP: 10.0.0.1