google / google/go-cloud

postgres/gcppostgres: Add support for private service connect

Open
#3,670 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.9k
Forks
856
Avg merge
1d 8h
Merged PRs (30d)
18

Description

### Is your feature request related to a problem? Please describe.

I am trying to connect a service using gocloud to a Google Cloud SQL instance which has private service connect enabled. However I'm encountering the following error:

```
Error: error connecting to PostgreSQL server :europe-west1: (gcppostgres): dial tcp :3307: connect: connection timed out
```

I see that gocloud still uses v1 of the cloudsql proxy library and with it the legacy behaviour of connecting to the first IP address returned by the SQL Admin API. I see neither docs nor code mentioning PSC support.

### Describe the solution you'd like

It is possible to connect to postgres instances on google cloud using private service connect.

### Additional context

The underlying cloudsql proxy library may need to be updated.

To make this non-breaking, go-cloud could default to using the legacy behaviour (--auto-ip flag in CLI) and new features like PSC would be opt-in.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.