Parcourir la source

devnet: add readiness checks to most components

Leo il y a 5 ans
Parent
commit
45837241ed
7 fichiers modifiés avec 36 ajouts et 4 suppressions
  1. 1 1
      Dockerfile.agent
  2. 5 1
      Tiltfile
  3. 9 1
      devnet/eth-devnet.yaml
  4. 9 0
      devnet/solana-devnet.yaml
  5. 6 1
      devnet/terra-devnet.yaml
  6. 3 0
      devnet/web.yaml
  7. 3 0
      solana/devnet_setup.sh

+ 1 - 1
Dockerfile.agent

@@ -1,7 +1,7 @@
 # syntax=docker/dockerfile:experimental
 FROM rust:1.45
 
-RUN apt-get update && apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang
+RUN apt-get update && apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang ncat
 RUN rustup component add rustfmt
 
 WORKDIR /usr/src/solana

+ 5 - 1
Tiltfile

@@ -161,4 +161,8 @@ k8s_resource(
     objects=["terra-lcd-cm0"]
 )
 
-k8s_resource("terra-terrad", objects=["terra-terrad-cm0"])
+k8s_resource(
+    "terra-terrad",
+    objects=["terra-terrad-cm0"],
+    port_forwards=[port_forward(26657, name="Terra RPC [:26657]")]
+)

+ 9 - 1
devnet/eth-devnet.yaml

@@ -43,12 +43,20 @@ spec:
             - containerPort: 8545
               name: rpc
               protocol: TCP
+          readinessProbe:
+            tcpSocket:
+              port: rpc
         - name: tests
           image: eth-node
           command:
             - /bin/sh
             - -c
-            - "npm run migrate && sleep infinity"
+            - "npm run migrate && nc -l -p 2000 && sleep infinity"
+          startupProbe:
+            periodSeconds: 1
+            failureThreshold: 60
+            tcpSocket:
+              port: 2000
         - name: mine
           image: eth-node
           command:

+ 9 - 0
devnet/solana-devnet.yaml

@@ -67,7 +67,16 @@ spec:
             - containerPort: 9900
               name: faucet
               protocol: TCP
+          readinessProbe:
+            httpGet:
+              port: rpc
+              path: /health
         - name: setup
           image: solana-agent
           command:
             - /usr/src/solana/devnet_setup.sh
+          startupProbe:
+            tcpSocket:
+              port: 2000
+            periodSeconds: 1
+            failureThreshold: 300

+ 6 - 1
devnet/terra-devnet.yaml

@@ -55,7 +55,9 @@ spec:
         name: terra-lcd
         ports:
         - containerPort: 1317
-        resources: {}
+        readinessProbe:
+          tcpSocket:
+            port: 1317
         volumeMounts:
         - mountPath: /root/.terrad/config
           name: terra-lcd-cm0
@@ -90,6 +92,9 @@ spec:
         name: terra-terrad
         ports:
         - containerPort: 26657
+        readinessProbe:
+          httpGet:
+            port: 26657
         resources: {}
         volumeMounts:
         - mountPath: /root/.terrad/config

+ 3 - 0
devnet/web.yaml

@@ -41,3 +41,6 @@ spec:
             - containerPort: 3000
               name: react-devserver
               protocol: TCP
+          readinessProbe:
+            httpGet:
+              port: react-devserver

+ 3 - 0
solana/devnet_setup.sh

@@ -49,5 +49,8 @@ echo "Created wrapped token $token"
 wrapped_account=$(cli create-account --seed=934893 "$wrapped_token" | grep 'Creating account' | awk '{ print $3 }')
 echo "Created wrapped token account $wrapped_account"
 
+# Let k8s startup probe succeed
+nc -l -p 2000
+
 # Keep the container alive for interactive CLI usage
 sleep infinity