scope

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AvailabilityDomain = "AvailabilityDomain"
	FaultDomain        = "FaultDomain"
	OCIClusterKind     = "OCICluster"
)
View Source
const (
	VcnDefaultCidr                        = "10.0.0.0/16"
	ControlPlaneEndpointSubnetDefaultCIDR = "10.0.0.8/29"
	ControlPlaneMachineSubnetDefaultCIDR  = "10.0.0.0/29"
	WorkerSubnetDefaultCIDR               = "10.0.64.0/20"
	ServiceLoadBalancerDefaultCIDR        = "10.0.0.32/27"
	ApiServerPort                         = 6443
	APIServerLBBackendSetName             = "apiserver-lb-backendset"
	APIServerLBListener                   = "apiserver-lb-listener"
	SGWServiceSuffix                      = "-services-in-oracle-services-network"
	ServiceGatewayName                    = "service-gateway"
	PublicRouteTableName                  = "public-route-table"
	PrivateRouteTableName                 = "private-route-table"
	NatGatewayName                        = "nat-gateway"
	InternetGatewayName                   = "internet-gateway"
	ControlPlaneEndpointDefaultName       = "control-plane-endpoint"
	ControlPlaneDefaultName               = "control-plane"
	WorkerDefaultName                     = "worker"
	ServiceLBDefaultName                  = "service-lb"
)
View Source
const (
	PollInterval   = 5 * time.Second
	RequestTimeout = 2 * time.Minute
)
View Source
const OCIMachineKind = "OCIMachine"

Variables

View Source
var (
	MockTestRegion = "us-lexington-1"
)

Functions

func MockAuthConfig added in v0.2.0

func MockAuthConfig() (config.AuthConfig, error)

Types

type ClientProvider added in v0.2.0

type ClientProvider struct {
	*logr.Logger
	// contains filtered or unexported fields
}

ClientProvider defines the regional clients

func MockNewClientProvider added in v0.2.0

func MockNewClientProvider(mockClients MockOCIClients) (*ClientProvider, error)

func NewClientProvider added in v0.2.0

func NewClientProvider(ociAuthConfigProvider common.ConfigurationProvider) (*ClientProvider, error)

NewClientProvider builds the ClientProvider with a client for the given region

func (*ClientProvider) GetOrBuildClient added in v0.2.0

func (c *ClientProvider) GetOrBuildClient(region string) (OCIClients, error)

GetOrBuildClient if the OCIClients exist for the region they are returned, if not clients will build them

type ClusterScope

type ClusterScope struct {
	*logr.Logger

	Cluster            *clusterv1.Cluster
	OCICluster         *infrastructurev1beta1.OCICluster
	VCNClient          vcn.Client
	LoadBalancerClient nlb.NetworkLoadBalancerClient
	IdentityClient     identityClent.Client
	Region             string
	ClientProvider     *ClientProvider
	// contains filtered or unexported fields
}

func NewClusterScope

func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error)

NewClusterScope creates a ClusterScope given the ClusterScopeParams

func (*ClusterScope) APIServerPort

func (s *ClusterScope) APIServerPort() int32

APIServerPort returns the APIServerPort to use when creating the load balancer.

func (*ClusterScope) Close

func (s *ClusterScope) Close(ctx context.Context) error

Close closes the current scope persisting the cluster configuration and status.

func (*ClusterScope) CreateInternetGateway

func (s *ClusterScope) CreateInternetGateway(ctx context.Context) (*string, error)

CreateInternetGateway creates the Internet Gateway for the cluster based on the ClusterScope

func (*ClusterScope) CreateLB

CreateLB configures and creates the Network Load Balancer for the cluster based on the ClusterScope. This configures the LB Listeners and Backend Sets in order to create the Network Load Balancer. It will await the Work Request completion before returning

See https://docs.oracle.com/en-us/iaas/Content/NetworkLoadBalancer/overview.htm for more details on the Network Load Balancer

func (*ClusterScope) CreateNSG

