diff --git a/docs/administrator.md b/docs/administrator.md index 54cd87854..f6f37aafb 100644 --- a/docs/administrator.md +++ b/docs/administrator.md @@ -344,7 +344,7 @@ The operator logs reasons for a rolling update with the `info` level and a diff ## Logical backups -The operator can manage k8s cron jobs to run logical backups of Postgres clusters. The cron job periodically spawns a batch job that runs a single pod. The backup script within this pod's container can connect to a DB for a logical backup. The operator updates cron jobs during Sync if the job schedule changes; the job name acts as the job identifier. Notes: +The operator can manage k8s cron jobs to run logical backups of Postgres clusters. The cron job periodically spawns a batch job that runs a single pod. The backup script within this pod's container can connect to a DB for a logical backup. The operator updates cron jobs during Sync if the job schedule changes; the job name acts as the job identifier. These jobs are to be enabled for each indvidual Postgres cluster by setting `enableLogicalBackup: true` in its manifest. Notes: 1. The provided `registry.opensource.zalan.do/acid/logical-backup` image implements the backup via `pg_dumpall` and upload of (compressed) results to an S3 bucket; `pg_dumpall` requires a `superuser` access to a DB and runs on the replica when possible. diff --git a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go index 6e834d6fd..c6e87d8ea 100644 --- a/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go +++ b/pkg/apis/acid.zalan.do/v1/operator_configuration_type.go @@ -177,7 +177,6 @@ type OperatorConfigurationUsers struct { type Duration time.Duration type OperatorLogicalBackupConfiguration struct { - Enable bool `json:"enable_logical_backup,omitempty"` Schedule string `json:"logical_backup_schedule,omitempty"` DockerImage string `json:"logical_backup_docker_image,omitempty"` S3Bucket string `json:"logical_backup_s3_bucket,omitempty"` diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index 5f6eb265c..63e2c5c2d 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -549,7 +549,12 @@ func (c *Cluster) syncLogicalBackupJob() error { return fmt.Errorf("could not generate the desired logical backup job state: %v", err) } if match, reason := k8sutil.SameLogicalBackupJob(job, desiredJob); !match { - c.logLogicalBackupJobChanges(job, desiredJob, reason) + c.logger.Infof("logical job %q is not in the desired state and needs to be updated", + c.getLogicalBackupJobName(), + ) + if reason != "" { + c.logger.Infof("reason: %s", reason) + } if err = c.patchLogicalBackupJob(desiredJob); err != nil { return fmt.Errorf("could not update logical backup job to match desired state: %v", err) } diff --git a/pkg/cluster/util.go b/pkg/cluster/util.go index 61c9e0ebe..5b531cc90 100644 --- a/pkg/cluster/util.go +++ b/pkg/cluster/util.go @@ -12,7 +12,6 @@ import ( "time" "k8s.io/api/apps/v1beta1" - batchv1beta1 "k8s.io/api/batch/v1beta1" v1 "k8s.io/api/core/v1" policybeta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -484,13 +483,3 @@ func (c *Cluster) GetSpec() (*acidv1.Postgresql, error) { func (c *Cluster) patroniUsesKubernetes() bool { return c.OpConfig.EtcdHost == "" } - -func (c *Cluster) logLogicalBackupJobChanges(old, new *batchv1beta1.CronJob, reason string) { - - c.logger.Infof("logical job %q is not in the desired state and needs to be updated", - c.getLogicalBackupJobName(), - ) - if reason != "" { - c.logger.Infof("reason: %s", reason) - } -} diff --git a/pkg/controller/operator_config.go b/pkg/controller/operator_config.go index 06589f814..245754e1c 100644 --- a/pkg/controller/operator_config.go +++ b/pkg/controller/operator_config.go @@ -106,7 +106,6 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur result.ScalyrCPULimit = fromCRD.Scalyr.ScalyrCPULimit result.ScalyrMemoryLimit = fromCRD.Scalyr.ScalyrMemoryLimit - result.EnableLogicalBackup = fromCRD.LogicalBackup.Enable result.LogicalBackupSchedule = fromCRD.LogicalBackup.Schedule result.LogicalBackupDockerImage = fromCRD.LogicalBackup.DockerImage result.LogicalBackupS3Bucket = fromCRD.LogicalBackup.S3Bucket diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index cd02c6ddb..0cd662a6e 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -68,7 +68,6 @@ type Scalyr struct { // LogicalBackup type LogicalBackup struct { - EnableLogicalBackup bool `name:"enable_logical_backup" default:"false"` LogicalBackupSchedule string `name:"logical_backup_schedule" default:"30 00 * * *"` LogicalBackupDockerImage string `name:"logical_backup_docker_image" default:"registry.opensource.zalan.do/acid/logical-backup"` LogicalBackupS3Bucket string `name:"logical_backup_s3_bucket" default:""`