Skip to content

Commit

Permalink
Rename constants
Browse files Browse the repository at this point in the history
Co-authored-by: Yusuke Kato <kpango@vdaas.org>
  • Loading branch information
ykadowak and kpango committed Mar 8, 2024
1 parent 3761404 commit 2b035ee
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/k8s/vald/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/core/ngt/service/ngt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/index/job/readreplica/rotate/service/rotator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/index/operator/service/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 2b035ee

Please sign in to comment.