diff --git a/docs/reference/cluster_manifest.md b/docs/reference/cluster_manifest.md index 552ef5815..ab20d0a21 100644 --- a/docs/reference/cluster_manifest.md +++ b/docs/reference/cluster_manifest.md @@ -123,7 +123,7 @@ These parameters are grouped directly under the `spec` key in the manifest. Determines if the logical backup of this cluster should be taken and uploaded to S3. Default: false. * **logicalBackupSchedule** - Backup schedule in the Cron format. Default: "30 00 \* \* \*" + Backup schedule in the Cron format. Please take [the reference schedule format](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#schedule) into account. Default: "30 00 \* \* \*" ## Postgres parameters diff --git a/docs/reference/operator_parameters.md b/docs/reference/operator_parameters.md index 92625e5c7..f9948ac00 100644 --- a/docs/reference/operator_parameters.md +++ b/docs/reference/operator_parameters.md @@ -470,7 +470,7 @@ scalyr sidecar. In the CRD-based configuration they are grouped under the In the CRD-based configuration those parameters are grouped under the `logical_backup` key. * **enable_logical_backup** - Determines if the operator should initiate the backup of all Postgres clusters it controls. Default: false. + Determines if the operator creates a Kubernets Cron job to do a logical backup of all Postgres clusters it controls. Default: false. * **logical_backup_schedule** Backup schedule in the cron format. Default: "30 00 \* \* \*" diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index f621ff919..4efe2f198 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -12,13 +12,13 @@ import ( "github.com/sirupsen/logrus" "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" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - batchv1beta1 "k8s.io/api/batch/v1beta1" "encoding/json" @@ -84,7 +84,7 @@ type Cluster struct { processMu sync.RWMutex // protects the current operation for reporting, no need to hold the master mutex specMu sync.RWMutex // protects the spec for reporting, no need to hold the master mutex - backupJob *batchv1beta1.CronJob // periodical logical backups independent from WAL archiving + logicalBackupJob *batchv1beta1.CronJob // periodical logical backups independent from WAL archiving } type compareStatefulsetResult struct { @@ -303,6 +303,7 @@ func (c *Cluster) Create() error { if err := c.createBackupCronJob(); err != nil { return fmt.Errorf("could not create a k8s cron job for logical backups: %v", err) } + c.logger.Infof("a k8s cron job for logical backup has been successfully created") } if err := c.listResources(); err != nil { diff --git a/pkg/cluster/resources.go b/pkg/cluster/resources.go index 24f4b9c10..fc445cee6 100644 --- a/pkg/cluster/resources.go +++ b/pkg/cluster/resources.go @@ -618,7 +618,7 @@ func (c *Cluster) createBackupCronJob() (err error) { if err != nil { return fmt.Errorf("could not create k8s cron job: %v", err) } - c.backupJob = cronJob + c.logicalBackupJob = cronJob return nil }