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

Feature/adapt to rollups 1.2.0 #72

Merged
merged 2 commits into from
Dec 5, 2023
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/rollups-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers:
url: https://github.com/oap75

type: application
version: 1.1.0-1
version: 1.2.0-0

dependencies:
- name: redis
Expand Down
13 changes: 12 additions & 1 deletion charts/rollups-node/ci/localnode-values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ extraDeploy:
RD_EPOCH_DURATION: "86400"
SC_GRPC_ENDPOINT: 'http://{{ include "validator.fullname" . }}-state-server:50051'
SC_DEFAULT_CONFIRMATIONS: "1"
- apiVersion: v1
kind: ConfigMap
metadata:
namespace: "{{ .Release.Namespace }}"
name: "{{ .Release.Name }}-authority-claimer"
data:
RUST_LOG: "info"
RD_EPOCH_DURATION: "86400"
SC_GRPC_ENDPOINT: 'http://{{ include "validator.fullname" . }}-state-server:50051'
TX_CHAIN_IS_LEGACY: "false"
TX_DEFAULT_CONFIRMATIONS: "2"
SC_DEFAULT_CONFIRMATIONS: "1"
- apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -49,6 +58,8 @@ localnode:
enabled: true
dispatcher:
extraEnvVarsCM: "{{ .Release.Name }}-dispatcher"
authorityClaimer:
extraEnvVarsCM: "{{ .Release.Name }}-authority-claimer"
stateServer:
extraEnvVarsCM: "{{ .Release.Name }}-state-server"
serverManager:
Expand Down
45 changes: 44 additions & 1 deletion charts/rollups-node/ci/test-values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ dapp:
network: sepolia