func (s *ClusterScope) CreateNSG(ctx context.Context, nsg infrastructurev1beta1.NSG) (*string, error)

func (*ClusterScope) CreateNatGateway

func (s *ClusterScope) CreateNatGateway(ctx context.Context) (*string, error)

CreateNatGateway creates the NAT Gateway for the cluster based on the ClusterScope

func (*ClusterScope) CreateRouteTable

func (s *ClusterScope) CreateRouteTable(ctx context.Context, routeTableType string) (*string, error)

func (*ClusterScope) CreateSecurityList

func (s *ClusterScope) CreateSecurityList(ctx context.Context, secList infrastructurev1beta1.SecurityList) (*string, error)

func (*ClusterScope) CreateServiceGateway

func (s *ClusterScope) CreateServiceGateway(ctx context.Context) (*string, error)

func (*ClusterScope) CreateSubnet

func (s *ClusterScope) CreateSubnet(ctx context.Context, spec infrastructurev1beta1.Subnet) (*string, error)

func (*ClusterScope) CreateVCN

func (s *ClusterScope) CreateVCN(ctx context.Context, spec infrastructurev1beta1.VCN) (*string, error)

func (*ClusterScope) DeleteApiServerLB

func (s *ClusterScope) DeleteApiServerLB(ctx context.Context) error

DeleteApiServerLB retrieves and attempts to delete the Network Load Balancer if found. It will await the Work Request completion before returning

func (*ClusterScope) DeleteDRG added in v0.3.0

func (s *ClusterScope) DeleteDRG(ctx context.Context) error

DeleteDRG tries to delete the DRG

func (*ClusterScope) DeleteDRGRPCAttachment added in v0.3.0

func (s *ClusterScope) DeleteDRGRPCAttachment(ctx context.Context) error

DeleteDRGRPCAttachment deletes DRG RPC attachments

func (*ClusterScope) DeleteDRGVCNAttachment added in v0.3.0

func (s *ClusterScope) DeleteDRGVCNAttachment(ctx context.Context) error

func (*ClusterScope) DeleteInternetGateway

func (s *ClusterScope) DeleteInternetGateway(ctx context.Context) error

DeleteInternetGateway retrieves and attempts to delete the Internet Gateway if found.

func (*ClusterScope) DeleteNSGs

func (s *ClusterScope) DeleteNSGs(ctx context.Context) error

func (*ClusterScope) DeleteNatGateway

func (s *ClusterScope) DeleteNatGateway(ctx context.Context) error

DeleteNatGateway retrieves and attempts to delete the NAT Gateway if found.

func (*ClusterScope) DeleteRouteTables

func (s *ClusterScope) DeleteRouteTables(ctx context.Context) error

func (*ClusterScope) DeleteSecurityLists

func (s *ClusterScope) DeleteSecurityLists(ctx context.Context) error

func (*ClusterScope) DeleteServiceGateway

func (s *ClusterScope) DeleteServiceGateway(ctx context.Context) error

func (*ClusterScope) DeleteSubnets

func (s *ClusterScope) DeleteSubnets(ctx context.Context) error

func (*ClusterScope) DeleteVCN

func (s *ClusterScope) DeleteVCN(ctx context.Context) error

func (*ClusterScope) GetCompartmentId

func (s *ClusterScope) GetCompartmentId() string

GetCompartmentId returns the CompartmentId defined in OCICluster's spec

func (*ClusterScope) GetControlPlaneEndpointDefaultEgressRules

func (s *ClusterScope) GetControlPlaneEndpointDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG

func (*ClusterScope) GetControlPlaneEndpointDefaultIngressRules

func (s *ClusterScope) GetControlPlaneEndpointDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG

func (*ClusterScope) GetControlPlaneEndpointSubnet

func (s *ClusterScope) GetControlPlaneEndpointSubnet() *infrastructurev1beta1.Subnet

func (*ClusterScope) GetControlPlaneEndpointSubnetCidr

