You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: backup command of the cnpg plugin using local time zone #11328
I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
I have read the troubleshooting guide and I think this is a new bug.
Contact Details
No response
Version
1.30.0
What version of Kubernetes are you using?
1.36
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
YAML manifest
What happened?
Currently, the cnpg backup plugin names backup objects using a timestamp that relies on the client local time zone. However, internally, the backupId is then transformed in the UTC time zone format.
I think we should standardise and always use UTC time zone even in this case.
time.Now() returns the current time in the local system timezone, and ToCompactISO8601 simply formats it with t.Format("20060102150405"), preserving whatever timezone the time.Time value carries. So on a client machine with a non-UTC timezone, the backup name timestamp will diverge from the server-side backupId after UTC normalization.
The fix is a one-line change — pass time.Now().UTC() instead of time.Now():
Activity
dosubot commentedon Aug 15, 2026
The root cause is in
internal/cmd/plugin/backup/cmd.go, where the backup name is generated using:[1]
time.Now()returns the current time in the local system timezone, andToCompactISO8601simply formats it witht.Format("20060102150405"), preserving whatever timezone thetime.Timevalue carries. So on a client machine with a non-UTC timezone, the backup name timestamp will diverge from the server-side backupId after UTC normalization.The fix is a one-line change — pass
time.Now().UTC()instead oftime.Now():To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
fix(plugin): use UTC time zone for default backup name (#11329)
fix(plugin): use UTC time zone for default backup name (#11329)
fix(plugin): use UTC time zone for default backup name (#11329)
fix(plugin): use UTC time zone for default backup name (#11329)