util

package
v3.5.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const GLOBAL_CUSTOM_CONFIGMAP = "pgo-custom-pg-config"
View Source
const LABEL_ARCHIVE = "archive"
View Source
const LABEL_ARCHIVE_TIMEOUT = "archive-timeout"
View Source
const LABEL_AUTOFAIL = "autofail"
View Source
const LABEL_AUTOFAIL_REPLACE_REPLICA = "autofail-replace-replica"
View Source
const LABEL_BACKREST = "pgo-backrest"
View Source
const LABEL_BACKREST_BACKUP_OPTS = "backrest-backup-opts"
View Source
const LABEL_BACKREST_COMMAND = "backrest-command"
View Source
const LABEL_BACKREST_JOB = "pgo-backrest-job"
View Source
const LABEL_BACKREST_OPTS = "backrest-opts"
View Source
const LABEL_BACKREST_PITR_TARGET = "backrest-pitr-target"
View Source
const LABEL_BACKREST_RESTORE = "pgo-backrest-restore"
View Source
const LABEL_BACKREST_RESTORE_FROM_CLUSTER = "backrest-restore-from-cluster"
View Source
const LABEL_BACKREST_RESTORE_OPTS = "backrest-restore-opts"
View Source
const LABEL_BACKREST_RESTORE_TO_PVC = "backrest-restore-to-pvc"
View Source
const LABEL_BACKUP_TYPE_BACKREST = "pgbackrest"
View Source
const LABEL_BACKUP_TYPE_BASEBACKUP = "pgbasebackup"
View Source
const LABEL_BACKUP_TYPE_PGDUMP = "pgdump"
View Source
const LABEL_BADGER = "crunchy-pgbadger"
View Source
const LABEL_CCP_IMAGE_KEY = "ccp-image"
View Source
const LABEL_CCP_IMAGE_TAG_KEY = "ccp-image-tag"
View Source
const LABEL_CLAIM_NAME = "claimName"
View Source
const LABEL_COLLECT = "crunchy_collect"
View Source
const LABEL_CONTAINER_NAME = "containername"
View Source
const LABEL_CURRENT_PRIMARY = "current-primary"
View Source
const LABEL_CUSTOM_CONFIG = "custom-config"
View Source
const LABEL_DATA_ROOT = "data-root"
View Source
const LABEL_DELETE_DATA = "delete-data"
View Source
const LABEL_DELETE_DATA_STARTED = "delete-data-started"
View Source
const LABEL_DEPLOYMENT_NAME = "deployment-name"
View Source
const LABEL_FAILOVER = "failover"
View Source
const LABEL_FAILOVER_STARTED = "failover-started"
View Source
const LABEL_FALSE = "false"
View Source
const LABEL_INGEST = "ingest"
View Source
const LABEL_JOB_NAME = "job-name"
View Source
const LABEL_NAME = "name"

resource labels used by the operator

