Skip to content

Commit 531be1d

Browse files
andrewsykimgongguan
authored andcommitted
define instances v2
Signed-off-by: Andrew Sy Kim <[email protected]>
1 parent e24a42f commit 531be1d

File tree

1 file changed

+14
-0
lines changed
  • staging/src/k8s.io/cloud-provider

1 file changed

+14
-0
lines changed

staging/src/k8s.io/cloud-provider/cloud.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ type Interface interface {
4949
LoadBalancer() (LoadBalancer, bool)
5050
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
5151
Instances() (Instances, bool)
52+
// InstancesV2 is an implementation for instances only used by cloud node-controller now.
53+
// Also returns true if the interface is supported, false otherwise.
54+
InstancesV2() (InstancesV2, bool)
5255
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
5356
Zones() (Zones, bool)
5457
// Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
@@ -186,6 +189,17 @@ type Instances interface {
186189
InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
187190
}
188191

192+
// InstancesV2 is an abstract, pluggable interface for sets of instances.
193+
// Unlike Instances, it is only used by cloud node-controller now.
194+
type InstancesV2 interface {
195+
// InstanceExistsByProviderID returns true if the instance for the given provider exists.
196+
InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
197+
// InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider.
198+
InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
199+
// InstanceMetadataByProviderID returns the instance's metadata.
200+
InstanceMetadataByProviderID(ctx context.Context, providerID string) (*InstanceMetadata, error)
201+
}
202+
189203
// Route is a representation of an advanced routing rule.
190204
type Route struct {
191205
// Name is the name of the routing rule in the cloud-provider.

0 commit comments

Comments
 (0)