address a code review
This commit is contained in:
		
							parent
							
								
									f4d8ec2878
								
							
						
					
					
						commit
						18e2d7a26f
					
				| 
						 | 
					@ -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.
 | 
					  Determines if the logical backup of this cluster should be taken and uploaded to S3. Default: false.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* **logicalBackupSchedule**
 | 
					* **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
 | 
					## Postgres parameters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.
 | 
					  In the CRD-based configuration those parameters are grouped under the `logical_backup` key.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * **enable_logical_backup**
 | 
					  * **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**
 | 
					  * **logical_backup_schedule**
 | 
				
			||||||
    Backup schedule in the cron format. Default: "30 00 \* \* \*"
 | 
					    Backup schedule in the cron format. Default: "30 00 \* \* \*"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,13 +12,13 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/sirupsen/logrus"
 | 
						"github.com/sirupsen/logrus"
 | 
				
			||||||
	"k8s.io/api/apps/v1beta1"
 | 
						"k8s.io/api/apps/v1beta1"
 | 
				
			||||||
 | 
						batchv1beta1 "k8s.io/api/batch/v1beta1"
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	policybeta1 "k8s.io/api/policy/v1beta1"
 | 
						policybeta1 "k8s.io/api/policy/v1beta1"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/types"
 | 
						"k8s.io/apimachinery/pkg/types"
 | 
				
			||||||
	"k8s.io/client-go/rest"
 | 
						"k8s.io/client-go/rest"
 | 
				
			||||||
	"k8s.io/client-go/tools/cache"
 | 
						"k8s.io/client-go/tools/cache"
 | 
				
			||||||
	batchv1beta1 "k8s.io/api/batch/v1beta1"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"encoding/json"
 | 
						"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
 | 
						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
 | 
						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 {
 | 
					type compareStatefulsetResult struct {
 | 
				
			||||||
| 
						 | 
					@ -303,6 +303,7 @@ func (c *Cluster) Create() error {
 | 
				
			||||||
		if err := c.createBackupCronJob(); err != nil {
 | 
							if err := c.createBackupCronJob(); err != nil {
 | 
				
			||||||
			return fmt.Errorf("could not create a k8s cron job for logical backups: %v", err)
 | 
								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 {
 | 
						if err := c.listResources(); err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -618,7 +618,7 @@ func (c *Cluster) createBackupCronJob() (err error) {
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("could not create k8s cron job: %v", err)
 | 
							return fmt.Errorf("could not create k8s cron job: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	c.backupJob = cronJob
 | 
						c.logicalBackupJob = cronJob
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue