Skip to content

Commit 95065b5

Browse files
committed
Moving code around
1 parent 0e0250e commit 95065b5

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

cloud/linode/cloud.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ var Options struct {
2828

2929
type linodeCloud struct {
3030
client Client
31-
instances cloudprovider.Instances
32-
zones cloudprovider.Zones
31+
instances cloudprovider.InstancesV2
3332
loadbalancers cloudprovider.LoadBalancer
3433
}
3534

@@ -64,7 +63,6 @@ func newCloud() (cloudprovider.Interface, error) {
6463
return &linodeCloud{
6564
client: &linodeClient,
6665
instances: newInstances(&linodeClient),
67-
zones: newZones(&linodeClient, region),
6866
loadbalancers: newLoadbalancers(&linodeClient, region),
6967
}, nil
7068
}
@@ -83,15 +81,15 @@ func (c *linodeCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool) {
8381
}
8482

8583
func (c *linodeCloud) Instances() (cloudprovider.Instances, bool) {
86-
return c.instances, true
84+
return nil, false
8785
}
8886

8987
func (c *linodeCloud) InstancesV2() (cloudprovider.InstancesV2, bool) {
90-
return nil, false
88+
return c.instances, true
9189
}
9290

9391
func (c *linodeCloud) Zones() (cloudprovider.Zones, bool) {
94-
return c.zones, true
92+
return nil, false
9593
}
9694

9795
func (c *linodeCloud) Clusters() (cloudprovider.Clusters, bool) {

cloud/linode/instances.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ type instances struct {
1717
client Client
1818
}
1919

20-
func newInstances(client Client) cloudprovider.Instances {
20+
// TODO(PR): providing both APIs to keep the tests green and to enable
21+
// gradual migration
22+
type hybridInstances interface {
23+
cloudprovider.Instances
24+
cloudprovider.InstancesV2
25+
}
26+
27+
func newInstances(client Client) hybridInstances {
2128
return &instances{client}
2229
}
2330

@@ -202,3 +209,16 @@ func (i *instances) InstanceShutdownByProviderID(ctx context.Context, providerID
202209

203210
return false, nil
204211
}
212+
213+
// TODO(PR): move code from instancesv1 over here
214+
func (i *instances) InstanceExists(ctx context.Context, node *v1.Node) (bool, error) {
215+
return false, nil // TODO(PR): fix
216+
}
217+
218+
func (i *instances) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error) {
219+
return false, nil // TODO(PR): fix
220+
}
221+
222+
func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) {
223+
return nil, nil
224+
}

cloud/linode/zones.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
cloudprovider "k8s.io/cloud-provider"
88
)
99

10+
// TODO(PR): move this to instancesv2; move tests to instances_test
1011
type zones struct {
1112
client Client
1213
region string

0 commit comments

Comments
 (0)