func (s *ClusterScope) GetControlPlaneEndpointSubnetCidr() string

func (*ClusterScope) GetControlPlaneLoadBalancerName

func (s *ClusterScope) GetControlPlaneLoadBalancerName() string

GetControlPlaneLoadBalancerName returns the user defined APIServerLB name from the spec or assigns the name based on the OCICluster's name

func (*ClusterScope) GetControlPlaneMachineDefaultEgressRules

func (s *ClusterScope) GetControlPlaneMachineDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG

func (*ClusterScope) GetControlPlaneMachineDefaultIngressRules

func (s *ClusterScope) GetControlPlaneMachineDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG

func (*ClusterScope) GetControlPlaneMachineSubnet

func (s *ClusterScope) GetControlPlaneMachineSubnet() *infrastructurev1beta1.Subnet

func (*ClusterScope) GetControlPlaneMachineSubnetCidr

func (s *ClusterScope) GetControlPlaneMachineSubnetCidr() string

func (*ClusterScope) GetDRG added in v0.3.0

func (s *ClusterScope) GetDRG(ctx context.Context) (*core.Drg, error)

GetDRG retrieves the Cluster's core.Drg using the one of the following methods

1. the OCICluster's spec Drg

2. Listing the Drgs for the Compartment (by ID) and filtering by tag

func (*ClusterScope) GetDRGAttachment added in v0.3.0

func (s *ClusterScope) GetDRGAttachment(ctx context.Context) (*core.DrgAttachment, error)

func (*ClusterScope) GetDRGName added in v0.3.0

func (s *ClusterScope) GetDRGName() string

func (*ClusterScope) GetDefinedTags

func (s *ClusterScope) GetDefinedTags() map[string]map[string]interface{}

GetDefinedTags returns a map of DefinedTags defined in the OCICluster's spec

func (*ClusterScope) GetDesiredRouteTables

func (s *ClusterScope) GetDesiredRouteTables() []string

func (*ClusterScope) GetFreeFormTags

func (s *ClusterScope) GetFreeFormTags() map[string]string

GetFreeFormTags returns a map of FreeformTags defined in the OCICluster's spec

func (*ClusterScope) GetInternetGateway

func (s *ClusterScope) GetInternetGateway(ctx context.Context) (*core.InternetGateway, error)

GetInternetGateway retrieves the Cluster's core.InternetGateway using the one of the following methods

1. the OCICluster's spec InternetGatewayId

2. Listing the Internet Gateways for the Compartment (by ID) and filtering by tag

func (*ClusterScope) GetLoadBalancer

GetLoadBalancer retrieves the Cluster's networkloadbalancer.NetworkLoadBalancer using the one of the following methods

1. the OCICluster's spec LoadBalancerId

2. Listing the NetworkLoadBalancers for the Compartment (by ID) and DisplayName then filtering by tag

func (*ClusterScope) GetNSG

func (*ClusterScope) GetNSGSpec

func (s *ClusterScope) GetNSGSpec() []*infrastructurev1beta1.NSG

func (*ClusterScope) GetNatGateway

func (s *ClusterScope) GetNatGateway(ctx context.Context) (*core.NatGateway, error)

GetNatGateway retrieves the Cluster's core.NatGateway using the one of the following methods

1. the OCICluster's spec NatGatewayId

2. Listing the NAT Gateways for the Compartment (by ID), VCN and DisplayName and filtering by tag

func (*ClusterScope) GetNodeDefaultEgressRules

func (s *ClusterScope) GetNodeDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG

func (*ClusterScope) GetNodeDefaultIngressRules

func (s *ClusterScope) GetNodeDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG

func (*ClusterScope) GetNodeSubnet

func (s *ClusterScope) GetNodeSubnet() []*infrastructurev1beta1.Subnet

func (*ClusterScope) GetOCICluster

func (s *ClusterScope) GetOCICluster() *infrastructurev1beta1.OCICluster

