scope

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 57 Imported by: 1

Documentation

Overview

Package scope implements cloud code.

Index

Constants

View Source
const BucketAccess = "public"

BucketAccess indicates if the bucket has public or private access public access.

View Source
const (
	// DEBUGLEVEL indicates the debug level of the logs.
	DEBUGLEVEL = 5
)
View Source
const (
	// LOGDEBUGLEVEL indicates the debug level of the logs.
	LOGDEBUGLEVEL = 5
)

Variables

View Source
var (
	// ResourceNotFoundCode indicates the http status code when a resource does not exist.
	ResourceNotFoundCode = 404

	// DHCPServerNotFound is the error returned when a DHCP server is not found.
	DHCPServerNotFound = ResourceNotFound("dhcp server does not exist")
)

Functions

func CheckCreateInfraAnnotation added in v0.9.0

func CheckCreateInfraAnnotation(cluster infrav1beta2.IBMPowerVSCluster) bool

CheckCreateInfraAnnotation checks for annotations set on IBMPowerVSCluster object to determine cluster creation workflow.

func GetClusterByName added in v0.9.0

func GetClusterByName(ctx context.Context, c client.Client, namespace, name string) (*infrav1beta2.IBMPowerVSCluster, error)

GetClusterByName finds and return a Cluster object using the specified params.

Types

type CRN added in v0.9.0

type CRN struct {
	Scheme          string
	Version         string
	CName           string
	CType           string
	ServiceName     string
	Region          string
	ScopeType       string
	Scope           string
	ServiceInstance string
	ResourceType    string
	Resource        string
}

CRN is a local duplicate of IBM Cloud CRN for parsing and references.

func ParseCRN added in v0.9.0

func ParseCRN(s string) (*CRN, error)

ParseCRN is a local duplicate of IBM Cloud CRN Parse functionality, to convert a string into a CRN, if it is in the correct format.

type ClientFactory added in v0.9.0

type ClientFactory struct {
	AuthenticatorFactory      func() (core.Authenticator, error)
	PowerVSClientFactory      func() (powervs.PowerVS, error)
	VPCClientFactory          func() (vpc.Vpc, error)
	TransitGatewayFactory     func() (transitgateway.TransitGateway, error)
	ResourceControllerFactory func() (resourcecontroller.ResourceController, error)
	ResourceManagerFactory    func() (resourcemanager.ResourceManager, error)
}

ClientFactory is collection of function used for overriding actual clients to help in testing.

type ClusterScope

type ClusterScope struct {
	logr.Logger
	Client client.Client

	IBMVPCClient    vpc.Vpc
	Cluster         *capiv1beta1.Cluster
	IBMVPCCluster   *infrav1beta2.IBMVPCCluster
	ServiceEndpoint []endpoints.ServiceEndpoint
	// contains filtered or unexported fields
}

ClusterScope defines a scope defined around a cluster.

func NewClusterScope

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

NewClusterScope creates a new ClusterScope from the supplied parameters.

func (*ClusterScope) APIServerPort added in v0.4.0

func (s *ClusterScope) APIServerPort() int32

APIServerPort returns the APIServerPort to use when creating the ControlPlaneEndpoint.

func (*ClusterScope) Close

func (s *ClusterScope) Close() error

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

func (*ClusterScope) CreateLoadBalancer added in v0.3.0

func (s *ClusterScope) CreateLoadBalancer() (*vpcv1.LoadBalancer, error)

CreateLoadBalancer creates a new IBM VPC load balancer in specified resource group.

func (*ClusterScope) CreateSubnet

func (s *ClusterScope) CreateSubnet() (*vpcv1.Subnet, error)

CreateSubnet creates a subnet within provided vpc and zone.

func (*ClusterScope) CreateVPC

func (s *ClusterScope) CreateVPC() (*vpcv1.VPC, error)

CreateVPC creates a new IBM VPC in specified resource group.

func (*ClusterScope) DeleteLoadBalancer added in v0.3.0

func (s *ClusterScope) DeleteLoadBalancer() (bool, error)

DeleteLoadBalancer deletes IBM VPC load balancer associated with a VPC id.

func (*ClusterScope) DeleteSubnet

func (s *ClusterScope) DeleteSubnet() error

DeleteSubnet deletes a subnet associated with subnet id.

func (*ClusterScope) DeleteVPC

func (s *ClusterScope) DeleteVPC() error

DeleteVPC deletes IBM VPC associated with a VPC id.

func (*ClusterScope) GetLoadBalancerAddress added in v0.7.0

func (s *ClusterScope) GetLoadBalancerAddress() string

GetLoadBalancerAddress will get the address for the load balancer.

func (*ClusterScope) GetLoadBalancerByHostname added in v0.7.0

func (s *ClusterScope) GetLoadBalancerByHostname(loadBalancerHostname string) (*vpcv1.LoadBalancer, error)

GetLoadBalancerByHostname retrieves a IBM VPC load balancer with specified hostname.

func (*ClusterScope) GetLoadBalancerID added in v0.3.0

func (s *ClusterScope) GetLoadBalancerID() string

GetLoadBalancerID will get the id for the load balancer.

func (*ClusterScope) GetLoadBalancerState added in v0.3.0

func (s *ClusterScope) GetLoadBalancerState() infrav1beta2.VPCLoadBalancerState

GetLoadBalancerState will get the state for the load balancer.

func (*ClusterScope) IsReady added in v0.3.0

func (s *ClusterScope) IsReady() bool

