PgBouncer K8s

Channel Revision Published Runs on
1/stable 103 08 Mar 2024
Ubuntu 22.04
1/candidate 145 04 May 2024
Ubuntu 22.04
1/beta 145 04 May 2024
Ubuntu 22.04
1/edge 147 04 May 2024
Ubuntu 22.04
juju deploy pgbouncer-k8s --channel 1/stable
Show information

Platform:

charms.pgbouncer_k8s.v0.pgb

PgBouncer Charm Library.

This charm library provides common pgbouncer-specific features for the pgbouncer machine and Kubernetes charms, including automatic config management using the PgbConfig object, and the default config for pgbouncer.


def parse_kv_string_to_dict(string: str)

Parses space-separated key=value pairs into a python dict.

Arguments

string

a string containing a set of key=value pairs, joined with = characters and separated with spaces

Returns

A dict containing the key-value pairs represented as strings.

Description

TODO this could make use of pgconnstr, but that requires that this charm lib has a dependency.

def parse_dict_to_kv_string(dictionary)

Helper function to encode a python dict into a pgbouncer-readable string.

Arguments

dictionary

A dict containing the key-value pairs represented as strings.

Description

TODO this could make use of pgconnstr, but that requires that this charm lib has a dependency.

def generate_password()

Generates a secure password of alphanumeric characters.

Returns

A random 24-character string of letters and numbers.

Description

Passwords are alphanumeric only, to ensure compatibility with the userlist.txt format - specifically, spaces and double quotes may interfere with parsing this file.

def get_hashed_password(
    username: str,
    password: str
)

Description

Creates an md5 hashed password for the given user, in the format postgresql expects. None