From 6f855d5190a0b41680beb324f2167a861441deb8 Mon Sep 17 00:00:00 2001 From: Sergey Dudoladov Date: Mon, 8 Apr 2019 15:03:56 +0200 Subject: [PATCH] minore changes --- docs/administrator.md | 2 +- pkg/cluster/k8sres.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/administrator.md b/docs/administrator.md index 76db1675d..09b36f7a0 100644 --- a/docs/administrator.md +++ b/docs/administrator.md @@ -346,7 +346,7 @@ The operator logs reasons for a rolling update with the `info` level and a diff The operator can manage k8s cron jobs to do periodic logical backups of all PG clusters under its control. The cron job spawns a separate pod with a single container that connects to one of the Postgres replicas for a backup. The operator updates cron jobs during Sync if a schedule or a docker image of a job changes. 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. +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. Any such image must ensure the logical backup is able to finish [in presence of pod restarts](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#handling-pod-and-container-failures) and [simultaneous invocations](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations) of the backup cron job. 2. Due to the [limitation of Kubernetes cron jobs](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations) it is highly advisable to set up additional monitoring for this feature; such monitoring is outside of the scope of operator responsibilities. diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index c9b7e1897..73808f3b3 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1316,11 +1316,12 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1beta1.CronJob, error) { return nil, fmt.Errorf("could not generate pod template for logical backup cron job: %v", err) } - // pods of k8s jobs support only "OnFailure" or "Never" - // but the default is "Always" - podTemplate.Spec.RestartPolicy = "OnFailure" podTemplate.Spec.Affinity = &podAffinity + // affects containers within a pod on the same node + // pods of k8s jobs support only "OnFailure" or "Never" + podTemplate.Spec.RestartPolicy = "Never" + jobSpec := batchv1.JobSpec{Template: *podTemplate} jobTemplateSpec := batchv1beta1.JobTemplateSpec{