Documentation ¶
Index ¶
- func DeleteUser(qr *queryRunner, username string) error
- func GetPgAdminQueryRunner(clientset kubernetes.Interface, restconfig *rest.Config, ...) (*queryRunner, error)
- func GetUsernames(qr *queryRunner) ([]string, error)
- func HashPassword(qr *queryRunner, pass string) (string, error)
- func NewQueryRunner(clientset kubernetes.Interface, apic *rest.Config, pod v1.Pod) *queryRunner
- func SetClusterConnection(qr *queryRunner, username string, dbInfo ServerEntry) error
- func SetLoginPassword(qr *queryRunner, username, pass string) error
- type Backoff
- type ExponentialBackoffPolicy
- type Jitter
- type ServerEntry
- type SpecificBackoffPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteUser ¶
DeleteUser deletes the specified user, their servergroups, and servers
func GetPgAdminQueryRunner ¶
func GetPgAdminQueryRunner(clientset kubernetes.Interface, restconfig *rest.Config, cluster *crv1.Pgcluster) (*queryRunner, error)
GetPgAdminQueryRunner takes cluster information, identifies whether it has a pgAdmin deployment and provides a query runner for executing queries against the pgAdmin database
The pointer will be nil if there is no pgAdmin deployed for the cluster
func GetUsernames ¶
GetUsernames provides a list of the provisioned pgadmin login users
func HashPassword ¶
HashPassword emulates the PBKDF2 password hashing mechanism using a salt randomly generated and stored in the pgadmin database
It returns a string of the Modular Crypt Format result of the hash, suitable for insertion/replacement of pgadmin login password fields
func NewQueryRunner ¶
NewQueryRunner creates a query runner instance with the configuration necessary to exec into the named pod in the provided namespace
func SetClusterConnection ¶
func SetClusterConnection(qr *queryRunner, username string, dbInfo ServerEntry) error
Configures a PG connection for the given username in the pgadmin database
func SetLoginPassword ¶
Sets the login password for the given username in the pgadmin database Adds the user to the pgadmin database if it does not exist
Types ¶
type ExponentialBackoffPolicy ¶
type ExponentialBackoffPolicy struct { Ratio float64 Base time.Duration Maximum time.Duration JitterMode Jitter }
ExponentialBackoffPolicy provides an exponential backoff based on: Base * (Ratio ^ Iteration)
For example a base of 10ms, ratio of 2, and no jitter would produce: 10ms, 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1.28s, 2.56s...
type Jitter ¶
type Jitter int
Jitter is an enum representing a distinct jitter mode
const ( // JitterNone performs no Jitter, with multiple clients, can be bursty JitterNone Jitter = iota // JitterFull represents a jitter range of (0, Duration) JitterFull // JitterCenter represents a jitter range of (0.5 Duration, 1.5 Duration) // That is, full, but centered on the value JitterCenter // JitterSmall represents a jitter range of 0.75 Duration, 1.25 Duration) JitterSmall )
type ServerEntry ¶
type ServerEntry struct { Name string // Typically set to the cluster name Host string Port int MaintenanceDB string SSLMode string Comment string Password string }
ServerEntry models parts of the pgadmin server table
func ServerEntryFromPgService ¶
func ServerEntryFromPgService(service *v1.Service, clustername string) ServerEntry
ServerEntryFromPgService populates the ServerEntry struct based on details of the kubernetes service, it is up to the caller to provide the assumed PgCluster service