Skip to content

Commit b5a2dac

Browse files
authored
Rename nsx restore annotation (#1271)
1 parent 372acca commit b5a2dac

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

pkg/controllers/common/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func UnlockSubnetSet(uuid types.UID, subnetSetLock *sync.Mutex) {
233233
}
234234
}
235235

236-
func UpdateRestoreAnnotation(client k8sclient.Client, ctx context.Context, obj k8sclient.Object, value string) error {
236+
func UpdateReconfigureNicAnnotation(client k8sclient.Client, ctx context.Context, obj k8sclient.Object, value string) error {
237237
key := types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}
238238
err := client.Get(ctx, key, obj)
239239
if err != nil {
@@ -244,7 +244,7 @@ func UpdateRestoreAnnotation(client k8sclient.Client, ctx context.Context, obj k
244244
if anno == nil {
245245
anno = map[string]string{}
246246
}
247-
restoreValue, ok := anno[servicecommon.AnnotationRestore]
247+
restoreValue, ok := anno[servicecommon.AnnotationReconfigureNic]
248248
if ok {
249249
// Append the value to annotation if it is an interface name
250250
if restoreValue == "" || value == "true" {
@@ -255,7 +255,7 @@ func UpdateRestoreAnnotation(client k8sclient.Client, ctx context.Context, obj k
255255
} else {
256256
restoreValue = value
257257
}
258-
anno[servicecommon.AnnotationRestore] = restoreValue
258+
anno[servicecommon.AnnotationReconfigureNic] = restoreValue
259259
obj.SetAnnotations(anno)
260260
return client.Update(ctx, obj)
261261
}

pkg/controllers/pod/pod_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
204204
retry.OnError(util.K8sClientRetry, func(err error) bool {
205205
return err != nil
206206
}, func() error {
207-
return common.UpdateRestoreAnnotation(r.Client, ctx, pod, "true")
207+
return common.UpdateReconfigureNicAnnotation(r.Client, ctx, pod, "true")
208208
})
209209
}
210210
} else {

pkg/controllers/pod/pod_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func TestPodReconciler_Reconcile(t *testing.T) {
298298
assert.Equal(t, v1.PodReady, pod.Status.Conditions[0].Type)
299299
return nil
300300
})
301-
patches.ApplyFunc(common.UpdateRestoreAnnotation, func(client client.Client, ctx context.Context, obj client.Object, value string) error {
301+
patches.ApplyFunc(common.UpdateReconfigureNicAnnotation, func(client client.Client, ctx context.Context, obj client.Object, value string) error {
302302
assert.Equal(t, "true", value)
303303
return nil
304304
})

pkg/controllers/subnetport/subnetport_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ func (r *SubnetPortReconciler) Reconcile(ctx context.Context, req ctrl.Request)
221221
retry.OnError(util.K8sClientRetry, func(err error) bool {
222222
return err != nil
223223
}, func() error {
224-
return common.UpdateRestoreAnnotation(r.Client, ctx, subnetPort, "cpvm")
224+
return common.UpdateReconfigureNicAnnotation(r.Client, ctx, subnetPort, "cpvm")
225225
})
226226
}
227227
}
228228
if vm != nil {
229229
retry.OnError(util.K8sClientRetry, func(err error) bool {
230230
return err != nil
231231
}, func() error {
232-
return common.UpdateRestoreAnnotation(r.Client, ctx, vm, nicName)
232+
return common.UpdateReconfigureNicAnnotation(r.Client, ctx, vm, nicName)
233233
})
234234
}
235235
}

pkg/controllers/subnetport/subnetport_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func TestSubnetPortReconciler_Reconcile(t *testing.T) {
431431
return nil
432432
})
433433
k8sClient.EXPECT().Update(gomock.Any(), gomock.Any()).Do(func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
434-
assert.Equal(t, "cpvm", obj.GetAnnotations()[servicecommon.AnnotationRestore])
434+
assert.Equal(t, "cpvm", obj.GetAnnotations()[servicecommon.AnnotationReconfigureNic])
435435
return nil
436436
})
437437
_, ret := r.Reconcile(ctx, req)

pkg/nsx/services/common/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const (
9494
AnnotationDefaultNetworkConfig string = "nsx.vmware.com/default"
9595
AnnotationAttachmentRef string = "nsx.vmware.com/attachment_ref"
9696
AnnotationAssociatedResource string = "nsx.vmware.com/associated-resource"
97-
AnnotationRestore string = "nsx/restore"
97+
AnnotationReconfigureNic string = "nsx/reconfigure-nic"
9898
AnnotationPodMAC string = "nsx.vmware.com/mac"
9999
LabelCPVM string = "iaas.vmware.com/is-cpvm-subnetport"
100100
TagScopePodName string = "nsx-op/pod_name"

0 commit comments

Comments
 (0)