From 35872494b65ae790cdb44d371e1a3a73763b530e Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:49:46 -0600 Subject: [PATCH 1/9] feat(nitro): add sequencer readiness check using maintenance API Add conditional readiness probe for sequencer nodes that uses the maintenance API to check if the node is in maintenance mode. This ensures sequencer nodes are only considered ready when not in maintenance mode. - Add helper functions in _helpers.tpl for sequencer probe detection and command - Add configuration options in values.yaml for customizing sequencer probe behavior - Update statefulset.yaml to conditionally apply sequencer readiness probe - Bump chart version from 0.6.28 to 0.6.29 --- charts/nitro/Chart.yaml | 2 +- charts/nitro/templates/_helpers.tpl | 27 +++++++++++++++++++++++++ charts/nitro/templates/statefulset.yaml | 14 ++++++++++++- charts/nitro/values.yaml | 21 +++++++++++++++++-- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/charts/nitro/Chart.yaml b/charts/nitro/Chart.yaml index 5d34876..51b11c9 100644 --- a/charts/nitro/Chart.yaml +++ b/charts/nitro/Chart.yaml @@ -7,6 +7,6 @@ maintainers: type: application -version: 0.6.28 +version: 0.6.29 appVersion: "v3.5.2-33d30c0" diff --git a/charts/nitro/templates/_helpers.tpl b/charts/nitro/templates/_helpers.tpl index b690b4a..c160f4c 100644 --- a/charts/nitro/templates/_helpers.tpl +++ b/charts/nitro/templates/_helpers.tpl @@ -71,6 +71,33 @@ curl "http://localhost:{{ .Values.configmap.data.http.port }}{{ .Values.configma {{- end }} {{- end -}} +{{/* +Sequencer readiness probe command +*/}} +{{- define "nitro.sequencerReadinessProbeCommand" -}} +{{- if .Values.readinessProbe.sequencerProbe.command -}} +{{ .Values.readinessProbe.sequencerProbe.command }} +{{- else -}} +curl -s "http://localhost:{{ .Values.configmap.data.http.port }}{{ .Values.configmap.data.http.rpcprefix }}" \ + -X POST -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"maintenance_secondsSinceLastMaintenance","id":1}' \ + | jq -e '.error == null and .result > 0' +{{- end -}} +{{- end -}} + +{{/* +Check if node should use sequencer probe +*/}} +{{- define "nitro.useSequencerProbe" -}} +{{- if .Values.readinessProbe.sequencerProbe.forceEnabled -}} +true +{{- else if .Values.readinessProbe.sequencerProbe.disableAutoDetect -}} +false +{{- else -}} +{{- index .Values.configmap.data "execution" "sequencer" "enable" -}} +{{- end -}} +{{- end }} + {{/* nitro args diff --git a/charts/nitro/templates/statefulset.yaml b/charts/nitro/templates/statefulset.yaml index 626f605..65f7f62 100644 --- a/charts/nitro/templates/statefulset.yaml +++ b/charts/nitro/templates/statefulset.yaml @@ -125,7 +125,19 @@ spec: {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: - {{- omit .Values.readinessProbe "enabled" | toYaml | nindent 12 }} + {{- if include "nitro.useSequencerProbe" . | eq "true" }} + exec: + command: + - sh + - -c + - | + {{ include "nitro.sequencerReadinessProbeCommand" . | nindent 18 }} + {{- with .Values.readinessProbe.sequencerProbe }} + {{- omit . "command" "forceEnabled" "disableAutoDetect" | toYaml | nindent 12 }} + {{- end }} + {{- else }} + {{- omit .Values.readinessProbe "enabled" "sequencerProbe" | toYaml | nindent 12 }} + {{- end }} {{- end }} {{- if and .Values.startupProbe.enabled .Values.configmap.data.http .Values.configmap.data.http.port }} startupProbe: diff --git a/charts/nitro/values.yaml b/charts/nitro/values.yaml index 4aa984c..f719459 100644 --- a/charts/nitro/values.yaml +++ b/charts/nitro/values.yaml @@ -26,8 +26,25 @@ commandOverride: {} ## @param livenessProbe Liveness probe configuration livenessProbe: {} -## @param readinessProbe Readiness probe configuration -readinessProbe: {} +## @param readinessProbe.enabled Enable readiness probe +## @param readinessProbe.sequencerProbe.forceEnabled Force sequencer probe regardless of config detection +## @param readinessProbe.sequencerProbe.disableAutoDetect Disable auto-detection of sequencer from config +## @param readinessProbe.sequencerProbe.command Custom command, if empty uses maintenance API check +readinessProbe: + enabled: true + # Default probe settings for non-sequencer nodes + tcpSocket: + port: http-rpc + initialDelaySeconds: 10 + periodSeconds: 3 + # Sequencer probe settings + sequencerProbe: + forceEnabled: false + disableAutoDetect: false + command: "" + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 5 ## @param startupProbe.enabled Enable built in startup probe ## @param startupProbe.failureThreshold Number of failures before pod is considered unhealthy From 18047baab4307709ca03d5d3004550109b593bb1 Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:51:41 -0600 Subject: [PATCH 2/9] Update Chart.yaml --- charts/nitro/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nitro/Chart.yaml b/charts/nitro/Chart.yaml index 51b11c9..84047c4 100644 --- a/charts/nitro/Chart.yaml +++ b/charts/nitro/Chart.yaml @@ -7,6 +7,6 @@ maintainers: type: application -version: 0.6.29 +version: 0.7.0 appVersion: "v3.5.2-33d30c0" From 15e3148978db24b29e0ae3491d7c638b02cc7429 Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:51:41 -0600 Subject: [PATCH 3/9] Update Chart.yaml --- charts/nitro/Chart.yaml | 2 +- charts/nitro/templates/_helpers.tpl | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/charts/nitro/Chart.yaml b/charts/nitro/Chart.yaml index 51b11c9..84047c4 100644 --- a/charts/nitro/Chart.yaml +++ b/charts/nitro/Chart.yaml @@ -7,6 +7,6 @@ maintainers: type: application -version: 0.6.29 +version: 0.7.0 appVersion: "v3.5.2-33d30c0" diff --git a/charts/nitro/templates/_helpers.tpl b/charts/nitro/templates/_helpers.tpl index c160f4c..fce10f8 100644 --- a/charts/nitro/templates/_helpers.tpl +++ b/charts/nitro/templates/_helpers.tpl @@ -94,7 +94,19 @@ true {{- else if .Values.readinessProbe.sequencerProbe.disableAutoDetect -}} false {{- else -}} -{{- index .Values.configmap.data "execution" "sequencer" "enable" -}} +{{- if hasKey .Values.configmap.data "execution" -}} + {{- if hasKey (index .Values.configmap.data "execution") "sequencer" -}} + {{- if hasKey (index .Values.configmap.data "execution" "sequencer") "enable" -}} + {{- index .Values.configmap.data "execution" "sequencer" "enable" -}} + {{- else -}} + false + {{- end -}} + {{- else -}} + false + {{- end -}} +{{- else -}} + false +{{- end -}} {{- end -}} {{- end }} From b32e72cdf0724f4f8049e2e43eb938f20192c53f Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 12:06:15 -0600 Subject: [PATCH 4/9] Update values.yaml --- charts/nitro/values.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/nitro/values.yaml b/charts/nitro/values.yaml index f719459..2cc1aff 100644 --- a/charts/nitro/values.yaml +++ b/charts/nitro/values.yaml @@ -27,9 +27,15 @@ commandOverride: {} livenessProbe: {} ## @param readinessProbe.enabled Enable readiness probe +## @param readinessProbe.tcpSocket.port Port to check for readiness (defaults to http-rpc) +## @param readinessProbe.initialDelaySeconds Initial delay before starting readiness checks +## @param readinessProbe.periodSeconds How often to perform readiness checks ## @param readinessProbe.sequencerProbe.forceEnabled Force sequencer probe regardless of config detection ## @param readinessProbe.sequencerProbe.disableAutoDetect Disable auto-detection of sequencer from config ## @param readinessProbe.sequencerProbe.command Custom command, if empty uses maintenance API check +## @param readinessProbe.sequencerProbe.initialDelaySeconds Initial delay before starting sequencer readiness checks +## @param readinessProbe.sequencerProbe.periodSeconds How often to perform sequencer readiness checks +## @param readinessProbe.sequencerProbe.timeoutSeconds Timeout for sequencer readiness checks readinessProbe: enabled: true # Default probe settings for non-sequencer nodes From 2673fff877192bee96a2868539336a7851ad9d1f Mon Sep 17 00:00:00 2001 From: a-thomas-22 <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 18:06:32 +0000 Subject: [PATCH 5/9] Update README and values.schema.json for modified charts --- charts/nitro/README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/charts/nitro/README.md b/charts/nitro/README.md index 634d911..99116aa 100644 --- a/charts/nitro/README.md +++ b/charts/nitro/README.md @@ -84,7 +84,16 @@ helm install xai offchainlabs/nitro -f values.yaml | `fullnameOverride` | String to fully override nitro.fullname | `""` | | `commandOverride` | Command override for the nitro container | `{}` | | `livenessProbe` | Liveness probe configuration | `{}` | -| `readinessProbe` | Readiness probe configuration | `{}` | +| `readinessProbe.enabled` | Enable readiness probe | `true` | +| `readinessProbe.tcpSocket.port` | Port to check for readiness (defaults to http-rpc) | `http-rpc` | +| `readinessProbe.initialDelaySeconds` | Initial delay before starting readiness checks | `10` | +| `readinessProbe.periodSeconds` | How often to perform readiness checks | `3` | +| `readinessProbe.sequencerProbe.forceEnabled` | Force sequencer probe regardless of config detection | `false` | +| `readinessProbe.sequencerProbe.disableAutoDetect` | Disable auto-detection of sequencer from config | `false` | +| `readinessProbe.sequencerProbe.command` | Custom command, if empty uses maintenance API check | `""` | +| `readinessProbe.sequencerProbe.initialDelaySeconds` | Initial delay before starting sequencer readiness checks | `10` | +| `readinessProbe.sequencerProbe.periodSeconds` | How often to perform sequencer readiness checks | `5` | +| `readinessProbe.sequencerProbe.timeoutSeconds` | Timeout for sequencer readiness checks | `5` | | `startupProbe.enabled` | Enable built in startup probe | `true` | | `startupProbe.failureThreshold` | Number of failures before pod is considered unhealthy | `2419200` | | `startupProbe.periodSeconds` | Number of seconds between startup probes | `1` | From 0c9249dc322eb66dd474d91de6a157ade6b88e7a Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 12:06:59 -0600 Subject: [PATCH 6/9] Trigger CI From 8ef82a2c3079e4715bab20374dcd0676eba8fc69 Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 12:39:57 -0600 Subject: [PATCH 7/9] Update values.yaml --- charts/nitro/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/nitro/values.yaml b/charts/nitro/values.yaml index 2cc1aff..047f6a5 100644 --- a/charts/nitro/values.yaml +++ b/charts/nitro/values.yaml @@ -49,8 +49,9 @@ readinessProbe: disableAutoDetect: false command: "" initialDelaySeconds: 10 - periodSeconds: 5 + periodSeconds: 3 timeoutSeconds: 5 + failureThreshold: 3 ## @param startupProbe.enabled Enable built in startup probe ## @param startupProbe.failureThreshold Number of failures before pod is considered unhealthy From d0f545f7b9cdc5a6077b9daae463287bdc94c38e Mon Sep 17 00:00:00 2001 From: Alec Thomas <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 12:40:09 -0600 Subject: [PATCH 8/9] Update values.yaml --- charts/nitro/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/nitro/values.yaml b/charts/nitro/values.yaml index 047f6a5..c699425 100644 --- a/charts/nitro/values.yaml +++ b/charts/nitro/values.yaml @@ -36,6 +36,7 @@ livenessProbe: {} ## @param readinessProbe.sequencerProbe.initialDelaySeconds Initial delay before starting sequencer readiness checks ## @param readinessProbe.sequencerProbe.periodSeconds How often to perform sequencer readiness checks ## @param readinessProbe.sequencerProbe.timeoutSeconds Timeout for sequencer readiness checks +## @param readinessProbe.sequencerProbe.failureThreshold Number of failures before pod is considered unhealthy readinessProbe: enabled: true # Default probe settings for non-sequencer nodes From 869a3df6b3daed65465ef11be5c4f97d7f8893ef Mon Sep 17 00:00:00 2001 From: a-thomas-22 <112640918+a-thomas-22@users.noreply.github.com> Date: Thu, 27 Feb 2025 18:41:47 +0000 Subject: [PATCH 9/9] Update README and values.schema.json for modified charts --- charts/nitro/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/nitro/README.md b/charts/nitro/README.md index 99116aa..8b66301 100644 --- a/charts/nitro/README.md +++ b/charts/nitro/README.md @@ -92,8 +92,9 @@ helm install xai offchainlabs/nitro -f values.yaml | `readinessProbe.sequencerProbe.disableAutoDetect` | Disable auto-detection of sequencer from config | `false` | | `readinessProbe.sequencerProbe.command` | Custom command, if empty uses maintenance API check | `""` | | `readinessProbe.sequencerProbe.initialDelaySeconds` | Initial delay before starting sequencer readiness checks | `10` | -| `readinessProbe.sequencerProbe.periodSeconds` | How often to perform sequencer readiness checks | `5` | +| `readinessProbe.sequencerProbe.periodSeconds` | How often to perform sequencer readiness checks | `3` | | `readinessProbe.sequencerProbe.timeoutSeconds` | Timeout for sequencer readiness checks | `5` | +| `readinessProbe.sequencerProbe.failureThreshold` | Number of failures before pod is considered unhealthy | `3` | | `startupProbe.enabled` | Enable built in startup probe | `true` | | `startupProbe.failureThreshold` | Number of failures before pod is considered unhealthy | `2419200` | | `startupProbe.periodSeconds` | Number of seconds between startup probes | `1` |