|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "kubevpn.fullname" . }} |
| 5 | + labels: |
| 6 | + {{- include "kubevpn.labels" . | nindent 4 }} |
| 7 | +spec: |
| 8 | + {{- if not .Values.autoscaling.enabled }} |
| 9 | + replicas: {{ .Values.replicaCount }} |
| 10 | + {{- end }} |
| 11 | + selector: |
| 12 | + matchLabels: |
| 13 | + {{- include "kubevpn.selectorLabels" . | nindent 6 }} |
| 14 | + template: |
| 15 | + metadata: |
| 16 | + {{- with .Values.podAnnotations }} |
| 17 | + annotations: |
| 18 | + {{- toYaml . | nindent 8 }} |
| 19 | + {{- end }} |
| 20 | + labels: |
| 21 | + {{- include "kubevpn.labels" . | nindent 8 }} |
| 22 | + {{- with .Values.podLabels }} |
| 23 | + {{- toYaml . | nindent 8 }} |
| 24 | + {{- end }} |
| 25 | + spec: |
| 26 | + {{- with .Values.imagePullSecrets }} |
| 27 | + imagePullSecrets: |
| 28 | + {{- toYaml . | nindent 8 }} |
| 29 | + {{- end }} |
| 30 | + serviceAccountName: {{ include "kubevpn.serviceAccountName" . }} |
| 31 | + securityContext: |
| 32 | + {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 33 | + containers: |
| 34 | + - args: |
| 35 | + - |2- |
| 36 | +
|
| 37 | + sysctl -w net.ipv4.ip_forward=1 |
| 38 | + sysctl -w net.ipv6.conf.all.disable_ipv6=0 |
| 39 | + sysctl -w net.ipv6.conf.all.forwarding=1 |
| 40 | + update-alternatives --set iptables /usr/sbin/iptables-legacy |
| 41 | + iptables -F |
| 42 | + ip6tables -F |
| 43 | + iptables -P INPUT ACCEPT |
| 44 | + ip6tables -P INPUT ACCEPT |
| 45 | + iptables -P FORWARD ACCEPT |
| 46 | + ip6tables -P FORWARD ACCEPT |
| 47 | + iptables -t nat -A POSTROUTING -s ${CIDR4} -o eth0 -j MASQUERADE |
| 48 | + ip6tables -t nat -A POSTROUTING -s ${CIDR6} -o eth0 -j MASQUERADE |
| 49 | + kubevpn serve -L "tcp://:10800" -L "tun://:8422?net=${TunIPv4}" -L "gtcp://:10801" -L "gudp://:10802" --debug=true |
| 50 | + command: |
| 51 | + - /bin/sh |
| 52 | + - -c |
| 53 | + env: |
| 54 | + - name: CIDR4 |
| 55 | + value: 223.254.0.0/16 |
| 56 | + - name: CIDR6 |
| 57 | + value: efff:ffff:ffff:ffff::/64 |
| 58 | + - name: TunIPv4 |
| 59 | + value: 223.254.0.100/16 |
| 60 | + - name: TunIPv6 |
| 61 | + value: efff:ffff:ffff:ffff:ffff:ffff:ffff:9999/64 |
| 62 | + envFrom: |
| 63 | + - secretRef: |
| 64 | + name: {{ include "kubevpn.fullname" . }} |
| 65 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 66 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 67 | + name: vpn |
| 68 | + ports: |
| 69 | + - containerPort: {{ .Values.service.port8422 }} |
| 70 | + name: 8422-for-udp |
| 71 | + protocol: UDP |
| 72 | + - containerPort: {{ .Values.service.port10800 }} |
| 73 | + name: 10800-for-tcp |
| 74 | + protocol: TCP |
| 75 | + resources: |
| 76 | + {{- toYaml .Values.resources | nindent 12 }} |
| 77 | + securityContext: |
| 78 | + capabilities: |
| 79 | + add: |
| 80 | + - NET_ADMIN |
| 81 | + privileged: true |
| 82 | + runAsUser: 0 |
| 83 | + - args: |
| 84 | + - control-plane |
| 85 | + - --watchDirectoryFilename |
| 86 | + - /etc/envoy/envoy-config.yaml |
| 87 | + command: |
| 88 | + - kubevpn |
| 89 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 90 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 91 | + name: control-plane |
| 92 | + ports: |
| 93 | + - containerPort: {{ .Values.service.port9002 }} |
| 94 | + name: 9002-for-envoy |
| 95 | + protocol: TCP |
| 96 | + resources: |
| 97 | + {{- toYaml .Values.resourcesSmall | nindent 12 }} |
| 98 | + volumeMounts: |
| 99 | + - mountPath: /etc/envoy |
| 100 | + name: envoy-config |
| 101 | + readOnly: true |
| 102 | + - args: |
| 103 | + - webhook |
| 104 | + command: |
| 105 | + - kubevpn |
| 106 | + envFrom: |
| 107 | + - secretRef: |
| 108 | + name: {{ include "kubevpn.fullname" . }} |
| 109 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 110 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 111 | + name: webhook |
| 112 | + ports: |
| 113 | + - containerPort: 80 |
| 114 | + name: 80-for-webhook |
| 115 | + protocol: TCP |
| 116 | + resources: |
| 117 | + {{- toYaml .Values.resourcesSmall | nindent 12 }} |
| 118 | + {{- with .Values.volumes }} |
| 119 | + volumes: |
| 120 | + {{- toYaml . | nindent 8 }} |
| 121 | + {{- end }} |
| 122 | + {{- with .Values.nodeSelector }} |
| 123 | + nodeSelector: |
| 124 | + {{- toYaml . | nindent 8 }} |
| 125 | + {{- end }} |
| 126 | + {{- with .Values.affinity }} |
| 127 | + affinity: |
| 128 | + {{- toYaml . | nindent 8 }} |
| 129 | + {{- end }} |
| 130 | + {{- with .Values.tolerations }} |
| 131 | + tolerations: |
| 132 | + {{- toYaml . | nindent 8 }} |
| 133 | + {{- end }} |
0 commit comments