IsReady will return the status for the cluster.

func (*ClusterScope) PatchObject

func (s *ClusterScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*ClusterScope) SetLoadBalancerAddress added in v0.7.0

func (s *ClusterScope) SetLoadBalancerAddress(address *string)

SetLoadBalancerAddress will set the address for the load balancer.

func (*ClusterScope) SetLoadBalancerID added in v0.3.0

func (s *ClusterScope) SetLoadBalancerID(id *string)

SetLoadBalancerID will set the id for the load balancer.

func (*ClusterScope) SetLoadBalancerState added in v0.3.0

func (s *ClusterScope) SetLoadBalancerState(status string)

SetLoadBalancerState will set the state for the load balancer.

func (*ClusterScope) SetNotReady added in v0.3.0

func (s *ClusterScope) SetNotReady()

SetNotReady will set the status as not ready for the cluster.

func (*ClusterScope) SetReady added in v0.3.0

func (s *ClusterScope) SetReady()

SetReady will set the status as ready for the cluster.

type ClusterScopeParams

type ClusterScopeParams struct {
	IBMVPCClient    vpc.Vpc
	Client          client.Client
	Logger          logr.Logger
	Cluster         *capiv1beta1.Cluster
	IBMVPCCluster   *infrav1beta2.IBMVPCCluster
	ServiceEndpoint []endpoints.ServiceEndpoint
}

ClusterScopeParams defines the input parameters used to create a new ClusterScope.

type MachineScope

type MachineScope struct {
	logr.Logger
	Client client.Client

	IBMVPCClient        vpc.Vpc
	GlobalTaggingClient globaltagging.GlobalTagging
	Cluster             *capiv1beta1.Cluster
	Machine             *capiv1beta1.Machine
	IBMVPCCluster       *infrav1beta2.IBMVPCCluster
	IBMVPCMachine       *infrav1beta2.IBMVPCMachine
	ServiceEndpoint     []endpoints.ServiceEndpoint
	// contains filtered or unexported fields
}

MachineScope defines a scope defined around a machine and its cluster.

func NewMachineScope

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

NewMachineScope creates a new MachineScope from the supplied parameters.

func (*MachineScope) APIServerPort added in v0.5.0

func (m *MachineScope) APIServerPort() int32

APIServerPort returns the APIServerPort.

func (*MachineScope) CheckTagExists added in v0.9.0

func (m *MachineScope) CheckTagExists(tagName string) (bool, error)

CheckTagExists checks whether a user tag already exists.

func (*MachineScope) Close

func (m *MachineScope) Close() error

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

func (*MachineScope) CreateMachine

func (m *MachineScope) CreateMachine() (*vpcv1.Instance, error)

CreateMachine creates a vpc machine.

func (*MachineScope) CreateVPCLoadBalancerPoolMember added in v0.3.0

func (m *MachineScope) CreateVPCLoadBalancerPoolMember(internalIP *string, targetPort int64) (*vpcv1.LoadBalancerPoolMember, error)

CreateVPCLoadBalancerPoolMember creates a new pool member and adds it to the load balancer pool.

func (*MachineScope) DeleteMachine

func (m *MachineScope) DeleteMachine() error

DeleteMachine deletes the vpc machine associated with machine instance id.

func (*MachineScope) DeleteVPCLoadBalancerPoolMember added in v0.3.0

func (m *MachineScope) DeleteVPCLoadBalancerPoolMember() error

DeleteVPCLoadBalancerPoolMember deletes a pool member from the load balancer pool.

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 added in v0.9.0

func (m *MachineScope) GetInstanceID() string

GetInstanceID will return the Machine's Instance ID.

func (*MachineScope) GetInstanceStatus added in v0.9.0

func (m *MachineScope) GetInstanceStatus() string

GetInstanceStatus will return the Machine's Instance Status.

func (*MachineScope) GetMachineInternalIP added in v0.9.0

func (m *MachineScope) GetMachineInternalIP() *string

GetMachineInternalIP returns the machine's internal IP.

func (*MachineScope) IsReady added in v0.9.0

func (m *MachineScope) IsReady() bool

IsReady returns whether the machine is ready.

func (*MachineScope) PatchObject

func (m *MachineScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*MachineScope) ReconcileVPCLoadBalancerPoolMember added in v0.9.0

func (m *MachineScope) ReconcileVPCLoadBalancerPoolMember(poolMember infrav1beta2.VPCLoadBalancerBackendPoolMember) (bool, error)

ReconcileVPCLoadBalancerPoolMember reconciles a Machine's Load Balancer Pool membership.

func (*MachineScope) SetAddresses added in v0.9.0

func (m *MachineScope) SetAddresses(instance *vpcv1.Instance)

SetAddresses sets the Machine's addresses.

func (*MachineScope) SetFailureMessage added in v0.9.0

func (m *MachineScope) SetFailureMessage(message string)

SetFailureMessage will set the Machine's Failure Message.

func (*MachineScope) SetFailureReason added in v0.9.0

func (m *MachineScope) SetFailureReason(reason string)

SetFailureReason will set the Machine's Failure Reason.

func (*MachineScope) SetInstanceID added in v0.9.0

func (m *MachineScope) SetInstanceID(id string)

SetInstanceID sets the Machine's Instance ID.

func (*MachineScope) SetInstanceStatus added in v0.9.0

func (m *MachineScope) SetInstanceStatus(status string)

SetInstanceStatus sets the Machine's Instance Status.

