cloudnative-pg icon indicating copy to clipboard operation
cloudnative-pg copied to clipboard

[Feature]: add .spec.timeZone to ScheduledBackup

Open mkris98 opened this issue 1 year ago • 0 comments

Is there an existing issue already for this feature request/idea?

  • [X] I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

The k8s nodes have a timezone set to UTC+1 and currently because of summertime this will be an offset of +2 hours. When i create a ScheduledBackup Custom Resource and specify the following schedule the backups run at 2 am during summertime and at 1 am during winter time.

apiVersion: postgresql.cnpg.io/v1 kind: ScheduledBackup metadata: name: fullbkp-autpgc16selfservice01-development namespace: aut spec: schedule: "0 0 0 * * *" backupOwnerReference: cluster method: barmanObjectStore cluster: name: autpgc16selfservice01-development immediate: true

The Backup resource created by the scheduled backup ignores the Timezone setting on the k8s node and creates the backupname with the following: fullbkp-autpgc16selfservice01-development-20240610000000 33h autpgc16selfservice01-development barmanObjectStore completed

The backup starts at 2 am, which can be seen here:

m_kristo@dbms-jumphost-dev:/gitlab/dbms/Development/development-dbms/backup_schedules$ k describe backup fullbkp-autpgc16selfservice01-development-20240610000000 -n aut Name: fullbkp-autpgc16selfservice01-development-20240610000000 Namespace: aut Labels: cnpg.io/cluster=autpgc16selfservice01-development cnpg.io/immediateBackup=false cnpg.io/scheduled-backup=fullbkp-autpgc16selfservice01-development Annotations: cnpg.io/operatorVersion: 1.23.1 API Version: postgresql.cnpg.io/v1 Kind: Backup Metadata: Creation Timestamp: 2024-06-10T00:00:00Z Generation: 1 Owner References: API Version: postgresql.cnpg.io/v1 Controller: true Kind: Cluster Name: autpgc16selfservice01-development UID: df2f0e7b-a8b1-499d-b0c3-15072652e079 Resource Version: 92746185 UID: 768ae7fb-4af7-4e52-a3c0-e28fa079b05b Spec: Cluster: Name: autpgc16selfservice01-development Method: barmanObjectStore Status: Backup Id: 20240610T020001 Backup Name: backup-20240610020000 Begin LSN: 0/1E011438 Begin Wal: 00000005000000000000001E Destination Path: gs://autpgc16selfsvc01-development-bucket End LSN: 0/20000000 End Wal: 000000050000000000000020 Google Credentials: Gke Environment: true Instance ID: Container ID: containerd://18eeeb3906d7336fe4cad58d16c7e6ce4722f8d0a9074ce5dc4af21a8b1ecde0 Pod Name: autpgc16selfservice01-development-2 Method: barmanObjectStore Phase: completed Server Name: autpgc16selfservice01-development Started At: 2024-06-10T02:00:01Z Stopped At: 2024-06-10T02:00:01Z Events:

Describe the solution you'd like

A possibility to specify the timezone for scheduledbackups is needed.

The official cronjob from kubernetes provides a spec.timeZone https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/

Describe alternatives you've considered

generating my own cronjob for every cluster is not an option. leaving the timezone as it is, make backup scheduling for different clusters with different timezones more difficult

Additional context

No response

Backport?

Yes

Are you willing to actively contribute to this feature?

No

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

mkris98 avatar Jun 11 '24 09:06 mkris98