Documentation ¶
Index ¶
- Constants
- Variables
- type ClusterStruct
- type ContainerResourcesStruct
- type PgoConfig
- func (c *PgoConfig) CheckEnv()
- func (c *PgoConfig) DefaultTemplate(path string) (string, error)
- func (c *PgoConfig) GetConf() *PgoConfig
- func (c *PgoConfig) GetConfig(clientset *kubernetes.Clientset, namespace string) error
- func (c *PgoConfig) GetContainerResource(name string) (crv1.PgContainerResources, 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) SetDefaultStorageClass(clientset *kubernetes.Clientset) error
- func (c *PgoConfig) Validate() error
- type PgoStruct
- type StorageStruct
Constants ¶
const ( ANNOTATION_PGHA_BOOTSTRAP_REPLICA = "pgo-pgha-bootstrap-replica" ANNOTATION_CLONE_SOURCE_CLUSTER_NAME = "clone-source-cluster-name" ANNOTATION_CLONE_TARGET_CLUSTER_NAME = "clone-target-cluster-name" )
annotations used 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_PGBADGER = "crunchy-pgbadger" CONTAINER_IMAGE_CRUNCHY_PGBENCH = "crunchy-pgbench" 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_BACKREST_SSH_KEY_BITS = 2048
const DEFAULT_EXPORTER_PORT = "9187"
const DEFAULT_LOG_MIN_DURATION_STATEMENT = "60000"
const DEFAULT_LOG_STATEMENT = "none"
const DEFAULT_PATRONI_PORT = "8009"
const DEFAULT_PGBADGER_PORT = "10000"
const DEFAULT_POSTGRES_PORT = "5432"
const DEFAULT_SERVICE_TYPE = "ClusterIP"
const DefaultConfigsPath = "/default-pgo-config/"
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_BASEBACKUP = "pgbasebackup"
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_INGEST = "ingest"
const LABEL_IS_BACKUP = "is-backup"
const LABEL_IS_REPLICA = "is-replica"
const LABEL_JOB_NAME = "job-name"
const LABEL_MINOR_UPGRADE = "minor-upgrade"
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_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_PGBACKUP = "pgbackup"
const LABEL_PGBASEBACKUP_RESTORE = "pgo-pgbasebackup-restore"
const LABEL_PGBASEBACKUP_RESTORE_BACKUP_PATH = "pgbasebackup-restore-backup-path"
const LABEL_PGBASEBACKUP_RESTORE_FROM_CLUSTER = "pgbasebackup-restore-from-cluster"
const LABEL_PGBASEBACKUP_RESTORE_FROM_PVC = "pgbasebackup-restore-from-pvc"
const LABEL_PGBASEBACKUP_RESTORE_TO_PVC = "pgbasebackup-restore-to-pvc"
const LABEL_PGBOUNCER = "crunchy-pgbouncer"
const LABEL_PGBOUNCER_PASS = "pgbouncer-password"
const LABEL_PGBOUNCER_SECRET = "pgbouncer-secret"
const LABEL_PGBOUNCER_TASK_ADD = "pgbouncer-add"
const LABEL_PGBOUNCER_TASK_CLUSTER = "pgbouncer-cluster"
const LABEL_PGBOUNCER_TASK_DELETE = "pgbouncer-delete"
const LABEL_PGBOUNCER_TASK_RECONFIGURE = "pgbouncer-reconfigure"
const LABEL_PGBOUNCER_USER = "pgbouncer-user"
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_DEFAULT_CONFIGMAP = "pgha-default-config"
const LABEL_PGHA_ROLE = "role"
const LABEL_PGHA_SCOPE = "crunchy-pgha-scope"
const LABEL_PGOUSER = "pgouser"
const LABEL_PGO_BACKREST_REPO = "pgo-backrest-repo"
const LABEL_PGO_BENCHMARK = "pgo-benchmark"
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_DEFAULT_SC = "pgo-default-sc"
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_RESOURCES_CONFIG = "resources-config"
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_STORAGE_CONFIG = "storage-config"
const LABEL_SYNC_REPLICATION = "sync-replication"
const LABEL_TARGET = "target"
const LABEL_TRUE = "true"
const LABEL_UPGRADE_BACKREST = "upgrade-backrest"
const LABEL_UPGRADE_COMPLETED = "upgrade-complete"
const LABEL_UPGRADE_DATE = "operator-upgrade-date"
const LABEL_UPGRADE_IN_PROGRESS = "upgrade-in-progress"
const LABEL_UPGRADE_PRIMARY = "upgrade-primary"
const LABEL_UPGRADE_REPLICA = "upgrade-replicas"
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 PostgresHaTemplatePath = "postgres-ha.yaml"
const VOLUME_PGBACKREST_REPO_MOUNT_PATH = "/backrestrepo"
const VOLUME_PGBACKREST_REPO_NAME = "backrestrepo"
volume configuration settings used by the pgBackRest repo mount
const VOLUME_SSHD_MOUNT_PATH = "/sshd"
const VOLUME_SSHD_NAME = "sshd"
volume configuration settings used by the SSHD secret
Variables ¶
var AffinityTemplate *template.Template
var BackrestRestorejobTemplate *template.Template
var BackrestjobTemplate *template.Template
var BadgerTemplate *template.Template
var BenchmarkJobTemplate *template.Template
var CollectTemplate *template.Template
var ContainerResourcesTemplate *template.Template
var DeploymentTemplate *template.Template
var JobTemplate *template.Template
var LoadTemplate *template.Template
var PVCMatchLabelsTemplate *template.Template
var PVCStorageClassTemplate *template.Template
var PVCTemplate *template.Template
var PgBasebackupRestoreJobTemplate *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 PostgresHaTemplate *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_PGBADGER": CONTAINER_IMAGE_CRUNCHY_PGBADGER, "RELATED_IMAGE_CRUNCHY_PGBENCH": CONTAINER_IMAGE_CRUNCHY_PGBENCH, "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 ¶
This section is empty.
Types ¶
type ClusterStruct ¶
type ClusterStruct struct { CCPImagePrefix string `yaml:"CCPImagePrefix"` CCPImageTag string `yaml:"CCPImageTag"` PrimaryNodeLabel string `yaml:"PrimaryNodeLabel"` ReplicaNodeLabel string `yaml:"ReplicaNodeLabel"` Policies string `yaml:"Policies"` LogStatement string `yaml:"LogStatement"` LogMinDurationStatement string `yaml:"LogMinDurationStatement"` Metrics bool `yaml:"Metrics"` Badger bool `yaml:"Badger"` Port string `yaml:"Port"` PGBadgerPort string `yaml:"PGBadgerPort"` ExporterPort string `yaml:"ExporterPort"` User string `yaml:"User"` ArchiveTimeout string `yaml:"ArchiveTimeout"` Database string `yaml:"Database"` PasswordAgeDays string `yaml:"PasswordAgeDays"` PasswordLength string `yaml:"PasswordLength"` Strategy string `yaml:"Strategy"` Replicas string `yaml:"Replicas"` ServiceType string `yaml:"ServiceType"` BackrestPort int `yaml:"BackrestPort"` Backrest bool `yaml:"Backrest"` BackrestS3Bucket string `yaml:"BackrestS3Bucket"` BackrestS3Endpoint string `yaml:"BackrestS3Endpoint"` BackrestS3Region string `yaml:"BackrestS3Region"` DisableAutofail bool `yaml:"DisableAutofail"` PgmonitorPassword string `yaml:"PgmonitorPassword"` EnableCrunchyadm bool `yaml:"EnableCrunchyadm"` DisableReplicaStartFailReinit bool `yaml:"DisableReplicaStartFailReinit"` PodAntiAffinity string `yaml:"PodAntiAffinity"` SyncReplication bool `yaml:"SyncReplication"` }
type PgoConfig ¶
type PgoConfig struct { BasicAuth string `yaml:"BasicAuth"` Cluster ClusterStruct `yaml:"Cluster"` Pgo PgoStruct `yaml:"Pgo"` ContainerResources map[string]ContainerResourcesStruct `yaml:"ContainerResources"` PrimaryStorage string `yaml:"PrimaryStorage"` BackupStorage string `yaml:"BackupStorage"` ReplicaStorage string `yaml:"ReplicaStorage"` BackrestStorage string `yaml:"BackrestStorage"` Storage map[string]StorageStruct `yaml:"Storage"` DefaultContainerResources string `yaml:"DefaultContainerResources"` DefaultLoadResources string `yaml:"DefaultLoadResources"` DefaultRmdataResources string `yaml:"DefaultRmdataResources"` DefaultBackupResources string `yaml:"DefaultBackupResources"` DefaultBadgerResources string `yaml:"DefaultBadgerResources"` DefaultPgbouncerResources string `yaml:"DefaultPgbouncerResources"` }
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) GetContainerResource ¶
func (c *PgoConfig) GetContainerResource(name string) (crv1.PgContainerResources, error)
func (*PgoConfig) GetStorageSpec ¶
func (c *PgoConfig) GetStorageSpec(name string) (crv1.PgStorageSpec, error)
func (*PgoConfig) LoadTemplate ¶
func (c *PgoConfig) LoadTemplate(cMap *v1.ConfigMap, rootPath, path string) (*template.Template, error)
LoadTemplate will load a JSON template from a path
func (*PgoConfig) SetDefaultStorageClass ¶
func (c *PgoConfig) SetDefaultStorageClass(clientset *kubernetes.Clientset) error
type StorageStruct ¶
type StorageStruct struct { AccessMode string `yaml:"AccessMode"` Size string `yaml:"Size"` StorageType string `yaml:"StorageType"` StorageClass string `yaml:"StorageClass"` Fsgroup string `yaml:"Fsgroup"` SupplementalGroups string `yaml:"SupplementalGroups"` MatchLabels string `yaml:"MatchLabels"` }