pgadmin

package
v4.4.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(qr *queryRunner, username string) error

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

func GetUsernames(qr *queryRunner) ([]string, error)

GetUsernames provides a list of the provisioned pgadmin login users

func HashPassword

func HashPassword(qr *queryRunner, pass string) (string, error)

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

func NewQueryRunner(clientset kubernetes.Interface, apic *rest.Config, pod v1.Pod) *queryRunner

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

func SetLoginPassword(qr *queryRunner, username, pass string) error

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 Backoff

type Backoff interface {
	Duration(round int) time.Duration
}

Backoff interface provides increasing length delays for event spacing

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...

func (ExponentialBackoffPolicy) Duration

func (cbp ExponentialBackoffPolicy) Duration(n int) time.Duration

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
)

func (Jitter) Apply

func (jm Jitter) Apply(t time.Duration) time.Duration

Apply provides a new time with respect to t based on the jitter mode

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

type SpecificBackoffPolicy

type SpecificBackoffPolicy struct {
	Times      []time.Duration
	JitterMode Jitter
}

SpecificBackoffPolicy allows manually specifying retry times

func (SpecificBackoffPolicy) Duration

func (sbp SpecificBackoffPolicy) Duration(n int) time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL