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

netbox: not possible to omit externalDatabase password #63

Open
norman-zon opened this issue Apr 3, 2024 · 1 comment
Open

netbox: not possible to omit externalDatabase password #63

norman-zon opened this issue Apr 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@norman-zon
Copy link

Using the netbox chart 5.0.7 it is not possible to omit existingSecretPasswordKey.

I use Google CloudSQL with IAM based auth (via CloudSQL proxy), which does not need a password.

When setting the connection info like this, everything works:

externalDatabase:
    host: localhost
    port: 5432
    database: netbox
    username: "[email protected]"
    password: ""

But when I try to use an existing secret with an empty password like so:

externalDatabase:
    existingSecretName: cloudsql-proxy-iam
    existingSecretHostKey: PGHOST
    existingSecretPortKey: PGPORT
    existingSecretUserKey: PGUSER
    existingSecretDatabaseKey: PGDATABASE
    existingSecretPasswordKey: PGPASSWORD

I get:

django.db.utils.OperationalError: connection failed: fe_sendauth: no password supplied

If I remove existingSecretPasswordKey completely, the chart fails with:

MountVolume.SetUp failed for volume "secrets" : references non-existent secret key: db-password

I think my usecase is not super common, but viable. Could you please change the handling of existingSecretPasswordKey, so it can be omited?

@firmansyahn
Copy link
Collaborator

firmansyahn commented Apr 5, 2024

This is because I arrogantly assume that any external database should have password already.
Even as far as to do auto generate if it empty.

Btw, netbox.databaseSecretPasswordKey cannot omited. Because netbox image itself expected it always exist. Either use default db-password or custom at existingSecretPasswordKey.

Will fix on next release.

external-db.yaml

data:
  db-password: {{ include "common.secrets.passwords.manage" (dict "secret" (printf "%s-%s" (include "netbox.fullname" .) "external-db") "key" "db-password" "length" 32 "providedValues" (list "externalDatabase.password") "context" $) }}

@firmansyahn firmansyahn added the bug Something isn't working label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants