Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion charts/abstract-node/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: abstract-node
description: External node for syncing and serving blockchain data for Abstract
version: 0.1.39
version: 0.1.40
type: application
icon: https://abstract-assets.abs.xyz/icons/light.png
keywords:
Expand Down
81 changes: 81 additions & 0 deletions charts/abstract-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,84 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
HA core StatefulSet / governing service name.
*/}}
{{- define "abstract-node.haCoreName" -}}
{{- $name := include "common.names.fullname" . | trunc 58 | trimSuffix "-" -}}
{{- printf "%s-core" $name -}}
{{- end }}

{{/*
HA API Deployment name.
*/}}
{{- define "abstract-node.haApiName" -}}
{{- $name := include "common.names.fullname" . | trunc 59 | trimSuffix "-" -}}
{{- printf "%s-api" $name -}}
{{- end }}

{{/*
Default HA core components. The tree API is included by default so API replicas can
proxy proof requests to the singleton tree.
*/}}
{{- define "abstract-node.haCoreComponents" -}}
{{- if .Values.ha.core.components -}}
{{- .Values.ha.core.components -}}
{{- else if .Values.ha.treeApi.enabled -}}
core,tree,tree_fetcher,tree_api
{{- else -}}
core,tree,tree_fetcher
{{- end -}}
{{- end }}

{{/*
Default HA API components.
*/}}
{{- define "abstract-node.haApiComponents" -}}
{{- default "api" .Values.ha.api.components -}}
{{- end }}

{{/*
Render external node command / args, preserving the existing shutdown wrapper behavior.
*/}}
{{- define "abstract-node.nodeArgs" -}}
{{- $root := .root -}}
{{- $args := default (list) .args -}}
{{- if $root.Values.shutdownWrapper.enabled }}
command:
- /bin/sh
- -ec
args:
- |
set -eu

child=0

forward_int() {
if [ "$child" -ne 0 ]; then
echo "Forwarding SIGINT to child process ${child}"
kill -INT "$child" 2>/dev/null || true
fi
}

trap 'forward_int' TERM
trap 'forward_int' INT

/usr/bin/entrypoint.sh "$@" &
child=$!

