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

Update _helpers.tpl env vars that use secret keys #572

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bastikus
Copy link

Returned default values for the external database

Pull Request

Description of the change

Helm chart does not work when using an external database for NextCloud. "key" is not defined.

Checklist

@provokateurin
Copy link
Member

This seems wrong, you should simply specify the key values as they are mandatory and defaults are not going to work either because every setup is different.

@bastikus
Copy link
Author

This seems wrong, you should simply specify the key values as they are mandatory and defaults are not going to work either because every setup is different.

Default values are indeed defined in values.yaml for external database, but secret for external database is not created in db-secret.yaml, nor are these values used in any other manifests.

@provokateurin
Copy link
Member

Hm I think having default values in the values.yaml for those fields makes no sense because everyone has to override them anyway. @jessebot what do you think?

Returned default values for the external database

Signed-off-by: Bastik <[email protected]>
@jessebot
Copy link
Collaborator

Sorry for the huge delay! I meant to come back to this and just did not 🤦

Anyway! Here's my ideal proposal long term to simplify this:

## Proposed values.yaml example 1

externalDatabase:
  enabled: false

  ## Supported database engines: mysql or postgresql
  type: mysql

  ## Database host
  host:

  ## Database user
  user: nextcloud

  ## Database password
  password: ""

  ## Database name
  database: nextcloud

  ## Name of a Kubernetes existing secret to use.
  existingSecret: ""
  # keys in externalDatabase.existingSecret to use for database credentials
  secretKeys:
    username: ""
    password: ""
    host: ""
    database: ""

The above codeblock I've posted would set all the default values to empty string "" and remove the need for the externalDatabase.existingSecret.enabled value. If externalDatabase.enabled is true and externalDatabase.existingSecret is set to anything that is not an empty string, we use the existing Kubernetes Secret for any of the values that are set under externalDatabase.secretKeys. If any of the secretKeys are empty, we default back to the plain text equivalent.

Here's example codeblock 2, which can still allow for doing the first example in a future PR, but gets this stuff cleaned up faster in this PR:

## Proposed values.yaml example 2

externalDatabase:
  enabled: false

  ## Supported database engines: mysql or postgresql
  type: mysql

  ## Database host
  host:

  ## Database user
  user: nextcloud

  ## Database password
  password: ""

  ## Database name
  database: nextcloud

  ## Use a existing secret
  existingSecret:
    enabled: false
    # this can still be set to empty string, because we still have the enabled parameter here
    secretName: ""
    usernameKey: ""
    passwordKey: ""
    hostKey: ""
    databaseKey: ""

Either way, I agree that we should not have default secret keys, as they have the potential to be wrong or unused. Would you like me to submit that PR? Do we still want to merge this one in the meantime?

@jessebot
Copy link
Collaborator

Oh, if this is to be merged, @bastikus please also update the version in Chart.yaml 🙏

@provokateurin
Copy link
Member

Either way, I agree that we should not have default secret keys, as they have the potential to be wrong or unused. Would you like me to submit that PR? Do we still want to merge this one in the meantime?

Yeah a PR would be nice, it's probably the same for other configs as well. Unfortunately this will be a breaking change :/

@jessebot jessebot changed the title Update _helpers.tpl Update _helpers.tpl env vars that use secret keys Jul 25, 2024
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.

3 participants