Skip to content

do not use RFC3339 because with zulu time it only adds a Z and no timeshift #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/v1/postgres_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ const (
PostgresConfigReplicationUsername = "standby"
PostgresConfigAuditorUsername = "auditor"
PostgresConfigMonitoringUsername = "monitoring"

zalando_timestamp_format = "2006-01-02T15:04:05-07:00"
)

var (
Expand Down Expand Up @@ -762,7 +764,7 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor
// make sure there is always a value set. The operator will fall back to CLONE_WITH_BASEBACKUP, which assumes the source db's credentials are existing within the same namespace, which is not the case with the postgreslet.
if p.Spec.PostgresRestore.Timestamp == "" {
// e.g. 2021-12-07T15:28:00+01:00
p.Spec.PostgresRestore.Timestamp = time.Now().Format(time.RFC3339)
p.Spec.PostgresRestore.Timestamp = time.Now().Format(zalando_timestamp_format)
}

z.Spec.Clone = &zalando.CloneDescription{
Expand Down
4 changes: 2 additions & 2 deletions api/v1/postgres_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T)
Description: "description",
},
},
want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second...
want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second...
wantErr: false,
},
{
Expand All @@ -283,7 +283,7 @@ func TestPostgresRestoreTimestamp_ToUnstructuredZalandoPostgresql(t *testing.T)
Description: "description",
},
},
want: time.Now().Format(time.RFC3339), // I know this is not perfect, let's just hope we always finish within the same second...
want: time.Now().Format(zalando_timestamp_format), // I know this is not perfect, let's just hope we always finish within the same second...
wantErr: false,
},
{
Expand Down
Loading