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

Switch from service binding label to tags to read credentials from VCAP_SERVICES #346

Open
gregorwolf opened this issue Nov 17, 2023 · 2 comments

Comments

@gregorwolf
Copy link
Collaborator

As described in the migration guide from cds-pg to @cap-js/postgres the

service binding label is postgresql-db

that means that if someone wants to use a PostgreSQL directly from a hyperscaler and does provides the credentials using a user provided service (UPS) the connection will not work out of the box. To make the connection work this additional entry in the package.json of the deployer and service module is needed:

  "cds": {
    "requires": {
      "kinds": {
        "postgres": {
          "vcap": {
            "label": "user-provided"
          }
        }
      }
    }
  }

If instead tags would be used to to read credentials from VCAP_SERVICES it would be easier to get them from the UPS. Using the UPS configuration via mta.yaml it's possible to set tags:

      service-tags: ["relational", "database"]

You can find a working in mta.yaml#L127. This tags mimic the tags that the PostgreSQL on SAP BTP, hyperscaler option creates in VCAP_SERVICES:

"tags": ["relational", "database"]

So I would suggest to read VCAP_SERVICES by the tag "database".

@gregorwolf gregorwolf added the bug Something isn't working label Nov 17, 2023
@patricebender patricebender added postgres gap and removed bug Something isn't working labels Nov 21, 2023
@johannes-vogel
Copy link
Contributor

Hi Gregor,

we've discussed this internally and have the following proposal:

Instead of switching to tags in general, we could introduce an own tag postgres which we can use if the label does not match.

Our default could be extended to:

  "cds": {
    "requires": {
      "kinds": {
        "postgres": {
          "vcap": {
            "label": "postgesql-db",
            "tags": "postgres"
          }
        }
      }
    }
  }

For hyperscaler, you could then simply tag them with postges.
Reason is that the tags database and relational are not unique and e. g. also used for SAP HANA.

Does that work for you?

Best,
Johannes

@gregorwolf
Copy link
Collaborator Author

As long as the Hyperscaler Service still works with additional manual settings I'm fine with this approach. For a User Provided Service the tag must be defined anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants