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

All variables should be prefixed with "POSTGRES_" #71

Open
d-lopes opened this issue Aug 30, 2021 · 0 comments
Open

All variables should be prefixed with "POSTGRES_" #71

d-lopes opened this issue Aug 30, 2021 · 0 comments

Comments

@d-lopes
Copy link

d-lopes commented Aug 30, 2021

Hi there,

following up on my other issue (#67), I have seen your implementation for the generation of the secret in https://github.com/movetokube/postgres-operator/blob/master/pkg/controller/postgresuser/postgresuser_controller.go which includes the database credentials:

"POSTGRES_URL":      []byte(pgUserUrl),
"POSTGRES_JDBC_URL": []byte(pgJDBCUrl),
"HOST":              []byte(r.pgHost),
"DATABASE_NAME":     []byte(cr.Status.DatabaseName),
"ROLE":              []byte(role),
"PASSWORD":          []byte(password),
"LOGIN":             []byte(login),

Is there a reason why not all Variables are prefixed with "POSTGRES_"? I believe this would be beneficial since you can have Kubernetes apps which are integrated with multiple managed services like Postres AND Kafka etc. In that case you have multiple service credentials (potentially named LOGIN and PASSWORD). Thus, it would be a cleaner approach to prefix every variable with accordingly.

I understand this is a breaking change but I might be worth it. You could try to mitigate this by duplicating that variables for a transition period:

"POSTGRES_URL":      []byte(pgUserUrl),
"POSTGRES_JDBC_URL": []byte(pgJDBCUrl),

=== legacy variables ===
  "HOST":              []byte(r.pgHost),
  "DATABASE_NAME":     []byte(cr.Status.DatabaseName),
  "ROLE":              []byte(role),
  "PASSWORD":          []byte(password),
  "LOGIN":             []byte(login),
=== legacy variables ===

=== new variables ===
  "POSTGRES_HOST":              []byte(r.pgHost),
  "POSTGRES_DATABASE_NAME":     []byte(cr.Status.DatabaseName),
  "POSTGRES_ROLE":              []byte(role),
  "POSTGRES_PASSWORD":          []byte(password),
  "POSTGRES_LOGIN":             []byte(login),
=== new variables ===

best regards

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

1 participant