func (*MachineScope) SetNotReady added in v0.9.0

func (m *MachineScope) SetNotReady()

SetNotReady sets the Machine Status as not ready.

func (*MachineScope) SetProviderID added in v0.4.0

func (m *MachineScope) SetProviderID(id *string) error

SetProviderID will set the provider id for the machine.

func (*MachineScope) SetReady added in v0.9.0

func (m *MachineScope) SetReady()

SetReady sets the Machine Status as ready.

func (*MachineScope) TagResource added in v0.9.0

func (m *MachineScope) TagResource(tagName string, resourceCRN string) error

TagResource will attach a user Tag to a resource.

type MachineScopeParams

type MachineScopeParams struct {
	IBMVPCClient    vpc.Vpc
	Client          client.Client
	Logger          logr.Logger
	Cluster         *capiv1beta1.Cluster
	Machine         *capiv1beta1.Machine
	IBMVPCCluster   *infrav1beta2.IBMVPCCluster
	IBMVPCMachine   *infrav1beta2.IBMVPCMachine
	ServiceEndpoint []endpoints.ServiceEndpoint
}

MachineScopeParams defines the input parameters used to create a new MachineScope.

type PowerVSClusterScope

type PowerVSClusterScope struct {
	logr.Logger
	Client client.Client

	IBMPowerVSClient      powervs.PowerVS
	IBMVPCClient          vpc.Vpc
	TransitGatewayClient  transitgateway.TransitGateway
	ResourceClient        resourcecontroller.ResourceController
	COSClient             cos.Cos
	ResourceManagerClient resourcemanager.ResourceManager

	Cluster           *capiv1beta1.Cluster
	IBMPowerVSCluster *infrav1beta2.IBMPowerVSCluster
	ServiceEndpoint   []endpoints.ServiceEndpoint
	// contains filtered or unexported fields
}

PowerVSClusterScope defines a scope defined around a Power VS Cluster.

func NewPowerVSClusterScope

func NewPowerVSClusterScope(params PowerVSClusterScopeParams) (*PowerVSClusterScope, error)

NewPowerVSClusterScope creates a new PowerVSClusterScope from the supplied parameters.

func (*PowerVSClusterScope) APIServerPort added in v0.8.0

func (s *PowerVSClusterScope) APIServerPort() int32

APIServerPort returns the APIServerPort to use when creating the ControlPlaneEndpoint.

func (*PowerVSClusterScope) COSInstance added in v0.8.0

func (s *PowerVSClusterScope) COSInstance() *infrav1beta2.CosInstance

COSInstance returns the COS instance reference.

func (*PowerVSClusterScope) Close

func (s *PowerVSClusterScope) Close() error

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

func (*PowerVSClusterScope) DHCPServer added in v0.8.0

func (s *PowerVSClusterScope) DHCPServer() *infrav1beta2.DHCPServer

DHCPServer returns the DHCP server details.

func (*PowerVSClusterScope) DeleteCOSInstance added in v0.8.0

func (s *PowerVSClusterScope) DeleteCOSInstance() error

DeleteCOSInstance deletes COS instance.

func (*PowerVSClusterScope) DeleteDHCPServer added in v0.8.0

func (s *PowerVSClusterScope) DeleteDHCPServer() error

DeleteDHCPServer deletes DHCP server.

func (*PowerVSClusterScope) DeleteLoadBalancer added in v0.8.0

func (s *PowerVSClusterScope) DeleteLoadBalancer() (bool, error)

DeleteLoadBalancer deletes loadBalancer.

func (*PowerVSClusterScope) DeleteServiceInstance added in v0.8.0

func (s *PowerVSClusterScope) DeleteServiceInstance() (bool, error)

DeleteServiceInstance deletes service instance.

func (*PowerVSClusterScope) DeleteTransitGateway added in v0.8.0

func (s *PowerVSClusterScope) DeleteTransitGateway() (bool, error)

DeleteTransitGateway deletes transit gateway.

func (*PowerVSClusterScope) DeleteVPC added in v0.8.0

func (s *PowerVSClusterScope) DeleteVPC() (bool, error)

DeleteVPC deletes VPC.

func (*PowerVSClusterScope) DeleteVPCSecurityGroups added in v0.8.0

func (s *PowerVSClusterScope) DeleteVPCSecurityGroups() error

DeleteVPCSecurityGroups deletes VPC security group.

func (*PowerVSClusterScope) DeleteVPCSubnet added in v0.8.0

func (s *PowerVSClusterScope) DeleteVPCSubnet() (bool, error)

DeleteVPCSubnet deletes VPC subnet.

func (*PowerVSClusterScope) GetDHCPServerID added in v0.8.0

func (s *PowerVSClusterScope) GetDHCPServerID() *string

GetDHCPServerID returns the DHCP id from status of IBMPowerVSCluster object. If it doesn't exist, returns nil.

func (*PowerVSClusterScope) GetLoadBalancerID added in v0.8.0

func (s *PowerVSClusterScope) GetLoadBalancerID(loadBalancerName string) *string

GetLoadBalancerID returns the loadBalancer.

func (*PowerVSClusterScope) GetLoadBalancerState added in v0.8.0

func (s *PowerVSClusterScope) GetLoadBalancerState(name string) *infrav1beta2.VPCLoadBalancerState

GetLoadBalancerState will return the state for the load balancer.

func (*PowerVSClusterScope) GetNetworkID added in v0.10.0

func (s *PowerVSClusterScope) GetNetworkID() *string

