File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
cluster-autoscaler/cloudprovider/oci/nodepools Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff 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.
632632func (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
Original file line number Diff line number Diff 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
102112func TestGetNodePoolNodes (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments