Extend Postgres manifest with new params
This commit is contained in:
parent
f7058c754d
commit
ad397045f7
|
|
@ -14,6 +14,8 @@ measurements. Please, refer to the [Kubernetes
|
|||
documentation](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
|
||||
for the possible values of those.
|
||||
|
||||
:exclamation: If both operator configmap/CRD and a Postgres cluster manifest define the same parameter, the value from the Postgres cluster manifest is applied.
|
||||
|
||||
## Manifest structure
|
||||
|
||||
A postgres manifest is a `YAML` document. On the top level both individual
|
||||
|
|
@ -254,3 +256,11 @@ defined in the sidecar dictionary:
|
|||
a dictionary of environment variables. Use usual Kubernetes definition
|
||||
(https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/)
|
||||
for environment variables. Optional.
|
||||
|
||||
### Logical backup
|
||||
|
||||
Those parameters are defined under the `logical_backup` key:
|
||||
* **enable_logical_backup**
|
||||
determines if the logical backup of this cluster should be uploaded to S3. Default: false.
|
||||
* **logical_backup_schedule**
|
||||
backup schedule in Cron format. Default: "30 00 * * *"
|
||||
|
|
|
|||
|
|
@ -308,3 +308,12 @@ every 6 hours.
|
|||
Note that if the statefulset is scaled down before resizing the size changes
|
||||
are only applied to the volumes attached to the running pods. The size of the
|
||||
volumes that correspond to the previously running pods is not changed.
|
||||
|
||||
## Logical backups
|
||||
|
||||
If you add
|
||||
```
|
||||
logical_backup:
|
||||
enable_logical_backup: true
|
||||
```
|
||||
to the cluster manifest, the operator will start a k8s cron job that will periodically execute `pg_dumpall` on the target PG cluster and upload results to an S3 bucket. Note that 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. See configuration reference for details.
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ spec:
|
|||
# uid: "efd12e58-5786-11e8-b5a7-06148230260c"
|
||||
# cluster: "acid-batman"
|
||||
# timestamp: "2017-12-19T12:40:33+01:00" # timezone required (offset relative to UTC, see RFC 3339 section 5.6)
|
||||
|
||||
# run periodic backups with k8s cron jobs and pg_dumpall
|
||||
# logical_backup:
|
||||
# enable_logical_backup: true
|
||||
# logical_backup_schedule: "30 00 * * *"
|
||||
maintenanceWindows:
|
||||
- 01:00-06:00 #UTC
|
||||
- Sat:00:00-04:00
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ type PostgresSpec struct {
|
|||
Volume `json:"volume,omitempty"`
|
||||
Patroni `json:"patroni,omitempty"`
|
||||
Resources `json:"resources,omitempty"`
|
||||
LogicalBackup `json:"logical_backup,omitempty"`
|
||||
|
||||
TeamID string `json:"teamId"`
|
||||
DockerImage string `json:"dockerImage,omitempty"`
|
||||
|
|
@ -127,3 +128,12 @@ type UserFlags []string
|
|||
|
||||
// PostgresStatus contains status of the PostgreSQL cluster (running, creation failed etc.)
|
||||
type PostgresStatus string
|
||||
|
||||
// CronSchedule is a convenience alias for string
|
||||
type CronSchedule string
|
||||
|
||||
// LogicalBackup contains config of a k8s cron job responsible for running pg_dumpall
|
||||
type LogicalBackup struct {
|
||||
EnableLogicalBackup bool `json:"enable_logical_backup,omitempty"`
|
||||
LogicalBackupSchedule CronSchedule `json:"logical_backup_schedule,omitempty"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue