operator

package
v4.2.1-2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AFFINITY_NOTINOperator = "NotIn"
View Source
const AffinityInOperator = "In"

consolidate with cluster.affinityTemplateFields

View Source
const DefaultArchiveTimeout = "60"
View Source
const DefaultPgHaConfigMapSuffix = "pgha-default-config"

Variables

View Source
var CRUNCHY_DEBUG bool
View Source
var ContainerImageOverrides = map[string]string{}

ContainerImageOverrides contains a list of container images that are overridden by the RELATED_IMAGE_* environmental variables that can be set by people deploying the Operator

View Source
var EventTCPAddress = "localhost:4150"
View Source
var InstallationName string
View Source
var NAMESPACE string
View Source
var PgoNamespace string

Functions

func AddDefaultPostgresHaConfigMap

func AddDefaultPostgresHaConfigMap(clientset *kubernetes.Clientset, cluster *crv1.Pgcluster, isInit, createDefaultPghaConf bool,
	namespace string) error

Creates a configMap containing 'crunchy-postgres-ha' configuration settings. aA default crunchy-postgres-ha configuration file is included if a default config file is not providing using a custom configMap.

func GetAffinity

func GetAffinity(nodeLabelKey, nodeLabelValue string, affoperator string) string

GetAffinity ...

func GetBadgerAddon

func GetBadgerAddon(clientset *kubernetes.Clientset, namespace string, cluster *crv1.Pgcluster, pgbadger_target string) string

func GetCollectAddon

func GetCollectAddon(clientset *kubernetes.Clientset, namespace string, spec *crv1.PgclusterSpec) string

func GetCollectVolume

func GetCollectVolume(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string) string

sets the proper collect secret in the deployment spec if collect is enabled

func GetConfVolume

func GetConfVolume(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string) string

consolidate with cluster.GetConfVolume

func GetContainerResourcesJSON

func GetContainerResourcesJSON(resources *crv1.PgContainerResources) string

GetContainerResources ...

func GetLabelsFromMap

func GetLabelsFromMap(labels map[string]string) string

needs to be consolidated with cluster.GetLabelsFromMap GetLabelsFromMap ...

func GetPgbackrestEnvVars

func GetPgbackrestEnvVars(backrestEnabled, clusterName, depName, port, storageType string) string

consolidate with cluster.GetPgbackrestEnvVars

func GetPgbackrestS3EnvVars

func GetPgbackrestS3EnvVars(cluster crv1.Pgcluster, clientset *kubernetes.Clientset,
	ns string) string

GetPgbackrestS3EnvVars retrieves the values for the various configuration settings require to configure pgBackRest for AWS S3, inlcuding a bucket, endpoint, region, key and key secret. The bucket, endpoint & region are obtained from the associated parameters in the pgcluster CR, while the key and key secret are obtained from the backrest repository secret. Once these values have been obtained, they are used to populate a template containing the various pgBackRest environment variables required to enable S3 support. After the template has been executed with the proper values, the result is then returned a string for inclusion in the PG and pgBackRest deployments.

func GetPgmonitorEnvVars

func GetPgmonitorEnvVars(metricsEnabled string) string

func GetPodAntiAffinity

func GetPodAntiAffinity(podAntiAffinityType string, clusterName string) string

GetPodAntiAffinity returns the populated pod anti-affinity json that should be attached to the various pods comprising the pg cluster

func GetReplicaAffinity

func GetReplicaAffinity(clusterLabels, replicaLabels map[string]string) string

GetReplicaAffinity ... use NotIn as an operator when a node-label is not specified on the replica, use the node labels from the primary in this case use In as an operator when a node-label is specified on the replica use the node labels from the replica in this case

func GetRepoType

func GetRepoType(backrestStorageType string) string

GetRepoType returns the proper repo type to set in container based on the backrest storage type provided

func GetSyncReplication

func GetSyncReplication(specSyncReplication *bool) bool

GetSyncReplication returns true if synchronous replication has been enabled using either the pgcluster CR specification or the pgo.yaml configuration file. Otherwise, if synchronous mode has not been enabled, it returns false.

func Initialize

func Initialize(clientset *kubernetes.Clientset)

func IsLocalAndS3Storage

func IsLocalAndS3Storage(backrestStorageType string) bool

IsLocalAndS3Storage a boolean indicating whether or not local and s3 storage should be enabled for pgBackRest based on the backrestStorageType string provided

func OverrideClusterContainerImages

func OverrideClusterContainerImages(containers []v1.Container)

OverrideClusterContainerImages is a helper function that provides the appropriate hooks to override any of the container images that might be deployed with a PostgreSQL cluster

func SetContainerImageOverride

func SetContainerImageOverride(containerImageName string, container *v1.Container)

SetContainerImageOverride determines if there is an override available for a container image, and sets said value on the Kubernetes Container image definition

func UpdatePghaDefaultConfigInitFlag

func UpdatePghaDefaultConfigInitFlag(clientset *kubernetes.Clientset, initVal bool, clusterName, namespace string)

UpdatePghaDefaultConfigInitFlag sets the init value for the pgha config file to true or false depending on the vlaue provided

Types

type DeploymentTemplateFields

type DeploymentTemplateFields struct {
	Name                string
	ClusterName         string
	Port                string
	CCPImagePrefix      string
	CCPImageTag         string
	CCPImage            string
	Database            string
	DeploymentLabels    string
	PodLabels           string
	DataPathOverride    string
	ArchiveMode         string
	ArchivePVCName      string
	XLOGDir             string
	BackrestPVCName     string
	PVCName             string
	RootSecretName      string
	UserSecretName      string
	PrimarySecretName   string
	SecurityContext     string
	ContainerResources  string
	NodeSelector        string
	ConfVolume          string
	CollectAddon        string
	CollectVolume       string
	BadgerAddon         string
	PgbackrestEnvVars   string
	PgbackrestS3EnvVars string
	PgmonitorEnvVars    string
	ScopeLabel          string
	//next 2 are for the replica deployment only
	Replicas    string
	PrimaryHost string
	// PgBouncer deployment only
	PgbouncerPass            string
	IsInit                   bool
	EnableCrunchyadm         bool
	ReplicaReinitOnStartFail bool
	PodAntiAffinity          string
	SyncReplication          bool
}

needs to be consolidated with cluster.DeploymentTemplateFields DeploymentTemplateFields ...

type PgbackrestEnvVarsTemplateFields

type PgbackrestEnvVarsTemplateFields struct {
	PgbackrestStanza            string
	PgbackrestDBPath            string
	PgbackrestRepo1Path         string
	PgbackrestRepo1Host         string
	PgbackrestRepo1Type         string
	PgbackrestLocalAndS3Storage bool
	PgbackrestPGPort            string
}

type PgbackrestS3EnvVarsTemplateFields

type PgbackrestS3EnvVarsTemplateFields struct {
	PgbackrestS3Bucket    string
	PgbackrestS3Endpoint  string
	PgbackrestS3Region    string
	PgbackrestS3Key       string
	PgbackrestS3KeySecret string
}

type PgmonitorEnvVarsTemplateFields

type PgmonitorEnvVarsTemplateFields struct {
	PgmonitorPassword string
}

type PostgresHaTemplateFields

type PostgresHaTemplateFields struct {
	LogStatement            string
	LogMinDurationStatement string
	ArchiveTimeout          string
}

Directories

Path Synopsis
Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment
Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment

Jump to

Keyboard shortcuts

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