k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.56k stars 233 forks source link

PostgreSQL's `target_session_attrs` is not supported #159

Closed DerEnderKeks closed 1 year ago

DerEnderKeks commented 1 year ago

Currently, it is not possible to use a PostgreSQL cluster that is based on the native client failover mechanism using target_session_attrs, which is implemented in libpq, because Kine is using lib/pq, which doesn't implement this feature.

Starting K3s with a PostgreSQL URL that contains the target_session_attrs parameter thus results in the following error:

level=fatal msg="starting kubernetes: preparing server: creating storage endpoint: building kine: pq: unrecognized configuration parameter \"target_session_attrs\""

As lib/pq is currently in maintenance mode, this feature probably won't happen there, and it would thus be required to replace lib/pq with a driver that supports the target_session_attrs feature, preferably one that is based on libpq itself. Alternatively, something like jackc/pgx could be used, which is also written in pure Go, just like lib/pq, in case that this is a requirement.

Would it be feasible to do this? I would offer my help, if you are ok with replacing the driver with something else.

brandond commented 1 year ago

If you're willing to take a shot at replacing it, please do so!

DerEnderKeks commented 1 year ago

As the PR is merged, I'm closing this issue. As soon as the Kine version in K3s gets bumped, this problem should be solved there.