GetNetworkID returns the Network id from status of IBMPowerVSCluster object. If it doesn't exist, returns nil.

func (*PowerVSClusterScope) GetPublicLoadBalancerHostName added in v0.9.0

func (s *PowerVSClusterScope) GetPublicLoadBalancerHostName() (*string, error)

GetPublicLoadBalancerHostName will return the hostname of the public load balancer.

func (*PowerVSClusterScope) GetResourceGroupID added in v0.8.0

func (s *PowerVSClusterScope) GetResourceGroupID() string

GetResourceGroupID returns the resource group id if it present under spec or status filed of IBMPowerVSCluster object or returns empty string.

func (*PowerVSClusterScope) GetServiceInstanceID added in v0.8.0

func (s *PowerVSClusterScope) GetServiceInstanceID() string

GetServiceInstanceID returns service instance id set in status field of IBMPowerVSCluster object. If it doesn't exist, returns empty string.

func (*PowerVSClusterScope) GetServiceName added in v0.8.0

func (s *PowerVSClusterScope) GetServiceName(resourceType infrav1beta2.ResourceType) *string

GetServiceName returns name of given service type from spec or generate a name for it.

func (*PowerVSClusterScope) GetTransitGatewayID added in v0.8.0

func (s *PowerVSClusterScope) GetTransitGatewayID() *string

GetTransitGatewayID returns the transit gateway id set in status field of IBMPowerVSCluster object. If it doesn't exist, returns empty string.

func (*PowerVSClusterScope) GetVPCID added in v0.8.0

func (s *PowerVSClusterScope) GetVPCID() *string

GetVPCID returns the VPC id set in status field of IBMPowerVSCluster object. If it doesn't exist, returns nil.

func (*PowerVSClusterScope) GetVPCSecurityGroupByID added in v0.8.0

func (s *PowerVSClusterScope) GetVPCSecurityGroupByID(securityGroupID string) (*string, []*string, *bool)

GetVPCSecurityGroupByID returns the VPC security group's ruleIDs.

func (*PowerVSClusterScope) GetVPCSecurityGroupByName added in v0.8.0

func (s *PowerVSClusterScope) GetVPCSecurityGroupByName(name string) (*string, []*string, *bool)

GetVPCSecurityGroupByName returns the VPC security group id and its ruleIDs.

func (*PowerVSClusterScope) GetVPCSubnetID added in v0.8.0

func (s *PowerVSClusterScope) GetVPCSubnetID(subnetName string) *string

GetVPCSubnetID returns the VPC subnet id.

func (*PowerVSClusterScope) GetVPCSubnetIDs added in v0.8.0

func (s *PowerVSClusterScope) GetVPCSubnetIDs() []*string

GetVPCSubnetIDs returns all the VPC subnet ids.

func (*PowerVSClusterScope) InfraCluster added in v0.8.0

func (s *PowerVSClusterScope) InfraCluster() string

InfraCluster returns the IBMPowerVS infrastructure cluster object name.

func (*PowerVSClusterScope) IsPowerVSZoneSupportsPER added in v0.8.0

func (s *PowerVSClusterScope) IsPowerVSZoneSupportsPER() error

IsPowerVSZoneSupportsPER checks whether PowerVS zone supports PER capabilities.

func (*PowerVSClusterScope) Name added in v0.8.0

func (s *PowerVSClusterScope) Name() string

Name returns the CAPI cluster name.

func (*PowerVSClusterScope) Network added in v0.8.0

Network returns the cluster Network.

func (*PowerVSClusterScope) PatchObject

func (s *PowerVSClusterScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*PowerVSClusterScope) ReconcileCOSInstance added in v0.8.0

func (s *PowerVSClusterScope) ReconcileCOSInstance() error

ReconcileCOSInstance reconcile COS bucket.

func (*PowerVSClusterScope) ReconcileLoadBalancers added in v0.8.0

func (s *PowerVSClusterScope) ReconcileLoadBalancers() (bool, error)

ReconcileLoadBalancers reconcile loadBalancer.

func (*PowerVSClusterScope) ReconcileNetwork added in v0.8.0

func (s *PowerVSClusterScope) ReconcileNetwork() (bool, error)

ReconcileNetwork reconciles network If only IBMPowerVSCluster.Spec.Network is set, network would be validated and if exists already will get used as cluster’s network or a new network will be created via DHCP service. If only IBMPowerVSCluster.Spec.DHCPServer is set, DHCP server would be validated and if exists already, will use DHCP server’s network as cluster network. If not a new DHCP service will be created and it’s network will be used. If both IBMPowerVSCluster.Spec.Network & IBMPowerVSCluster.Spec.DHCPServer is set, network and DHCP server would be validated and if both exists already then network is belongs to given DHCP server or not would be validated. If both IBMPowerVSCluster.Spec.Network & IBMPowerVSCluster.Spec.DHCPServer is not set, by default DHCP service will be created to setup cluster's network.

func (*PowerVSClusterScope) ReconcilePowerVSServiceInstance added in v0.8.0

func (s *PowerVSClusterScope) ReconcilePowerVSServiceInstance() (bool, error)

ReconcilePowerVSServiceInstance reconciles Power VS service instance.

func (*PowerVSClusterScope) ReconcileResourceGroup added in v0.8.0

func (s *PowerVSClusterScope) ReconcileResourceGroup() error

ReconcileResourceGroup reconciles resource group to fetch resource group id.

func (*PowerVSClusterScope) ReconcileTransitGateway added in v0.8.0