View Source
const LABEL_NAMESPACE = "namespace"
View Source
const LABEL_NODE_LABEL = "node-label"
View Source
const LABEL_NODE_LABEL_KEY = "NodeLabelKey"
View Source
const LABEL_NODE_LABEL_VALUE = "NodeLabelValue"
View Source
const LABEL_OPERATOR = "postgres-operator"
View Source
const LABEL_PASSWORD = "password"
View Source
const LABEL_PGBACKREST_DB_PATH = "pgbackrest-db-path"
View Source
const LABEL_PGBACKREST_REPO_HOST = "pgbackrest-repo-host"
View Source
const LABEL_PGBACKREST_REPO_PATH = "pgbackrest-repo-path"
View Source
const LABEL_PGBACKREST_STANZA = "pgbackrest-stanza"
View Source
const LABEL_PGBACKUP = "pgbackup"
View Source
const LABEL_PGBOUNCER = "crunchy-pgbouncer"
View Source
const LABEL_PGBOUNCER_PASS = "pgbouncer-password"
View Source
const LABEL_PGBOUNCER_SECRET = "pgbouncer-secret"
View Source
const LABEL_PGBOUNCER_TASK_ADD = "pgbouncer-add"
View Source
const LABEL_PGBOUNCER_TASK_CLUSTER = "pgbouncer-cluster"
View Source
const LABEL_PGBOUNCER_TASK_DELETE = "pgbouncer-delete"
View Source
const LABEL_PGBOUNCER_TASK_RECONFIGURE = "pgbouncer-reconfigure"
View Source
const LABEL_PGBOUNCER_USER = "pgbouncer-user"
View Source
const LABEL_PGDUMP_ALL = "pgdump-all"
View Source
const LABEL_PGDUMP_COMMAND = "pgdump"
View Source
const LABEL_PGDUMP_DB = "pgdump-db"
View Source
const LABEL_PGDUMP_HOST = "pgdump-host"
View Source
const LABEL_PGDUMP_OPTS = "pgdump-opts"
View Source
const LABEL_PGDUMP_PORT = "pgdump-port"
View Source
const LABEL_PGDUMP_PVC = "pgdump-pvc"
View Source
const LABEL_PGDUMP_RESTORE = "pgdump-restore"
View Source
const LABEL_PGDUMP_USER = "pgdump-user"
View Source
const LABEL_PGO_BACKREST_REPO = "pgo-backrest-repo"
View Source
const LABEL_PGO_BENCHMARK = "pgo-benchmark"
View Source
const LABEL_PGO_VERSION = "pgo-version"
View Source
const LABEL_PGPOLICY = "pgpolicy"
View Source
const LABEL_PGPOOL = "crunchy-pgpool"
View Source
const LABEL_PGPOOL_SECRET = "pgpool-secret"
View Source
const LABEL_PGPOOL_TASK_ADD = "pgpool-add"
View Source
const LABEL_PGPOOL_TASK_CLUSTER = "pgpool-cluster"
View Source
const LABEL_PGPOOL_TASK_DELETE = "pgpool-delete"
View Source
const LABEL_PGPOOL_TASK_RECONFIGURE = "pgpool-reconfigure"
View Source
const LABEL_PGREMOVE = "pgremove"
View Source
const LABEL_PGRESTORE_COMMAND = "pgrestore"
View Source
const LABEL_PGRESTORE_DB = "pgrestore-db"
View Source
const LABEL_PGRESTORE_FROM_CLUSTER = "pgrestore-from-cluster"
View Source
const LABEL_PGRESTORE_FROM_PVC = "pgrestore-from-pvc"
View Source
const LABEL_PGRESTORE_HOST = "pgrestore-host"
View Source
const LABEL_PGRESTORE_OPTS = "pgrestore-opts"
View Source
const LABEL_PGRESTORE_PITR_TARGET = "pgrestore-pitr-target"
View Source
const LABEL_PGRESTORE_PORT = "pgrestore-port"
View Source
const LABEL_PGRESTORE_USER = "pgrestore-user"
View Source
const LABEL_PGTASK = "pg-task"
View Source
const LABEL_PG_CLUSTER = "pg-cluster"
View Source
const LABEL_PG_CLUSTER_IDENTIFIER = "pg-cluster-id"
View Source
const LABEL_PG_DATABASE = "pg-database"
View Source
const LABEL_POD_NAME = "podname"
View Source
const LABEL_PRIMARY = "primary"
View Source
const LABEL_PVCNAME = "pvcname"
View Source
const LABEL_PVC_NAME = "pvc-name"
View Source
const LABEL_REPLICA_COUNT = "replica-count"
View Source
const LABEL_REPLICA_NAME = "replica-name"
View Source
const LABEL_RESOURCES_CONFIG = "resources-config"
View Source
const LABEL_RESTORE_TYPE_PGRESTORE = "pgrestore"
View Source
const LABEL_RMDATA = "pgrmdata"
View Source
const LABEL_SELECTOR = "selector"
View Source
const LABEL_SERVICE_NAME = "service-name"
View Source
const LABEL_SERVICE_TYPE = "service-type"
View Source
const LABEL_SESSION_ID = "sessionid"
View Source
const LABEL_STORAGE_CONFIG = "storage-config"
View Source
const LABEL_TARGET = "target"
View Source
const LABEL_TRUE = "true"
View Source
const LABEL_UPGRADE_DATE = "operator-upgrade-date"
View Source
const LABEL_USERNAME = "username"
View Source
const LABEL_VERSION = "version"
View Source
const LABEL_VOLUME_NAME = "volume-name"

Variables

This section is empty.

Functions

func CopySecrets

func CopySecrets(clientset *kubernetes.Clientset, namespace string, fromCluster, toCluster string) error

CopySecrets will copy a secret to another secret

func CreateBackrestPVCSnippet

func CreateBackrestPVCSnippet(backRestPVCName string) string

CreateBackrestPVCSnippet

func CreateBackupPVCSnippet

func CreateBackupPVCSnippet(backupPVCName string) string

CreateBackupPVCSnippet generates the PVC definition fragment

func CreatePVCSnippet

func CreatePVCSnippet(storageType string, PVCName string) string

CreatePVCSnippet generates the PVC json snippet

func CreateSecContext

func CreateSecContext(fsGroup string, suppGroup string) string

CreateSecContext will generate the JSON security context fragment for a storage type

func CreateSecret

func CreateSecret(clientset *kubernetes.Clientset, db, secretName, username, password, namespace string) error

CreateSecret create the secret, user, and primary secrets

