Skip to content

Commit

Permalink
[rpc-node] Adding consensus layer
Browse files Browse the repository at this point in the history
  • Loading branch information
nzenchik committed Jun 5, 2024
1 parent 62d7533 commit 9da7ec1
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/rpc-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
13 changes: 13 additions & 0 deletions charts/rpc-node/templates/consensus-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if and .Values.consensus.enabled .Values.consensus.envFromSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "rpc-node.fullname" . }}-consensus-env
labels:
{{- include "rpc-node.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.consensus.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}
41 changes: 41 additions & 0 deletions charts/rpc-node/templates/consensus-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.consensus.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "rpc-node.fullname" . }}-consensus-cluster
labels:
{{- include "rpc-node.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
{{- range .Values.consensus.service.cluster.ports }}
- port: {{ .port }}
targetPort: {{ .port }}
protocol: {{ .protocol }}
name: {{ .name }}
{{- end }}
selector:
app: {{ .Release.Name }}-consensus
{{- include "rpc-node.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "rpc-node.fullname" . }}-consensus-node
labels:
{{- include "rpc-node.labels" . | nindent 4 }}
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
{{- range .Values.consensus.service.node.ports }}
- port: {{ .port }}
targetPort: {{ .port }}
protocol: {{ .protocol }}
name: {{ .name }}
nodePort: {{ .port }}
{{- end }}
selector:
app: {{ .Release.Name }}-consensus
{{- include "rpc-node.selectorLabels" . | nindent 4 }}
{{- end }}
129 changes: 129 additions & 0 deletions charts/rpc-node/templates/consensus-stateful-set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{{- if .Values.consensus.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "rpc-node.fullname" . }}-consensus
labels:
app: {{ .Release.Name }}-consensus
{{- include "rpc-node.labels" . | nindent 4 }}
spec:
replicas: 1
serviceName: {{ include "rpc-node.fullname" . }}-consensus
selector:
matchLabels:
app: {{ .Release.Name }}-consensus
{{- include "rpc-node.selectorLabels" . | nindent 6 }}
updateStrategy:
type: {{ .Values.updateStrategy }}
{{- if .Values.consensus.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: consensus-data
spec:
accessModes:
{{- range .Values.consensus.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.consensus.persistence.size | quote }}
{{- if .Values.consensus.persistence.storageClass }}
{{- if (eq "-" .Values.consensus.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.consensus.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
template:
metadata:
{{- with .Values.consensus.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ .Release.Name }}-consensus
{{- include "rpc-node.labels" . | nindent 8 }}
{{- with .Values.consensus.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "rpc-node.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.consensus.podSecurityContext | nindent 8 }}
containers:
- name: consensus
securityContext:
{{- toYaml .Values.consensus.securityContext | nindent 12 }}
image: "{{ .Values.consensus.image.repository }}:{{ .Values.consensus.image.tag }}"
imagePullPolicy: {{ .Values.consensus.image.pullPolicy }}
{{- with .Values.consensus.command }}
command: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with (concat .Values.consensus.args .Values.consensus.extraArgs) }}
args: {{ toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.consensus.env }}
env:
{{- range $key, $value := .Values.consensus.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.consensus.envFromSecret }}
envFrom:
- secretRef:
name: {{ include "rpc-node.fullname" . }}-consensus-env
{{- range .Values.consensus.envFrom }}
- {{ toYaml . | nindent 12 | trim }}
{{- end }}
{{- end }}
ports:
{{- range .Values.consensus.service.cluster.ports }}
- name: {{ .name }}
containerPort: {{ .port }}
protocol: {{ .protocol }}
{{- end }}
{{- range .Values.consensus.service.node.ports }}
- name: {{ .name }}
containerPort: {{ .port }}
protocol: {{ .protocol }}
{{- end }}
livenessProbe:
{{- toYaml .Values.consensus.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.consensus.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.consensus.resources | nindent 12 }}
{{- if or .Values.consensus.persistence.enabled .Values.volumeMounts }}
volumeMounts:
{{- if .Values.consensus.persistence.enabled }}
- name: consensus-data
mountPath: /data
{{- end }}
{{- with .Values.consensus.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.consensus.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 300
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/rpc-node/templates/execution-stateful-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
{{- with .Values.execution.command }}
command: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.execution.args }}
{{- with (concat .Values.execution.args .Values.execution.extraArgs) }}
args: {{ toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.execution.env }}
Expand Down
130 changes: 120 additions & 10 deletions charts/rpc-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,20 @@ execution:
# hosts:
# - chart-example.local
command:
args:
- --http
- --http.addr="0.0.0.0"
- --http.port="8545"
- --http.compression
- --http.vhosts="*"
- --http.corsdomain="*"
- --http.api="eth,debug,net,trace,txpool,web3,erigon"
- --ws
- --ws.compression
args: []
#- --http
#- --http.addr="0.0.0.0"
#- --http.port="8545"
#- --http.compression
#- --http.vhosts="*"
#- --http.corsdomain="*"
#- --http.api="eth,debug,net,trace,txpool,web3,erigon"
#- --ws
#- --ws.compression
#- --metrics
#- --metrics.addr=0.0.0.0
#- --metrics.port=6060
extraArgs: []

env: []
# NAME: VALUE
Expand Down Expand Up @@ -152,3 +153,112 @@ execution:
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

consensus:
enabled: false
image:
repository: sigp/lighthouse
pullPolicy: IfNotPresent
tag: "latest"

podAnnotations: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

persistence:
enabled: false
# storageClass: "-"
accessModes:
- ReadWriteOnce
size: 10Gi
annotations: {}

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
cluster:
ports:
- name: rpc
port: 5052
protocol: TCP
node:
ports:
- name: p2p-tcp
port: 9909
protocol: TCP
- name: p2p-udp
port: 9909
protocol: UDP

command: "lighthouse bn"
args: []
#- --network
#- mainnet
#- --checkpoint-sync-url
#- https://mainnet.checkpoint.sigp.io
#- --execution-endpoint
#- http://{{ include "rpc-node.fullname" . }}-execution-cluster:8551
#- --execution-jwt
#- /jwtsecret
#- --disable-deposit-contract-sync
#- --listen-address
#- 0.0.0.0
#- --port
#- 9909
#- --http
#- --http-address
#- 0.0.0.0
extraArgs: []

env: []
# NAME: VALUE
# This will create a Secret with the specified data
envFromSecret: []
# NAME: VALUE
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

livenessProbe:
httpGet:
path: /
port: rpc
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 15
readinessProbe:
httpGet:
path: /
port: rpc
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 15

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

0 comments on commit 9da7ec1

Please sign in to comment.