status=0
wait "$child" || status=$?
exit "$status"
- wrapper
{{- range $args }}
- {{ . | quote }}
{{- end }}
{{- else if $args }}
args:
{{- range $args }}
- {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
244 changes: 244 additions & 0 deletions charts/abstract-node/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{{- if .Values.ha.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "abstract-node.haApiName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: api
spec:
replicas: {{ .Values.ha.api.replicaCount }}
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: api
template:
metadata:
labels:
{{- include "common.labels.matchLabels" . | nindent 8 }}
app.kubernetes.io/component: api
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with (concat .Values.imagePullSecrets .Values.global.imagePullSecrets) }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
priorityClassName: {{ .Values.priorityClassName | quote }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- $apiArgs := concat (list (printf "--components=%s" (include "abstract-node.haApiComponents" .))) .Values.ha.api.extraArgs }}
{{ include "abstract-node.nodeArgs" (dict "root" . "args" $apiArgs) | nindent 10 }}
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: DATABASE_URL
valueFrom:
secretKeyRef:
{{- if .Values.cnpg.enabled }}
name: {{ include "cnpg.clusterName" . }}-app
{{- else }}
name: {{ .Values.database.secretName }}
{{- end }}
key: {{ .Values.database.secretKey }}
optional: false
- name: EN_GAS_PRICE_SCALE_FACTOR
value: "1.5"
- name: EN_ESTIMATE_GAS_SCALE_FACTOR
value: "1.3"
- name: EN_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION
value: "5000"
- name: DATABASE_POOL_SIZE
value: {{ .Values.database.poolSize | quote }}
- name: EN_HTTP_PORT
value: {{ .Values.rpc.http.port | quote }}
- name: EN_WS_PORT
value: {{ .Values.rpc.ws.port | quote }}
- name: EN_HEALTHCHECK_PORT
value: {{ .Values.healthcheck.port | quote }}
- name: EN_PROMETHEUS_PORT
value: {{ .Values.metrics.port | quote }}
- name: EN_ETH_CLIENT_URL
value: {{ .Values.node.ethClientUrl | quote }}
- name: EN_MAIN_NODE_URL
value: {{ .Values.node.mainnetUrl | quote }}
- name: EN_L1_CHAIN_ID
value: {{ .Values.node.l1ChainId | quote }}
- name: EN_L2_CHAIN_ID
value: {{ .Values.node.l2ChainId | quote }}
- name: EN_STATE_CACHE_PATH
value: "./db/ext-node/state_keeper"
- name: EN_MERKLE_TREE_PATH
value: "./db/ext-node/lightweight"
- name: EN_PRUNING_ENABLED
value: {{ .Values.node.pruningEnabled | quote }}
- name: EN_SNAPSHOTS_RECOVERY_ENABLED
value: {{ .Values.node.snapshotRecoveryEnabled | quote }}
- name: EN_SNAPSHOTS_OBJECT_STORE_BUCKET_BASE_URL
value: {{ .Values.node.snapshotBucket | quote }}
- name: EN_SNAPSHOTS_OBJECT_STORE_MODE
value: "GCSAnonymousReadOnly"
- name: RUST_LOG
value: "warn,zksync=info,zksync_web3_decl::client=error"
- name: EN_API_NAMESPACES
value: {{ .Values.rpc.api | quote }}
{{- if or .Values.ha.treeApi.enabled .Values.ha.api.treeApiUrl }}
{{- $treeApiUrl := default (printf "http://%s:%s" (include "abstract-node.haCoreName" .) (.Values.ha.treeApi.port | toString)) .Values.ha.api.treeApiUrl }}
- name: EN_API_TREE_API_REMOTE_URL
value: {{ $treeApiUrl | quote }}
- name: EN_API_WEB3_JSON_RPC_TREE_API_REQUEST_TIMEOUT_SEC
value: {{ .Values.ha.treeApi.requestTimeoutSec | quote }}
{{- end }}
{{- if .Values.rpc.maxResponseBodySizeMb }}
- name: EN_MAX_RESPONSE_BODY_SIZE_MB
value: {{ .Values.rpc.maxResponseBodySizeMb | quote }}
{{- end }}
{{- if .Values.database.poolSizeMaster }}
- name: EN_DATABASE_MAX_CONNECTIONS_MASTER
value: {{ .Values.database.poolSizeMaster | quote }}
{{- end }}
{{- if .Values.node.batchCommitDataGeneratorMode }}
- name: EN_L1_BATCH_COMMIT_DATA_GENERATOR_MODE
value: {{ .Values.node.batchCommitDataGeneratorMode | quote }}
{{- end }}
{{- if .Values.node.daClient }}
- name: EN_DA_CLIENT
value: {{ .Values.node.daClient | quote }}
{{- end }}
{{- if and .Values.node.daClient .Values.node.daClientType }}
- name: "EN_DA_{{ .Values.node.daClient | upper }}_CLIENT_TYPE"
value: {{ .Values.node.daClientType | quote }}
{{- end }}
{{- if .Values.node.daBridgeApiUrl }}
- name: EN_DA_BRIDGE_API_URL
value: {{ .Values.node.daBridgeApiUrl | quote }}
{{- end }}
{{- if .Values.node.daTimeoutMs }}
- name: EN_DA_TIMEOUT_MS
value: {{ .Values.node.daTimeoutMs | quote }}
{{- end }}
{{- if .Values.node.daApiNodeUrl }}
- name: EN_DA_API_NODE_URL
value: {{ .Values.node.daApiNodeUrl | quote }}
{{- end }}
{{- if .Values.node.daAppId }}
- name: EN_DA_APP_ID
value: {{ .Values.node.daAppId | quote }}
{{- end }}
{{- if .Values.node.daSecretsSeedPhrase }}
- name: EN_DA_SECRETS_SEED_PHRASE
value: {{ .Values.node.daSecretsSeedPhrase | quote }}
{{- end }}
{{- if .Values.node.experimentalSnapshotsRecoveryL1Batch }}
- name: EN_EXPERIMENTAL_SNAPSHOTS_RECOVERY_L1_BATCH
value: {{ .Values.node.experimentalSnapshotsRecoveryL1Batch | quote }}
{{- end }}
{{- if .Values.node.statekeeper.l2BlockCommitDeadline }}
- name: EN_STATE_KEEPER_L2_BLOCK_COMMIT_DEADLINE
value: {{ .Values.node.statekeeper.l2BlockCommitDeadline | quote }}
{{- end }}
{{- if .Values.rpc.sendRawTxSyncMaxTimeout }}
- name: EN_API_SEND_RAW_TX_SYNC_MAX_TIMEOUT_MS
value: {{ .Values.rpc.sendRawTxSyncMaxTimeout | quote }}
{{- end }}
{{- if .Values.rpc.sendRawTxSyncDefaultTimeout }}
- name: EN_API_SEND_RAW_TX_SYNC_DEFAULT_TIMEOUT_MS
value: {{ .Values.rpc.sendRawTxSyncDefaultTimeout | quote }}
{{- end }}
{{- range $name, $value := .Values.node.extraEnv }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}
ports:
{{- if .Values.rpc.http.enabled }}
- name: http
containerPort: {{ .Values.rpc.http.port }}
{{- end }}
{{- if .Values.rpc.ws.enabled }}
- name: ws
containerPort: {{ .Values.rpc.ws.port }}
{{- end }}
{{- if or .Values.global.metrics.enabled .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.port }}
{{- end }}
{{- if .Values.healthcheck.enabled }}
- name: healthcheck
containerPort: {{ .Values.healthcheck.port }}
{{- end }}
{{- with .Values.resources }}
resources:
{{ toYaml . | nindent 12 | trim }}
{{- end }}
{{- if .Values.rpc.http.enabled }}
- name: sidecar
image: "{{ .Values.sidecar.registry }}/{{ .Values.sidecar.repository }}:{{ .Values.sidecar.tag }}"
imagePullPolicy: {{ .Values.sidecar.pullPolicy }}
env:
- name: SERVER_BINDADDR
value: "{{ .Values.sidecar.bindAddr }}:{{ .Values.sidecar.bindPort }}"
- name: CLIENT_RPCPORT
value: {{ .Values.rpc.http.port | quote }}
- name: CLIENT_HEALTHPORT
value: {{ .Values.healthcheck.port | quote }}
- name: CLIENT_SCHEME
value: "http"
- name: CLIENT_HOST
value: "127.0.0.1"
ports:
- containerPort: {{ .Values.sidecar.bindPort }}
name: sidecar
protocol: TCP
{{- if or .Values.global.livenessProbe.enabled .Values.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
httpGet:
path: {{ .Values.livenessProbe.httpGet.path }}
port: {{ .Values.livenessProbe.httpGet.port }}
scheme: {{ .Values.livenessProbe.httpGet.scheme }}
{{- end }}
{{- if or .Values.global.readinessProbe.enabled .Values.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
httpGet:
path: {{ .Values.readinessProbe.httpGet.path }}
port: {{ .Values.readinessProbe.httpGet.port }}
scheme: {{ .Values.readinessProbe.httpGet.scheme }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 4 additions & 1 deletion charts/abstract-node/templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ spec:
selector:
matchLabels:
{{- include "common.labels.matchLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.ha.enabled }}
app.kubernetes.io/component: api
{{- end }}
{{- end }}
40 changes: 40 additions & 0 deletions charts/abstract-node/templates/service-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.ha.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "abstract-node.haCoreName" . }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: core
spec:
clusterIP: None
type: ClusterIP
ports:
{{- if .Values.global.metrics.enabled }}
- name: metrics
port: {{ .Values.metrics.port }}
targetPort: metrics
{{- end }}
{{- if .Values.healthcheck.enabled }}
- name: healthcheck
port: {{ .Values.healthcheck.port }}
targetPort: healthcheck
{{- end }}
{{- if .Values.ha.treeApi.enabled }}
- name: tree-api
port: {{ .Values.ha.treeApi.port }}
targetPort: tree-api
{{- end }}
{{- if .Values.consensus.enabled }}
- name: consensus
port: {{ .Values.consensus.port }}
targetPort: consensus
- name: debug-page
port: {{ .Values.consensus.debugPagePort }}
targetPort: debug-page
{{- end }}
selector:
{{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: core
{{- end }}
Loading
Loading