Skip to content

Commit 22e083f

Browse files
committed
implement instancesV2
1 parent 531be1d commit 22e083f

File tree

7 files changed

+40
-0
lines changed

7 files changed

+40
-0
lines changed

pkg/volume/cinder/attacher_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,10 @@ func (testcase *testcase) Instances() (cloudprovider.Instances, bool) {
645645
return &instances{testcase.instanceID}, true
646646
}
647647

648+
func (testcase *testcase) InstancesV2() (cloudprovider.InstancesV2, bool) {
649+
return nil, false
650+
}
651+
648652
func (testcase *testcase) DisksAreAttached(instanceID string, volumeIDs []string) (map[string]bool, error) {
649653
expected := &testcase.disksAreAttached
650654

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Cloud struct {
5959
Exists bool
6060
Err error
6161

62+
EnableInstancesV2 bool
6263
ExistsByProviderID bool
6364
ErrByProviderID error
6465
NodeShutdown bool
@@ -152,6 +153,16 @@ func (f *Cloud) Instances() (cloudprovider.Instances, bool) {
152153
return f, true
153154
}
154155

156+
// InstancesV2 returns a fake implementation of InstancesV2.
157+
//
158+
// Actually it just returns f itself.
159+
func (f *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) {
160+
if f.EnableInstancesV2 {
161+
return f, true
162+
}
163+
return nil, false
164+
}
165+
155166
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
156167
func (f *Cloud) Zones() (cloudprovider.Zones, bool) {
157168
return f, true

staging/src/k8s.io/legacy-cloud-providers/aws/aws.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,11 @@ func (c *Cloud) Instances() (cloudprovider.Instances, bool) {
13941394
return c, true
13951395
}
13961396

1397+
// InstancesV2 returns an implementation of InstancesV2 for Amazon Web Services.
1398+
func (c *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) {
1399+
return nil, false
1400+
}
1401+
13971402
// Zones returns an implementation of Zones for Amazon Web Services.
13981403
func (c *Cloud) Zones() (cloudprovider.Zones, bool) {
13991404
return c, true

staging/src/k8s.io/legacy-cloud-providers/azure/azure.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@ func (az *Cloud) Instances() (cloudprovider.Instances, bool) {
659659
return az, true
660660
}
661661

662+
// InstancesV2 returns an instancesV2 interface. Also returns true if the interface is supported, false otherwise.
663+
func (az *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) {
664+
return nil, false
665+
}
666+
662667
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
663668
func (az *Cloud) Zones() (cloudprovider.Zones, bool) {
664669
return az, true

staging/src/k8s.io/legacy-cloud-providers/gce/gce.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@ func (g *Cloud) Instances() (cloudprovider.Instances, bool) {
659659
return g, true
660660
}
661661

662+
// InstancesV2 returns an implementation of InstancesV2 for Google Compute Engine.
663+
func (g *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) {
664+
return nil, false
665+
}
666+
662667
// Zones returns an implementation of Zones for Google Compute Engine.
663668
func (g *Cloud) Zones() (cloudprovider.Zones, bool) {
664669
return g, true

staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_instances.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ func (os *OpenStack) Instances() (cloudprovider.Instances, bool) {
6262
}, true
6363
}
6464

65+
// InstancesV2 returns an implementation of InstancesV2 for OpenStack.
66+
func (os *OpenStack) InstancesV2() (cloudprovider.InstancesV2, bool) {
67+
return nil, false
68+
}
69+
6570
// CurrentNodeName implements Instances.CurrentNodeName
6671
// Note this is *not* necessarily the same as hostname.
6772
func (i *Instances) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {

staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,11 @@ func (vs *VSphere) Instances() (cloudprovider.Instances, bool) {
560560
return vs, true
561561
}
562562

563+
// InstancesV2 returns an implementation of InstancesV2 for vSphere.
564+
func (vs *VSphere) InstancesV2() (cloudprovider.InstancesV2, bool) {
565+
return nil, false
566+
}
567+
563568
func getLocalIP() ([]v1.NodeAddress, error) {
564569
// hashtable with VMware-allocated OUIs for MAC filtering
565570
// List of official OUIs: http://standards-oui.ieee.org/oui.txt

0 commit comments

Comments
 (0)