util

package
v4.1.1-rc2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

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, *appsv1.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 *appsv1.Deployment, namespace, databasePort string) (uint64, uint64, string, error)

func GetSecretPassword

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

GetSecretPassword ...

func IsAutofailEnabled

func IsAutofailEnabled(cluster *crv1.Pgcluster) bool

IsAutofailEnabled - returns true if autofail label is set to true, false if not.

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 UpdatePolicyLabels

func UpdatePolicyLabels(clientset *kubernetes.Clientset, clusterName string, namespace string, newLabels map[string]string) error

UpdatePolicyLabels ...

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