func (s *PowerVSClusterScope) ReconcileTransitGateway() (bool, error)

ReconcileTransitGateway reconcile transit gateway.

func (*PowerVSClusterScope) ReconcileVPC added in v0.8.0

func (s *PowerVSClusterScope) ReconcileVPC() (bool, error)

ReconcileVPC reconciles VPC.

func (*PowerVSClusterScope) ReconcileVPCSecurityGroups added in v0.8.0

func (s *PowerVSClusterScope) ReconcileVPCSecurityGroups() error

ReconcileVPCSecurityGroups reconciles VPC security group.

func (*PowerVSClusterScope) ReconcileVPCSubnets added in v0.8.0

func (s *PowerVSClusterScope) ReconcileVPCSubnets() (bool, error)

ReconcileVPCSubnets reconciles VPC subnet.

func (*PowerVSClusterScope) ResourceGroup added in v0.8.0

ResourceGroup returns the cluster resource group.

func (*PowerVSClusterScope) ServiceInstance added in v0.8.0

ServiceInstance returns the cluster ServiceInstance.

func (*PowerVSClusterScope) SetLoadBalancerStatus added in v0.8.0

func (s *PowerVSClusterScope) SetLoadBalancerStatus(name string, loadBalancer infrav1beta2.VPCLoadBalancerStatus)

SetLoadBalancerStatus set the loadBalancer id.

func (*PowerVSClusterScope) SetStatus added in v0.8.0

func (s *PowerVSClusterScope) SetStatus(resourceType infrav1beta2.ResourceType, resource infrav1beta2.ResourceReference)

SetStatus set the IBMPowerVSCluster status for provided ResourceType.

func (*PowerVSClusterScope) SetTransitGatewayConnectionStatus added in v0.9.0

func (s *PowerVSClusterScope) SetTransitGatewayConnectionStatus(networkType networkConnectionType, resource *infrav1beta2.ResourceReference)

SetTransitGatewayConnectionStatus sets the connection status of Transit gateway.

func (*PowerVSClusterScope) SetTransitGatewayStatus added in v0.9.0

func (s *PowerVSClusterScope) SetTransitGatewayStatus(id *string, controllerCreated *bool)

SetTransitGatewayStatus sets the status of Transit gateway.

func (*PowerVSClusterScope) SetVPCSecurityGroupStatus added in v0.9.0

func (s *PowerVSClusterScope) SetVPCSecurityGroupStatus(name string, resource infrav1beta2.VPCSecurityGroupStatus)

SetVPCSecurityGroupStatus set the VPC security group id.

func (*PowerVSClusterScope) SetVPCSubnetStatus added in v0.9.0

func (s *PowerVSClusterScope) SetVPCSubnetStatus(name string, resource infrav1beta2.ResourceReference)

SetVPCSubnetStatus set the VPC subnet id.

func (*PowerVSClusterScope) TransitGateway added in v0.8.0

func (s *PowerVSClusterScope) TransitGateway() *infrav1beta2.TransitGateway

TransitGateway returns the cluster Transit Gateway information.

func (*PowerVSClusterScope) VPC added in v0.8.0

VPC returns the cluster VPC information.

func (*PowerVSClusterScope) Zone added in v0.8.0

func (s *PowerVSClusterScope) Zone() *string

Zone returns the cluster zone.

type PowerVSClusterScopeParams

type PowerVSClusterScopeParams struct {
	Client            client.Client
	Logger            logr.Logger
	Cluster           *capiv1beta1.Cluster
	IBMPowerVSCluster *infrav1beta2.IBMPowerVSCluster
	ServiceEndpoint   []endpoints.ServiceEndpoint

	// ClientFactory contains collection of functions to override actual client, which helps in testing.
	ClientFactory
}

PowerVSClusterScopeParams defines the input parameters used to create a new PowerVSClusterScope.

type PowerVSImageScope added in v0.2.0

type PowerVSImageScope struct {
	logr.Logger
	Client client.Client

	IBMPowerVSClient powervs.PowerVS
	IBMPowerVSImage  *infrav1beta2.IBMPowerVSImage
	ServiceEndpoint  []endpoints.ServiceEndpoint
	// contains filtered or unexported fields
}

PowerVSImageScope defines a scope defined around a Power VS Cluster.

func NewPowerVSImageScope added in v0.2.0

func NewPowerVSImageScope(params PowerVSImageScopeParams) (scope *PowerVSImageScope, err error)

NewPowerVSImageScope creates a new PowerVSImageScope from the supplied parameters.

func (*PowerVSImageScope) Close added in v0.2.0

func (i *PowerVSImageScope) Close() error

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

func (*PowerVSImageScope) CreateImageCOSBucket added in v0.2.0

func (i *PowerVSImageScope) CreateImageCOSBucket() (*models.ImageReference, *models.JobReference, error)

CreateImageCOSBucket creates a power vs image.

func (*PowerVSImageScope) DeleteImage added in v0.2.0

func (i *PowerVSImageScope) DeleteImage() error

DeleteImage will delete the image.

func (*PowerVSImageScope) DeleteImportJob added in v0.2.0

func (i *PowerVSImageScope) DeleteImportJob() error

DeleteImportJob will delete the image import job.

func (*PowerVSImageScope) GetImageID added in v0.2.0

func (i *PowerVSImageScope) GetImageID() string

GetImageID will get the id for the image.

func (*PowerVSImageScope) GetImageState added in v0.2.0

GetImageState will get the state for the image.

