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

feat: add values template file #80

Conversation

omidasadpour
Copy link
Contributor

@omidasadpour omidasadpour commented Jan 24, 2024

/close #79

@omidasadpour omidasadpour self-assigned this Jan 24, 2024
@omidasadpour omidasadpour marked this pull request as draft January 24, 2024 07:29
@omidasadpour omidasadpour force-pushed the feat/auto-generate-values.yaml-from-toml branch 2 times, most recently from eea9315 to f473461 Compare January 29, 2024 08:38
@omidasadpour omidasadpour marked this pull request as ready for review January 29, 2024 08:39
VALUES_FILE="values.yaml"

# Download the Config.toml file from the rollups-node repository
wget https://raw.githubusercontent.com/cartesi/rollups-node/main/internal/config/generate/Config.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the tagged URL, so we can target a version of the configuration. I know we don't have a tagged release for this file yet, but we should be prepared.

charts/rollups-node/script.sh Outdated Show resolved Hide resolved
charts/rollups-node/script.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this file, since we're gonna use the config. map exclusively, we should iterate over it and define the environment in case they are defined.

We don't want to create a new entry here when a new config is created by the script. Some exceptions are the ones the depends on volumes and secrets, like MNEMONIC and MNEMONIC_FILE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this ?

env:
{{- range $key, $value := .Values.validator.config }}
{{- if ne $value "" }}
  - name: {{ $key }}
    value: {{ quote $value }}
{{- end }}
{{- end }}

charts/rollups-node/script.sh Outdated Show resolved Hide resolved
@omidasadpour omidasadpour force-pushed the feat/auto-generate-values.yaml-from-toml branch from 3434449 to 0e6ae5a Compare January 30, 2024 08:26
Copy link
Collaborator

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit from this PR should be removed.

Comment on lines +66 to +69
{{- range $key, $value := .Values.validator.config }}
{{- if and (ne $value "") (not (in $key (list "CARTESI_AUTH_MNEMONIC" "CARTESI_AUTH_MNEMONIC_FILE" "CARTESI_AUTH_MNEMONIC_ACCOUNT_INDEX" "CARTESI_AUTH_AWS_KMS_KEY_ID" "CARTESI_AUTH_AWS_KMS_REGION"))) }}
- name: {{ $key }}
value: {{ quote $value }}
Copy link
Collaborator

@endersonmaia endersonmaia Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we extract this to a helper method and handle all the cases for secrets and chainID there?

Keep an eye on these issues:

secretName: {{ include "validator.fullname" . }}-mnemonic
{{- else }}
secretName: {{ .Values.dapp.mnemonic.secretRef }}
secretName: {{ .Values.validator.config.CARTESI_AUTH_MNEMONIC_FILE }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misleading since the docs tell you to point to a file and not a secretName.

Maybe the user will need to use extraVolumes to mount a secret outside of helm or use extraDeploy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part uses if else . so, if user doesn't define the CARTESI_AUTH_MNEMONIC , the helm will not create secret and use existing secret.

Them. the existing secrets or the created secret via helm will be mount as a config file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Them. the existing secrets or the created secret via helm will be mount as a config file.

I don't see this happening, could you point me where is this.

Also, my point was that CARTESI_AUTH_MNEMONIC_FILE asks where the file is and the the secretName - how it's being used. Got it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, my point was that CARTESI_AUTH_MNEMONIC_FILE asks where the file is and the the secretName - how it's being used. Got it?

I see. So, we should extract the name from the path and use it in deployment file then.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we should not use the value of CARTESI_AUTH_MNEMONIC_FILE as the secretName at all.

If the user informs CARTESI_AUTH_MNEMONIC, we make the secret and mount it and define CARTESI_AUTH_MNEMONIC_FILE to point to it. This is already being done, maybe we should document that this is happening.

If the user informs CARTESI_AUTH_MNEMONIC_FILE they should take care of putting the value of the MNEMONIC on the file the the variable points to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get U know. So, we should change the condition. I'll send a fixup !

@omidasadpour omidasadpour force-pushed the feat/auto-generate-values.yaml-from-toml branch from 0e6ae5a to 8aa226a Compare January 30, 2024 11:21
@endersonmaia
Copy link
Collaborator

I'm gonna merge it and make some adjustments at the other PR.

@endersonmaia endersonmaia merged commit 41e9dc9 into feature/adapt-to-rollups-node-1.3.0 Jan 31, 2024
3 of 4 checks passed
@endersonmaia endersonmaia deleted the feat/auto-generate-values.yaml-from-toml branch January 31, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants