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

DATASOURCES_DEFAULT_HOST can't be empty when mariadbDependencyEnabled and postgresqlDependencyEnabled are disabled #84

Open
vaaleyard opened this issue May 2, 2024 · 3 comments

Comments

@vaaleyard
Copy link

I'm trying to use an external database as the passbolt db, and I want to pass its variables to fetch from a secret I have in the my kubernetes cluster.

I have a secret in kubernetes with four variables, which has the connection settings for the database:

DATASOURCES_DEFAULT_DATABASE:  8 bytes
DATASOURCES_DEFAULT_HOST:      58 bytes
DATASOURCES_DEFAULT_PASSWORD:  28 bytes
DATASOURCES_DEFAULT_USERNAME:  5 bytes

My values file is something like this:

redisDependencyEnabled: false
mariadbDependencyEnabled: false

passboltEnv:
  plain:
    EMAIL_TRANSPORT_DEFAULT_TLS: false
    PASSBOLT_SSL_FORCE: false
    APP_FULL_BASE_URL: "https://passbolt.tld"

  # with extraenvfrom it also doesn't work
  # extraEnvFrom:
  #   - secretRef:
  #       name: passbolt-config-secret
  
  extraEnv:
  - name: DATASOURCES_DEFAULT_HOST
    valueFrom:
      secretKeyRef:
        name: passbolt-config-secret
        key: DATASOURCES_DEFAULT_HOST
  - name: DATASOURCES_DEFAULT_DATABASE
    valueFrom:
      secretKeyRef:
        name: passbolt-config-secret
        key: DATASOURCES_DEFAULT_DATABASE
  - name: DATASOURCES_DEFAULT_USERNAME
    valueFrom:
      secretKeyRef:
        name: passbolt-config-secret
        key: DATASOURCES_DEFAULT_USERNAME
  - name: DATASOURCES_DEFAULT_DATABASE
    valueFrom:
      secretKeyRef:
        name: passbolt-config-secret
        key: DATASOURCES_DEFAULT_DATABASE

Troubleshooting the error message:

Error: UPGRADE FAILED: execution error at (passbolt/templates/deployment.yaml:122:24): DATASOURCES_DEFAULT_HOST can't be empty when mariadbDependencyEnabled and postgresqlDependencyEnabled are disabled

and going to _helpers.tpl#L67 it looks like I have to obligatory pass the HOST variable as plain... Wouldn't it be better to also allow it to pass as a secret variable? Because it doesn't make sense to also leave this var in plain text.

@dlen
Copy link
Member

dlen commented May 2, 2024

Hey @vaaleyard,

Yes this is intentional as we considered that for the database hostname it would be enough to store it as a configmap.
There are no plans in the short term to change that. I'm leaving this issue open in case your suggestion shows community traction in order to implement it.

@vaaleyard
Copy link
Author

And is it possible to pass the other DATASOURCES_DEFAULT_* variables as a secret? Like in the example above
Because in secret-env.yaml#L22 it uses the passboltEnv.secret directly...

@dlen
Copy link
Member

dlen commented May 3, 2024

I think you would have problems with this function https://github.com/passbolt/charts-passbolt/blob/main/templates/_helpers.tpl#L67 that doesn't consider that the host could be stored in a secret.

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

No branches or pull requests

2 participants