Skip to content

Commit

Permalink
fix(contributoor): liveness/readiness probe setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mattevans committed Jan 22, 2025
1 parent 8deeaff commit b4f7304
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 37 deletions.
11 changes: 6 additions & 5 deletions charts/contributoor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ A lightweight sidecar that runs alongside an Ethereum consensus client and colle
| autoscaling.minReplicas | int | `2` | Minimum number of replicas |
| autoscaling.targetCPUUtilizationPercentage | int | `85` | Target CPU utilization percentage |
| config.beaconNodeAddress | string | `"http://localhost:5052"` | |
| config.contributoorDirectory | string | `"/path/to/.contributoor/dir"` | |
| config.contributoorDirectory | string | `"/config/.contributoor"` | |
| config.healthCheckAddress | string | `":9191"` | |
| config.logLevel | string | `"info"` | |
| config.metricsAddress | string | `":9090"` | |
| config.networkName | string | `"NETWORK_NAME_MAINNET"` | |
| config.outputServer.address | string | `"xatu.primary.production.platform.ethpandaops.io:443"` | |
| config.outputServer.credentials | string | `"Someb64Value"` | |
| config.outputServer.tls | bool | `true` | |
| config.runMethod | string | `"RUN_METHOD_DOCKER"` | |
| config.version | string | `"0.0.47"` | |
| config.version | string | `"0.0.49"` | |
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
| customArgs | list | `["--network=mainnet","--beacon-node-address=http://localhost:5052","--metrics-address=:9090","--log-level=info","--username=your-username","--password=your-password","--output-server-address=xatu.primary.production.platform.ethpandaops.io:443","--output-server-tls=true","--contributoor-version=0.0.47","--contributoor-directory=/path/to/.contributoor"]` | Custom args for the contributoor container |
| customArgs | list | `["--network=mainnet","--beacon-node-address=http://localhost:5052","--metrics-address=:9090","--health-check-address=:9191","--log-level=info","--username=your-username","--password=your-password","--output-server-address=xatu.primary.production.platform.ethpandaops.io:443","--output-server-tls=true","--contributoor-directory=/config/.contributoor"]` | Custom args for the contributoor container These are optional, and will be passed to the contributoor container, overriding the values set in 'config'. |
| customCommand | list | `[]` | Command replacement for the contributoor container |
| extraContainers | list | `[]` | Additional containers |
| extraEnv | list | `[]` | Additional env variables |
Expand All @@ -54,7 +55,7 @@ A lightweight sidecar that runs alongside an Ethereum consensus client and colle
| ingress.http.tls | list | `[]` | Ingress TLS |
| initContainers | list | `[]` | Additional init containers |
| lifecycle | object | See `values.yaml` | Lifecycle hooks |
| livenessProbe | object | See `values.yaml` | Liveness probe |
| livenessProbe | object | `{"httpGet":{"path":"/healthz","port":9191},"initialDelaySeconds":60,"periodSeconds":120}` | Liveness probe |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | Node selector for pods |
| persistence.accessModes | list | `["ReadWriteOnce"]` | Access mode for the volume claim template |
Expand All @@ -68,7 +69,7 @@ A lightweight sidecar that runs alongside an Ethereum consensus client and colle
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
| podLabels | object | `{}` | Pod labels |
| priorityClassName | string | `nil` | Pod priority class |
| readinessProbe | object | See `values.yaml` | Readiness probe |
| readinessProbe | object | `{"httpGet":{"path":"/healthz","port":9191},"initialDelaySeconds":10,"periodSeconds":10}` | Readiness probe |
| replicas | int | `1` | Number of replicas |
| resources | object | `{}` | Resource requests and limits |
| secretEnv | object | `{}` | Secret env variables injected via a created secret |
Expand Down
16 changes: 5 additions & 11 deletions charts/contributoor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,10 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Get metrics address
*/}}
{{- define "contributoor.metricsPort" -}}
{{- $address := .Values.config.metricsAddress -}}
{{- if $address -}}
{{- $parts := splitList ":" $address -}}
{{- if len $parts | eq 2 -}}
{{- index $parts 1 -}}
{{- end -}}
{{- end -}}
{{- define "contributoor.healthCheckPort" -}}
{{ (split ":" .Values.config.healthCheckAddress)._2 | default "9191" }}
{{- end -}}