func (*PowerVSImageScope) GetImportJob added in v0.2.0

func (i *PowerVSImageScope) GetImportJob() (*models.Job, error)

GetImportJob will get the image import job.

func (*PowerVSImageScope) GetJobID added in v0.2.0

func (i *PowerVSImageScope) GetJobID() string

GetJobID will get the id for the import image job.

func (*PowerVSImageScope) IsReady added in v0.2.0

func (i *PowerVSImageScope) IsReady() bool

IsReady will return the status for the image.

func (*PowerVSImageScope) PatchObject added in v0.2.0

func (i *PowerVSImageScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*PowerVSImageScope) SetImageID added in v0.2.0

func (i *PowerVSImageScope) SetImageID(id *string)

SetImageID will set the id for the image.

func (*PowerVSImageScope) SetImageState added in v0.2.0

func (i *PowerVSImageScope) SetImageState(status string)

SetImageState will set the state for the image.

func (*PowerVSImageScope) SetJobID added in v0.2.0

func (i *PowerVSImageScope) SetJobID(id string)

SetJobID will set the id for the import image job.

func (*PowerVSImageScope) SetNotReady added in v0.2.0

func (i *PowerVSImageScope) SetNotReady()

SetNotReady will set the status as not ready for the image.

func (*PowerVSImageScope) SetReady added in v0.2.0

func (i *PowerVSImageScope) SetReady()

SetReady will set the status as ready for the image.

type PowerVSImageScopeParams added in v0.2.0

type PowerVSImageScopeParams struct {
	Client          client.Client
	Logger          logr.Logger
	IBMPowerVSImage *infrav1beta2.IBMPowerVSImage
	ServiceEndpoint []endpoints.ServiceEndpoint
	Zone            *string
}

PowerVSImageScopeParams defines the input parameters used to create a new PowerVSImageScope.

type PowerVSMachineScope

type PowerVSMachineScope struct {
	logr.Logger
	Client client.Client

	IBMPowerVSClient  powervs.PowerVS
	IBMVPCClient      vpc.Vpc
	ResourceClient    resourcecontroller.ResourceController
	Cluster           *capiv1beta1.Cluster
	Machine           *capiv1beta1.Machine
	IBMPowerVSCluster *infrav1beta2.IBMPowerVSCluster
	IBMPowerVSMachine *infrav1beta2.IBMPowerVSMachine
	IBMPowerVSImage   *infrav1beta2.IBMPowerVSImage
	ServiceEndpoint   []endpoints.ServiceEndpoint
	DHCPIPCacheStore  cache.Store
	// contains filtered or unexported fields
}

PowerVSMachineScope defines a scope defined around a Power VS Machine.

func NewPowerVSMachineScope

func NewPowerVSMachineScope(params PowerVSMachineScopeParams) (scope *PowerVSMachineScope, err error)

NewPowerVSMachineScope creates a new PowerVSMachineScope from the supplied parameters.

func (*PowerVSMachineScope) APIServerPort added in v0.8.0

func (m *PowerVSMachineScope) APIServerPort() int32

APIServerPort returns the APIServerPort.

func (*PowerVSMachineScope) Close

func (m *PowerVSMachineScope) Close() error

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

func (*PowerVSMachineScope) CreateMachine

func (m *PowerVSMachineScope) CreateMachine() (*models.PVMInstanceReference, error)

CreateMachine creates a powervs machine.

func (*PowerVSMachineScope) CreateVPCLoadBalancerPoolMember added in v0.8.0

func (m *PowerVSMachineScope) CreateVPCLoadBalancerPoolMember() (*vpcv1.LoadBalancerPoolMember, error)

CreateVPCLoadBalancerPoolMember creates a member in load balancer pool.

func (*PowerVSMachineScope) DeleteMachine

func (m *PowerVSMachineScope) DeleteMachine() error

DeleteMachine deletes the power vs machine associated with machine instance id and service instance id.

func (*PowerVSMachineScope) DeleteMachineIgnition added in v0.8.0

func (m *PowerVSMachineScope) DeleteMachineIgnition() error

DeleteMachineIgnition deletes the ignition associated with machine.

func (*PowerVSMachineScope) GetImages

func (m *PowerVSMachineScope) GetImages() (*models.Images, error)

GetImages will get list of images for the powervs service instance.

func (*PowerVSMachineScope) GetInstanceID added in v0.2.0

func (m *PowerVSMachineScope) GetInstanceID() string

GetInstanceID will get the instance id for the machine.

func (*PowerVSMachineScope) GetInstanceState added in v0.2.0

GetInstanceState will get the state for the machine.

func (*PowerVSMachineScope) GetMachineInternalIP added in v0.8.0

func (m *PowerVSMachineScope) GetMachineInternalIP() string

GetMachineInternalIP returns the machine's internal IP.

func (*PowerVSMachineScope) GetNetworks

func (m *PowerVSMachineScope) GetNetworks() (*models.Networks, error)

GetNetworks will get list of networks for the powervs service instance.

func (*PowerVSMachineScope) GetRawBootstrapData added in v0.9.0

func (m *PowerVSMachineScope) GetRawBootstrapData() ([]byte, error)

GetRawBootstrapData returns the bootstrap data if present.

func (*PowerVSMachineScope) GetRegion added in v0.2.0

func (m *PowerVSMachineScope) GetRegion() string

GetRegion will get the region for the machine.

func (*PowerVSMachineScope) GetServiceInstanceID added in v0.8.0

