Documentation ¶
Index ¶
- Constants
- Variables
- func PostgreSQLWALPath(cluster string) string
- func PostgreSQLWALVolumeMount() core_v1.VolumeMount
- type ClusterStruct
- type PgoConfig
- func (c *PgoConfig) CheckEnv()
- func (c *PgoConfig) DefaultTemplate(path string) (string, error)
- func (c *PgoConfig) GetConfig(clientset *kubernetes.Clientset, namespace string) error
- func (c *PgoConfig) GetPodAntiAffinitySpec(cluster, pgBackRest, pgBouncer crv1.PodAntiAffinityType) (crv1.PodAntiAffinitySpec, error)
- func (c *PgoConfig) GetStorageSpec(name string) (crv1.PgStorageSpec, error)
- func (c *PgoConfig) LoadTemplate(cMap *v1.ConfigMap, rootPath, path string) (*template.Template, error)
- func (c *PgoConfig) Validate() error
- type PgoStruct
- type StorageStruct
Constants ¶
const ( ANNOTATION_PGHA_BOOTSTRAP_REPLICA = "pgo-pgha-bootstrap-replica" ANNOTATION_CLONE_BACKREST_PVC_SIZE = "clone-backrest-pvc-size" ANNOTATION_CLONE_ENABLE_METRICS = "clone-enable-metrics" ANNOTATION_CLONE_PVC_SIZE = "clone-pvc-size" ANNOTATION_CLONE_SOURCE_CLUSTER_NAME = "clone-source-cluster-name" ANNOTATION_CLONE_TARGET_CLUSTER_NAME = "clone-target-cluster-name" ANNOTATION_PRIMARY_DEPLOYMENT = "primary-deployment" // annotation to track the cluster's current primary ANNOTATION_CURRENT_PRIMARY = "current-primary" // annotation to indicate whether a cluster has been upgraded ANNOTATION_IS_UPGRADED = "is-upgraded" // annotation to store the Operator versions upgraded from and to ANNOTATION_UPGRADE_INFO = "upgrade-info" // annotation to store the string boolean, used when checking upgrade status ANNOTATIONS_FALSE = "false" )
annotations used by the operator
const ( // ControllerGroupRefreshInterval is the default informer refresh interval in seconds // for the controllers created by the Controller Manager that require a refresh interval DefaultControllerGroupRefreshInterval = 60 // NamespaceRefreshInterval is the default informer refresh interval in seconds // for the Operator's namespace controller DefaultNamespaceRefreshInterval = 60 )
The following constants define the default refresh intervals for any informers created by that require a refresh interval
const ( // DefaultConfigMapWorkerCount defines the default number or workers for the worker queue // in the ConfigMap controller DefaultConfigMapWorkerCount = 2 // DefaultNamespaceWorkerCount defines the default number or workers for the worker queue // in the Namespace controller DefaultNamespaceWorkerCount = 3 // DefaultPGClusterWorkerCount defines the default number or workers for the worker queue // in the PGCluster controller DefaultPGClusterWorkerCount = 1 // DefaultPGReplicaWorkerCount defines the default number or workers for the worker queue // in the PGReplica controller DefaultPGReplicaWorkerCount = 1 // DefaultPGTaskWorkerCount defines the default number or workers for the worker queue // in the PGTask controller DefaultPGTaskWorkerCount = 1 )
The following constants define the default number of workers created for the worker queues created within the various controller created by the Operator
const ( CONTAINER_IMAGE_PGO_BACKREST = "pgo-backrest" CONTAINER_IMAGE_PGO_BACKREST_REPO = "pgo-backrest-repo" CONTAINER_IMAGE_PGO_BACKREST_REPO_SYNC = "pgo-backrest-repo-sync" CONTAINER_IMAGE_PGO_BACKREST_RESTORE = "pgo-backrest-restore" CONTAINER_IMAGE_PGO_CLIENT = "pgo-client" CONTAINER_IMAGE_PGO_LOAD = "pgo-load" CONTAINER_IMAGE_PGO_RMDATA = "pgo-rmdata" CONTAINER_IMAGE_PGO_SQL_RUNNER = "pgo-sqlrunner" CONTAINER_IMAGE_CRUNCHY_ADMIN = "crunchy-admin" CONTAINER_IMAGE_CRUNCHY_BACKREST_RESTORE = "crunchy-backrest-restore" CONTAINER_IMAGE_CRUNCHY_COLLECT = "crunchy-collect" CONTAINER_IMAGE_CRUNCHY_GRAFANA = "crunchy-grafana" CONTAINER_IMAGE_CRUNCHY_PGADMIN = "crunchy-pgadmin4" CONTAINER_IMAGE_CRUNCHY_PGBADGER = "crunchy-pgbadger" CONTAINER_IMAGE_CRUNCHY_PGBOUNCER = "crunchy-pgbouncer" CONTAINER_IMAGE_CRUNCHY_PGDUMP = "crunchy-pgdump" CONTAINER_IMAGE_CRUNCHY_PGRESTORE = "crunchy-pgrestore" CONTAINER_IMAGE_CRUNCHY_POSTGRES_HA = "crunchy-postgres-ha" CONTAINER_IMAGE_CRUNCHY_POSTGRES_GIS_HA = "crunchy-postgres-gis-ha" CONTAINER_IMAGE_CRUNCHY_PROMETHEUS = "crunchy-prometheus" )
a list of container images that are available
const CONFIG_PATH = "pgo.yaml"
const CustomConfigMapName = "pgo-config"
const CustomConfigsPath = "/pgo-config/"
const DEFAULT_BACKREST_PORT = 2022
const DEFAULT_EXPORTER_PORT = "9187"
const DEFAULT_PATRONI_PORT = "8009"
const DEFAULT_PGADMIN_PORT = "5050"
const DEFAULT_PGBADGER_PORT = "10000"
const DEFAULT_POSTGRES_PORT = "5432"
const DEFAULT_SERVICE_TYPE = "ClusterIP"
const DefaultConfigsPath = "/default-pgo-config/"
const DefaultPgBouncerReplicas = 1
DefaultPgBouncerReplicas is the total number of Pods to place in a pgBouncer Deployment
const GLOBAL_CUSTOM_CONFIGMAP = "pgo-custom-pg-config"
const LABEL_ARCHIVE = "archive"
const LABEL_ARCHIVE_TIMEOUT = "archive-timeout"
const LABEL_AUTOFAIL = "autofail"
const LABEL_BACKREST = "pgo-backrest"
const LABEL_BACKREST_BACKUP_OPTS = "backrest-backup-opts"
const LABEL_BACKREST_COMMAND = "backrest-command"
const LABEL_BACKREST_JOB = "pgo-backrest-job"
const LABEL_BACKREST_OPTS = "backrest-opts"
const LABEL_BACKREST_PITR_TARGET = "backrest-pitr-target"
const LABEL_BACKREST_REPO_SECRET = "backrest-repo-config"
const LABEL_BACKREST_RESTORE = "pgo-backrest-restore"
const LABEL_BACKREST_RESTORE_FROM_CLUSTER = "backrest-restore-from-cluster"
const LABEL_BACKREST_RESTORE_OPTS = "backrest-restore-opts"
const LABEL_BACKREST_RESTORE_TO_PVC = "backrest-restore-to-pvc"
const LABEL_BACKREST_STORAGE_TYPE = "backrest-storage-type"
const LABEL_BACKUP_TYPE_BACKREST = "pgbackrest"
const LABEL_BACKUP_TYPE_PGDUMP = "pgdump"
const LABEL_BADGER = "crunchy-pgbadger"
const LABEL_BADGER_CCPIMAGE = "crunchy-pgbadger"
const LABEL_CCP_IMAGE_KEY = "ccp-image"
const LABEL_CCP_IMAGE_TAG_KEY = "ccp-image-tag"
const LABEL_CLAIM_NAME = "claimName"
const LABEL_COLLECT = "crunchy_collect"
const LABEL_COLLECT_PG_USER = "ccp_monitoring"
const LABEL_CONTAINER_NAME = "containername"
const LABEL_CRUNCHY = "crunchydata"
const LABEL_CURRENT_PRIMARY = "current-primary"
const LABEL_CUSTOM_CONFIG = "custom-config"
const LABEL_DATA_ROOT = "data-root"
const LABEL_DELETE_BACKUPS = "delete-backups"
const LABEL_DELETE_DATA = "delete-data"
const LABEL_DELETE_DATA_STARTED = "delete-data-started"
const LABEL_DEPLOYMENT_NAME = "deployment-name"
const LABEL_FAILOVER = "failover"
const LABEL_FAILOVER_STARTED = "failover-started"
const LABEL_FALSE = "false"
const LABEL_IMAGE_PREFIX = "image-prefix"
const LABEL_INGEST = "ingest"
const LABEL_IS_BACKUP = "is-backup"
const LABEL_IS_REPLICA = "is-replica"
const LABEL_JOB_NAME = "job-name"
const LABEL_NAME = "name"
resource labels used by the operator
const LABEL_NAMESPACE = "namespace"
const LABEL_NODE_LABEL = "node-label"
const LABEL_NODE_LABEL_KEY = "NodeLabelKey"
const LABEL_NODE_LABEL_VALUE = "NodeLabelValue"
const LABEL_OPERATOR = "postgres-operator"
const LABEL_PASSWORD = "password"
const LABEL_PGADMIN = "crunchy-pgadmin"
const LABEL_PGADMIN_TASK_ADD = "pgadmin-add"
const LABEL_PGADMIN_TASK_CLUSTER = "pgadmin-cluster"
const LABEL_PGADMIN_TASK_DELETE = "pgadmin-delete"
const LABEL_PGBACKREST_DB_PATH = "pgbackrest-db-path"
const LABEL_PGBACKREST_REPO_HOST = "pgbackrest-repo-host"
const LABEL_PGBACKREST_REPO_PATH = "pgbackrest-repo-path"
const LABEL_PGBACKREST_STANZA = "pgbackrest-stanza"
const LABEL_PGBOUNCER = "crunchy-pgbouncer"
const LABEL_PGDUMP_ALL = "pgdump-all"
const LABEL_PGDUMP_COMMAND = "pgdump"
const LABEL_PGDUMP_DB = "pgdump-db"
const LABEL_PGDUMP_HOST = "pgdump-host"
const LABEL_PGDUMP_OPTS = "pgdump-opts"
const LABEL_PGDUMP_PORT = "pgdump-port"
const LABEL_PGDUMP_PVC = "pgdump-pvc"
const LABEL_PGDUMP_RESTORE = "pgdump-restore"
const LABEL_PGDUMP_USER = "pgdump-user"
const LABEL_PGHA_BACKUP_TYPE = "pgha-backup-type"
const LABEL_PGHA_CONFIGMAP = "pgha-config"
const LABEL_PGHA_ROLE = "role"
const LABEL_PGHA_ROLE_PRIMARY = "master"
const LABEL_PGHA_ROLE_REPLICA = "replica"
const LABEL_PGHA_SCOPE = "crunchy-pgha-scope"
const LABEL_PGOUSER = "pgouser"
const LABEL_PGO_BACKREST_REPO = "pgo-backrest-repo"
const LABEL_PGO_CLONE = "pgo-clone"
a general label for grouping all the tasks...helps with cleanups
const LABEL_PGO_CLONE_STEP_1 = "pgo-clone-step-1"
the individualized step labels
const LABEL_PGO_CLONE_STEP_2 = "pgo-clone-step-2"
const LABEL_PGO_CLONE_STEP_3 = "pgo-clone-step-3"
const LABEL_PGO_CREATED_BY = "pgo-created-by"
const LABEL_PGO_INSTALLATION_NAME = "pgo-installation-name"
const LABEL_PGO_LOAD = "pgo-load"
const LABEL_PGO_PGOROLE = "pgo-pgorole"
const LABEL_PGO_PGOUSER = "pgo-pgouser"
const LABEL_PGO_UPDATED_BY = "pgo-updated-by"
const LABEL_PGO_VERSION = "pgo-version"
const LABEL_PGPOLICY = "pgpolicy"
const LABEL_PGREMOVE = "pgremove"
const LABEL_PGRESTORE_COMMAND = "pgrestore"
const LABEL_PGRESTORE_DB = "pgrestore-db"
const LABEL_PGRESTORE_FROM_CLUSTER = "pgrestore-from-cluster"
const LABEL_PGRESTORE_FROM_PVC = "pgrestore-from-pvc"
const LABEL_PGRESTORE_HOST = "pgrestore-host"
const LABEL_PGRESTORE_OPTS = "pgrestore-opts"
const LABEL_PGRESTORE_PITR_TARGET = "pgrestore-pitr-target"
const LABEL_PGRESTORE_PORT = "pgrestore-port"
const LABEL_PGRESTORE_USER = "pgrestore-user"
const LABEL_PGTASK = "pg-task"
const LABEL_PG_CLUSTER = "pg-cluster"
const LABEL_PG_CLUSTER_IDENTIFIER = "pg-cluster-id"
const LABEL_PG_DATABASE = "pgo-pg-database"
const LABEL_POD_ANTI_AFFINITY = "pg-pod-anti-affinity"
const LABEL_POD_NAME = "podname"
const LABEL_PVCNAME = "pvcname"
const LABEL_PVC_NAME = "pvc-name"
const LABEL_REPLICA_COUNT = "replica-count"
const LABEL_REPLICA_NAME = "replica-name"
const LABEL_RESTORE_TYPE_PGRESTORE = "pgrestore"
const LABEL_RMDATA = "pgrmdata"
const LABEL_ROLENAME = "rolename"
const LABEL_SELECTOR = "selector"
const LABEL_SERVICE_NAME = "service-name"
const LABEL_SERVICE_TYPE = "service-type"
const LABEL_SESSION_ID = "sessionid"
const LABEL_SHUTDOWN = "shutdown"
const LABEL_STARTUP = "startup"
const LABEL_STORAGE_CONFIG = "storage-config"
const LABEL_SYNC_REPLICATION = "sync-replication"
const LABEL_TARGET = "target"
const LABEL_TRUE = "true"
const LABEL_UPGRADE = "upgrade"
label for the pgcluster upgrade
const LABEL_USERNAME = "username"
const LABEL_VENDOR = "vendor"
const LABEL_VERSION = "version"
const LABEL_VOLUME_NAME = "volume-name"
const LABEL_WORKFLOW_ID = "workflowid" // NOTE: this now matches crv1.PgtaskWorkflowID
const LOAD_BALANCER_SERVICE_TYPE = "LoadBalancer"
const NODEPORT_SERVICE_TYPE = "NodePort"
const PGOBackrestRoleBindingPath = "pgo-backrest-role-binding.json"
const PGOBackrestRolePath = "pgo-backrest-role.json"
const PGOBackrestServiceAccountPath = "pgo-backrest-sa.json"
const PGODefaultServiceAccountPath = "pgo-default-sa.json"
const PGOPgRoleBindingPath = "pgo-pg-role-binding.json"
const PGOPgRolePath = "pgo-pg-role.json"
const PGOPgServiceAccountPath = "pgo-pg-sa.json"
const PGOTargetRoleBindingPath = "pgo-target-role-binding.json"
const PGOTargetRolePath = "pgo-target-role.json"
const PGOTargetServiceAccountPath = "pgo-target-sa.json"
const VOLUME_PGBACKREST_REPO_MOUNT_PATH = "/backrestrepo"
const VOLUME_PGBACKREST_REPO_NAME = "backrestrepo"
volume configuration settings used by the pgBackRest repo mount
const VOLUME_POSTGRESQL_DATA = "pgdata"
volume configuration settings used by the PostgreSQL data directory and mount
const VOLUME_POSTGRESQL_DATA_MOUNT_PATH = "/pgdata"
const VOLUME_SSHD_MOUNT_PATH = "/sshd"
const VOLUME_SSHD_NAME = "sshd"
volume configuration settings used by the SSHD secret
const VOLUME_TABLESPACE_NAME_PREFIX = "tablespace-"
the pattern for the volume name used on a tablespace, which follows "tablespace-<tablespaceName>"
const VOLUME_TABLESPACE_PATH_PREFIX = "/tablespaces/"
the pattern for the path used to mount the volume of a tablespace, which follows "/tablespace/<pvcName>"
const VOLUME_TABLESPACE_PVC_NAME_FORMAT = "%s-tablespace-%s"
the pattern for the name of a tablespace PVC, which is off the form: "<clusterName>-tablespace-<tablespaceName>"
Variables ¶
var ( // DefaultBackrestRepoResourceMemory is the default value of the resource // request for memory for a pgBackRest repository DefaultBackrestResourceMemory = resource.MustParse("48Mi") // DefaultInstanceResourceMemory is the default value of the resource request // for memory for a PostgreSQL instance in a cluster DefaultInstanceResourceMemory = resource.MustParse("512Mi") // DefaultPgBouncerResourceMemory is the default value of the resource request // for memory of a pgBouncer instance DefaultPgBouncerResourceMemory = resource.MustParse("24Mi") )
Default resource values for deploying a PostgreSQL cluster. These values are utilized if the user has not provided these values either through configuration or from one-off API/CLI calls.
These values were determined by either program defaults (e.g. the PostgreSQL one) and/or loose to vigorous experimentation and profiling
var AffinityTemplate *template.Template
var BackrestRestorejobTemplate *template.Template
var BackrestjobTemplate *template.Template
var BadgerTemplate *template.Template
var CollectTemplate *template.Template
var ContainerResourcesTemplate *template.Template
var DeploymentTemplate *template.Template
var LoadTemplate *template.Template
var PVCMatchLabelsTemplate *template.Template
var PVCStorageClassTemplate *template.Template
var PVCTemplate *template.Template
var PgAdminServiceTemplate *template.Template
var PgAdminTemplate *template.Template
var PgDumpBackupJobTemplate *template.Template
var PgRestoreJobTemplate *template.Template
var PgbackrestEnvVarsTemplate *template.Template
var PgbackrestS3EnvVarsTemplate *template.Template
var PgbouncerConfTemplate *template.Template
var PgbouncerHBATemplate *template.Template
var PgbouncerTemplate *template.Template
var PgbouncerUsersTemplate *template.Template
var PgmonitorEnvVarsTemplate *template.Template
var PgoBackrestRepoServiceTemplate *template.Template
var PgoBackrestRepoTemplate *template.Template
var PgoBackrestRoleBindingTemplate *template.Template
var PgoBackrestRoleTemplate *template.Template
var PgoBackrestServiceAccountTemplate *template.Template
var PgoDefaultServiceAccountTemplate *template.Template
var PgoPgRoleBindingTemplate *template.Template
var PgoPgRoleTemplate *template.Template
var PgoPgServiceAccountTemplate *template.Template
var PgoTargetRoleBindingTemplate *template.Template
var PgoTargetRoleTemplate *template.Template
var PgoTargetServiceAccountTemplate *template.Template
var PodAntiAffinityTemplate *template.Template
var PolicyJobTemplate *template.Template
var RelatedImageMap = map[string]string{ "RELATED_IMAGE_PGO_BACKREST": CONTAINER_IMAGE_PGO_BACKREST, "RELATED_IMAGE_PGO_BACKREST_REPO": CONTAINER_IMAGE_PGO_BACKREST_REPO, "RELATED_IMAGE_PGO_BACKREST_REPO_SYNC": CONTAINER_IMAGE_PGO_BACKREST_REPO_SYNC, "RELATED_IMAGE_PGO_BACKREST_RESTORE": CONTAINER_IMAGE_PGO_BACKREST_RESTORE, "RELATED_IMAGE_PGO_CLIENT": CONTAINER_IMAGE_PGO_CLIENT, "RELATED_IMAGE_PGO_LOAD": CONTAINER_IMAGE_PGO_LOAD, "RELATED_IMAGE_PGO_RMDATA": CONTAINER_IMAGE_PGO_RMDATA, "RELATED_IMAGE_PGO_SQL_RUNNER": CONTAINER_IMAGE_PGO_SQL_RUNNER, "RELATED_IMAGE_CRUNCHY_ADMIN": CONTAINER_IMAGE_CRUNCHY_ADMIN, "RELATED_IMAGE_CRUNCHY_BACKREST_RESTORE": CONTAINER_IMAGE_CRUNCHY_BACKREST_RESTORE, "RELATED_IMAGE_CRUNCHY_COLLECT": CONTAINER_IMAGE_CRUNCHY_COLLECT, "RELATED_IMAGE_CRUNCHY_PGADMIN": CONTAINER_IMAGE_CRUNCHY_PGADMIN, "RELATED_IMAGE_CRUNCHY_PGBADGER": CONTAINER_IMAGE_CRUNCHY_PGBADGER, "RELATED_IMAGE_CRUNCHY_PGBOUNCER": CONTAINER_IMAGE_CRUNCHY_PGBOUNCER, "RELATED_IMAGE_CRUNCHY_PGDUMP": CONTAINER_IMAGE_CRUNCHY_PGDUMP, "RELATED_IMAGE_CRUNCHY_PGRESTORE": CONTAINER_IMAGE_CRUNCHY_PGRESTORE, "RELATED_IMAGE_CRUNCHY_POSTGRES_HA": CONTAINER_IMAGE_CRUNCHY_POSTGRES_HA, "RELATED_IMAGE_CRUNCHY_POSTGRES_GIS_HA": CONTAINER_IMAGE_CRUNCHY_POSTGRES_GIS_HA, }
a map of the "RELATED_IMAGE_*" environmental variables to their defined container image names, which allows certain packagers to inject the full definition for where to pull a container image from
var RmdatajobTemplate *template.Template
var ServiceTemplate *template.Template
Functions ¶
func PostgreSQLWALPath ¶
PostgreSQLWALPath returns the absolute path to a mounted WAL directory.
func PostgreSQLWALVolumeMount ¶
func PostgreSQLWALVolumeMount() core_v1.VolumeMount
PostgreSQLWALVolumeMount returns the VolumeMount for the PostgreSQL WAL directory.
Types ¶
type ClusterStruct ¶
type ClusterStruct struct { CCPImagePrefix string CCPImageTag string Policies string Metrics bool Badger bool Port string PGBadgerPort string ExporterPort string User string Database string PasswordAgeDays string PasswordLength string Replicas string ServiceType string BackrestPort int Backrest bool BackrestS3Bucket string BackrestS3Endpoint string BackrestS3Region string DisableAutofail bool PgmonitorPassword string EnableCrunchyadm bool DisableReplicaStartFailReinit bool PodAntiAffinity string PodAntiAffinityPgBackRest string PodAntiAffinityPgBouncer string SyncReplication bool DefaultInstanceResourceMemory resource.Quantity `json:"DefaultInstanceMemory"` DefaultBackrestResourceMemory resource.Quantity `json:"DefaultBackrestMemory"` DefaultPgBouncerResourceMemory resource.Quantity `json:"DefaultPgBouncerMemory"` DisableFSGroup bool }
type PgoConfig ¶
type PgoConfig struct { BasicAuth string Cluster ClusterStruct Pgo PgoStruct PrimaryStorage string WALStorage string BackupStorage string ReplicaStorage string BackrestStorage string Storage map[string]StorageStruct }
func (*PgoConfig) CheckEnv ¶
func (c *PgoConfig) CheckEnv()
CheckEnv is mostly used for the OLM deployment use case when someone wants to deploy with OLM, use the baked-in configuration, but use a different set of images, by setting these env vars in the OLM CSV, users can override the baked in images
func (*PgoConfig) DefaultTemplate ¶
DefaultTemplate attempts to load a default configuration template file
func (*PgoConfig) GetConfig ¶
func (c *PgoConfig) GetConfig(clientset *kubernetes.Clientset, namespace string) error
func (*PgoConfig) GetPodAntiAffinitySpec ¶
func (c *PgoConfig) GetPodAntiAffinitySpec(cluster, pgBackRest, pgBouncer crv1.PodAntiAffinityType) (crv1.PodAntiAffinitySpec, error)
GetPodAntiAffinitySpec accepts possible user-defined values for what the pod anti-affinity spec should be, which include rules for: - PostgreSQL instances - pgBackRest - pgBouncer
func (*PgoConfig) GetStorageSpec ¶
func (c *PgoConfig) GetStorageSpec(name string) (crv1.PgStorageSpec, error)
type PgoStruct ¶
type PgoStruct struct { Audit bool ConfigMapWorkerCount *int ControllerGroupRefreshInterval *int NamespaceRefreshInterval *int NamespaceWorkerCount *int PGClusterWorkerCount *int PGOImagePrefix string PGOImageTag string PGReplicaWorkerCount *int PGTaskWorkerCount *int }
PgoStruct defines various configuration settings for the PostgreSQL Operator