-
Notifications
You must be signed in to change notification settings - Fork 190
Description
What would you like to be added?
CPI currently implements only Instance() method which is part of the Kubernetes cloud provider interfaces. To improve scalability and reduce the load on infrastructure APIs, Kubernetes introduced the InstanceV2()interface.
// InstancesV2 is an implementation for instances and should only be implemented by external cloud providers.
// Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce
// API calls to the cloud provider when registering and syncing nodes. Implementation of this interface will
// disable calls to the Zones interface. Also returns true if the interface is supported, false otherwise.
InstancesV2() (InstancesV2, bool)
This issue tracks the implementation of the InstanceV2() interface in the vSphere CPI supervisor mode. The existing Instance() will still be maintained. Supporting InstanceV2() will enable optimized performance in large clusters by minimizing unnecessary API calls to Supervisor Cluster and better aligning with modern Kubernetes architecture expectations.
// InstancesV2 is an abstract, pluggable interface for cloud provider instances.
// Unlike the Instances interface, it is designed for external cloud providers and should only be used by them.
// Implementation of this interface will disable calls to the Zones interface.
type InstancesV2 interface {
// InstanceExists returns true if the instance for the given node exists according to the cloud provider.
// Use the node.name or node.spec.providerID field to find the node in the cloud provider.
InstanceExists(ctx context.Context, node *v1.Node) (bool, error)
// InstanceShutdown returns true if the instance is shutdown according to the cloud provider.
// Use the node.name or node.spec.providerID field to find the node in the cloud provider.
InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error)
// InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are
// translated into specific fields and labels in the Node object on registration.
// Implementations should always check node.spec.providerID first when trying to discover the instance
// for a given node. In cases where node.spec.providerID is empty, implementations can use other
// properties of the node like its name, labels and annotations.
InstanceMetadata(ctx context.Context, node *v1.Node) (*InstanceMetadata, error)
}
Deliverables include implementing the new interface methods for CPI paravirtual mode, writing appropriate unit tests and downstream E2E tests(No E2E for paravirtual mode in upstream).
Why is this needed?
Improve scalability and reduce the load on infrastructure APIs from CPI.