From 17aee5390a78353276501597fc223b12a1fc80d3 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Wed, 20 Nov 2024 19:35:09 +0000 Subject: [PATCH] feat: add probes overrides --- charts/erigon/README.md | 3 +++ .../templates/stateful-node/statefulset.yaml | 18 ++++++++++++------ charts/erigon/values.yaml | 18 ++++++++++++++++++ charts/nimbus/README.md | 3 +++ .../nimbus/templates/nimbus/statefulset.yaml | 17 ++++++++++++----- charts/nimbus/values.yaml | 17 +++++++++++++++++ 6 files changed, 65 insertions(+), 11 deletions(-) diff --git a/charts/erigon/README.md b/charts/erigon/README.md index f519d1a1..412aa75d 100644 --- a/charts/erigon/README.md +++ b/charts/erigon/README.md @@ -167,6 +167,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | statefulNode.jwt.existingSecret.key | Data key for the JWT in the Secret | string | `nil` | | statefulNode.jwt.existingSecret.name | Name of the Secret resource in the same namespace | string | `nil` | | statefulNode.jwt.fromLiteral | Use this literal value for the JWT | string | `nil` | + | statefulNode.livenessProbe | Sets a livenessProbe configuration for the container | object | `{}` | | statefulNode.nodeSelector | | object | `{}` | | statefulNode.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` | | statefulNode.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` | @@ -175,6 +176,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | statefulNode.p2pNodePort.port | NodePort to be used. Must be unique. | int | `31000` | | statefulNode.podAnnotations | Annotations for the `Pod` | object | `{}` | | statefulNode.podSecurityContext | Pod-wide security context | object | `{"fsGroup":101337,"runAsGroup":101337,"runAsNonRoot":true,"runAsUser":101337}` | + | statefulNode.readinessProbe | Sets a readinessProbe configuration for the container | object | `{"grpc":{"port":9090}}` | | statefulNode.resources | | object | `{}` | | statefulNode.restoreSnapshot.enabled | Enable initialising Erigon state from a remote snapshot | bool | `false` | | statefulNode.restoreSnapshot.snapshotUrl | URL for snapshot to download and extract to restore state | string | `""` | @@ -186,6 +188,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | statefulNode.service.ports.ws-rpc | Service Port to expose WS-RPC interface on | int | `8546` | | statefulNode.service.topologyAwareRouting.enabled | | bool | `false` | | statefulNode.service.type | | string | `"ClusterIP"` | + | statefulNode.startupProbe | Sets a startupProbe configuration for the container | object | `{}` | | statefulNode.terminationGracePeriodSeconds | Amount of time to wait before force-killing the Erigon process | int | `60` | | statefulNode.tolerations | | list | `[]` | | statefulNode.updateStrategyType | Choice of StatefulSet updateStrategy (OnDelete|RollingUpdate) | string | `"RollingUpdate"` | diff --git a/charts/erigon/templates/stateful-node/statefulset.yaml b/charts/erigon/templates/stateful-node/statefulset.yaml index 15ef5214..b26c50da 100644 --- a/charts/erigon/templates/stateful-node/statefulset.yaml +++ b/charts/erigon/templates/stateful-node/statefulset.yaml @@ -32,7 +32,7 @@ spec: updateStrategy: type: RollingUpdate rollingUpdate: - partition: {{ default 0 ($values.rollingUpdatePartition | atoi) }} + partition: {{ default 0 ($values.rollingUpdatePartition | quote | atoi) }} {{- end }} template: metadata: @@ -252,12 +252,18 @@ spec: mountPath: /storage - name: tmp mountPath: /tmp + {{- if $values.readinessProbe }} readinessProbe: - # This currently requires GRPCContainerProbe feature gate to be enabled on the kubelet - # https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe - # https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/ - grpc: - port: 9090 # named ports not supported yet by grpc probes + {{ toYaml $values.readinessProbe | nindent 12 }} + {{- end }} + {{- if $values.livenessProbe }} + livenessProbe: + {{ toYaml $values.livenessProbe | nindent 12 }} + {{- end }} + {{- if $values.startupProbe }} + startupProbe: + {{ toYaml $values.startupProbe | nindent 12 }} + {{- end }} {{- with $values.resources }} resources: {{- toYaml . | nindent 12 }} diff --git a/charts/erigon/values.yaml b/charts/erigon/values.yaml index 0d1d7ff9..fc1bd90f 100644 --- a/charts/erigon/values.yaml +++ b/charts/erigon/values.yaml @@ -113,6 +113,24 @@ statefulNode: # -- When using a RollingUpdate update strategy in the StatefulSet, sets a partition index to only update PODs with that index or higher rollingUpdatePartition: 0 + # Probes configuration for the containers in the StatefulSet + # Users can directly define readiness, liveness, and startup probes below. + # These will be directly copied into the StatefulSet manifest. + + # -- Sets a readinessProbe configuration for the container + readinessProbe: + # This currently requires GRPCContainerProbe feature gate to be enabled on the kubelet + # https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe + # https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/ + grpc: + port: 9090 # named ports not supported yet by grpc probes + + # -- Sets a livenessProbe configuration for the container + livenessProbe: {} + + # -- Sets a startupProbe configuration for the container + startupProbe: {} + # -- Annotations for the `Pod` podAnnotations: {} diff --git a/charts/nimbus/README.md b/charts/nimbus/README.md index 0cafb4db..d29f6f6a 100644 --- a/charts/nimbus/README.md +++ b/charts/nimbus/README.md @@ -119,6 +119,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | nimbus.jwt.existingSecret.key | Data key for the JWT in the Secret | string | `""` | | nimbus.jwt.existingSecret.name | Name of the Secret resource in the same namespace | string | `""` | | nimbus.jwt.fromLiteral | Use this literal value for the JWT | string | `""` | + | nimbus.livenessProbe | Sets a livenessProbe configuration for the container | object | `{}` | | nimbus.nodeSelector | | object | `{}` | | nimbus.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` | | nimbus.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` | @@ -127,12 +128,14 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | nimbus.p2pNodePort.port | NodePort to be used. Must be unique. | int | `31000` | | nimbus.podAnnotations | Annotations for the `Pod` | object | `{}` | | nimbus.podSecurityContext | Pod-wide security context | object | `{"fsGroup":101337,"runAsGroup":101337,"runAsNonRoot":true,"runAsUser":101337}` | + | nimbus.readinessProbe | Sets a readinessProbe configuration for the container | object | `{"initialDelaySeconds":10,"periodSeconds":10,"tcpSocket":{"port":"http-nimbus"}}` | | nimbus.resources | | object | `{}` | | nimbus.rollingUpdatePartition | When using a RollingUpdate update strategy in the StatefulSet, sets a partition index to only update PODs with that index or higher | int | `0` | | nimbus.service.ports.http-metrics | Service Port to expose Prometheus metrics on | int | `8008` | | nimbus.service.ports.http-nimbus | Service Port to expose JSON-RPC interface on | int | `5052` | | nimbus.service.topologyAwareRouting.enabled | | bool | `false` | | nimbus.service.type | | string | `"ClusterIP"` | + | nimbus.startupProbe | Sets a startupProbe configuration for the container | object | `{}` | | nimbus.terminationGracePeriodSeconds | Amount of time to wait before force-killing the container | int | `60` | | nimbus.tolerations | | list | `[]` | | nimbus.trustedNodeSync.enabled | Enable init container to do a trusted checkpoint sync from another Consensus Client (be careful) | bool | `false` | diff --git a/charts/nimbus/templates/nimbus/statefulset.yaml b/charts/nimbus/templates/nimbus/statefulset.yaml index fb9b2395..e8896ef8 100644 --- a/charts/nimbus/templates/nimbus/statefulset.yaml +++ b/charts/nimbus/templates/nimbus/statefulset.yaml @@ -32,7 +32,7 @@ spec: updateStrategy: type: RollingUpdate rollingUpdate: - partition: {{ default 0 ($values.rollingUpdatePartition | atoi) }} + partition: {{ default 0 ($values.rollingUpdatePartition | quote | atoi) }} {{- end }} template: metadata: @@ -253,11 +253,18 @@ spec: mountPath: /storage - name: tmp mountPath: /tmp + {{- if $values.readinessProbe }} readinessProbe: - tcpSocket: - port: http-nimbus - initialDelaySeconds: 10 - periodSeconds: 10 + {{ toYaml $values.readinessProbe | nindent 12 }} + {{- end }} + {{- if $values.livenessProbe }} + livenessProbe: + {{ toYaml $values.livenessProbe | nindent 12 }} + {{- end }} + {{- if $values.startupProbe }} + startupProbe: + {{ toYaml $values.startupProbe | nindent 12 }} + {{- end }} {{- with $values.resources }} resources: {{- toYaml . | nindent 12 }} diff --git a/charts/nimbus/values.yaml b/charts/nimbus/values.yaml index 674d2382..c8d57718 100644 --- a/charts/nimbus/values.yaml +++ b/charts/nimbus/values.yaml @@ -109,6 +109,23 @@ nimbus: # -- When using a RollingUpdate update strategy in the StatefulSet, sets a partition index to only update PODs with that index or higher rollingUpdatePartition: 0 + # Probes configuration for the containers in the StatefulSet + # Users can directly define readiness, liveness, and startup probes below. + # These will be directly copied into the StatefulSet manifest. + + # -- Sets a readinessProbe configuration for the container + readinessProbe: + tcpSocket: + port: http-nimbus + initialDelaySeconds: 10 + periodSeconds: 10 + + # -- Sets a livenessProbe configuration for the container + livenessProbe: {} + + # -- Sets a startupProbe configuration for the container + startupProbe: {} + # -- Annotations for the `Pod` podAnnotations: {}