From bd269e06baa9ae9b1f19b57aabd65b5731d2a3b8 Mon Sep 17 00:00:00 2001 From: kerthcet Date: Mon, 25 Dec 2023 16:34:10 +0800 Subject: [PATCH] feat: support annotation in nodewrapper Signed-off-by: kerthcet --- pkg/scheduler/testing/wrappers.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/scheduler/testing/wrappers.go b/pkg/scheduler/testing/wrappers.go index 6cda66b6661..97274a24ff7 100644 --- a/pkg/scheduler/testing/wrappers.go +++ b/pkg/scheduler/testing/wrappers.go @@ -730,6 +730,15 @@ func (n *NodeWrapper) Label(k, v string) *NodeWrapper { return n } +// Annotation applies a {k,v} annotation pair to the inner node. +func (n *NodeWrapper) Annotation(k, v string) *NodeWrapper { + if n.Annotations == nil { + n.Annotations = make(map[string]string) + } + metav1.SetMetaDataAnnotation(&n.ObjectMeta, k, v) + return n +} + // Capacity sets the capacity and the allocatable resources of the inner node. // Each entry in `resources` corresponds to a resource name and its quantity. // By default, the capacity and allocatable number of pods are set to 32.