postgresql-container icon indicating copy to clipboard operation
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

Open rareddy opened this issue 6 years ago • 3 comments

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

  1. The "URI" is using IP address of the service instead of service name. This should be changed to service name
  2. 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.

image

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:

  1. Change the URI to use the "service name"
  2. 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

  1. DATABASE_TYPE = postgresql
  2. 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

rareddy avatar Apr 30 '18 21:04 rareddy

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.

bparees avatar Apr 30 '18 22:04 bparees

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.

rareddy avatar May 01 '18 19:05 rareddy

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?

jorgemoralespou avatar Feb 18 '19 21:02 jorgemoralespou