Skip to content

Commit

Permalink
add dtl chart
Browse files Browse the repository at this point in the history
  • Loading branch information
coutug committed Sep 27, 2024
1 parent 1dc0171 commit eaddd3c
Show file tree
Hide file tree
Showing 12 changed files with 515 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/dtl/.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/dtl/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: dtl
description: Data Transport Layer for Ethereum Optimism
type: application
version: 0.0.1
appVersion: "0.5.56"
77 changes: 77 additions & 0 deletions charts/dtl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# op-node Node
op-node Node is a consensus engine for op-node Stack. This is a op-node Node Helm Chart packaged by Test in Prod.

## Introduction
You can build a new op-node Stack chain or connect to an existing one. You need an op-node execution engine that works along with op-node Node.

Please refer to the example values for op-nodetimism Goerli [here.](example-values/op-nodetimism-goerli.yaml)

## LFG
`helm install op-node-release op-node-charts/op-node -f values.yaml`

## Requirements
1. K8s 1.8+
2. Helm 3.2.0+
3. op-node Execution Engine with EngineAPI access.
4. op-node Vibe 🎶

## Parameters
**This chart connects to op-nodetimism Goerli Testnet in default.** Please refer to the [op-node's flag code](https://github.com/ethereum-op-nodetimism/op-nodetimism/blob/bbebb76e073987e58d0b97adb718b6ce8164c1c7/op-node/flags/flags.go) for the detail!
### Required Parameters
| Name | Description | Value |
|----------------|----------------------------------------------------------------------------|-------------------------------------|
| `l2.rpcAddr` | An op-node execution engine address that this op-node Node can change the state. | `""` |
| `l2.jwtSecret` | jwtSecret key that has an admin permission to the execution engine client. | `""` |
| `l1.rpcAddr` | RPC address of your L2's L1. | `"DSRV AllthatNode Goerli Network"` |

### op-node Node Parameters
| Name | Description | Value |
|---------------------|------------------------------------------------------------------------------------------------------------------|----------|
| `sequencer.enabled` | If this op-node will work as a sequencer or not. | `false` |
| `sequencer.p2pKey` | A key that op-node will sign as a sequencer upon p2p sync | `""` |
| `p2p.enabled` | p2p switch | `true` |
| `p2p.priv.file` | A private file to sign message for p2p message | `""` |
| `snapshotLogPath` | Path to the snapshot log file | `/logs` |
| `rollupConfig.file` | A JSON that has rollup's rollup params. This should not be used with `network` param | `""` |
| `network` | Name of the network. There are some hardcoded network configs in the codebase. Please refer to the op-node repo. | `goerli` |
| `metrics.enabled` | Prometheus switch for the metrics | `true` |
| `args` | Other application arguments for op-node | `[]` |


### Deployment Parameters
| Name | Description | Value |
|------------------------------|----------------------------------------|-----------|
| `replicaCount` | Number of op-node replicas to deploy | 1 |
| `livenessProbe` | livenessProbe switch for op-node | `true` |
| `readinessProbe` | readinessProbe switch for op-node | `true` |
| `rpc.port.containerPort` | Container port for RPC connections | `8545` |
| `rpc.port.hostPort` | Host port for RPC connections | `7545` |
| `rpc.addr` | Listening address for RPC | `0.0.0.0` |
| `listen.ip` | p2p listening address | `0.0.0.0` |
| `listen.tcp.containerPort` | p2p container port for TCP connections | `9003` |
| `listen.tcp.hostPort` | p2p host port for TCP connections | `9003` |
| `listen.udp.containerPort` | p2p container port for UDP connections | `9003` |
| `listen.udp.hostPort` | p2p host port for UDP connections | `9003` |
| `metrics.port.containerPort` | Container port for metrics connections | `7300` |
| `metrics.port.hostPort` | Host port for metrics connections | `7300` |
| `metrics.addr` | Listening address for metrics | `0.0.0.0` |
| `pprof.port.containerPort` | Container port for pprof connections | `6060` |
| `pprof.port.hostPort` | Host port for pprof connections | `6060` |
| `pprof.addr` | Listening address for pprof | `0.0.0.0` |


### Common Parameters
| Name | Description | Value |
|--------------------|----------------------------------------------------------|---------------|
| `fullnameOverride` | String to fully override op-node.fullname template | `""` |
| `nameOverride` | String to fully override op-node.name | `""` |
| `service.type` | Service type | `"ClusterIP"` |
| `resources` | The resources limits for the op-node | `{}` |
| `nodeSelector` | Node labels for pod assignment. Evaluated as a template. | `{}` |
| `tolerations` | Tolerations for pod assignment. Evaluated as a template. | `[]` |
| `affinity` | Affinity for pod assignment | `{}` |

## Kudos
- This chart uses DSRV's AllThatNode Goerli public RPC. Shout out to DSRV, the most reliable blockchain infra provider :)
- Kudos to Bitnami for providing decent template references.
- Of course, thanks op-node Labs and op-nodetimism Foundation for building amazing collective and technology.
3 changes: 3 additions & 0 deletions charts/dtl/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## dtl ##
Welcome to dtl, a consensus engine for dtl Stack.
This engine should work along with an dtl execution engine.
70 changes: 70 additions & 0 deletions charts/dtl/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "dtl.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "dtl.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
secret vault name
*/}}
{{- define "dtl.secretname" -}}
{{ include "dtl.fullname" . }}-secret
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "dtl.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "dtl.labels" -}}
helm.sh/chart: {{ include "dtl.chart" . }}
{{ include "dtl.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "dtl.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dtl.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{/*
Create the name of the service account to use
*/}}
{{- define "dtl.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (printf "%s-%s" (include "dtl.fullname" .) .Release.Namespace) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/dtl/templates/dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- $values := $.Values.grafana }}
{{- if $values.dashboards }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "dtl.fullname" . }}-dashboards
labels:
{{- include "dtl.labels" . | nindent 4 }}
{{ $values.dashboardsConfigMapLabel }}: {{ $values.dashboardsConfigMapLabelValue | quote }}
data:
{{- (.Files.Glob "dashboards/*").AsConfig | nindent 2 }}
{{- end }}
49 changes: 49 additions & 0 deletions charts/dtl/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- if .Values.rbac.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "dtl.serviceAccountName" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
rules:
{{- toYaml .Values.rbac.rules | nindent 0 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "dtl.serviceAccountName" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "dtl.serviceAccountName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "dtl.serviceAccountName" . }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "dtl.serviceAccountName" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
rules:
{{- toYaml .Values.rbac.clusterRules | nindent 0 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "dtl.serviceAccountName" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "dtl.serviceAccountName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "dtl.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/dtl/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dtl.fullname" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: port
port: {{ .Values.dtl.env.DATA_TRANSPORT_LAYER__SERVER_PORT }}
targetPort: port
selector:
{{- include "dtl.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/dtl/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "dtl.serviceAccountName" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/dtl/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if $.Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "dtl.fullname" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
spec:
jobLabel: "{{ .Release.Name }}"
selector:
matchLabels:
{{- include "dtl.selectorLabels" . | nindent 6 }}
endpoints:
- port: metrics
path: {{ .Values.serviceMonitor.path }}
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
honorLabels: true
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml .Values.serviceMonitor.relabelings | nindent 8 }}
{{- end }}
{{- end }}
80 changes: 80 additions & 0 deletions charts/dtl/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "dtl.fullname" . }}
labels:
{{- include "dtl.labels" . | nindent 4 }}
spec:
serviceName: {{ include "dtl.fullname" . }}
replicas: 1
selector:
matchLabels:
{{- include "dtl.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "dtl.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ template "dtl.fullname" . }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: port
containerPort: {{ .Values.dtl.env.DATA_TRANSPORT_LAYER__SERVER_PORT }}
protocol: TCP
command:
- exec node dist/src/services/run.js

{{- with .Values.args }}
# Arguments
args:
{{- toYaml . | nindent 12 }}
{{- end }}

env:
{{- range $key, $value := .Values.dtl.env}}
- name: {{ $key }}
value: {{ $value }}
{{- end }}

{{- if .Values.livenessProbe }}
livenessProbe:
initialDelaySeconds: 15
periodSeconds: 60
tcpSocket:
port: port
{{- end }}
{{- if .Values.readinessProbe }}
readinessProbe:
initialDelaySeconds: 15
periodSeconds: 60
tcpSocket:
port: port
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: db
mountPath: {{ .Values.dtl.env.DATA_TRANSPORT_LAYER__DB_PATH }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: db
annotations:
"helm.sh/resource-policy": keep
labels:
{{- include "dtl.selectorLabels" $ | nindent 10 }}
spec:
{{- toYaml .Values.volumeClaimSpec | nindent 8 }}
Loading

0 comments on commit eaddd3c

Please sign in to comment.