{{- define "contributoor.metricsPort" -}}
{{ (split ":" .Values.config.metricsAddress)._2 | default "9090" }}
{{- end -}}
30 changes: 20 additions & 10 deletions charts/contributoor/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,13 @@ spec:
{{- if gt (len .Values.customCommand) 0 }}
{{- toYaml .Values.customCommand | nindent 12}}
{{- else }}
- "/contributoor"
- "sentry"
- --config=/config.yaml
{{- if gt (len .Values.args) 0 }}
{{- toYaml .Values.args | nindent 12}}
{{- end }}
[]
{{- end }}
{{- if gt (len .Values.customArgs) 0 }}
args:
{{- if gt (len .Values.customArgs) 0 }}
{{- toYaml .Values.customArgs | nindent 12}}
{{- else }}
[]
{{- end }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
Expand All @@ -69,15 +66,28 @@ spec:
{{ toYaml .Values.extraVolumeMounts | nindent 10}}
{{- end }}
ports:
{{- if (include "contributoor.metricsPort" .) }}
{{- if .Values.config.healthCheckAddress }}
- name: health
containerPort: {{ include "contributoor.healthCheckPort" . | atoi }}
protocol: TCP
{{- end }}
{{- if .Values.config.metricsAddress }}
- name: metrics
containerPort: {{ include "contributoor.metricsPort" . }}
protocol: TCP
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
httpGet:
path: /healthz
port: health
initialDelaySeconds: 60
periodSeconds: 120
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
httpGet:
path: /healthz
port: health
initialDelaySeconds: 10
periodSeconds: 10
lifecycle:
{{- toYaml .Values.lifecycle | nindent 12 }}
resources:
Expand Down
8 changes: 7 additions & 1 deletion charts/contributoor/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
{{- if (include "contributoor.metricsPort" .) }}
{{- if .Values.config.healthCheckAddress }}
- port: {{ include "contributoor.healthCheckPort" . | atoi }}
targetPort: health
protocol: TCP
name: health
{{- end }}
{{- if .Values.config.metricsAddress }}
- port: {{ include "contributoor.metricsPort" . }}
targetPort: metrics
protocol: TCP
Expand Down
22 changes: 12 additions & 10 deletions charts/contributoor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ args: []
config:
beaconNodeAddress: http://localhost:5052
metricsAddress: ":9090"
healthCheckAddress: ":9191"
logLevel: info
networkName: NETWORK_NAME_MAINNET
outputServer:
address: xatu.primary.production.platform.ethpandaops.io:443
credentials: Someb64Value
tls: true
version: 0.0.47
contributoorDirectory: /path/to/.contributoor/dir
version: 0.0.49
contributoorDirectory: /config/.contributoor
runMethod: RUN_METHOD_DOCKER

ingress:
Expand Down Expand Up @@ -79,17 +80,18 @@ ingress:
# - chart-example.local

# -- Custom args for the contributoor container
# These are optional, and will be passed to the contributoor container, overriding the values set in 'config'.
customArgs:
- --network=mainnet
- --beacon-node-address=http://localhost:5052
- --metrics-address=:9090
- --health-check-address=:9191
- --log-level=info
- --username=your-username
- --password=your-password
- --output-server-address=xatu.primary.production.platform.ethpandaops.io:443
- --output-server-tls=true
- --contributoor-version=0.0.47
- --contributoor-directory=/path/to/.contributoor
- --contributoor-directory=/config/.contributoor

# -- Command replacement for the contributoor container
customCommand: [] # Only change this if you need to change the default command
Expand All @@ -108,18 +110,18 @@ imagePullSecrets: []
annotations: {}

# -- Liveness probe
# @default -- See `values.yaml`
livenessProbe:
tcpSocket:
port: grpc
httpGet:
path: /healthz
port: 9191
initialDelaySeconds: 60
periodSeconds: 120

# -- Readiness probe
# @default -- See `values.yaml`
readinessProbe:
tcpSocket:
port: grpc
httpGet:
path: /healthz
port: 9191
initialDelaySeconds: 10
periodSeconds: 10

Expand Down

0 comments on commit b4f7304

Please sign in to comment.