Documentation
¶
Overview ¶
Package naming provides functions and constants for the postgres-operator naming and labeling scheme.
Index ¶
- Constants
- func AnyCluster() metav1.LabelSelector
- func AsObjectKey(m metav1.ObjectMeta) client.ObjectKey
- func AsSelector(s metav1.LabelSelector) (labels.Selector, error)
- func Cluster(cluster string) metav1.LabelSelector
- func ClusterBackupJobs(cluster string) metav1.LabelSelector
- func ClusterConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterDataForPostgresAndPGBackRest(cluster string) metav1.LabelSelector
- func ClusterDedicatedSnapshotVolume(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterInstance(cluster, instance string) metav1.LabelSelector
- func ClusterInstanceRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterInstanceSet(cluster, set string) metav1.LabelSelector
- func ClusterInstanceSets(cluster string) metav1.LabelSelector
- func ClusterInstances(cluster string) metav1.LabelSelector
- func ClusterPGAdmin(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterPGBouncer(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterPGBouncerSelector(cluster *v1beta1.PostgresCluster) metav1.LabelSelector
- func ClusterPatronis(cluster *v1beta1.PostgresCluster) metav1.LabelSelector
- func ClusterPodService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterPostgresUsers(cluster string) metav1.LabelSelector
- func ClusterPrimaryService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterReplicaService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ClusterRestoreJobs(cluster string) metav1.LabelSelector
- func ClusterVolumeSnapshot(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func CrunchyBridgeClusterPostgresRoles(clusterName string) metav1.LabelSelector
- func DeprecatedPostgresUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func DirectoryMoveJobLabels(clusterName string) labels.Set
- func ExporterQueriesConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func ExporterWebConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func GenerateInstance(cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec) metav1.ObjectMeta
- func GenerateStartupInstance(cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec) metav1.ObjectMeta
- func InstanceCertificates(instance metav1.Object) metav1.ObjectMeta
- func InstanceConfigMap(instance metav1.Object) metav1.ObjectMeta
- func InstancePodDNSNames(ctx context.Context, instance *appsv1.StatefulSet) []string
- func InstancePostgresDataVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta
- func InstancePostgresWALVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta
- func InstanceSet(cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec) metav1.ObjectMeta
- func InstanceTablespaceDataVolume(instance *appsv1.StatefulSet, tablespaceName string) metav1.ObjectMeta
- func KubernetesClusterDomain(ctx context.Context) string
- func Merge(sets ...map[string]string) labels.Set
- func MonitoringUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func MovePGBackRestRepoDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func MovePGDataDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func MovePGWALDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func OperatorConfigurationSecret() metav1.ObjectMeta
- func PGBackRestBackupJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestBackupJobLabels(clusterName, repoName string, backupType BackupJobType) labels.Set
- func PGBackRestBackupJobSelector(clusterName, repoName string, backupType BackupJobType) labels.Selector
- func PGBackRestConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestConfigLabels(clusterName string) labels.Set
- func PGBackRestCronJob(cluster *v1beta1.PostgresCluster, backuptype, repoName string) metav1.ObjectMeta
- func PGBackRestCronJobLabels(clusterName, repoName, backupType string) labels.Set
- func PGBackRestDedicatedLabels(clusterName string) labels.Set
- func PGBackRestDedicatedSelector(clusterName string) labels.Selector
- func PGBackRestLabels(clusterName string) labels.Set
- func PGBackRestRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestRepoLabels(clusterName, repoName string) labels.Set
- func PGBackRestRepoVolume(cluster *v1beta1.PostgresCluster, repoName string) metav1.ObjectMeta
- func PGBackRestRepoVolumeLabels(clusterName, repoName string) labels.Set
- func PGBackRestRestoreConfigLabels(clusterName string) labels.Setdeprecated
- func PGBackRestRestoreConfigSelector(clusterName string) labels.Selector
- func PGBackRestRestoreJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestRestoreJobLabels(clusterName string) labels.Set
- func PGBackRestRestoreJobSelector(clusterName string) labels.Selector
- func PGBackRestSSHConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestSSHSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PGBackRestSelector(clusterName string) labels.Selector
- func PatroniDistributedConfiguration(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PatroniLeaderConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PatroniLeaderEndpoints(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PatroniScope(cluster *v1beta1.PostgresCluster) string
- func PatroniTrigger(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PostgresCustomUserSecretName(cluster *v1beta1.PostgresCluster, name string) metav1.ObjectMeta
- func PostgresRootCASecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PostgresTLSSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func PostgresUserSecret(cluster *v1beta1.PostgresCluster, username string) metav1.ObjectMeta
- func ReplicationClientCertSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
- func RepoHostPodDNSNames(ctx context.Context, repoHost *appsv1.StatefulSet) []string
- func ServiceDNSNames(ctx context.Context, service *corev1.Service) []string
- func StandalonePGAdmin(pgadmin *v1beta1.PGAdmin) metav1.ObjectMeta
- func StandalonePGAdminDataLabels(pgAdminName string) labels.Set
- func StandalonePGAdminDataSelector(pgAdmiName string) labels.Selector
- func StandalonePGAdminLabels(pgAdminName string) labels.Set
- func StandalonePGAdminSelector(pgAdminName string) labels.Selector
- func UpgradeCheckConfigMap() metav1.ObjectMeta
- func WithPerconaLabels(set map[string]string, clusterName, component, crVersion string) labels.Set
- type BackupJobType
Constants ¶
const ( // Finalizer marks an object to be garbage collected by this module. Finalizer = annotationPrefix + "finalizer" // PatroniSwitchover is the annotation added to a PostgresCluster to initiate a manual // Patroni Switchover (or Failover). PatroniSwitchover = annotationPrefix + "trigger-switchover" // PGBackRestBackup is the annotation that is added to a PostgresCluster to initiate a manual // backup. The value of the annotation will be a unique identifier for a backup Job (e.g. a // timestamp), which will be stored in the PostgresCluster status to properly track completion // of the Job. Also used to annotate the backup Job itself as needed to identify the backup // ID associated with a specific manual backup Job. PGBackRestBackup = annotationPrefix + "pgbackrest-backup" // PGBackRestBackupJobCompletion is the annotation that is added to restore jobs, pvcs, and // VolumeSnapshots that are involved in the volume snapshot creation process. The annotation // holds a RFC3339 formatted timestamp that corresponds to the completion time of the associated // backup job. PGBackRestBackupJobCompletion = annotationPrefix + "pgbackrest-backup-job-completion" // PGBackRestConfigHash is an annotation used to specify the hash value associated with a // repo configuration as needed to detect configuration changes that invalidate running Jobs // (and therefore must be recreated) PGBackRestConfigHash = annotationPrefix + "pgbackrest-hash" // PGBackRestRestore is the annotation that is added to a PostgresCluster to initiate an in-place // restore. The value of the annotation will be a unique identifier for a restore Job (e.g. a // timestamp), which will be stored in the PostgresCluster status to properly track completion // of the Job. PGBackRestRestore = annotationPrefix + "pgbackrest-restore" // PGBackRestIPVersion is an annotation used to indicate whether an IPv6 wildcard address should be // used for the pgBackRest "tls-server-address" or not. If the user wants to use IPv6, the value // should be "IPv6". As of right now, if the annotation is not present or if the annotation's value // is anything other than "IPv6", the "tls-server-address" will default to IPv4 (0.0.0.0). The need // for this annotation is due to an issue in pgBackRest (#1841) where using a wildcard address to // bind all addresses does not work in certain IPv6 environments. PGBackRestIPVersion = annotationPrefix + "pgbackrest-ip-version" // PostgresExporterCollectorsAnnotation is an annotation used to allow users to control whether or // not postgres_exporter default metrics, settings, and collectors are enabled. The value "None" // disables all postgres_exporter defaults. Disabling the defaults may cause errors in dashboards. PostgresExporterCollectorsAnnotation = annotationPrefix + "postgres-exporter-collectors" // CrunchyBridgeClusterAdoptionAnnotation is an annotation used to allow users to "adopt" or take // control over an existing Bridge Cluster with a CrunchyBridgeCluster CR. Essentially, if a // CrunchyBridgeCluster CR does not have a status.ID, but the name matches the name of an existing // bridge cluster, the user must add this annotation to the CR to allow the CR to take control of // the Bridge Cluster. The Value assigned to the annotation must be the ID of existing cluster. CrunchyBridgeClusterAdoptionAnnotation = annotationPrefix + "adopt-bridge-cluster" // AutoCreateUserSchemaAnnotation is an annotation used to allow users to control whether the cluster // has schemas automatically created for the users defined in `spec.users` for all of the databases // listed for that user. AutoCreateUserSchemaAnnotation = annotationPrefix + "autoCreateUserSchema" // AuthorizeBackupRemovalAnnotation is an annotation used to allow users // to delete PVC-based backups when changing from a cluster with backups // to a cluster without backups. As usual with the operator, we do not // touch cloud-based backups. AuthorizeBackupRemovalAnnotation = annotationPrefix + "authorizeBackupRemoval" // Used from Kubernetes v1.21+ to define a default container used when the // `-c` flag is not passed. // --https://kubernetes.io/docs/reference/labels-annotations-taints/#kubectl-kubernetes-io-default-container DefaultContainerAnnotation = "kubectl.kubernetes.io/default-container" // K8SPG-712 // OverrideConfigAnnotation is an annotation used to prevent the controller from reconciling // ConfigMaps when a user wants to manually override their contents. When this annotation // is present, the controller will not update the ConfigMap, allowing users to make custom // modifications that won't be overwritten during reconciliation. OverrideConfigAnnotation = perconaAnnotationPrefix + "override-config" )
const ( ControllerBridge = "bridge-controller" ControllerPGAdmin = "pgadmin-controller" )
const ( LabelVersion = perconaLabelPrefix + "version" LabelPerconaComponent = appK8sPrefix + "component" LabelPerconaManagedBy = appK8sPrefix + "managed-by" LabelPerconaPartOf = appK8sPrefix + "part-of" LabelPerconaName = appK8sPrefix + "name" LabelPerconaInstance = appK8sPrefix + "instance" // LabelCluster et al. provides the fundamental labels for Postgres instances LabelCluster = labelPrefix + "cluster" LabelInstance = labelPrefix + "instance" LabelInstanceSet = labelPrefix + "instance-set" // LabelRepoName is used to specify the name of a pgBackRest repository LabelRepoName = labelPrefix + "name" LabelPatroni = labelPrefix + "patroni" LabelRole = labelPrefix + "role" // LabelClusterCertificate is used to identify a secret containing a cluster certificate LabelClusterCertificate = labelPrefix + "cluster-certificate" // LabelData is used to identify Pods and Volumes store Postgres data. LabelData = labelPrefix + "data" // LabelMoveJob is used to identify a directory move Job. LabelMoveJob = labelPrefix + "move-job" // LabelMovePGBackRestRepoDir is used to identify the Job that moves an existing pgBackRest repo directory. LabelMovePGBackRestRepoDir = labelPrefix + "move-pgbackrest-repo-dir" // LabelMovePGDataDir is used to identify the Job that moves an existing pgData directory. LabelMovePGDataDir = labelPrefix + "move-pgdata-dir" // LabelMovePGWalDir is used to identify the Job that moves an existing pg_wal directory. LabelMovePGWalDir = labelPrefix + "move-pgwal-dir" // LabelPGBackRest is used to indicate that a resource is for pgBackRest LabelPGBackRest = labelPrefix + "pgbackrest" // LabelPGBackRestBackup is used to indicate that a resource is for a pgBackRest backup LabelPGBackRestBackup = labelPrefix + "pgbackrest-backup" // LabelPGBackRestConfig is used to indicate that a ConfigMap or Secret is for pgBackRest LabelPGBackRestConfig = labelPrefix + "pgbackrest-config" // LabelPGBackRestDedicated is used to indicate that a ConfigMap is for a pgBackRest dedicated // repository host LabelPGBackRestDedicated = labelPrefix + "pgbackrest-dedicated" // LabelPGBackRestRepo is used to indicate that a Deployment or Pod is for a pgBackRest // repository LabelPGBackRestRepo = labelPrefix + "pgbackrest-repo" // LabelPGBackRestRepoVolume is used to indicate that a resource for a pgBackRest // repository LabelPGBackRestRepoVolume = labelPrefix + "pgbackrest-volume" LabelPGBackRestCronJob = labelPrefix + "pgbackrest-cronjob" // LabelPGBackRestRestore is used to indicate that a Job or Pod is for a pgBackRest restore LabelPGBackRestRestore = labelPrefix + "pgbackrest-restore" // LabelPGBackRestRestoreConfig is used to indicate that a configuration // resource (e.g. a ConfigMap or Secret) is for a pgBackRest restore LabelPGBackRestRestoreConfig = labelPrefix + "pgbackrest-restore-config" // LabelPGMonitorDiscovery is the label added to Pods running the "exporter" container to // support discovery by Prometheus according to pgMonitor configuration LabelPGMonitorDiscovery = labelPrefix + "crunchy-postgres-exporter" // LabelPostgresUser identifies the PostgreSQL user an object is for or about. LabelPostgresUser = labelPrefix + "pguser" // LabelStartupInstance is used to indicate the startup instance associated with a resource LabelStartupInstance = labelPrefix + "startup-instance" RolePrimary = "primary" RoleReplica = "replica" // RolePatroniLeader is the LabelRole that Patroni sets on the Pod that is // currently the leader. RolePatroniLeader = "primary" RolePatroniLeaderDeprecated = "master" // K8SPG-648: patroni v4.0.0 deprecated "master" role. // RolePatroniReplica is a LabelRole value that Patroni sets on Pods that are // following the leader. RolePatroniReplica = "replica" // RolePGBouncer is the LabelRole applied to PgBouncer objects. RolePGBouncer = "pgbouncer" // RolePGAdmin is the LabelRole applied to pgAdmin objects. RolePGAdmin = "pgadmin" // RolePostgresData is the LabelRole applied to PostgreSQL data volumes. RolePostgresData = "pgdata" // RolePostgresUser is the LabelRole applied to PostgreSQL user secrets. RolePostgresUser = "pguser" // RolePostgresWAL is the LabelRole applied to PostgreSQL WAL volumes. RolePostgresWAL = "pgwal" // RoleMonitoring is the LabelRole applied to Monitoring resources RoleMonitoring = "monitoring" // RoleSnapshot is the LabelRole applied to Snapshot resources. RoleSnapshot = "snapshot" )
const ( // LabelCrunchyBridgeClusterPostgresRole identifies the PostgreSQL user an object is for or about. LabelCrunchyBridgeClusterPostgresRole = labelPrefix + "cbc-pgrole" // RoleCrunchyBridgeClusterPostgresRole is the LabelRole applied to CBC PostgreSQL role secrets. RoleCrunchyBridgeClusterPostgresRole = "cbc-pgrole" )
const ( // DataPGAdmin is a LabelData value that indicates the object has pgAdmin data. DataPGAdmin = "pgadmin" // DataPGBackRest is a LabelData value that indicates the object has pgBackRest data. DataPGBackRest = "pgbackrest" // DataPostgres is a LabelData value that indicates the object has PostgreSQL data. DataPostgres = "postgres" )
const ( // ContainerDatabase is the name of the container running PostgreSQL and // supporting tools: Patroni, pgBackRest, etc. ContainerDatabase = "database" // ContainerPGAdmin is the name of a container running pgAdmin. ContainerPGAdmin = "pgadmin" // ContainerPGAdminStartup is the name of the initialization container // that prepares the filesystem for pgAdmin. ContainerPGAdminStartup = "pgadmin-startup" // ContainerPGBackRestConfig is the name of a container supporting pgBackRest. ContainerPGBackRestConfig = "pgbackrest-config" // ContainerPGBouncer is the name of a container running PgBouncer. ContainerPGBouncer = "pgbouncer" // ContainerPGBouncerConfig is the name of a container supporting PgBouncer. ContainerPGBouncerConfig = "pgbouncer-config" // ContainerPostgresStartup is the name of the initialization container // that prepares the filesystem for PostgreSQL. ContainerPostgresStartup = "postgres-startup" // ContainerClientCertCopy is the name of the container that is responsible for copying and // setting proper permissions on the client certificate and key after initialization whenever // there is a change in the certificates or key ContainerClientCertCopy = "replication-cert-copy" // ContainerNSSWrapperInit is the name of the init container utilized to configure support // for the nss_wrapper ContainerNSSWrapperInit = "nss-wrapper-init" // ContainerPGBackRestLogDirInit is the name of the init container utilized to make // a pgBackRest log directory when using a dedicated repo host. ContainerPGBackRestLogDirInit = "pgbackrest-log-dir" // ContainerPGMonitorExporter is the name of a container running postgres_exporter ContainerPGMonitorExporter = "exporter" // ContainerJobMovePGDataDir is the name of the job container utilized to copy v4 Operator // pgData directories to the v5 default location ContainerJobMovePGDataDir = "pgdata-move-job" // ContainerJobMovePGWALDir is the name of the job container utilized to copy v4 Operator // pg_wal directories to the v5 default location ContainerJobMovePGWALDir = "pgwal-move-job" // ContainerJobMovePGBackRestRepoDir is the name of the job container utilized to copy v4 // Operator pgBackRest repo directories to the v5 default location ContainerJobMovePGBackRestRepoDir = "repo-move-job" )
const ( // PortExporter is the named port for the "exporter" container PortExporter = "exporter" // PortPGAdmin is the name of a port that connects to pgAdmin. PortPGAdmin = "pgadmin" // PortPGBouncer is the name of a port that connects to PgBouncer. PortPGBouncer = "pgbouncer" // PortPostgreSQL is the name of a port that connects to PostgreSQL. PortPostgreSQL = "postgres" )
const ( // Deprecated: K8SPG-555: use PostgresRootCASecret instead. // Currently it's used to update certificates from older operator version // RootCertSecret is the default root certificate secret name // TODO: remove when 2.4.0 will become unsupported RootCertSecret = "pgo-root-cacert" /* #nosec */ // ClusterCertSecret is the default cluster leaf certificate secret name ClusterCertSecret = "%s-cluster-cert" /* #nosec */ )
const ( // CertVolume is the name of the Certificate volume and volume mount in a // PostgreSQL instance Pod CertVolume = "cert-volume" // CertMountPath is the path for mounting the postgrescluster certificates // and key CertMountPath = "/pgconf/tls" // ReplicationDirectory is the directory at CertMountPath where the replication // certificates and key are mounted ReplicationDirectory = "/replication" // ReplicationTmp is the directory where the replication certificates and key can // have the proper permissions set due to: // https://github.com/kubernetes/kubernetes/issues/57923 ReplicationTmp = "/tmp/replication" // ReplicationCert is the secret key to the postgrescluster's // replication/rewind user's client certificate ReplicationCert = "tls.crt" // ReplicationCertPath is the path to the postgrescluster's replication/rewind // user's client certificate ReplicationCertPath = "replication/tls.crt" // ReplicationPrivateKey is the secret key to the postgrescluster's // replication/rewind user's client private key ReplicationPrivateKey = "tls.key" // ReplicationPrivateKeyPath is the path to the postgrescluster's // replication/rewind user's client private key ReplicationPrivateKeyPath = "replication/tls.key" // ReplicationCACert is the key name of the postgrescluster's replication/rewind // user's client CA certificate // Note: when using auto-generated certificates, this will be identical to the // server CA cert ReplicationCACert = "ca.crt" // ReplicationCACertPath is the path to the postgrescluster's replication/rewind // user's client CA certificate ReplicationCACertPath = "replication/ca.crt" )
const ( // PGBackRestRepoContainerName is the name assigned to the container used to run pgBackRest PGBackRestRepoContainerName = "pgbackrest" // PGBackRestRestoreContainerName is the name assigned to the container used to run pgBackRest // restores PGBackRestRestoreContainerName = "pgbackrest-restore" // PGBackRestRepoName is the name used for a pgbackrest repository PGBackRestRepoName = "%s-pgbackrest-repo-%s" // PGBackRestPGDataLogPath is the pgBackRest default log path configuration used by the // PostgreSQL instance. PGBackRestPGDataLogPath = "/pgdata/pgbackrest/log" // PGBackRestRepoLogPath is the pgBackRest default log path configuration used by the // dedicated repo host, if configured. PGBackRestRepoLogPath = "/pgbackrest/%s/log" // RestoreConfigCopySuffix is the suffix used for ConfigMap or Secret configuration // resources needed when restoring from a PostgresCluster data source. If, for // example, a Secret is named 'mysecret' and is the first item in the configuration // slice, the copied Secret will be named 'mysecret-restorecopy-0' RestoreConfigCopySuffix = "%s-restorecopy-%d" )
const (
// LabelStandalonePGAdmin is used to indicate a resource for a standalone-pgadmin instance.
LabelStandalonePGAdmin = labelPrefix + "pgadmin"
)
Variables ¶
This section is empty.
Functions ¶
func AnyCluster ¶
func AnyCluster() metav1.LabelSelector
AnyCluster selects things for any PostgreSQL cluster.
func AsObjectKey ¶
func AsObjectKey(m metav1.ObjectMeta) client.ObjectKey
AsObjectKey converts the ObjectMeta API type to a client.ObjectKey. When you have a client.Object, use client.ObjectKeyFromObject() instead.
func AsSelector ¶
func AsSelector(s metav1.LabelSelector) (labels.Selector, error)
AsSelector is a wrapper around metav1.LabelSelectorAsSelector() which converts the LabelSelector API type into something that implements labels.Selector.
func Cluster ¶
func Cluster(cluster string) metav1.LabelSelector
Cluster selects things for cluster.
func ClusterBackupJobs ¶
func ClusterBackupJobs(cluster string) metav1.LabelSelector
ClusterBackupJobs selects things for all existing backup jobs in cluster.
func ClusterConfigMap ¶
func ClusterConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterConfigMap returns the ObjectMeta necessary to lookup cluster's shared ConfigMap.
func ClusterDataForPostgresAndPGBackRest ¶
func ClusterDataForPostgresAndPGBackRest(cluster string) metav1.LabelSelector
ClusterDataForPostgresAndPGBackRest selects things for PostgreSQL data and things for pgBackRest data.
func ClusterDedicatedSnapshotVolume ¶
func ClusterDedicatedSnapshotVolume(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterDedicatedSnapshotVolume returns the ObjectMeta for the dedicated Snapshot volume for a cluster.
func ClusterInstance ¶
func ClusterInstance(cluster, instance string) metav1.LabelSelector
ClusterInstance selects things for a single instance in a cluster.
func ClusterInstanceRBAC ¶
func ClusterInstanceRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterInstanceRBAC returns the ObjectMeta necessary to lookup the ServiceAccount, Role, and RoleBinding for cluster's PostgreSQL instances.
func ClusterInstanceSet ¶
func ClusterInstanceSet(cluster, set string) metav1.LabelSelector
ClusterInstanceSet selects things for set in cluster.
func ClusterInstanceSets ¶
func ClusterInstanceSets(cluster string) metav1.LabelSelector
ClusterInstanceSets selects things for sets in a cluster.
func ClusterInstances ¶
func ClusterInstances(cluster string) metav1.LabelSelector
ClusterInstances selects things for PostgreSQL instances in cluster.
func ClusterPGAdmin ¶
func ClusterPGAdmin(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterPGAdmin returns the ObjectMeta necessary to lookup the ConfigMap, Service, StatefulSet, or Volume for the cluster's pgAdmin user interface.
func ClusterPGBouncer ¶
func ClusterPGBouncer(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterPGBouncer returns the ObjectMeta necessary to lookup the ConfigMap, Deployment, Secret, PodDisruptionBudget or Service that is cluster's PgBouncer proxy.
func ClusterPGBouncerSelector ¶
func ClusterPGBouncerSelector(cluster *v1beta1.PostgresCluster) metav1.LabelSelector
ClusterPGBouncerSelector selects things labeled for PGBouncer in cluster.
func ClusterPatronis ¶
func ClusterPatronis(cluster *v1beta1.PostgresCluster) metav1.LabelSelector
ClusterPatronis selects things labeled for Patroni in cluster.
func ClusterPodService ¶
func ClusterPodService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterPodService returns the ObjectMeta necessary to lookup the Service that is responsible for the network identity of Pods.
func ClusterPostgresUsers ¶
func ClusterPostgresUsers(cluster string) metav1.LabelSelector
ClusterPostgresUsers selects things labeled for PostgreSQL users in cluster.
func ClusterPrimaryService ¶
func ClusterPrimaryService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterPrimaryService returns the ObjectMeta necessary to lookup the Service that exposes the PostgreSQL primary instance.
func ClusterReplicaService ¶
func ClusterReplicaService(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterReplicaService returns the ObjectMeta necessary to lookup the Service that exposes PostgreSQL replica instances.
func ClusterRestoreJobs ¶
func ClusterRestoreJobs(cluster string) metav1.LabelSelector
ClusterRestoreJobs selects all existing restore jobs in a cluster.
func ClusterVolumeSnapshot ¶
func ClusterVolumeSnapshot(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ClusterVolumeSnapshot returns the ObjectMeta, including a random name, for a new pgdata VolumeSnapshot.
func CrunchyBridgeClusterPostgresRoles ¶
func CrunchyBridgeClusterPostgresRoles(clusterName string) metav1.LabelSelector
CrunchyBridgeClusterPostgresRoles selects things labeled for CrunchyBridgeCluster PostgreSQL roles in cluster.
func DeprecatedPostgresUserSecret ¶
func DeprecatedPostgresUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
DeprecatedPostgresUserSecret returns the ObjectMeta necessary to lookup the old Secret containing the default Postgres user and connection information. Use PostgresUserSecret instead.
func DirectoryMoveJobLabels ¶
DirectoryMoveJobLabels provides labels for PVC move Jobs.
func ExporterQueriesConfigMap ¶
func ExporterQueriesConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ExporterQueriesConfigMap returns ObjectMeta necessary to lookup and create the exporter queries configmap. This configmap is used to pass the default queries to the exporter.
func ExporterWebConfigMap ¶
func ExporterWebConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ExporterWebConfigMap returns ObjectMeta necessary to lookup and create the exporter web configmap. This configmap is used to configure the exporter web server.
func GenerateInstance ¶
func GenerateInstance( cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec, ) metav1.ObjectMeta
GenerateInstance returns a random name for a member of cluster and set.
func GenerateStartupInstance ¶
func GenerateStartupInstance( cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec, ) metav1.ObjectMeta
GenerateStartupInstance returns a stable name that's shaped like GenerateInstance above. The stable name is based on a four character hash of the cluster name and instance set name
func InstanceCertificates ¶
func InstanceCertificates(instance metav1.Object) metav1.ObjectMeta
InstanceCertificates returns the ObjectMeta necessary to lookup the Secret containing instance's certificates.
func InstanceConfigMap ¶
func InstanceConfigMap(instance metav1.Object) metav1.ObjectMeta
InstanceConfigMap returns the ObjectMeta necessary to lookup instance's shared ConfigMap.
func InstancePodDNSNames ¶
func InstancePodDNSNames(ctx context.Context, instance *appsv1.StatefulSet) []string
InstancePodDNSNames returns the possible DNS names for instance. The first name is the fully qualified domain name (FQDN).
func InstancePostgresDataVolume ¶
func InstancePostgresDataVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta
InstancePostgresDataVolume returns the ObjectMeta for the PostgreSQL data volume for instance.
func InstancePostgresWALVolume ¶
func InstancePostgresWALVolume(instance *appsv1.StatefulSet) metav1.ObjectMeta
InstancePostgresWALVolume returns the ObjectMeta for the PostgreSQL WAL volume for instance.
func InstanceSet ¶
func InstanceSet(cluster *v1beta1.PostgresCluster, set *v1beta1.PostgresInstanceSetSpec) metav1.ObjectMeta
InstanceSet returns the ObjectMeta necessary to lookup the objects associated with a single instance set. Includes PodDisruptionBudgets
func InstanceTablespaceDataVolume ¶
func InstanceTablespaceDataVolume(instance *appsv1.StatefulSet, tablespaceName string) metav1.ObjectMeta
InstanceTablespaceDataVolume returns the ObjectMeta for the tablespace data volume for instance.
func KubernetesClusterDomain ¶
KubernetesClusterDomain looks up the Kubernetes cluster domain name.
func Merge ¶
Merge takes sets of labels and merges them. The last set provided will win in case of conflicts.
func MonitoringUserSecret ¶
func MonitoringUserSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
MonitoringUserSecret returns ObjectMeta necessary to lookup the Secret containing authentication credentials for monitoring tools.
func MovePGBackRestRepoDirJob ¶
func MovePGBackRestRepoDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
MovePGBackRestRepoDirJob returns the ObjectMeta for a pgBackRest repo directory move Job
func MovePGDataDirJob ¶
func MovePGDataDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
MovePGDataDirJob returns the ObjectMeta for a pgData directory move Job
func MovePGWALDirJob ¶
func MovePGWALDirJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
MovePGWALDirJob returns the ObjectMeta for a pg_wal directory move Job
func OperatorConfigurationSecret ¶
func OperatorConfigurationSecret() metav1.ObjectMeta
OperatorConfigurationSecret returns the ObjectMeta necessary to lookup the Secret containing PGO configuration.
func PGBackRestBackupJob ¶
func PGBackRestBackupJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestBackupJob returns the ObjectMeta for the pgBackRest backup Job utilized to create replicas using pgBackRest
func PGBackRestBackupJobLabels ¶
func PGBackRestBackupJobLabels(clusterName, repoName string, backupType BackupJobType) labels.Set
PGBackRestBackupJobLabels provides labels for pgBackRest backup Jobs.
func PGBackRestBackupJobSelector ¶
func PGBackRestBackupJobSelector(clusterName, repoName string, backupType BackupJobType) labels.Selector
PGBackRestBackupJobSelector provides a selector for querying all pgBackRest resources
func PGBackRestConfig ¶
func PGBackRestConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestConfig returns the ObjectMeta for a pgBackRest ConfigMap
func PGBackRestConfigLabels ¶
PGBackRestConfigLabels provides labels for the pgBackRest configuration created and used by the PostgreSQL Operator
func PGBackRestCronJob ¶
func PGBackRestCronJob(cluster *v1beta1.PostgresCluster, backuptype, repoName string) metav1.ObjectMeta
PGBackRestCronJob returns the ObjectMeta for a pgBackRest CronJob
func PGBackRestCronJobLabels ¶
PGBackRestCronJobLabels provides common labels for pgBackRest CronJobs
func PGBackRestDedicatedLabels ¶
PGBackRestDedicatedLabels provides labels for a pgBackRest dedicated repository host
func PGBackRestDedicatedSelector ¶
PGBackRestDedicatedSelector provides a selector for querying pgBackRest dedicated repository host resources
func PGBackRestLabels ¶
PGBackRestLabels provides common labels for pgBackRest resources.
func PGBackRestRBAC ¶
func PGBackRestRBAC(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestRBAC returns the ObjectMeta necessary to lookup the ServiceAccount, Role, and RoleBinding for pgBackRest Jobs
func PGBackRestRepoLabels ¶
PGBackRestRepoLabels provides common labels for pgBackRest repository resources.
func PGBackRestRepoVolume ¶
func PGBackRestRepoVolume(cluster *v1beta1.PostgresCluster, repoName string) metav1.ObjectMeta
PGBackRestRepoVolume returns the ObjectMeta for a pgBackRest repository volume
func PGBackRestRepoVolumeLabels ¶
PGBackRestRepoVolumeLabels the labels for a pgBackRest repository volume.
func PGBackRestRestoreConfigLabels
deprecated
PGBackRestRestoreConfigLabels provides labels for configuration (e.g. ConfigMaps and Secrets) generated to perform a pgBackRest restore.
Deprecated: Store restore data in the pgBackRest ConfigMap and Secret, PGBackRestConfig and PGBackRestSecret.
func PGBackRestRestoreConfigSelector ¶
PGBackRestRestoreConfigSelector provides selector for querying pgBackRest restore config resources.
func PGBackRestRestoreJob ¶
func PGBackRestRestoreJob(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestRestoreJob returns the ObjectMeta for a pgBackRest restore Job
func PGBackRestRestoreJobLabels ¶
PGBackRestRestoreJobLabels provides labels for pgBackRest restore Jobs and associated configuration ConfigMaps and Secrets.
func PGBackRestRestoreJobSelector ¶
PGBackRestRestoreJobSelector provides selector for querying pgBackRest restore Jobs.
func PGBackRestSSHConfig ¶
func PGBackRestSSHConfig(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestSSHConfig returns the ObjectMeta for a pgBackRest SSHD ConfigMap Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization. TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSSHSecret ¶
func PGBackRestSSHSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestSSHSecret returns the ObjectMeta for a pgBackRest SSHD Secret Deprecated: Repository hosts use mTLS for encryption, authentication, and authorization. TODO(tjmoore4): Once we no longer need this for cleanup purposes, this should be removed.
func PGBackRestSecret ¶
func PGBackRestSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PGBackRestSecret returns the ObjectMeta for a pgBackRest Secret
func PGBackRestSelector ¶
PGBackRestSelector provides a selector for querying all pgBackRest resources
func PatroniDistributedConfiguration ¶
func PatroniDistributedConfiguration(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PatroniDistributedConfiguration returns the ObjectMeta necessary to lookup the DCS created by Patroni for cluster. This same name is used for both ConfigMap and Endpoints. See Patroni DCS "config_path".
func PatroniLeaderConfigMap ¶
func PatroniLeaderConfigMap(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PatroniLeaderConfigMap returns the ObjectMeta necessary to lookup the ConfigMap created by Patroni for the leader election of cluster. See Patroni DCS "leader_path".
func PatroniLeaderEndpoints ¶
func PatroniLeaderEndpoints(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PatroniLeaderEndpoints returns the ObjectMeta necessary to lookup the Endpoints created by Patroni for the leader election of cluster. See Patroni DCS "leader_path".
func PatroniScope ¶
func PatroniScope(cluster *v1beta1.PostgresCluster) string
PatroniScope returns the "scope" Patroni uses for cluster.
func PatroniTrigger ¶
func PatroniTrigger(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PatroniTrigger returns the ObjectMeta necessary to lookup the ConfigMap or Endpoints Patroni creates for cluster to initiate a controlled change of the leader. See Patroni DCS "failover_path".
func PostgresCustomUserSecretName ¶
func PostgresCustomUserSecretName(cluster *v1beta1.PostgresCluster, name string) metav1.ObjectMeta
PostgresCustomUserSecretName returns the ObjectMeta necessary to lookup a Secret containing a PostgreSQL user and its connection information.
func PostgresRootCASecret ¶
func PostgresRootCASecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PostgresRootCASecret returns the ObjectMeta necessary to lookup the Secret containing the root CA certificates and key Part of K8SPG-555 ticket.
func PostgresTLSSecret ¶
func PostgresTLSSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
PostgresTLSSecret returns the ObjectMeta necessary to lookup the Secret containing the default Postgres TLS certificates and key
func PostgresUserSecret ¶
func PostgresUserSecret(cluster *v1beta1.PostgresCluster, username string) metav1.ObjectMeta
PostgresUserSecret returns the ObjectMeta necessary to lookup a Secret containing a PostgreSQL user and its connection information.
func ReplicationClientCertSecret ¶
func ReplicationClientCertSecret(cluster *v1beta1.PostgresCluster) metav1.ObjectMeta
ReplicationClientCertSecret returns ObjectMeta necessary to lookup the Secret containing the Patroni client authentication certificate information.
func RepoHostPodDNSNames ¶
func RepoHostPodDNSNames(ctx context.Context, repoHost *appsv1.StatefulSet) []string
RepoHostPodDNSNames returns the possible DNS names for a pgBackRest repository host Pod. The first name is the fully qualified domain name (FQDN).
func ServiceDNSNames ¶
ServiceDNSNames returns the possible DNS names for service. The first name is the fully qualified domain name (FQDN).
func StandalonePGAdmin ¶
func StandalonePGAdmin(pgadmin *v1beta1.PGAdmin) metav1.ObjectMeta
StandalonePGAdmin returns the ObjectMeta necessary to lookup the ConfigMap, Service, StatefulSet, or Volume for the cluster's pgAdmin user interface.
func StandalonePGAdminDataLabels ¶
StandalonePGAdminDataLabels returns the labels for standalone pgAdmin resources that contain or mount data
func StandalonePGAdminDataSelector ¶
StandalonePGAdminDataSelector returns a selector for standalone pgAdmin resources that contain or mount data
func StandalonePGAdminLabels ¶
StandalonePGAdminLabels return labels for standalone pgAdmin resources
func StandalonePGAdminSelector ¶
StandalonePGAdminSelector provides a selector for standalone pgAdmin resources
func UpgradeCheckConfigMap ¶
func UpgradeCheckConfigMap() metav1.ObjectMeta
UpgradeCheckConfigMap returns the ObjectMeta for the PGO ConfigMap
Types ¶
type BackupJobType ¶
type BackupJobType string
BackupJobType represents different types of backups (e.g. ad-hoc backups, scheduled backups, the backup for pgBackRest replica creation, etc.)
const ( // BackupManual is the backup type utilized for manual backups BackupManual BackupJobType = "manual" // BackupReplicaCreate is the backup type for the backup taken to enable pgBackRest replica // creation BackupReplicaCreate BackupJobType = "replica-create" // BackupScheduled is the backup type utilized for scheduled backups BackupScheduled BackupJobType = "scheduled" )