From b7f7ea9e0ffae5e142082883903cfa7ef4751867 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Tue, 13 Aug 2024 18:23:38 +0530 Subject: [PATCH] change readinessprobe to be exec command to check sync info status --- .../templates/chains/cosmos/genesis.yaml | 18 +++++++++++++++--- .../templates/chains/cosmos/validator.yaml | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/starship/charts/devnet/templates/chains/cosmos/genesis.yaml b/starship/charts/devnet/templates/chains/cosmos/genesis.yaml index 3f88d765a..d2ef471a0 100644 --- a/starship/charts/devnet/templates/chains/cosmos/genesis.yaml +++ b/starship/charts/devnet/templates/chains/cosmos/genesis.yaml @@ -274,9 +274,21 @@ spec: name: scripts {{- if not ($chain.cometmock.enabled) }} readinessProbe: - httpGet: - path: /status - port: 26657 + exec: + command: + - bash + - -c + - | + # Try to see if the node is still catching up. + ([[ $($CHAIN_BIN status 2>&1 | jq -r .SyncInfo.catching_up) == false ]]) & + tester=$! + # Kill the test if it takes longer than we expect. + (sleep 5; kill $tester 2>/dev/null) & + killer=$! + # Kill the killer before exiting. + trap 'kill $killer 2>/dev/null' EXIT + # Return the test's exit code, whether it succeeded, failed, or was killed. + wait $tester initialDelaySeconds: 10 periodSeconds: 10 {{- end }} diff --git a/starship/charts/devnet/templates/chains/cosmos/validator.yaml b/starship/charts/devnet/templates/chains/cosmos/validator.yaml index cdeed3564..a47057842 100644 --- a/starship/charts/devnet/templates/chains/cosmos/validator.yaml +++ b/starship/charts/devnet/templates/chains/cosmos/validator.yaml @@ -286,9 +286,21 @@ spec: name: scripts {{- if not ($chain.cometmock.enabled) }} readinessProbe: - httpGet: - path: /status - port: 26657 + exec: + command: + - bash + - -c + - | + # Try to see if the node is still catching up. + ([[ $($CHAIN_BIN status 2>&1 | jq -r .SyncInfo.catching_up) == false ]]) & + tester=$! + # Kill the test if it takes longer than we expect. + (sleep 5; kill $tester 2>/dev/null) & + killer=$! + # Kill the killer before exiting. + trap 'kill $killer 2>/dev/null' EXIT + # Return the test's exit code, whether it succeeded, failed, or was killed. + wait $tester initialDelaySeconds: 10 periodSeconds: 10 {{- end }}