func (m *PowerVSMachineScope) GetServiceInstanceID() (string, error)

GetServiceInstanceID returns the service instance id.

func (*PowerVSMachineScope) GetZone added in v0.2.0

func (m *PowerVSMachineScope) GetZone() string

GetZone will get the zone for the machine.

func (*PowerVSMachineScope) IsReady added in v0.2.0

func (m *PowerVSMachineScope) IsReady() bool

IsReady will return the status for the machine.

func (*PowerVSMachineScope) Name added in v0.8.0

func (m *PowerVSMachineScope) Name() string

Name returns the IBMPowerVSMachine name.

func (*PowerVSMachineScope) PatchObject

func (m *PowerVSMachineScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*PowerVSMachineScope) Role added in v0.8.0

func (m *PowerVSMachineScope) Role() string

Role returns the machine role from the labels.

func (*PowerVSMachineScope) SetAddresses added in v0.2.0

func (m *PowerVSMachineScope) SetAddresses(instance *models.PVMInstance)

SetAddresses will set the addresses for the machine.

func (*PowerVSMachineScope) SetFailureMessage added in v0.2.2

func (m *PowerVSMachineScope) SetFailureMessage(message string)

SetFailureMessage will set status FailureMessage for the machine.

func (*PowerVSMachineScope) SetFailureReason added in v0.2.2

func (m *PowerVSMachineScope) SetFailureReason(reason string)

SetFailureReason will set status FailureReason for the machine.

func (*PowerVSMachineScope) SetHealth added in v0.2.0

func (m *PowerVSMachineScope) SetHealth(health *models.PVMInstanceHealth)

SetHealth will set the health status for the machine.

func (*PowerVSMachineScope) SetInstanceID added in v0.2.0

func (m *PowerVSMachineScope) SetInstanceID(id *string)

SetInstanceID will set the instance id for the machine.

func (*PowerVSMachineScope) SetInstanceState added in v0.2.0

func (m *PowerVSMachineScope) SetInstanceState(status *string)

SetInstanceState will set the state for the machine.

func (*PowerVSMachineScope) SetNotReady added in v0.2.0

func (m *PowerVSMachineScope) SetNotReady()

SetNotReady will set status as not ready for the machine.

func (*PowerVSMachineScope) SetProviderID added in v0.2.0

func (m *PowerVSMachineScope) SetProviderID(instanceID string) error

SetProviderID will set the provider id for the machine.

func (*PowerVSMachineScope) SetReady added in v0.2.0

func (m *PowerVSMachineScope) SetReady()

SetReady will set the status as ready for the machine.

func (*PowerVSMachineScope) SetRegion added in v0.2.0

func (m *PowerVSMachineScope) SetRegion(region string)

SetRegion will set the region for the machine.

func (*PowerVSMachineScope) SetZone added in v0.2.0

func (m *PowerVSMachineScope) SetZone(zone string)

SetZone will set the zone for the machine.

func (*PowerVSMachineScope) UseIgnition added in v0.8.0

func (m *PowerVSMachineScope) UseIgnition() bool

UseIgnition returns true if Ignition is set in IBMPowerVSCluster.

type PowerVSMachineScopeParams

type PowerVSMachineScopeParams struct {
	Logger            logr.Logger
	Client            client.Client
	Cluster           *capiv1beta1.Cluster
	Machine           *capiv1beta1.Machine
	IBMPowerVSCluster *infrav1beta2.IBMPowerVSCluster
	IBMPowerVSMachine *infrav1beta2.IBMPowerVSMachine
	IBMPowerVSImage   *infrav1beta2.IBMPowerVSImage
	ServiceEndpoint   []endpoints.ServiceEndpoint
	DHCPIPCacheStore  cache.Store
}

PowerVSMachineScopeParams defines the input parameters used to create a new PowerVSMachineScope.

type ResourceNotFound added in v0.8.0

type ResourceNotFound string

ResourceNotFound is the string representing an error when a resource is not found in IBM Cloud.

type VPCClusterScope added in v0.9.0

type VPCClusterScope struct {
	logr.Logger
	Client client.Client

	COSClient                cos.Cos
	GlobalTaggingClient      globaltagging.GlobalTagging
	ResourceControllerClient resourcecontroller.ResourceController
	ResourceManagerClient    resourcemanager.ResourceManager
	VPCClient                vpc.Vpc

	Cluster         *capiv1beta1.Cluster
	IBMVPCCluster   *infrav1beta2.IBMVPCCluster
	ServiceEndpoint []endpoints.ServiceEndpoint
	// contains filtered or unexported fields
}

VPCClusterScope defines a scope defined around a VPC Cluster.

func NewVPCClusterScope added in v0.9.0

func NewVPCClusterScope(params VPCClusterScopeParams) (*VPCClusterScope, error)

NewVPCClusterScope creates a new VPCClusterScope from the supplied parameters.

func (*VPCClusterScope) CheckTagExists added in v0.9.0

func (s *VPCClusterScope) CheckTagExists(tagName string) (bool, error)

CheckTagExists checks whether a user tag already exists.

func (*VPCClusterScope) Close added in v0.9.0

func (s *VPCClusterScope) Close() error

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

func (*VPCClusterScope) GetAPIServerPort added in v0.9.0

func (s *VPCClusterScope) GetAPIServerPort() int32

GetAPIServerPort will return the API Server's port.

func (*VPCClusterScope) GetControlPlaneSubnetIDs added in v0.9.0