func CreateUserSecret

func CreateUserSecret(clientset *kubernetes.Clientset, clustername, username, password, namespace string, passwordLength int) error

CreateUserSecret will create a new secret holding a user credential

func DrainDeployment

func DrainDeployment(clientset *kubernetes.Clientset, name string, namespace string) error

DrainDeployment will drain a deployment to 0 pods

func ExecPolicy

func ExecPolicy(clientset *kubernetes.Clientset, restclient *rest.RESTClient, namespace string, policyName string, clusterName string) error

ExecPolicy execute a sql policy against a cluster

func GeneratePassword

func GeneratePassword(length int) string

GeneratePassword generate a password of a given length

func GenerateRandString

func GenerateRandString(length int) string

GenerateRandString generate a rand lowercase string of a given length

func GetBestTarget

func GetBestTarget(clientset *kubernetes.Clientset, clusterName, namespace string) (*v1.Pod, *v1beta1.Deployment, error)

GetBestTarget

func GetLabels

func GetLabels(name, clustername string, replica bool) string

GetLabels ...

func GetMD5HashForAuthFile

func GetMD5HashForAuthFile(text string) string

Generates an Md5Hash

func GetPasswordFromSecret

func GetPasswordFromSecret(clientset *kubernetes.Clientset, namespace string, secretName string) (string, string, error)

GetPasswordFromSecret will fetch the username, password from a user secret

func GetPod

func GetPod(clientset *kubernetes.Clientset, deploymentName, namespace string) (*v1.Pod, error)

GetPod determines the best target to fail to

func GetPolicySQL

func GetPolicySQL(restclient *rest.RESTClient, namespace, policyName string) (string, error)

GetPolicySQL returns the SQL string from a policy

func GetPreferredNodes

func GetPreferredNodes(clientset *kubernetes.Clientset, selector, namespace string) ([]string, error)

func GetRepStatus

func GetRepStatus(restclient *rest.RESTClient, clientset *kubernetes.Clientset, dep *v1beta1.Deployment, namespace, databasePort string) (uint64, uint64, string)

func GetSecretPassword

func GetSecretPassword(clientset *kubernetes.Clientset, db, suffix, Namespace string) (string, error)

GetSecretPassword ...

func LoadTemplate

func LoadTemplate(path string) *template.Template

LoadTemplate will load a JSON template from a path

func NewClient

func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error)

NewClient gets a REST connection to Kube

func Patch

func Patch(restclient *rest.RESTClient, path string, value string, resource string, name string, namespace string) error

Patch will patch a particular resource

func PatchClusterCRD

func PatchClusterCRD(restclient *rest.RESTClient, labelMap map[string]string, oldCrd *crv1.Pgcluster, namespace string) error

PatchClusterCRD patches the pgcluster CRD

func RandStringBytesRmndr

func RandStringBytesRmndr(n int) string

RandStringBytesRmndr ...

func RunPsql

func RunPsql(password string, hostip string, sqlstring string) error

RunPsql runs a psql statement

func ScaleDeployment

func ScaleDeployment(clientset *kubernetes.Clientset, deploymentName, namespace string, replicaCount int) error

ScaleDeployment will increase the number of pods in a deployment

func UpdateUserSecret

func UpdateUserSecret(clientset *kubernetes.Clientset, clustername, username, password, namespace string, passwordLength int) error

UpdateUserSecret updates a user secret with a new password

func ValidatePolicy

func ValidatePolicy(restclient *rest.RESTClient, namespace string, policyName string) error

ValidatePolicy tests to see if a policy exists

func WaitUntilDeploymentIsDeleted

func WaitUntilDeploymentIsDeleted(clientset *kubernetes.Clientset, depname string, timeout time.Duration, namespace string) error

WaitUntilDeploymentIsDeleted timeout := time.Minute

func WaitUntilPod

func WaitUntilPod(clientset *kubernetes.Clientset, lo meta_v1.ListOptions, podPhase v1.PodPhase, timeout time.Duration, namespace string) error

WaitUntilPod ... podPhase is v1.PodRunning timeout := time.Minute

func WaitUntilPodIsDeleted

func WaitUntilPodIsDeleted(clientset *kubernetes.Clientset, podname string, timeout time.Duration, namespace string) error

WaitUntilPodIsDeleted timeout := time.Minute

Types

type ReplicationInfo

type ReplicationInfo struct {
	ReceiveLocation uint64
	ReplayLocation  uint64
	Node            string
	DeploymentName  string
}

func GetReplicationInfo

func GetReplicationInfo(target string) (*ReplicationInfo, error)

type ThingSpec

type ThingSpec struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

ThingSpec is a json patch structure

Jump to

Keyboard shortcuts

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