func (*ClusterScope) GetRegionCodeFromRegion

func (s *ClusterScope) GetRegionCodeFromRegion(ctx context.Context, region string) (string, error)

GetRegionCodeFromRegion pulls all OCI regions available and returns the passed in region's code if contained in the list.

example: "ca-toronto-1" -> "YYZ"

func (*ClusterScope) GetSecurityList

func (*ClusterScope) GetServiceGateway

func (s *ClusterScope) GetServiceGateway(ctx context.Context) (*core.ServiceGateway, error)

func (*ClusterScope) GetServiceLoadBalancerDefaultEgressRules

func (s *ClusterScope) GetServiceLoadBalancerDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG

func (*ClusterScope) GetServiceLoadBalancerDefaultIngressRules

func (s *ClusterScope) GetServiceLoadBalancerDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG

func (*ClusterScope) GetServiceLoadBalancerSubnet

func (s *ClusterScope) GetServiceLoadBalancerSubnet() *infrastructurev1beta1.Subnet

func (*ClusterScope) GetServiceLoadBalancerSubnetCidr

func (s *ClusterScope) GetServiceLoadBalancerSubnetCidr() string

func (*ClusterScope) GetSubnet

func (*ClusterScope) GetSubnetsSpec

func (s *ClusterScope) GetSubnetsSpec() []*infrastructurev1beta1.Subnet

func (*ClusterScope) GetVCN

func (s *ClusterScope) GetVCN(ctx context.Context) (*core.Vcn, error)

func (*ClusterScope) GetVcnCidr

func (s *ClusterScope) GetVcnCidr() string

func (*ClusterScope) GetVcnName

func (s *ClusterScope) GetVcnName() string

func (*ClusterScope) IsAllSubnetsPrivate

func (s *ClusterScope) IsAllSubnetsPrivate() bool

IsAllSubnetsPrivate determines if all the ClusterScope's subnets are private

func (*ClusterScope) IsAllSubnetsPublic

func (s *ClusterScope) IsAllSubnetsPublic() bool

IsAllSubnetsPublic determines if all the ClusterScope's subnets are public

func (*ClusterScope) IsLBEqual

IsLBEqual determines if the actual networkloadbalancer.NetworkLoadBalancer is equal to the desired. Equality is determined by DisplayName, FreeformTags and DefinedTags matching.

func (*ClusterScope) IsNSGEqual

func (s *ClusterScope) IsNSGEqual(actual *core.NetworkSecurityGroup, desired infrastructurev1beta1.NSG) bool

func (*ClusterScope) IsNSGExitsByRole

func (s *ClusterScope) IsNSGExitsByRole(role infrastructurev1beta1.Role) bool

func (*ClusterScope) IsResourceCreatedByClusterAPI

func (s *ClusterScope) IsResourceCreatedByClusterAPI(resourceFreeFormTags map[string]string) bool

func (*ClusterScope) IsSecurityListEqual

func (s *ClusterScope) IsSecurityListEqual(actual core.SecurityList, desired infrastructurev1beta1.SecurityList) bool

func (*ClusterScope) IsSecurityListExitsByRole

func (s *ClusterScope) IsSecurityListExitsByRole(role infrastructurev1beta1.Role) bool

func (*ClusterScope) IsSubnetsEqual

func (s *ClusterScope) IsSubnetsEqual(actual *core.Subnet, desired infrastructurev1beta1.Subnet) bool

func (*ClusterScope) IsTagsEqual

func (s *ClusterScope) IsTagsEqual(freeFromTags map[string]string, definedTags map[string]map[string]interface{}) bool

func (*ClusterScope) IsVcnEquals

func (s *ClusterScope) IsVcnEquals(actual *core.Vcn, desired infrastructurev1beta1.VCN) bool

func (*ClusterScope) LBSpec

LBSpec builds the LoadBalancer from the ClusterScope and returns it

func (*ClusterScope) NSGSpec

