Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refactor the service clients #53

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloud/ociutil/ociutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func IsNotFound(err error) bool {
}

// AwaitLBWorkRequest waits for the LB work request to either succeed, fail. See k8s.io/apimachinery/pkg/util/wait
func AwaitLBWorkRequest(ctx context.Context, networkLoadBalancerClient nlb.NetworkLoadBalancerClient, workRequestId *string) (*networkloadbalancer.WorkRequest, error) {
func AwaitLBWorkRequest(ctx context.Context, networkLoadBalancerClient nlb.Client, workRequestId *string) (*networkloadbalancer.WorkRequest, error) {
var wr *networkloadbalancer.WorkRequest
err := wait.PollWithContext(ctx, WorkRequestPollInterval, WorkRequestTimeout, func(ctx context.Context) (done bool, err error) {
twr, err := networkLoadBalancerClient.GetWorkRequest(ctx, networkloadbalancer.GetWorkRequestRequest{
Expand Down
4 changes: 2 additions & 2 deletions cloud/scope/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import (

// OCIClients is the struct of all the needed OCI clients
type OCIClients struct {
ComputeClient compute.ComputeClient
ComputeClient compute.Client
VCNClient vcn.Client
LoadBalancerClient nlb.NetworkLoadBalancerClient
LoadBalancerClient nlb.Client
IdentityClient identityClient.Client
}

Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/clients_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

type MockOCIClients struct {
VCNClient vcn.Client
ComputeClient compute.ComputeClient
ComputeClient compute.Client
LoadBalancerClient *networkloadbalancer.NetworkLoadBalancerClient
IdentityClient *identity.IdentityClient
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ClusterScopeParams struct {
Cluster *clusterv1.Cluster
OCICluster *infrastructurev1beta1.OCICluster
VCNClient vcn.Client
LoadBalancerClient nlb.NetworkLoadBalancerClient
LoadBalancerClient nlb.Client
IdentityClient identityClent.Client
Region string
OCIAuthConfigProvider common.ConfigurationProvider
Expand All @@ -64,7 +64,7 @@ type ClusterScope struct {
Cluster *clusterv1.Cluster
OCICluster *infrastructurev1beta1.OCICluster
VCNClient vcn.Client
LoadBalancerClient nlb.NetworkLoadBalancerClient
LoadBalancerClient nlb.Client
IdentityClient identityClent.Client
Region string
}
Expand Down
8 changes: 4 additions & 4 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ type MachineScopeParams struct {
Cluster *clusterv1.Cluster
Machine *clusterv1.Machine
Client client.Client
ComputeClient compute.ComputeClient
ComputeClient compute.Client
OCICluster *infrastructurev1beta1.OCICluster
OCIMachine *infrastructurev1beta1.OCIMachine
VCNClient vcn.Client
NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient
NetworkLoadBalancerClient nlb.Client
}

type MachineScope struct {
Expand All @@ -67,11 +67,11 @@ type MachineScope struct {
patchHelper *patch.Helper
Cluster *clusterv1.Cluster
Machine *clusterv1.Machine
ComputeClient compute.ComputeClient
ComputeClient compute.Client
OCICluster *infrastructurev1beta1.OCICluster
OCIMachine *infrastructurev1beta1.OCIMachine
VCNClient vcn.Client
NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient
NetworkLoadBalancerClient nlb.Client
}

// NewMachineScope creates a MachineScope given the MachineScopeParams
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/compute/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/oracle/oci-go-sdk/v63/core"
)

type ComputeClient interface {
type Client interface {
LaunchInstance(ctx context.Context, request core.LaunchInstanceRequest) (response core.LaunchInstanceResponse, err error)
TerminateInstance(ctx context.Context, request core.TerminateInstanceRequest) (response core.TerminateInstanceResponse, err error)
GetInstance(ctx context.Context, request core.GetInstanceRequest) (response core.GetInstanceResponse, err error)
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/networkloadbalancer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/oracle/oci-go-sdk/v63/networkloadbalancer"
)

type NetworkLoadBalancerClient interface {
type Client interface {
ListNetworkLoadBalancers(ctx context.Context, request networkloadbalancer.ListNetworkLoadBalancersRequest) (response networkloadbalancer.ListNetworkLoadBalancersResponse, err error)
GetNetworkLoadBalancer(ctx context.Context, request networkloadbalancer.GetNetworkLoadBalancerRequest) (response networkloadbalancer.GetNetworkLoadBalancerResponse, err error)
CreateBackend(ctx context.Context, request networkloadbalancer.CreateBackendRequest) (response networkloadbalancer.CreateBackendResponse, err error)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ var (
// usePRArtifacts specifies whether or not to use the build from a PR of the Kubernetes repository
usePRArtifacts bool

computeClient compute.ComputeClient
computeClient compute.Client

vcnClient vcn.Client

lbClient nlb.NetworkLoadBalancerClient
lbClient nlb.Client

adCount int
)
Expand Down