postgres-operator
postgres-operator copied to clipboard
All variables should be prefixed with "POSTGRES_"
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