ソースを参照

startup and healthcheck

Vadim Surkov 3 年 前
コミット
f79a0ee6dc
2 ファイル変更15 行追加4 行削除
  1. 12 2
      helm/templates/deployment.yaml
  2. 3 2
      helm/values.yaml

+ 12 - 2
helm/templates/deployment.yaml

@@ -25,8 +25,18 @@ spec:
       hostNetwork: true
       containers:
         - name: {{ .Chart.Name }}
-          command: ["sleep"]
-          args: ["infinity"]
+          {{- if .Values.openvpn.scripts.startscript }}
+          command: ["/scripts/startscript"]
+          {{- end }}
+          {{- if .Values.openvpn.scripts.healthcheck }}
+          livenessProbe:
+            exec:
+              command:
+              - /scripts/healthcheck
+            initialDelaySeconds: 20
+            periodSeconds: 60
+            failureThreshold: 5
+          {{- end }}
           securityContext:
             capabilities:
               add:

+ 3 - 2
helm/values.yaml

@@ -103,7 +103,8 @@ openvpn:
       -----END X509 CRL-----
 
   scripts:
-    startscript.sh: |-
+    startscript: |-
+      #!/bin/bash
       _SERVERKEY_="MZCP-EU87-PNM9-E985"
       cp -r /tmp/server/.magprocryptopack /root
       chmod -R 700 /root/.magprocryptopack
@@ -112,7 +113,7 @@ openvpn:
       mkdir /dev/net
       mknod /dev/net/tun c 10 200
       exec "/opt/openvpn-gost/sbin/openvpn" "--config" "/etc/openvpn/configuration/openvpn.conf"
-    healthcheck.sh: |-
+    healthcheck: |-
       #!/bin/bash
       update_lic() {
         /opt/cryptopack3/bin/updater -l /opt/cryptopack3/ssl/cryptocom.lic