Documentation ¶
Overview ¶
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
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
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
Package cluster holds the cluster CRD logic and definitions A cluster is comprised of a primary service, replica service, primary deployment, and replica deployment
Index ¶
- Constants
- func AddCluster(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, ...) error
- func AddClusterBase(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, ...)
- func AddPgbouncer(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...) error
- func AddPgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func AddUpgrade(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func Clone(clientset *kubernetes.Clientset, client *rest.RESTClient, namespace string, ...)
- func CreateRmdataJob(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string, ...) error
- func CreateService(clientset *kubernetes.Clientset, fields *ServiceTemplateFields, ...) error
- func DeleteCluster(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...) error
- func DeleteClusterBase(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func DeletePgbouncer(clientset *kubernetes.Clientset, clusterName, namespace string)
- func DeletePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func DeletePgreplicas(restclient *rest.RESTClient, clusterName, namespace string)
- func DeleteReplica(clientset *kubernetes.Clientset, cl *crv1.Pgreplica, namespace string) error
- func Failover(identifier string, clientset *kubernetes.Clientset, client *rest.RESTClient, ...) error
- func FailoverBase(namespace string, clientset *kubernetes.Clientset, client *rest.RESTClient, ...)
- func PatchpgtaskFailoverStatus(restclient *rest.RESTClient, oldCrd *crv1.Pgtask, namespace string) error
- func ProcessNextUpgradeItem(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func ProcessPolicies(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func PublishCloneEvent(eventType string, namespace string, task *crv1.Pgtask, errorMessage string)
- func ReconfigurePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func RemovePrimaryOnRoleChangeTag(clientset *kubernetes.Clientset, restconfig *rest.Config, ...) error
- func Scale(clientset *kubernetes.Clientset, client *rest.RESTClient, ...) error
- func ScaleBase(clientset *kubernetes.Clientset, client *rest.RESTClient, ...)
- func ScaleDownBase(clientset *kubernetes.Clientset, client *rest.RESTClient, ...)
- func UpdateCloneWorkflow(client *rest.RESTClient, namespace, workflowID, status string) error
- func UpdatePgBouncerAuthorizations(clientset *kubernetes.Clientset, ...) error
- func UpgradeWithAutofailDisabled(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- func UpgradeWithAutofailEnabled(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...)
- type CreatePVC
- type PgbouncerConfFields
- type PgbouncerHBAFields
- type PgbouncerPasswdFields
- type PgbouncerTemplateFields
- type RmdataJob
- type ServiceTemplateFields
Constants ¶
const PGBOUNCER_SUFFIX = "-pgbouncer"
const ReplicaSuffix = "-replica"
ReplicaSuffix ...
Variables ¶
This section is empty.
Functions ¶
func AddCluster ¶
func AddCluster(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, namespace string, primaryPVCName string) error
AddCluster ...
func AddClusterBase ¶
func AddClusterBase(clientset *kubernetes.Clientset, client *rest.RESTClient, cl *crv1.Pgcluster, namespace string)
func AddPgbouncer ¶
func AddPgbouncer(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string, createService bool, updateCreds bool) error
ProcessPgbouncer ...
func AddPgbouncerFromTask ¶
func AddPgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)
func AddUpgrade ¶
func AddUpgrade(clientset *kubernetes.Clientset, restclient *rest.RESTClient, upgrade *crv1.Pgtask, namespace string)
AddUpgrade implements the upgrade workflow for cluster minor upgrade
func Clone ¶
func Clone(clientset *kubernetes.Clientset, client *rest.RESTClient, namespace string, task *crv1.Pgtask)
Clone allows for one to clone the data from an existing cluster to a new cluster in the Operator. It works by doing the following:
1. Create some PVCs that will be utilized by the new cluster 2. Syncing (i.e. using rsync) the pgBackRest repository from the old cluster to the new cluster 3. perform a pgBackRest delta restore to the new PVC 4. Create a new cluster by using the old cluster as a template and providing the specifications to the new cluster, with a few "opinionated" items (e.g. copying over the secrets)
func CreateRmdataJob ¶
func CreateRmdataJob(clientset *kubernetes.Clientset, cl *crv1.Pgcluster, namespace string, removeData, removeBackup, isReplica, isBackup bool) error
CreateService ...
func CreateService ¶
func CreateService(clientset *kubernetes.Clientset, fields *ServiceTemplateFields, namespace string) error
CreateService ...
func DeleteCluster ¶
func DeleteCluster(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string) error
DeleteCluster ...
func DeleteClusterBase ¶
func DeleteClusterBase(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cl *crv1.Pgcluster, namespace string)
DeleteClusterBase ...
func DeletePgbouncer ¶
func DeletePgbouncer(clientset *kubernetes.Clientset, clusterName, namespace string)
DeletePgbouncer
func DeletePgbouncerFromTask ¶
func DeletePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)
func DeletePgreplicas ¶
func DeletePgreplicas(restclient *rest.RESTClient, clusterName, namespace string)
DeletePgreplicas
func DeleteReplica ¶
DeleteReplica ...
func FailoverBase ¶
func FailoverBase(namespace string, clientset *kubernetes.Clientset, client *rest.RESTClient, task *crv1.Pgtask, restconfig *rest.Config)
FailoverBase ... gets called first on a failover
func ProcessNextUpgradeItem ¶
func ProcessNextUpgradeItem(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cluster crv1.Pgcluster, upgradeTaskName, namespace string)
ProcessNextUpgradeItem - processes the next deployment for a cluster being upgraded One deployment is done per call in the following order: replicas, backrest, primary If more than one replica is in the list, they are done one at a time, once per call with an item getting removed from the list each time. This method should get called after the pod goes ready from the previous item, which is handled by the pod controller.
func ProcessPolicies ¶
func ProcessPolicies(clientset *kubernetes.Clientset, restclient *rest.RESTClient, stopchan chan struct{}, namespace string)
ProcessPolicies ...
func PublishCloneEvent ¶
PublishCloneEvent lets one publish an event related to the clone process
func ReconfigurePgbouncerFromTask ¶
func ReconfigurePgbouncerFromTask(clientset *kubernetes.Clientset, restclient *rest.RESTClient, task *crv1.Pgtask, namespace string)
func RemovePrimaryOnRoleChangeTag ¶
func RemovePrimaryOnRoleChangeTag(clientset *kubernetes.Clientset, restconfig *rest.Config, clusterName, namespace string) error
RemovePrimaryOnRoleChangeTag sets the 'primary_on_role_change' tag to null in the Patroni DCS, effectively removing the tag. This is accomplished by exec'ing into the primary PG pod, and sending a patch request to update the appropriate data (i.e. the 'primary_on_role_change' tag) in the DCS.
func Scale ¶
func Scale(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace, pvcName string, cluster *crv1.Pgcluster) error
Scale ...
func ScaleBase ¶
func ScaleBase(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace string)
ScaleBase ...
func ScaleDownBase ¶
func ScaleDownBase(clientset *kubernetes.Clientset, client *rest.RESTClient, replica *crv1.Pgreplica, namespace string)
ScaleDownBase ...
func UpdateCloneWorkflow ¶
func UpdateCloneWorkflow(client *rest.RESTClient, namespace, workflowID, status string) error
UpdateCloneWorkflow updates a Workflow with the current state of the clone task
func UpdatePgBouncerAuthorizations ¶
func UpdatePgBouncerAuthorizations(clientset *kubernetes.Clientset, namespace, username, password, secretName, clusterName, podIP string) error
func UpgradeWithAutofailDisabled ¶
func UpgradeWithAutofailDisabled(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cluster crv1.Pgcluster, upgradeTaskName, namespace string)
UpgradeWithAutofailDisabled patches the primary and all replicas at the same time, and then immediately mark the upgrade as complete. When performing a minor upgrade with autofail disabled, once the upgrade is complete and new pods have been created for the primary and each replica, any "database" containers will remain in an unready state, i.e. readiness probes will fail for those containers. This is because when autofail is disabled (i.e. Patroni is "paused"), Patroni will not attempt to start the PG database on a primary or replica. Therefore, the user must re-enable autofail following a minor upgrade during which autofail was disabled in order to fully bring the cluster (which includes the primary and all replicas) back online.
func UpgradeWithAutofailEnabled ¶
func UpgradeWithAutofailEnabled(clientset *kubernetes.Clientset, restclient *rest.RESTClient, cluster crv1.Pgcluster, upgradeTaskName, namespace string)
UpgradeWithAutofailEnabled is called when a minor upgrade is initiated for a PG cluster that has autofail enabled. Being that all replicas, and then the primary, are patched sequentially for a minor upgrade during which autofail is enabled for the cluster, this function simply calls the ProcessNextUpgradeItem function to trigger the upgrade the first Deployment in the sequence of primary and replica Deployments (ProcessNextUpgradeItem will then be called for any remaining Deployments from the Pod controller).
Types ¶
type CreatePVC ¶
type CreatePVC struct { Clientset *kubernetes.Clientset // ClusterName is the name of the PostgreSQL cluster to associate with the // PVC. Set ClusterName to PVCName if this is being restored to a differnet PVC ClusterName string Namespace string PVCName string RESTClient *rest.RESTClient Storage crv1.PgStorageSpec }
arguments required to create a new PVC
type PgbouncerConfFields ¶
type PgbouncerHBAFields ¶
type PgbouncerHBAFields struct { }
type PgbouncerPasswdFields ¶
type PgbouncerTemplateFields ¶
type PgbouncerTemplateFields struct { Name string ClusterName string PGBouncerSecret string CCPImagePrefix string CCPImageTag string Port string PrimaryServiceName string ReplicaServiceName string ContainerResources string PodAntiAffinity string PodAntiAffinityLabelName string PodAntiAffinityLabelValue string }