func (s *ClusterScope) NSGSpec() ([]*infrastructurev1beta1.NSG, error)

func (*ClusterScope) NodeSubnetCidr

func (s *ClusterScope) NodeSubnetCidr() []string

func (*ClusterScope) PatchObject

func (s *ClusterScope) PatchObject(ctx context.Context) error

PatchObject persists the cluster configuration and status.

func (*ClusterScope) ReconcileApiServerLB

func (s *ClusterScope) ReconcileApiServerLB(ctx context.Context) error

ReconcileApiServerLB tries to move the Load Balancer to the desired OCICluster Spec

func (*ClusterScope) ReconcileDRG added in v0.3.0

func (s *ClusterScope) ReconcileDRG(ctx context.Context) error

ReconcileDRG tries to move the DRG to the desired OCICluster Spec

func (*ClusterScope) ReconcileDRGRPCAttachment added in v0.3.0

func (s *ClusterScope) ReconcileDRGRPCAttachment(ctx context.Context) error

ReconcileDRGRPCAttachment reconciles DRG RPC attachments

func (*ClusterScope) ReconcileDRGVCNAttachment added in v0.3.0

func (s *ClusterScope) ReconcileDRGVCNAttachment(ctx context.Context) error

ReconcileDRGVCNAttachment tries to attach the DRG to the VCN

func (*ClusterScope) ReconcileFailureDomains

func (s *ClusterScope) ReconcileFailureDomains(ctx context.Context) error

func (*ClusterScope) ReconcileInternetGateway

func (s *ClusterScope) ReconcileInternetGateway(ctx context.Context) error

ReconcileInternetGateway tries to move the Internet Gateway to the desired OCICluster Spec

func (*ClusterScope) ReconcileNSG

func (s *ClusterScope) ReconcileNSG(ctx context.Context) error

func (*ClusterScope) ReconcileNatGateway

func (s *ClusterScope) ReconcileNatGateway(ctx context.Context) error

ReconcileNatGateway tries to move the NAT Gateway to the desired OCICluster Spec

func (*ClusterScope) ReconcileRouteTable

func (s *ClusterScope) ReconcileRouteTable(ctx context.Context) error

func (*ClusterScope) ReconcileServiceGateway

func (s *ClusterScope) ReconcileServiceGateway(ctx context.Context) error

func (*ClusterScope) ReconcileSubnet

func (s *ClusterScope) ReconcileSubnet(ctx context.Context) error

func (*ClusterScope) ReconcileVCN

func (s *ClusterScope) ReconcileVCN(ctx context.Context) error

func (*ClusterScope) SetFailureDomain

func (s *ClusterScope) SetFailureDomain(id string, spec clusterv1.FailureDomainSpec)

SetFailureDomain sets the cluster's failure domain in the status

func (*ClusterScope) SubnetSpec

func (s *ClusterScope) SubnetSpec() ([]*infrastructurev1beta1.Subnet, error)

func (*ClusterScope) UpdateDRGAttachment added in v0.3.0

func (s *ClusterScope) UpdateDRGAttachment(ctx context.Context) (*core.DrgAttachment, error)

func (*ClusterScope) UpdateInternetGateway

func (s *ClusterScope) UpdateInternetGateway(ctx context.Context) error

UpdateInternetGateway updates the FreeFormTags and DefinedTags

func (*ClusterScope) UpdateLB

UpdateLB updates existing Load Balancer's DisplayName, FreeformTags and DefinedTags

func (*ClusterScope) UpdateNSG

func (s *ClusterScope) UpdateNSG(ctx context.Context, nsgSpec infrastructurev1beta1.NSG) error

func (*ClusterScope) UpdateNatGateway

func (s *ClusterScope) UpdateNatGateway(ctx context.Context) error

UpdateNatGateway updates the FreeFormTags and DefinedTags

func (*ClusterScope) UpdateRouteTable

func (s *ClusterScope) UpdateRouteTable(ctx context.Context, id *string) error

func (*ClusterScope) UpdateSecurityList

