postgresql-container
postgresql-container copied to clipboard
Openshift PG template when used create a service and binding using template service broker does not create a secret with service name
When using OpenShift builtin PostgreSQL template in 3.7/3.9, with template service broker enabled, the secret created for database credentials, using the service IP in the uri variable, when it really should use the service name. So, there are currently multiple issues here
- The "URI" is using IP address of the service instead of service name. This should be changed to service name
- In the "URI", the protocol used is "postgres" which does not match to any programming platforms. URI in its current form is not useful at all. For ex: I can't use it a java program or nodejs program to connect to the pg instance.
Steps To Reproduce Deploy PostgreSQL from service catalog.
Look at the secret generated to see that IP address is used and not service name.
Suggestions to Improve:
- Change the URI to use the "service name"
- Change the URI to use "postgresql" as the protocol instead of "postgres"
Alternatively, if URI can not be modified any backward compatibility reasons, I suggest adding below additional properties
- DATABASE_TYPE = postgresql
- SERVICE_NAME = ${myservice}
using which programming platforms can make meaningful connection URLs to connect to the instance.
This ticket is originally reported at https://github.com/openshift/origin/issues/17230 https://github.com/openshift/origin/issues/17738
changes made here need to be careful not to break backwards compatibility. Depending what gets proposed we may have to only add new values, not change existing values.
These are changes I would like to propose https://github.com/rareddy/postgresql-container/commit/0cb928999f3858f3d1d4e4696d13cbf019d5158e
"service-port" and "service-type", may seem verbose but for an application, it takes out the guesswork to determine them and be explicit.
This is open for more than a year and in the meantime, the binding created from the postgres template is not directly usable from Java (and other languages) as reported in https://github.com/openshift/origin/issues/17738
The issue there is closed.
Any expectation this will move forward?