extraDeploy:
- apiVersion: v1
kind: ConfigMap
metadata:
namespace: "{{ .Release.Namespace }}"
name: "{{ .Release.Name }}-sepolia-deployment"
data:
"sepolia.json": |
{
"contracts": {
"Authority": { "address": "0x5827Ec9365D3a9b27bF1dB982d258Ad234D37242" },
"History": { "address": "0x76f4dCaC0920826541EE718214EEE4be07346cEE" },
"InputBox": { "address": "0x59b22D57D4f067708AB0c00552767405926dc768" }
}
}
- apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -21,8 +35,19 @@ extraDeploy:
RD_EPOCH_DURATION: "86400"
SC_GRPC_ENDPOINT: "http://localhost:50051"
SC_DEFAULT_CONFIRMATIONS: "1"
ROLLUPS_DEPLOYMENT_FILE: "/opt/cartesi/share/deployments/sepolia.json"
- apiVersion: v1
kind: ConfigMap
metadata:
namespace: "{{ .Release.Namespace }}"
name: "{{ .Release.Name }}-authority-claimer"
data:
RUST_LOG: "info"
RD_EPOCH_DURATION: "86400"
SC_GRPC_ENDPOINT: 'http://{{ include "validator.fullname" . }}-state-server:50051'
TX_CHAIN_IS_LEGACY: "false"
TX_DEFAULT_CONFIRMATIONS: "2"
SC_DEFAULT_CONFIRMATIONS: "1"
ROLLUPS_DEPLOYMENT_FILE: "/opt/cartesi/share/deployments/sepolia.json"
- apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -60,6 +85,24 @@ dispatcher:
extraEnvVarsCM: "{{ .Release.Name }}-dispatcher"
healthCheck:
enabled: true
extraVolumes:
- name: sepolia-deployment
configMap:
name: "{{ .Release.Name }}-sepolia-deployment"
extraVolumeMounts:
- name: sepolia-deployment
mountPath: /opt/cartesi/share/deployments
readOnly: true
authorityClaimer:
extraEnvVarsCM: "{{ .Release.Name }}-authority-claimer"
extraVolumes:
- name: sepolia-deployment
configMap:
name: "{{ .Release.Name }}-sepolia-deployment"
extraVolumeMounts:
- name: sepolia-deployment
mountPath: /opt/cartesi/share/deployments
readOnly: true
stateServer:
extraEnvVarsCM: "{{ .Release.Name }}-state-server"
serverManager:
Expand Down
7 changes: 7 additions & 0 deletions charts/rollups-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ Return the proper dispatcher image name
{{ include "images.image" (dict "imageRoot" .Values.dispatcher.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper authorityClaimer image name
*/}}
{{- define "authorityClaimer.image" -}}
{{ include "images.image" (dict "imageRoot" .Values.authorityClaimer.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper stateServer image name
*/}}
Expand Down
157 changes: 157 additions & 0 deletions charts/rollups-node/templates/authority-claimer-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{{- /*
(c) Cartesi and individual authors (see AUTHORS)
SPDX-License-Identifier: Apache-2.0 (see LICENSE)
*/}}

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "validator.fullname" . }}-authority-claimer
labels: {{- include "validator.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "validator.selectorLabels" . | nindent 6 }}
rollups.cartesi.io/component: authority-claimer
template:
metadata:
{{- with .Values.authorityClaimer.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "validator.selectorLabels" . | nindent 8 }}
rollups.cartesi.io/component: authority-claimer
spec:
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "validator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.authorityClaimer.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.authorityClaimer.initContainers }}
{{- include "tplvalues.render" ( dict "value" .Values.authorityClaimer.initContainers "context" $ ) | nindent 8 }}
{{- end }}
containers:
- name: rollups-authority-claimer
image: {{ include "authorityClaimer.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.authorityClaimer.resources | nindent 12 }}
{{- if .Values.authorityClaimer.command }}
command:
{{- include "tplvalues.render" (dict "value" .Values.authorityClaimer.command "context" $) | nindent 12 }}
{{- end }}
args:
{{- if .Values.authorityClaimer.healthCheck.enabled }}
- {{ print "--http-server-port=" (default .Values.authorityClaimer.healthCheck.port 8086) | quote }}
{{- end }}
{{- if .Values.localnode.enabled }}
- --rollups-deployment-file=/opt/cartesi/share/deployments/localhost.json
- --dapp-deployment-file=/deployments/localhost/dapp.json
{{- else }}
- {{ print "--dapp-address=" (required "A valid .Values.dapp.contractAddress is required" .Values.dapp.contractAddress) | quote }}
- {{ print "--dapp-deploy-block-hash=" (required "A valid .Values.dapp.blockHash is required" .Values.dapp.blockHash) | quote }}
{{- end }}
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef .Values.localnode.enabled) }}
- {{ print "--tx-signing-mnemonic-file=/var/run/secrets/mnemonic/MNEMONIC" | quote }}
{{- end }}
{{- if .Values.localnode.enabled }}
- --tx-provider-http-endpoint=http://{{ include "validator.fullname" . }}-localnode:8545
{{- else }}
- {{ print "--tx-provider-http-endpoint=" (required "A valid .Values.dapp.httpProvider is required" .Values.dapp.httpProvider) | quote }}
{{- end }}
{{- if (or .Values.dapp.network .Values.localnode.enabled) }}
- {{ print "--tx-chain-id=" (include "dapp.chainID" .) | quote }}
{{- end }}
- {{ print (include "validator.redisConfig" .) | quote }}
{{- range .Values.authorityClaimer.args }}
- {{ . | quote}}
{{- end }}
{{- range .Values.authorityClaimer.extraArgs }}
- {{ . | quote}}
{{- end }}
{{- if .Values.authorityClaimer.healthCheck.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ (default 8086 .Values.authorityClaimer.healthCheck.port) }}
initialDelaySeconds: 3
{{- end }}
env:
- name: RUST_LOG
value: {{ .Values.authorityClaimer.logLevel }}
{{- if .Values.authorityClaimer.extraEnvVars }}
{{- include "tplvalues.render" (dict "value" .Values.authorityClaimer.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.authorityClaimer.extraEnvVarsCM .Values.authorityClaimer.extraEnvVarsSecret }}
envFrom:
{{- if .Values.authorityClaimer.extraEnvVarsCM }}
- configMapRef:
name: {{ include "tplvalues.render" ( dict "value" .Values.authorityClaimer.extraEnvVarsCM "context" $ ) }}
{{- end }}
{{- if .Values.authorityClaimer.extraEnvVarsSecret }}
- secretRef:
name: {{ include "tplvalues.render" ( dict "value" .Values.authorityClaimer.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
volumeMounts:
{{- if (or .Values.dapp.mnemonic.value .Values.localnode.enabled .Values.dapp.mnemonic.secretRef) }}
- name: mnemonic
mountPath: /var/run/secrets/mnemonic
readOnly: true
{{- end }}
- name: authority-claimer-lib
mountPath: /opt/cartesi/rollups-authority-claimer/lib
readOnly: false
{{- if .Values.localnode.enabled }}
- name: blockchain-data
mountPath: /opt/cartesi/share/deployments
readOnly: false
- name: deployments
mountPath: /deployments
readOnly: false
{{- end}}
{{- if .Values.authorityClaimer.extraVolumeMounts }}
{{- include "tplvalues.render" ( dict "value" .Values.authorityClaimer.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}

volumes:
{{- if .Values.localnode.enabled }}
- name: blockchain-data
persistentVolumeClaim:
claimName: {{ include "validator.fullname" . }}-blockchain-data-pvc
- name: deployments
persistentVolumeClaim:
claimName: {{ include "validator.fullname" . }}-deployments-pvc
{{- end }}
- name: authority-claimer-lib
emptyDir: {}
{{- if (or .Values.dapp.mnemonic.value .Values.localnode.enabled .Values.dapp.mnemonic.secretRef) }}
- name: mnemonic
secret:
{{- if (or .Values.dapp.mnemonic.value .Values.localnode.enabled) }}
secretName: {{ include "validator.fullname" . }}-mnemonic
{{- else }}
secretName: {{ .Values.dapp.mnemonic.secretRef }}
{{- end }}
{{- end }}
{{- if .Values.authorityClaimer.extraVolumes }}
{{- include "tplvalues.render" ( dict "value" .Values.authorityClaimer.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
{{- with .Values.authorityClaimer.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.authorityClaimer.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.authorityClaimer.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
21 changes: 0 additions & 21 deletions charts/rollups-node/templates/dapp-configmap.yaml

This file was deleted.

34 changes: 5 additions & 29 deletions charts/rollups-node/templates/dispatcher-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,17 @@ spec:
- {{ print "--http-server-port=" (default .Values.dispatcher.healthCheck.port 8081) | quote }}
{{- end }}
{{- if .Values.localnode.enabled }}
- --rd-rollups-deployment-file=/opt/cartesi/share/deployments/localhost.json
- --rd-dapp-deployment-file=/deployments/localhost/dapp.json
- --rollups-deployment-file=/opt/cartesi/share/deployments/localhost.json
- --dapp-deployment-file=/deployments/localhost/dapp.json
{{- else }}
- {{ print "--rd-rollups-deployment-file=/opt/cartesi/share/deployments/" (required "A valid .Values.dapp.network is required" .Values.dapp.network | replace "-" "_") ".json" | quote }}
- {{ print "--rd-dapp-deployment-file=/deployments/" (required "A valid .Values.dapp.network is required" .Values.dapp.network | replace "-" "_") "/dapp.json" | quote }}
{{- end }}
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef .Values.localnode.enabled) }}
- {{ print "--auth-mnemonic-file=/var/run/secrets/mnemonic/MNEMONIC" | quote }}
{{- end }}
{{- if .Values.localnode.enabled }}
- --tx-provider-http-endpoint=http://{{ include "validator.fullname" . }}-localnode:8545
{{- else }}
- {{ print "--tx-provider-http-endpoint=" (required "A valid .Values.dapp.httpProvider is required" .Values.dapp.httpProvider) | quote }}
- {{ print "--dapp-address=" (required "A valid .Values.dapp.contractAddress is required" .Values.dapp.contractAddress) | quote }}
- {{ print "--dapp-deploy-block-hash=" (required "A valid .Values.dapp.blockHash is required" .Values.dapp.blockHash) | quote }}
{{- end }}
{{- if (or .Values.dapp.network .Values.localnode.enabled) }}
- {{ print "--tx-chain-id=" (include "dapp.chainID" .) | quote }}
- {{ print "--chain-id=" (include "dapp.chainID" .) | quote }}
{{- end }}
- {{ print (include "validator.redisConfig" .) | quote }}
{{- range .Values.dispatcher.args }}
- {{ . | quote}}
{{- end }}
{{- range .Values.dispatcher.extraArgs }}
- {{ . | quote}}
Expand Down Expand Up @@ -106,20 +97,13 @@ spec:
mountPath: /var/run/secrets/mnemonic
readOnly: true
{{- end }}
- name: dispatcher-lib
mountPath: /opt/cartesi/rollups-dispatcher/lib
readOnly: false
{{- if .Values.localnode.enabled }}
- name: blockchain-data
mountPath: /opt/cartesi/share/deployments
readOnly: false
- name: deployments
mountPath: /deployments
readOnly: false
{{- else }}
- name: dapp
mountPath: "/deployments/{{ .Values.dapp.network }}/"
readOnly: true
{{- end}}
{{- if .Values.dispatcher.extraVolumeMounts }}
{{- include "tplvalues.render" ( dict "value" .Values.dispatcher.extraVolumeMounts "context" $ ) | nindent 12 }}
Expand All @@ -134,14 +118,6 @@ spec:
persistentVolumeClaim:
claimName: {{ include "validator.fullname" . }}-deployments-pvc
{{- end }}
- name: dispatcher-lib
emptyDir: {}
- name: dapp
configMap:
name: "{{ include "validator.fullname" . }}-dapp"
items:
- key: "dapp.json"
path: "dapp.json"
{{- if (or .Values.dapp.mnemonic.value .Values.localnode.enabled .Values.dapp.mnemonic.secretRef) }}
- name: mnemonic
secret:
Expand Down
Loading
Loading