Skip to content

Commit ff8a810

Browse files
committed
Autoscaler should not try to monitor or scale virtual nodes and virtual node pools
1 parent 6aa6f02 commit ff8a810

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

cluster-autoscaler/cloudprovider/oci/nodepools/consts/annotations.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ const (
2828

2929
// EphemeralStorageSize is the freeform tag key that would be used to determine the ephemeral-storage size of the node
3030
EphemeralStorageSize = "cluster-autoscaler/node-ephemeral-storage"
31+
32+
// OciNodePoolResourceIdent is the string identifier in the ocid that indicates the resource is a virtual node pool
33+
OciVirtualNodeResourceIdent = "virtualnode"
3134
)

cluster-autoscaler/cloudprovider/oci/nodepools/oci_manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ func (m *ociManagerImpl) GetNodePoolNodes(np NodePool) ([]cloudprovider.Instance
630630

631631
// GetNodePoolForInstance returns NodePool to which the given instance belongs.
632632
func (m *ociManagerImpl) GetNodePoolForInstance(instance ocicommon.OciRef) (NodePool, error) {
633+
if strings.Contains(instance.InstanceID, npconsts.OciVirtualNodeResourceIdent) {
634+
return nil, nil
635+
}
633636
if instance.NodePoolID == "" {
634637
klog.V(4).Infof("node pool id missing from reference: %+v", instance)
635638

cluster-autoscaler/cloudprovider/oci/nodepools/oci_manager_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ func TestGetNodePoolForInstance(t *testing.T) {
9797
if np.Id() != "ocid2" {
9898
t.Fatalf("got unexpected ocid %q ; wanted \"ocid2\"", np.Id())
9999
}
100+
101+
// now verify node pool can be found via lookup up by instance id in cache
102+
np, err = manager.GetNodePoolForInstance(ocicommon.OciRef{InstanceID: "virtualnode"})
103+
if err != nil {
104+
t.Fatalf("unexpected error: %+v", err)
105+
}
106+
107+
if np != nil {
108+
t.Fatalf("got unexpected ocid %q ; wanted nil", np.Id())
109+
}
100110
}
101111

102112
func TestGetNodePoolNodes(t *testing.T) {

0 commit comments

Comments
 (0)