Skip to content

Commit 55e3660

Browse files
committed
Fix linting errors
1 parent 847530a commit 55e3660

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

pkg/oci/instances.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ func extractNodeAddressesFromVNIC(vnic *core.Vnic) ([]api.NodeAddress, error) {
7777
func (cp *CloudProvider) NodeAddresses(name types.NodeName) ([]api.NodeAddress, error) {
7878
glog.V(4).Infof("NodeAddresses(%q) called", name)
7979

80-
inst, err := cp.client.Instances().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name))
80+
inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name))
8181
if err != nil {
8282
return []api.NodeAddress{}, errors.Wrap(err, "GetInstanceByNodeName")
8383
}
8484

85-
vnic, err := cp.client.Instances().GetPrimaryVNICForInstance(context.TODO(), *inst.Id)
85+
vnic, err := cp.client.Compute().GetPrimaryVNICForInstance(context.TODO(), *inst.Id)
8686
if err != nil {
8787
return []api.NodeAddress{}, errors.Wrap(err, "GetPrimaryVNICForInstance")
8888
}
@@ -97,7 +97,7 @@ func (cp *CloudProvider) NodeAddresses(name types.NodeName) ([]api.NodeAddress,
9797
func (cp *CloudProvider) NodeAddressesByProviderID(providerID string) ([]api.NodeAddress, error) {
9898
glog.V(4).Infof("NodeAddressesByProviderID(%q) called", providerID)
9999
instanceID := util.MapProviderIDToInstanceID(providerID)
100-
vnic, err := cp.client.Instances().GetPrimaryVNICForInstance(context.TODO(), instanceID)
100+
vnic, err := cp.client.Compute().GetPrimaryVNICForInstance(context.TODO(), instanceID)
101101
if err != nil {
102102
return []api.NodeAddress{}, errors.Wrap(err, "GetPrimaryVNICForInstance")
103103
}
@@ -111,7 +111,7 @@ func (cp *CloudProvider) ExternalID(nodeName types.NodeName) (string, error) {
111111
glog.V(4).Infof("ExternalID(%q) called", nodeName)
112112

113113
instName := mapNodeNameToInstanceName(nodeName)
114-
inst, err := cp.client.Instances().GetInstanceByNodeName(context.TODO(), instName)
114+
inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), instName)
115115
if client.IsNotFound(err) {
116116
glog.Infof("Instance %q was not found. Unable to get ExternalID: %v", instName, err)
117117
return "", cloudprovider.InstanceNotFound
@@ -131,7 +131,7 @@ func (cp *CloudProvider) InstanceID(nodeName types.NodeName) (string, error) {
131131
glog.V(4).Infof("InstanceID(%q) called", nodeName)
132132

133133
name := mapNodeNameToInstanceName(nodeName)
134-
inst, err := cp.client.Instances().GetInstanceByNodeName(context.TODO(), name)
134+
inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), name)
135135
if err != nil {
136136
return "", errors.Wrap(err, "GetInstanceByNodeName")
137137
}
@@ -142,7 +142,7 @@ func (cp *CloudProvider) InstanceID(nodeName types.NodeName) (string, error) {
142142
func (cp *CloudProvider) InstanceType(name types.NodeName) (string, error) {
143143
glog.V(4).Infof("InstanceType(%q) called", name)
144144

145-
inst, err := cp.client.Instances().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name))
145+
inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name))
146146
if err != nil {
147147
return "", errors.Wrap(err, "GetInstanceByNodeName")
148148
}
@@ -154,7 +154,7 @@ func (cp *CloudProvider) InstanceTypeByProviderID(providerID string) (string, er
154154
glog.V(4).Infof("InstanceTypeByProviderID(%q) called", providerID)
155155

156156
instanceID := util.MapProviderIDToInstanceID(providerID)
157-
inst, err := cp.client.Instances().GetInstance(context.TODO(), instanceID)
157+
inst, err := cp.client.Compute().GetInstance(context.TODO(), instanceID)
158158
if err != nil {
159159
return "", errors.Wrap(err, "GetInstance")
160160
}
@@ -180,7 +180,7 @@ func (cp *CloudProvider) CurrentNodeName(hostname string) (types.NodeName, error
180180
func (cp *CloudProvider) InstanceExistsByProviderID(providerID string) (bool, error) {
181181
glog.V(4).Infof("InstanceExistsByProviderID(%q) called", providerID)
182182
instanceID := util.MapProviderIDToInstanceID(providerID)
183-
instance, err := cp.client.Instances().GetInstance(context.TODO(), instanceID)
183+
instance, err := cp.client.Compute().GetInstance(context.TODO(), instanceID)
184184
if client.IsNotFound(err) {
185185
return false, nil
186186
}

pkg/oci/load_balancer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (cp *CloudProvider) getSubnetsForNodes(ctx context.Context, nodes []*api.No
341341
}
342342

343343
id := util.MapProviderIDToInstanceID(node.Spec.ProviderID)
344-
vnic, err := cp.client.Instances().GetPrimaryVNICForInstance(ctx, id)
344+
vnic, err := cp.client.Compute().GetPrimaryVNICForInstance(ctx, id)
345345
if err != nil {
346346
return nil, err
347347
}

pkg/oci/newclient/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
// Interface of consumed OCI API functionality.
3333
type Interface interface {
34-
Instances() InstancesInterface
34+
Compute() ComputeInterface
3535
LoadBalancer() LoadBalancerInterface
3636
Networking() NetworkingInterface
3737
}
@@ -105,6 +105,6 @@ func (c *client) Networking() NetworkingInterface {
105105
return c
106106
}
107107

108-
func (c *client) Instances() InstancesInterface {
108+
func (c *client) Compute() ComputeInterface {
109109
return c
110110
}

pkg/oci/newclient/instances.go renamed to pkg/oci/newclient/compute.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import (
2323
"github.com/pkg/errors"
2424
)
2525

26-
type InstancesInterface interface {
26+
// ComputeInterface defines the subset of the OCI compute API utilised by the
27+
// CCM.
28+
type ComputeInterface interface {
2729
// GetInstance gets information about the specified instance.
2830
GetInstance(ctx context.Context, id string) (*core.Instance, error)
2931
// GetInstanceByDisplayName gets information about the named instance.

pkg/oci/newclient/vcn.go renamed to pkg/oci/newclient/networking.go

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/pkg/errors"
2424
)
2525

26+
// NetworkingInterface defines the subset of the OCI compute API utilised by the CCM.
2627
type NetworkingInterface interface {
2728
GetSubnet(ctx context.Context, id string) (*core.Subnet, error)
2829
GetSubnetFromCacheByIP(ip string) (*core.Subnet, error)

pkg/oci/zones.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (cp *CloudProvider) GetZone() (cloudprovider.Zone, error) {
4949
// initialization must be down outside the kubelets.
5050
func (cp *CloudProvider) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error) {
5151
instanceID := util.MapProviderIDToInstanceID(providerID)
52-
instance, err := cp.client.Instances().GetInstance(context.TODO(), instanceID)
52+
instance, err := cp.client.Compute().GetInstance(context.TODO(), instanceID)
5353
if err != nil {
5454
return cloudprovider.Zone{}, err
5555
}
@@ -64,7 +64,7 @@ func (cp *CloudProvider) GetZoneByProviderID(providerID string) (cloudprovider.Z
6464
// in the context of external cloud providers where node initialization must be
6565
// down outside the kubelets.
6666
func (cp *CloudProvider) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error) {
67-
instance, err := cp.client.Instances().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(nodeName))
67+
instance, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(nodeName))
6868
if err != nil {
6969
return cloudprovider.Zone{}, err
7070
}

0 commit comments

Comments
 (0)