Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arbitrum] init chart #291

Merged
merged 27 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ check-version-increment: true
validate-chart-schema: true
validate-maintainers: true
validate-yaml: true
helm-extra-args: --timeout 600s
20 changes: 20 additions & 0 deletions dysnix/arbitrum/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: arbitrum
description: Arbitrum nitro-node Helm Chart

version: 0.1.0
appVersion: v2.3.0-3e14543

keywords:
- rollup
- arbitrum
- nitro
- cryptocurrency
- blockchain

sources:
- https://github.com/dysnix/charts

maintainers:
- name: VladStarr
email: [email protected]
15 changes: 15 additions & 0 deletions dysnix/arbitrum/ci/ct-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
readinessProbe:
enabled: false

livenessProbe:
enabled: false

config:
init:
empty: true
url: ""
parent-chain:
connection:
url: https://ethereum-rpc.publicnode.com
blob-client:
beacon-url: https://ethereum-beacon-api.publicnode.com
12 changes: 12 additions & 0 deletions dysnix/arbitrum/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
arbitrum RPC can be accessed via port {{ .Values.config.http.port }} on the following DNS name from within your cluster:
{{ template "arbitrum.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local

To connect to arbitrum RPC:

1. Forward the port for the node:

$ kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') {{ .Values.config.http.port }}

2. Try basic RPC method:

$ curl -X POST http://localhost:{{ .Values.config.http.port }} --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":1}'
76 changes: 76 additions & 0 deletions dysnix/arbitrum/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "arbitrum.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 "arbitrum.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 -}}

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

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "arbitrum.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "arbitrum.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "arbitrum.healthcheck" -}}
{{- $context := index . 0 }}
{{- $root := index . 1 }}
{{- if and $root.exec (kindIs "string" $root.exec.command) }}
{{- omit $root "enabled" "exec" | toYaml }}
exec:
command:
{{- tpl $root.exec.command $context | nindent 4 }}
{{- else }}
{{- omit $root "enabled" | toYaml }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions dysnix/arbitrum/templates/configmap-scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "arbitrum.fullname" . }}-scripts
labels:
{{- include "arbitrum.labels" . | nindent 4 }}
data:
readiness.sh: |-
{{- include (print $.Template.BasePath "/scripts/_readiness.tpl") . | nindent 4 }}
liveness.sh: |-
{{- include (print $.Template.BasePath "/scripts/_liveness.tpl") . | nindent 4 }}
{{- if or .Values.syncToS3.enabled .Values.initFromS3.enabled }}
init-from-s3.sh: |-
{{- include (print $.Template.BasePath "/scripts/_init-from-s3.tpl") . | nindent 4 }}
sync-to-s3.sh: |-
{{- include (print $.Template.BasePath "/scripts/_sync-to-s3.tpl") . | nindent 4 }}
s3-env.sh: |-
{{- include (print $.Template.BasePath "/scripts/_s3-env.tpl") . | nindent 4 }}
s3-cron.sh: |-
{{- include (print $.Template.BasePath "/scripts/_s3-cron.tpl") . | nindent 4 }}
{{- end }}
9 changes: 9 additions & 0 deletions dysnix/arbitrum/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "arbitrum.fullname" . }}
labels:
{{- include "arbitrum.labels" . | nindent 4 }}
data:
config.json: |
{{- .Values.config | toPrettyJson | replace "\\u0026" "&" | replace "\\u003c" "<" | replace "\\u003e" ">" | nindent 4 }}
61 changes: 61 additions & 0 deletions dysnix/arbitrum/templates/ingress-http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if and .Values.services.rpc.enabled .Values.ingress.http.enabled -}}
{{- $fullName := include "arbitrum.fullname" . -}}
{{- $svcPort := .Values.services.rpc.httpPort -}}
{{- if and .Values.ingress.http.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.http.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.http.annotations "kubernetes.io/ingress.class" .Values.ingress.http.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-http
labels:
{{- include "arbitrum.labels" . | nindent 4 }}
{{- with .Values.ingress.http.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.http.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.http.className }}
{{- end }}
{{- if .Values.ingress.http.tls }}
tls:
{{- range .Values.ingress.http.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.http.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-rpc
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-rpc
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
61 changes: 61 additions & 0 deletions dysnix/arbitrum/templates/ingress-ws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if and .Values.services.rpc.enabled .Values.ingress.ws.enabled -}}
{{- $fullName := include "arbitrum.fullname" . -}}
{{- $svcPort := .Values.services.rpc.wsPort -}}
{{- if and .Values.ingress.ws.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.ws.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.ws.annotations "kubernetes.io/ingress.class" .Values.ingress.ws.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-ws
labels:
{{- include "arbitrum.labels" . | nindent 4 }}
{{- with .Values.ingress.ws.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ws.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.ws.className }}
{{- end }}
{{- if .Values.ingress.ws.tls }}
tls:
{{- range .Values.ingress.ws.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.ws.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-rpc
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-rpc
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions dysnix/arbitrum/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if and .Values.syncToS3.enabled .Values.serviceAccount.create }}
{{- $fullName := include "arbitrum.fullname" . }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $fullName }}
labels: {{ include "arbitrum.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources:
- configmaps
resourceNames:
- {{ $fullName }}-s3-config
verbs:
- get
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $fullName }}
labels: {{ include "arbitrum.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ $fullName }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
11 changes: 11 additions & 0 deletions dysnix/arbitrum/templates/s3-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if or .Values.initFromS3.enabled .Values.syncToS3.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "arbitrum.fullname" . }}-s3-config
data:
DATA_DIR: {{ .Values.config.persistent.chain }}
SYNC_TO_S3: "False"
S3_BASE_URL: {{ tpl .Values.s3config.baseUrl . }}
FORCE_INIT: {{ ternary "True" "False" .Values.initFromS3.force | quote }}
{{- end }}
45 changes: 45 additions & 0 deletions dysnix/arbitrum/templates/s3-cronjob-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- if .Values.syncToS3.cronjob.enabled -}}
{{- $fullName := print (include "arbitrum.fullname" .) "-s3-cronjob" }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $fullName }}
labels: {{ include "arbitrum.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $fullName }}
labels: {{ include "arbitrum.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources:
- pods
verbs:
- get
- list
- watch
- delete
- apiGroups: [""]
resources:
- configmaps
resourceNames:
- {{ include "arbitrum.fullname" . }}-s3-config
verbs:
- get
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $fullName }}
labels: {{ include "arbitrum.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ $fullName }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
Loading
Loading