Skip to content

Commit 5aaf7fd

Browse files
author
Duong Pham
committed
fix: issue 1228 race condition when rollout restart target
Please reference github issue #1228
1 parent b5b2802 commit 5aaf7fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

helpers/rollout_restart.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,21 @@ func patchForRolloutRestart(ctx context.Context, obj ctrlclient.Object, client c
129129
if t.Spec.Template.ObjectMeta.Annotations == nil {
130130
t.Spec.Template.ObjectMeta.Annotations = make(map[string]string)
131131
}
132-
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339)
132+
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339Nano)
133133
return client.Patch(ctx, t, patch)
134134
case *appsv1.StatefulSet:
135135
patch := ctrlclient.StrategicMergeFrom(t.DeepCopy())
136136
if t.Spec.Template.ObjectMeta.Annotations == nil {
137137
t.Spec.Template.ObjectMeta.Annotations = make(map[string]string)
138138
}
139-
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339)
139+
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339Nano)
140140
return client.Patch(ctx, t, patch)
141141
case *appsv1.DaemonSet:
142142
patch := ctrlclient.StrategicMergeFrom(t.DeepCopy())
143143
if t.Spec.Template.ObjectMeta.Annotations == nil {
144144
t.Spec.Template.ObjectMeta.Annotations = make(map[string]string)
145145
}
146-
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339)
146+
t.Spec.Template.ObjectMeta.Annotations[AnnotationRestartedAt] = time.Now().Format(time.RFC3339Nano)
147147
return client.Patch(ctx, t, patch)
148148
case *argorolloutsv1alpha1.Rollout:
149149
// use MergeFrom() since it supports CRDs whereas StrategicMergeFrom() does not.

0 commit comments

Comments
 (0)