Skip to content

Commit

Permalink
Add Reth chart
Browse files Browse the repository at this point in the history
  • Loading branch information
antares-sw committed Jul 4, 2024
1 parent 31051d6 commit fa16b58
Show file tree
Hide file tree
Showing 18 changed files with 968 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/reth/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/reth/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://charts.stakewise.io/
version: 1.0.0
digest: sha256:a52d823dcd535c64eafc9df56fe41455c602032e084b8adcaa34e536451d2ab2
generated: "2023-01-09T12:35:46.013108+04:00"
24 changes: 24 additions & 0 deletions charts/reth/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: reth
version: 1.0.0
kubeVersion: "^1.20.0-0"
description: Official Golang implementation of the Ethereum v1 protocol.
type: application
icon: https://storage.googleapis.com/stakewise-charts/stakewise.png
keywords:
- ethereum
- blockchain
- reth
- p2p
home: https://www.ethereum.org/
sources:
- https://github.com/ethereum/go-ethereum/
maintainers:
- name: Dmitri Tsumak
email: dmitri@stakewise.io
appVersion: v1.0.0

dependencies:
- name: common
version: 1.x.x
repository: https://charts.stakewise.io/
3 changes: 3 additions & 0 deletions charts/reth/templates/_helpers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "reth.p2pPort" -}}
{{- printf "30303" -}}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/reth/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if or .Values.global.rbac.create .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "common.names.clusterRoleName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
rules:
{{- toYaml .Values.rbac.clusterRules | nindent 0 }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/reth/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if or .Values.global.rbac.create .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "common.names.clusterRoleName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "common.names.clusterRoleName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "common.names.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/reth/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
{{- end }}
35 changes: 35 additions & 0 deletions charts/reth/templates/prometheusrules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if and (or .Values.global.metrics.enabled .Values.metrics.enabled)
(or .Values.global.metrics.prometheusRule.enabled .Values.metrics.prometheusRule.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "common.names.fullname" . }}
{{- if .Values.metrics.prometheusRule.namespace }}
namespace: {{ .Values.metrics.prometheusRule.namespace }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.metrics.prometheusRule.additionalLabels }}
{{- toYaml .Values.metrics.prometheusRule.additionalLabels | nindent 4 }}
{{- end }}
spec:
groups:
{{- with .Values.metrics.prometheusRule.rules }}
- name: {{ include "common.names.fullname" $ }}
rules: {{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.metrics.prometheusRule.default }}
- name: {{ include "common.names.fullname" $ }}-default
rules:
- alert: RethNodeDown
expr: up{job="{{ include "common.names.fullname" . }}"} == 0
for: 5m
labels:
severity: critical
annotations:
summary: Reth Node {{ printf "{{ $labels.instance }}" }} down
description: Reth Node {{ printf "{{ $labels.instance }}" }} is down
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/reth/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if or .Values.global.rbac.create .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
rules:
{{- toYaml .Values.rbac.rules | nindent 0 }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/reth/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if or .Values.global.rbac.create .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "common.names.serviceAccountName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "common.names.serviceAccountName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "common.names.serviceAccountName" . }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/reth/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.global.JWTSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
type: Opaque
data:
jwtsecret: {{ .Values.global.JWTSecret | b64enc | quote }}
{{- end }}
42 changes: 42 additions & 0 deletions charts/reth/templates/service-p2p.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if .Values.p2pNodePort.enabled -}}
{{- range $i, $e := until (int .Values.global.replicaCount) }}
{{- $port := add $.Values.p2pNodePort.startAt $i -}}
{{- if hasKey $.Values.p2pNodePort.replicaToNodePort ($i | toString) -}}
{{ $port = index $.Values.p2pNodePort.replicaToNodePort ($i | toString) }}
{{- end }}

---
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.names.fullname" $ }}-{{ $i }}
labels:
{{- include "common.labels.standard" $ | nindent 4 }}
pod: "{{ include "common.names.fullname" $ }}-{{ $i }}"
type: p2p
{{- with $.Values.p2pNodePort.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ $.Values.p2pNodePort.type }}
externalTrafficPolicy: Local
ports:
- name: p2p-tcp
port: {{ include "reth.p2pPort" $ }}
protocol: TCP
targetPort: {{ $port }}
nodePort: {{ $port }}
{{- if eq $.Values.p2pNodePort.type "NodePort" }}
- name: p2p-udp
port: {{ include "reth.p2pPort" $ }}
protocol: UDP
targetPort: p2p-udp
nodePort: {{ $port }}
{{- end }}
selector:
{{- include "common.labels.matchLabels" $ | nindent 4 }}
statefulset.kubernetes.io/pod-name: "{{ include "common.names.fullname" $ }}-{{ $i }}"

{{- end }}
{{- end }}
43 changes: 43 additions & 0 deletions charts/reth/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if or .Values.http.enabled .Values.ws.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
spec:
{{- if .Values.svcHeadless }}
clusterIP: None
{{- end }}
{{- if .Values.sessionAffinity.enabled }}
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: {{ .Values.sessionAffinity.timeoutSeconds }}
{{- end }}
type: ClusterIP
ports:
{{- if .Values.global.JWTSecret }}
- name: authrpc
port: {{ .Values.authRpc.port }}
targetPort: authrpc
{{- end }}
{{- if .Values.http.enabled }}
- name: http
port: {{ .Values.http.port }}
targetPort: http
{{- end }}
{{- if .Values.ws.enabled }}
- name: ws
port: {{ .Values.ws.port }}
targetPort: ws
{{- end }}
{{- if .Values.global.metrics.enabled }}
- name: metrics
port: {{ .Values.metrics.port }}
targetPort: metrics
{{- end }}
selector:
{{- include "common.labels.matchLabels" . | nindent 4 }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/reth/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if or .Values.global.serviceAccount.create .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "common.names.serviceAccountName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
42 changes: 42 additions & 0 deletions charts/reth/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if and (or .Values.global.metrics.enabled .Values.metrics.enabled)
(or .Values.global.metrics.serviceMonitor.enabled .Values.metrics.serviceMonitor.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "common.names.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: metrics
path: /
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
{{- end }}
Loading

0 comments on commit fa16b58

Please sign in to comment.