func (s *VPCClusterScope) GetControlPlaneSubnetIDs() ([]string, error)

GetControlPlaneSubnetIDs returns all of the Control Plane subnet Id's.

func (*VPCClusterScope) GetLoadBalancerHostName added in v0.9.0

func (s *VPCClusterScope) GetLoadBalancerHostName() (*string, error)

GetLoadBalancerHostName will return the hostname of the cluster's public Load Balancer, assuming only one public Load Balancer was provided. Or, the hostname of the single private Load Balancer (assuming the cluster has no public access and only one private Load Balancer was provided). This function has a very hard assumption that all Load Balancers have been reconciled within Status (and not just some). NOTE(cjschaef): A webhook validation check could help ensure this.

func (*VPCClusterScope) GetNetworkResourceGroupID added in v0.9.0

func (s *VPCClusterScope) GetNetworkResourceGroupID() (string, error)

GetNetworkResourceGroupID returns the Resource Group ID for the Network Resources if it is present. Otherwise, it defaults to the cluster's Resource Group ID.

func (*VPCClusterScope) GetResourceGroupID added in v0.9.0

func (s *VPCClusterScope) GetResourceGroupID() (string, error)

GetResourceGroupID returns the Resource Group ID for the cluster.

func (*VPCClusterScope) GetSecurityGroupID added in v0.9.0

func (s *VPCClusterScope) GetSecurityGroupID(name string) (*string, error)

GetSecurityGroupID returns the ID of a security group, provided the name. This will first check Status for the Security Group (by name), but as the Security Group may not be tracked by CAPI, a lookup of the Security Group by name is made via the VPC API.

func (*VPCClusterScope) GetServiceName added in v0.9.0

func (s *VPCClusterScope) GetServiceName(resourceType infrav1beta2.ResourceType) *string

GetServiceName returns the name of a given service type from Spec or generates a name for it.

func (*VPCClusterScope) GetSubnetID added in v0.9.0

func (s *VPCClusterScope) GetSubnetID(name string) (*string, error)

GetSubnetID returns the ID of a subnet, provided the name.

func (*VPCClusterScope) GetVPCID added in v0.9.0

func (s *VPCClusterScope) GetVPCID() (*string, error)

GetVPCID returns the VPC id, if available.

func (*VPCClusterScope) Name added in v0.9.0

func (s *VPCClusterScope) Name() string

Name returns the CAPI cluster name.

func (*VPCClusterScope) NetworkSpec added in v0.9.0

func (s *VPCClusterScope) NetworkSpec() *infrav1beta2.VPCNetworkSpec

NetworkSpec returns the VPCClusterScope's Network spec.

func (*VPCClusterScope) NetworkStatus added in v0.9.0

func (s *VPCClusterScope) NetworkStatus() *infrav1beta2.VPCNetworkStatus

NetworkStatus returns the VPCClusterScope's Network status.

func (*VPCClusterScope) PatchObject added in v0.9.0

func (s *VPCClusterScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*VPCClusterScope) ReconcileLoadBalancers added in v0.9.0

func (s *VPCClusterScope) ReconcileLoadBalancers() (bool, error)

ReconcileLoadBalancers reconciles Load Balancers.

func (*VPCClusterScope) ReconcileSecurityGroups added in v0.9.0

func (s *VPCClusterScope) ReconcileSecurityGroups() (bool, error)

ReconcileSecurityGroups will attempt to reconcile the defined SecurityGroups and their SecurityGroupRules. Our best option is to perform a first set of passes, creating all the SecurityGroups first, then reconcile the SecurityGroupRules after that, as the SecuirtyGroupRules could be dependent on an IBM Cloud Security Group that must be created first.

func (*VPCClusterScope) ReconcileSubnets added in v0.9.0

func (s *VPCClusterScope) ReconcileSubnets() (bool, error)

ReconcileSubnets reconciles the VPC Subnet(s). For Subnets, we collect all of the required subnets, for each Plane, and reconcile them individually. Requeing if one is missing or just created. Reconciliation is attempted on all subnets each loop, to prevent single subnet creation per reconciliation loop.

func (*VPCClusterScope) ReconcileVPC added in v0.9.0

func (s *VPCClusterScope) ReconcileVPC() (bool, error)

ReconcileVPC reconciles the cluster's VPC.

func (*VPCClusterScope) ReconcileVPCCustomImage added in v0.9.0

func (s *VPCClusterScope) ReconcileVPCCustomImage() (bool, error)

ReconcileVPCCustomImage reconciles the VPC Custom Image.

func (*VPCClusterScope) SetResourceStatus added in v0.9.0

func (s *VPCClusterScope) SetResourceStatus(resourceType infrav1beta2.ResourceType, resource *infrav1beta2.ResourceStatus)

SetResourceStatus sets the status for the provided ResourceType.

func (*VPCClusterScope) TagResource added in v0.9.0

func (s *VPCClusterScope) TagResource(tagName string, resourceCRN string) error

TagResource will attach a user Tag to a resource.

type VPCClusterScopeParams added in v0.9.0

type VPCClusterScopeParams struct {
	Client          client.Client
	Cluster         *capiv1beta1.Cluster
	IBMVPCCluster   *infrav1beta2.IBMVPCCluster
	Logger          logr.Logger
	ServiceEndpoint []endpoints.ServiceEndpoint

	IBMVPCClient vpc.Vpc
}

VPCClusterScopeParams defines the input parameters used to create a new VPCClusterScope.

Jump to

Keyboard shortcuts

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