Skip to content

Connection string parameters break the init container #10

@reknih

Description

@reknih

Describe the bug

When connecting to an externally managed database over an encrypted connection, the parameters ?sslmode=require&ssl=true are necessary at the end of the connection string. However, when specifying them, the awk string replacement in the init script fails. This leads to the perpetually repeating error message pg_isready: error: invalid connection option "plausible_db?sslmode".

Version of Helm, Kubernetes and the plausible-analytics chart:

$ kubectl version  
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.5

$ helm version
version.BuildInfo{Version:"v3.13.2", GitCommit:"2a2fb3b98829f1e0be6fb18af2f6599e0f4e8243", GitTreeState:"clean", GoVersion:"go1.21.4"}

I used version 0.2.4 of the plausible-analytics chart

What happened:

Startup of plausible-analytics pods fails if the init-container is enabled.

What you expected to happen:

The connection string parameters should be honored in the wait-for-postgres script (or at least they should not be included in the database name). Connections to external databases forcing encryption should be possible.

How to reproduce it (as minimally and precisely as possible):

helm upgrade plausible imio/plausible-analytics --set "databaseURL=postgres://postgres:postgres@your.external.postgres.example.com:5432/plausible_db?sslmode=require&ssl=true,postgresql.enabled=false"

Anything else we need to know:

The error is here:

db=$(echo $info | awk -F[@:/] '{print $5}')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions