Skip to content

When using long names for namespaces and TCPs, kine uses truncated username+schema #889

@toelke

Description

@toelke

Hi all!

We are using rather long names for namespaces and TCPs:

$ kubectl get tcp -A
AMESPACE                                                       NAME                                       VERSION   STATUS   CONTROL-PLANE ENDPOINT   KUBECONFIG                                                  DATASTORE   AGE
customer-project-gws-dev-f7d30cc5-3ecb-49c3-9df4-faeee92ebffd   k8s-052c018d-35b4-423a-a5d9-8f38ffeecfec   v1.30.2   Ready    10.97.0.2:6443           k8s-052c018d-35b4-423a-a5d9-8f38ffeecfec-admin-kubeconfig   default     5m44s

The username generated for kine to access postgres reflects that:

$ kubectl get -n customer-project-gws-dev-f7d30cc5-3ecb-49c3-9df4-faeee92ebffd secret k8s-052c018d-35b4-423a-a5d9-8f38ffeecfec-datastore-config -o yaml | yq '.data.DB_USER | @base64d'
"customer_project_gws_dev_f7d30cc5_3ecb_49c3_9df4_faeee92ebffd_k8s_052c018d_35b4_423a_a5d9_8f38ffeecfec"

But since that is longer than the 63 characters postgres allows as a username, it is truncated in actual use.

This means that when creating two clusters, we get this error message from kine:

time="2025-07-23T08:56:46Z" level=fatal msg="building kine: pq: password authentication failed for user \"customer_project_gws_dev_f7d30cc5_3ecb_49c3_9df4_faeee92ebffd_k\\""

I could not find the place where this username and schema is generated; do you think there is an easy way to shorten this? (Perhaps by hashing long names and hoping there will not be a collision?)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions