diff --git a/internal/k8s/vald/annotations.go b/internal/k8s/vald/annotations.go index c138871074..24ef49e6ce 100644 --- a/internal/k8s/vald/annotations.go +++ b/internal/k8s/vald/annotations.go @@ -19,9 +19,9 @@ package vald import "time" const ( - TimestampLayout = time.RFC3339Nano + TimeFormat = time.RFC3339Nano UncommittedAnnotationsKey = "vald.vdaas.org/uncommitted" - UnsavedProcessedVqAnnotationsKey = "vald.vdaas.org/unsaved-processed-vq" + UnsavedProcessedVQAnnotationsKey = "vald.vdaas.org/unsaved-processed-vq" UnsavedCreateIndexExecutionNumAnnotationsKey = "vald.vdaas.org/unsaved-create-index-execution" LastTimeSaveIndexTimestampAnnotationsKey = "vald.vdaas.org/last-time-save-index-timestamp" IndexCountAnnotationsKey = "vald.vdaas.org/index-count" diff --git a/pkg/agent/core/ngt/service/ngt.go b/pkg/agent/core/ngt/service/ngt.go index 0cd08f0419..f1e1a80902 100644 --- a/pkg/agent/core/ngt/service/ngt.go +++ b/pkg/agent/core/ngt/service/ngt.go @@ -2007,7 +2007,7 @@ func (n *ngt) unsavedNumberOfCreateIndexExecutionEntry() (k, v string) { } func (n *ngt) lastTimeSaveIndexTimestampEntry(timestamp time.Time) (k, v string) { - return lastTimeSaveIndexTimestampAnnotationsKey, timestamp.UTC().Format(vald.TimestampLayout) + return lastTimeSaveIndexTimestampAnnotationsKey, timestamp.UTC().Format(vald.TimeFormat) } func (n *ngt) indexCountEntry() (k, v string) { diff --git a/pkg/agent/core/ngt/service/ngt_test.go b/pkg/agent/core/ngt/service/ngt_test.go index 95cef9565d..3adcf18726 100644 --- a/pkg/agent/core/ngt/service/ngt_test.go +++ b/pkg/agent/core/ngt/service/ngt_test.go @@ -1301,7 +1301,7 @@ func TestExportIndexInfo(t *testing.T) { unsavedProcessedVqAnnotationsKey: "2", } expectedAfterSave := map[string]string{ - lastTimeSaveIndexTimestampAnnotationsKey: saveIndexTime.UTC().Format(kvald.TimestampLayout), + lastTimeSaveIndexTimestampAnnotationsKey: saveIndexTime.UTC().Format(kvald.TimeFormat), unsavedCreateIndexExecutionNumAnnotationsKey: "0", unsavedProcessedVqAnnotationsKey: "0", } diff --git a/pkg/index/job/readreplica/rotate/service/rotator.go b/pkg/index/job/readreplica/rotate/service/rotator.go index 1cd0de4ebf..ec64ac39bc 100644 --- a/pkg/index/job/readreplica/rotate/service/rotator.go +++ b/pkg/index/job/readreplica/rotate/service/rotator.go @@ -306,7 +306,7 @@ func (s *subProcess) updateDeployment(ctx context.Context, newPVC string, deploy if deployment.Annotations == nil { deployment.Annotations = map[string]string{} } - deployment.Annotations[vald.LastTimeSnapshotTimestampAnnotationsKey] = snapshotTime.UTC().Format(vald.TimestampLayout) + deployment.Annotations[vald.LastTimeSnapshotTimestampAnnotationsKey] = snapshotTime.UTC().Format(vald.TimeFormat) for _, vol := range deployment.Spec.Template.Spec.Volumes { if vol.Name == s.volumeName { diff --git a/pkg/index/operator/service/operator.go b/pkg/index/operator/service/operator.go index 3108bc58f2..28d58e88e6 100644 --- a/pkg/index/operator/service/operator.go +++ b/pkg/index/operator/service/operator.go @@ -169,7 +169,7 @@ func (o *operator) rotateIfNeeded(ctx context.Context, pod pod.Pod) error { log.Info("the agent pod has not saved index yet. skipping...") return nil } - lastSavedTime, err := time.Parse(vald.TimestampLayout, t) + lastSavedTime, err := time.Parse(vald.TimeFormat, t) if err != nil { return fmt.Errorf("parsing last time saved time: %w", err) } @@ -193,7 +193,7 @@ func (o *operator) rotateIfNeeded(ctx context.Context, pod pod.Pod) error { annotations := dep.GetAnnotations() t, ok = annotations[vald.LastTimeSnapshotTimestampAnnotationsKey] if ok { - lastSnapshotTime, err := time.Parse(vald.TimestampLayout, t) + lastSnapshotTime, err := time.Parse(vald.TimeFormat, t) if err != nil { return fmt.Errorf("parsing last snapshot time: %w", err) }