Skip to content

Commit

Permalink
feat: change templates based on new values.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
omidasadpour committed Jan 29, 2024
1 parent 5678962 commit f473461
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 20 deletions.
2 changes: 1 addition & 1 deletion charts/rollups-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Selector labels
TODO: diff between query and validator
*/}}
{{- define "validator.selectorLabels" -}}
dapp.cartesi.io/contract-address: {{ required "A valid .Values.dapp.contractAddress is required" .Values.dapp.contractAddress | lower | quote }}
dapp.cartesi.io/contract-address: {{ required "A valid .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS is required" .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS | lower | quote }}
dapp.cartesi.io/chain-id: {{ include "dapp.chainID" . | quote }}
dapp.cartesi.io/network: {{ .Values.dapp.network | quote }}
app.kubernetes.io/name: {{ include "validator.name" . }}
Expand Down
100 changes: 85 additions & 15 deletions charts/rollups-node/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,101 @@ spec:
initialDelaySeconds: 3
{{- end }}
env:
- name: CARTESI_LOG_LEVEL
value: {{ .Values.validator.logLevel }}
{{- if .Values.dapp.network }}
- name: CARTESI_BLOCKCHAIN_ID
value: {{ include "dapp.chainID" . | quote }}
{{- end }}
{{- if .Values.dapp.contractAddress }}
- name: CARTESI_LOG_LEVEL
value: {{ .Values.validator.config.CARTESI_LOG_LEVEL }}
- name: CARTESI_LOG_TIMESTAMP
value: {{ .Values.validator.config.CARTESI_LOG_TIMESTAMP }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS }}
- name: CARTESI_CONTRACTS_DAPP_ADDRESS
value: {{ .Values.dapp.contractAddress | quote }}
value: {{ .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS | quote }}
{{- end }}
{{- if .Values.dapp.blockNumber }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER }}
- name: CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER
value: {{ .Values.dapp.blockNumber | quote }}
value: {{ .Values.validator.config.CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_HISTORY_ADDRESS }}
- name: CARTESI_CONTRACTS_HISTORY_ADDRESS
value: {{ .Values.validator.config.CARTESI_CONTRACTS_HISTORY_ADDRESS | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_AUTHORITY_ADDRESS }}
- name: CARTESI_CONTRACTS_AUTHORITY_ADDRESS
value: {{ .Values.validator.config.CARTESI_CONTRACTS_AUTHORITY_ADDRESS | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_INPUT_BOX_ADDRESS }}
- name: CARTESI_CONTRACTS_INPUT_BOX_ADDRESS
value: {{ .Values.validator.config.CARTESI_CONTRACTS_INPUT_BOX_ADDRESS | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_ENABLED }}
- name: CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_ENABLED
value: {{ .Values.validator.config.CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_ENABLED | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_REDIS_ENDPOINT }}
- name: CARTESI_CONTRACTS_CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_REDIS_ENDPOINTDAPP_ADDRESS
value: {{ .Values.validator.config.CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_REDIS_ENDPOINT | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_FEATURE_HOST_MODE }}
- name: CARTESI_FEATURE_HOST_MODE
value: {{ .Values.validator.config.CARTESI_FEATURE_HOST_MODE | quote }}
{{- end }}
{{- if .Values.dapp.httpProvider }}
{{- if .Values.validator.config.CARTESI_FEATURE_READER_MODE }}
- name: CARTESI_FEATURE_READER_MODE
value: {{ .Values.validator.config.CARTESI_FEATURE_READER_MODE | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK }}
- name: CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK
value: {{ .Values.validator.config.CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_HTTP_ADDRESS }}
- name: CARTESI_HTTP_ADDRESS
value: {{ .Values.validator.config.CARTESI_HTTP_ADDRESS | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_HTTP_PORT }}
- name: CARTESI_HTTP_PORT
value: {{ .Values.validator.config.CARTESI_HTTP_PORT | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_POSTGRES_ENDPOINT }}
- name: CARTESI_POSTGRES_ENDPOINT
value: {{ .Values.validator.config.CARTESI_POSTGRES_ENDPOINT | quote }}
{{- end }}
- name: CARTESI_EPOCH_DURATION
value: {{ .Values.validator.config.CARTESI_EPOCH_DURATION | quote }}
{{- if .Values.validator.config.CARTESI_SNAPSHOT_DIR }}
- name: CARTESI_SNAPSHOT_DIR
value: {{ .Values.validator.config.CARTESI_SNAPSHOT_DIR | quote }}
{{- end }}
{{- if .Values.validator.config.CARTESI_BLOCKCHAIN_HTTP_ENDPOINT }}
- name: CARTESI_BLOCKCHAIN_HTTP_ENDPOINT
value: {{ .Values.dapp.httpProvider | quote }}
value: {{ .Values.validator.config.CARTESI_BLOCKCHAIN_HTTP_ENDPOINT | quote }}
{{- end }}
{{- if .Values.dapp.wsProvider }}
{{- if .Values.validator.config.CARTESI_BLOCKCHAIN_WS_ENDPOINT }}
- name: CARTESI_BLOCKCHAIN_WS_ENDPOINT
value: {{ .Values.dapp.wsProvider | quote }}
value: {{ .Values.validator.config.CARTESI_BLOCKCHAIN_WS_ENDPOINT | quote }}
{{- end }}
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef) }}
- name: CARTESI_BLOCKCHAIN_IS_LEGACY
value: {{ .Values.validator.config.CARTESI_BLOCKCHAIN_IS_LEGACY | quote }}
- name: CARTESI_BLOCKCHAIN_FINALITY_OFFSET
value: {{ .Values.validator.config.CARTESI_BLOCKCHAIN_FINALITY_OFFSET | quote }}
- name: CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT
value: {{ .Values.validator.config.CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT | quote }}
{{- if .Values.validator.config.CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER }}
- name: CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER
value: {{ .Values.validator.config.CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER | quote }}
{{- end }}
{{- if (or .Values.validator.config.CARTESI_AUTH_MNEMONIC .Values.validator.config.CARTESI_AUTH_MNEMONIC_FILE) }}
- name: CARTESI_AUTH_MNEMONIC_FILE
value: "/var/run/secrets/mnemonic/MNEMONIC"
- name: CARTESI_AUTH_MNEMONIC_ACCOUNT_INDEX
value: {{ .Values.validator.config.CARTESI_AUTH_MNEMONIC_ACCOUNT_INDEX }}
{{- end }}
{{- if .Values.validator.config.CARTESI_AUTH_AWS_KMS_KEY_ID }}
- name: CARTESI_AUTH_AWS_KMS_KEY_ID
value: {{ .Values.validator.config.CARTESI_AUTH_AWS_KMS_REGION | quote }}
- name: CARTESI_AUTH_AWS_KMS_REGION
value: {{ required "A valid .Values.validator.config.CARTESI_AUTH_AWS_KMS_REGION is required" .Values.validator.config.CARTESI_AUTH_AWS_KMS_REGION | quote }}
{{- end }}
{{- if .Values.validator.extraEnvVars }}
{{- include "tplvalues.render" (dict "value" .Values.validator.extraEnvVars "context" $) | nindent 12 }}
Expand All @@ -100,7 +170,7 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef) }}
{{- if (or .Values.validator.config.CARTESI_AUTH_MNEMONIC .Values.validator.config.CARTESI_AUTH_MNEMONIC_FILE) }}
- name: mnemonic
mountPath: /var/run/secrets/mnemonic
readOnly: true
Expand All @@ -109,13 +179,13 @@ spec:
{{- include "tplvalues.render" ( dict "value" .Values.validator.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
volumes:
{{- if (or .Values.dapp.mnemonic.value .Values.dapp.mnemonic.secretRef) }}
{{- if (or .Values.validator.config.CARTESI_AUTH_MNEMONIC .Values.validator.config.CARTESI_AUTH_MNEMONIC_FILE) }}
- name: mnemonic
secret:
{{- if .Values.dapp.mnemonic.value }}
{{- if .Values.validator.config.CARTESI_AUTH_MNEMONIC }}
secretName: {{ include "validator.fullname" . }}-mnemonic
{{- else }}
secretName: {{ .Values.dapp.mnemonic.secretRef }}
secretName: {{ .Values.validator.config.CARTESI_AUTH_MNEMONIC_FILE }}
{{- end }}
{{- end }}
{{- if .Values.validator.extraVolumes }}
Expand Down
4 changes: 2 additions & 2 deletions charts/rollups-node/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
rules:
- host: {{ .Values.dapp.contractAddress | lower }}.{{ .Values.ingress.subDomain }}
- host: {{ .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS | lower }}.{{ .Values.ingress.subDomain }}
http: &graphql
paths:
- pathType: Prefix
Expand All @@ -33,7 +33,7 @@ spec:
- host: {{ .Release.Name | lower }}.{{ .Values.ingress.subDomain }}
http: *graphql
{{- end }}
- host: {{ .Values.dapp.contractAddress | lower }}.{{ .Values.ingress.subDomain }}
- host: {{ .Values.validator.config.CARTESI_CONTRACTS_DAPP_ADDRESS | lower }}.{{ .Values.ingress.subDomain }}
http: &inspect
paths:
- pathType: Prefix
Expand Down
4 changes: 2 additions & 2 deletions charts/rollups-node/templates/mnemonic-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: Apache-2.0 (see LICENSE)
*/}}

{{- if .Values.dapp.mnemonic.value }}
{{- if .Values.validator.config.CARTESI_AUTH_MNEMONIC }}
---
apiVersion: v1
kind: Secret
Expand All @@ -12,5 +12,5 @@ metadata:
labels: {{- include "validator.labels" . | nindent 4 }}
type: Opaque
data:
MNEMONIC: {{ .Values.dapp.mnemonic.value | b64enc }}
MNEMONIC: {{ .Values.validator.config.CARTESI_AUTH_MNEMONIC | b64enc }}
{{- end }}

0 comments on commit f473461

Please sign in to comment.