deployment.yaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. annotations:
  15. checksum/config: {{ include (print $.Template.BasePath "/cm-configuration.yaml") . | sha256sum }}
  16. checksum/config2: {{ include (print $.Template.BasePath "/secret-keys.yaml") . | sha256sum }}
  17. checksum/config3: {{ include (print $.Template.BasePath "/cm-openvpnscripts.yaml") . | sha256sum }}
  18. {{- with .Values.openvpn.podAnnotations }}
  19. {{- toYaml . | nindent 8 }}
  20. {{- end }}
  21. labels:
  22. {{- include "openvpn.selectorLabels" . | nindent 8 }}
  23. spec:
  24. {{- if .Values.registry_secret_data }}
  25. imagePullSecrets:
  26. - name: {{ include "openvpn.fullname" . }}-registry-secret
  27. {{- end }}
  28. hostNetwork: true
  29. containers:
  30. - name: {{ .Chart.Name }}
  31. command: ["/scripts/startscript"]
  32. {{- if .Values.openvpn.healthcheck }}
  33. livenessProbe:
  34. exec:
  35. command:
  36. - /scripts/healthcheck
  37. initialDelaySeconds: 20
  38. periodSeconds: 60
  39. failureThreshold: 5
  40. {{- end }}
  41. securityContext:
  42. capabilities:
  43. add:
  44. - NET_ADMIN
  45. - MKNOD
  46. image: "{{ .Values.openvpn.image }}:{{ .Values.openvpn.tag | default "latest" }}"
  47. imagePullPolicy: {{ .Values.openvpn.pullPolicy }}
  48. env:
  49. - name: TZ
  50. value: Europe/Moscow
  51. resources:
  52. {{- toYaml .Values.openvpn.resources | nindent 12 }}
  53. volumeMounts:
  54. - name: keys
  55. mountPath: /etc/openvpn/keys/
  56. - name: ccd
  57. mountPath: /etc/openvpn/ccd/
  58. - name: configuration
  59. mountPath: /etc/openvpn/configuration/
  60. - name: scripts
  61. mountPath: /scripts/
  62. - name: {{ .Chart.Name }}-stop
  63. image: "{{ .Values.openvpn.image }}:{{ .Values.openvpn.tag | default "latest" }}"
  64. imagePullPolicy: {{ .Values.openvpn.pullPolicy }}
  65. command: ["sleep","infinity"]
  66. lifecycle:
  67. preStop:
  68. exec:
  69. command: ["/bin/bash","-c","/scripts/stopscript"]
  70. volumeMounts:
  71. - name: scripts
  72. mountPath: /scripts/
  73. securityContext:
  74. capabilities:
  75. add:
  76. - NET_ADMIN
  77. - MKNOD
  78. volumes:
  79. - name: keys
  80. secret:
  81. secretName: {{ include "openvpn.fullname" . }}-keys
  82. - name: ccd
  83. configMap:
  84. name: {{ include "openvpn.fullname" . }}-ccd
  85. - name: configuration
  86. configMap:
  87. name: {{ include "openvpn.fullname" . }}-configuration
  88. - name: scripts
  89. configMap:
  90. name: {{ include "openvpn.fullname" . }}-scripts
  91. defaultMode: 0755