Skip to content

Commit

Permalink
feat(WIP): adapt to rollups-node:1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Jan 4, 2024
1 parent 8526aca commit 9f08f4e
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 1,718 deletions.
10 changes: 5 additions & 5 deletions charts/rollups-node/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.graphqlServer.service.type }}
{{- if contains "NodePort" .Values.validator.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "validator.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.graphqlServer.service.type }}
{{- else if contains "LoadBalancer" .Values.validator.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "validator.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "validator.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.graphqlServer.service.port }}
{{- else if contains "ClusterIP" .Values.graphqlServer.service.type }}
echo http://$SERVICE_IP:4000/graphql
{{- else if contains "ClusterIP" .Values.validator.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "validator.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080/graphql to use your application"
echo "Visit http://127.0.0.1:4000/graphql to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
48 changes: 3 additions & 45 deletions charts/rollups-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,52 +90,10 @@ Return the proper image name
{{- end -}}

{{/*
Return the proper dispatcher image name
Return the proper validator image name
*/}}
{{- define "dispatcher.image" -}}
{{ 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
*/}}
{{- define "stateServer.image" -}}
{{ include "images.image" (dict "imageRoot" .Values.stateServer.image "global" .Values.global) }}
{{- end -}}

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

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

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

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

{{/*
Expand Down
131 changes: 0 additions & 131 deletions charts/rollups-node/templates/authority-claimer-deployment.yaml

This file was deleted.

131 changes: 131 additions & 0 deletions charts/rollups-node/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{{- /*
(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" . }}-validator
labels: {{- include "validator.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "validator.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.validator.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "validator.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "validator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.validator.podSecurityContext | nindent 8 }}
initContainers:
{{- if .Values.validator.initContainers }}
{{- include "tplvalues.render" ( dict "value" .Values.validator.initContainers "context" $ ) | nindent 8 }}
{{- end }}
containers:
- name: rollups-node
image: {{ include "validator.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.validator.resources | nindent 12 }}
{{- if .Values.validator.command }}
command:
{{- include "tplvalues.render" (dict "value" .Values.validator.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.validator.args }}
args:
{{- include "tplvalues.render" (dict "value" .Values.validator.args "context" $) | nindent 12 }}
{{- range .Values.validator.extraArgs }}
- {{ . | quote}}
{{- end }}
{{- end }}
{{- if .Values.validator.healthCheck.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: {{ (default 8081 .Values.validator.healthCheck.port) }}
initialDelaySeconds: 3
{{- end }}
env:
- name: CARTESI_LOG_LEVEL
value: {{ .Values.validator.logLevel }}
{{- if .Values.dapp.network }}
- name: CARTESI_BLOCKCHAIN_ID
value: {{ print "--chain-id=" (include "dapp.chainID" .) | quote }}
{{- end }}
{{- if .Values.dapp.contractAddress }}
- name: CARTESI_CONTRACTS_DAPP_ADDRESS
value: {{ .Values.dapp.contractAddress | quote }}
{{- end }}
{{- if .Values.dapp.blockNumber }}
- name: CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER
value: {{ .Values.dapp.blockNumber | quote }}
{{- end }}
{{- if .Values.dapp.httpProvider }}
- name: CARTESI_BLOCKCHAIN_HTTP_ENDPOINT
value: {{ .Values.dapp.httpProvider | quote }}
{{- end }}
{{- if .Values.dapp.wsProvider }}
- name: CARTESI_BLOCKCHAIN_WS_ENDPOINT
value: {{ .Values.dapp.wsProvider | quote }}
{{- end }}
{{- if .Values.validator.extraEnvVars }}
{{- include "tplvalues.render" (dict "value" .Values.validator.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.validator.extraEnvVarsCM .Values.validator.extraEnvVarsSecret }}
envFrom:
{{- if .Values.validator.extraEnvVarsCM }}
- configMapRef:
name: {{ include "tplvalues.render" ( dict "value" .Values.validator.extraEnvVarsCM "context" $ ) }}
{{- end }}
{{- if .Values.validator.extraEnvVarsSecret }}
- secretRef:
name: {{ include "tplvalues.render" ( dict "value" .Values.validator.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
volumeMounts:
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef) }}
- name: mnemonic
mountPath: /var/run/secrets/mnemonic
readOnly: true
{{- end }}
{{- if .Values.validator.extraVolumeMounts }}
{{- include "tplvalues.render" ( dict "value" .Values.validator.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
volumes:
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef) }}
- name: mnemonic
secret:
{{- if .Values.dapp.mnemonic.value }}
secretName: {{ include "validator.fullname" . }}-mnemonic
{{- else }}
secretName: {{ .Values.dapp.mnemonic.secretRef }}
{{- end }}
{{- end }}
{{- if .Values.validator.extraVolumes }}
{{- include "tplvalues.render" ( dict "value" .Values.validator.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
{{- with .Values.validator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.validator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.validator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading

0 comments on commit 9f08f4e

Please sign in to comment.