func (s *ClusterScope) UpdateSecurityList(ctx context.Context, securityListSpec infrastructurev1beta1.SecurityList) error

func (*ClusterScope) UpdateServiceGateway

func (s *ClusterScope) UpdateServiceGateway(ctx context.Context) error

func (*ClusterScope) UpdateSubnet

func (s *ClusterScope) UpdateSubnet(ctx context.Context, spec infrastructurev1beta1.Subnet) error

func (*ClusterScope) UpdateVCN

func (s *ClusterScope) UpdateVCN(ctx context.Context, vcn infrastructurev1beta1.VCN) error

func (*ClusterScope) VCNSpec

func (s *ClusterScope) VCNSpec() infrastructurev1beta1.VCN

type ClusterScopeClient

type ClusterScopeClient interface {
	ReconcileVCN(ctx context.Context) error
	ReconcileInternetGateway(ctx context.Context) error
	ReconcileNatGateway(ctx context.Context) error
	ReconcileServiceGateway(ctx context.Context) error
	ReconcileNSG(ctx context.Context) error
	ReconcileRouteTable(ctx context.Context) error
	ReconcileSubnet(ctx context.Context) error
	ReconcileApiServerLB(ctx context.Context) error
	ReconcileFailureDomains(ctx context.Context) error
	ReconcileDRG(ctx context.Context) error
	DeleteDRG(ctx context.Context) error
	ReconcileDRGVCNAttachment(ctx context.Context) error
	ReconcileDRGRPCAttachment(ctx context.Context) error
	DeleteApiServerLB(ctx context.Context) error
	DeleteNSGs(ctx context.Context) error
	DeleteSubnets(ctx context.Context) error
	DeleteRouteTables(ctx context.Context) error
	DeleteSecurityLists(ctx context.Context) error
	DeleteServiceGateway(ctx context.Context) error
	DeleteNatGateway(ctx context.Context) error
	DeleteInternetGateway(ctx context.Context) error
	DeleteVCN(ctx context.Context) error
	DeleteDRGVCNAttachment(ctx context.Context) error
	DeleteDRGRPCAttachment(ctx context.Context) error
	Close(ctx context.Context) error
	GetOCICluster() *v1beta1.OCICluster
}

type ClusterScopeParams

type ClusterScopeParams struct {
	Client                client.Client
	Logger                *logr.Logger
	Cluster               *clusterv1.Cluster
	OCICluster            *infrastructurev1beta1.OCICluster
	VCNClient             vcn.Client
	LoadBalancerClient    nlb.NetworkLoadBalancerClient
	IdentityClient        identityClent.Client
	Region                string
	OCIAuthConfigProvider common.ConfigurationProvider
	ClientProvider        *ClientProvider
}

ClusterScopeParams defines the params need to create a new ClusterScope

type MachineScope

type MachineScope struct {
	*logr.Logger
	Client client.Client

	Cluster                   *clusterv1.Cluster
	Machine                   *clusterv1.Machine
	ComputeClient             compute.ComputeClient
	OCICluster                *infrastructurev1beta1.OCICluster
	OCIMachine                *infrastructurev1beta1.OCIMachine
	VCNClient                 vcn.Client
	NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient
	// contains filtered or unexported fields
}

func NewMachineScope

func NewMachineScope(params MachineScopeParams) (*MachineScope, error)

NewMachineScope creates a MachineScope given the MachineScopeParams

func (*MachineScope) Close

func (m *MachineScope) Close(ctx context.Context) error

Close closes the current scope persisting the cluster configuration and status.

func (*MachineScope) DeleteMachine

func (m *MachineScope) DeleteMachine(ctx context.Context) error

DeleteMachine terminates the instance using InstanceId from the OCIMachine spec and deletes the boot volume

func (*MachineScope) GetBootstrapData

func (m *MachineScope) GetBootstrapData() (string, error)

GetBootstrapData returns the bootstrap data from the secret in the Machine's bootstrap.dataSecretName.

