deployment.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "openvpn.fullname" . }}
  5. labels:
  6. {{- include "openvpn.labels" . | nindent 4 }}
  7. spec:
  8. replicas: 1
  9. selector:
  10. matchLabels:
  11. {{- include "openvpn.selectorLabels" . | nindent 6 }}
  12. template:
  13. metadata:
  14. {{- with .Values.openvpn.podAnnotations }}
  15. annotations:
  16. {{- toYaml . | nindent 8 }}
  17. {{- end }}
  18. labels:
  19. {{- include "openvpn.selectorLabels" . | nindent 8 }}
  20. spec:
  21. {{- if .Values.registry_secret_data }}
  22. imagePullSecrets:
  23. - name: {{ include "openvpn.fullname" . }}-registry-secret
  24. {{- end }}
  25. hostNetwork: true
  26. containers:
  27. - name: {{ .Chart.Name }}
  28. {{- if .Values.openvpn.scripts.startscript }}
  29. command: ["/scripts/startscript"]
  30. {{- end }}
  31. {{- if .Values.openvpn.scripts.healthcheck }}
  32. livenessProbe:
  33. exec:
  34. command:
  35. - /scripts/healthcheck
  36. initialDelaySeconds: 20
  37. periodSeconds: 60
  38. failureThreshold: 5
  39. {{- end }}
  40. securityContext:
  41. capabilities:
  42. add:
  43. - NET_ADMIN
  44. image: "{{ .Values.openvpn.image }}:{{ .Values.openvpn.tag | default "latest" }}"
  45. imagePullPolicy: {{ .Values.openvpn.pullPolicy }}
  46. env:
  47. - name: TZ
  48. value: Europe/Moscow
  49. resources:
  50. {{- toYaml .Values.openvpn.resources | nindent 12 }}
  51. volumeMounts:
  52. - name: keys
  53. mountPath: /etc/openvpn/keys/
  54. - name: ccd
  55. mountPath: /etc/openvpn/ccd/
  56. - name: configuration
  57. mountPath: /etc/openvpn/configuration/
  58. {{- if .Values.openvpn.scripts }}
  59. - name: scripts
  60. mountPath: /scripts/
  61. {{- end }}
  62. volumes:
  63. - name: keys
  64. secret:
  65. secretName: {{ include "openvpn.fullname" . }}-keys
  66. - name: ccd
  67. configMap:
  68. name: {{ include "openvpn.fullname" . }}-ccd
  69. - name: configuration
  70. configMap:
  71. name: {{ include "openvpn.fullname" . }}-configuration
  72. {{- if .Values.openvpn.scripts }}
  73. - name: scripts
  74. configMap:
  75. name: {{ include "openvpn.fullname" . }}-scripts
  76. defaultMode: 0755
  77. {{- end }}