func (*MachineScope) GetInstanceId

func (m *MachineScope) GetInstanceId() *string

GetInstanceId returns the OCIMachine instance id.

func (*MachineScope) GetInstanceIp

func (m *MachineScope) GetInstanceIp(ctx context.Context) (*string, error)

GetInstanceIp returns the OCIMachine's instance IP from its primary VNIC attachment.

See https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVNICs.htm for more on VNICs

func (*MachineScope) GetMachine

func (m *MachineScope) GetMachine(ctx context.Context) (*core.Instance, error)

GetMachine will attempt to get the machine instance by instance id, or display name if not instance id

func (*MachineScope) GetMachineByDisplayName

func (m *MachineScope) GetMachineByDisplayName(ctx context.Context, name string) (*core.Instance, error)

GetMachineByDisplayName returns the machine from the compartment if there is a matching DisplayName, and it was created by the cluster

func (*MachineScope) GetMachineIPFromStatus

func (m *MachineScope) GetMachineIPFromStatus() (string, error)

GetMachineIPFromStatus returns the IP address from the OCIMachine's status if it is the Internal IP

func (*MachineScope) GetOrCreateMachine

func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, error)

GetOrCreateMachine will get machine instance or create if the instances doesn't exist

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) IsReady

func (m *MachineScope) IsReady() bool

IsReady returns the ready status of the machine.

func (*MachineScope) IsResourceCreatedByClusterAPI

func (s *MachineScope) IsResourceCreatedByClusterAPI(resourceFreeFormTags map[string]string) bool

IsResourceCreatedByClusterAPI determines if the instance was created by the cluster using the tags created at instance launch.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the OCIMachine name.

func (*MachineScope) PatchObject

func (m *MachineScope) PatchObject(ctx context.Context) error

PatchObject persists the cluster configuration and status.

func (*MachineScope) ReconcileCreateInstanceOnLB

func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error

ReconcileCreateInstanceOnLB sets up backend sets for the load balancer

func (*MachineScope) ReconcileDeleteInstanceOnLB

func (m *MachineScope) ReconcileDeleteInstanceOnLB(ctx context.Context) error

ReconcileDeleteInstanceOnLB checks to make sure the instance is part of a backend set then deletes the backend on the NetworkLoadBalancer

It will await the Work Request completion before returning

See https://docs.oracle.com/en-us/iaas/Content/NetworkLoadBalancer/BackendServers/backend_server_management.htm#BackendServerManagement for more info on Backend Server Management

func (*MachineScope) SetFailureMessage

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the OCIMachine status error message.

func (*MachineScope) SetFailureReason

func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError)

SetFailureReason sets the OCIMachine status error reason.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the OCIMachine Ready Status.

type MachineScopeParams

type MachineScopeParams struct {
	Logger                    *logr.Logger
	Cluster                   *clusterv1.Cluster
	Machine                   *clusterv1.Machine
	Client                    client.Client
	ComputeClient             compute.ComputeClient
	OCICluster                *infrastructurev1beta1.OCICluster
	OCIMachine                *infrastructurev1beta1.OCIMachine
	VCNClient                 vcn.Client
	NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient
}

MachineScopeParams defines the params need to create a new MachineScope

type MockOCIClients added in v0.2.0

type MockOCIClients struct {
	VCNClient          vcn.Client
	ComputeClient      compute.ComputeClient
	LoadBalancerClient *networkloadbalancer.NetworkLoadBalancerClient
	IdentityClient     *identity.IdentityClient
}

type OCIClients added in v0.2.0

type OCIClients struct {
	ComputeClient      compute.ComputeClient
	VCNClient          vcn.Client
	LoadBalancerClient nlb.NetworkLoadBalancerClient
	IdentityClient     identityClient.Client
}

OCIClients is the struct of all the needed OCI clients

Directories

Path Synopsis
Package mock_scope is a generated GoMock package.
Package mock_scope is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL