scope

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 33 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
)

Variables

This section is empty.

Functions

This section is empty.

Types

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
	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) 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) PatchObject

func (m *MachineScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*MachineScope) SetProviderID added in v0.4.0

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

SetProviderID will set the provider id for the machine.

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
	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) (scope *PowerVSClusterScope, err error)

NewPowerVSClusterScope creates a new PowerVSClusterScope from the supplied parameters.

func (*PowerVSClusterScope) Close

func (s *PowerVSClusterScope) Close() error

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

func (*PowerVSClusterScope) PatchObject

func (s *PowerVSClusterScope) PatchObject() error

PatchObject persists the cluster configuration and status.

type PowerVSClusterScopeParams

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

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
}

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

type PowerVSMachineScope

type PowerVSMachineScope struct {
	logr.Logger
	Client client.Client

	IBMPowerVSClient  powervs.PowerVS
	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) 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) DeleteMachine

func (m *PowerVSMachineScope) DeleteMachine() error

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

func (*PowerVSMachineScope) GetBootstrapData

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

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

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) GetNetworks

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

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

func (*PowerVSMachineScope) GetRegion added in v0.2.0

func (m *PowerVSMachineScope) GetRegion() string

GetRegion will get the region for the machine.

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) PatchObject

func (m *PowerVSMachineScope) PatchObject() error

PatchObject persists the cluster configuration and status.

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 capierrors.MachineStatusError)

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(id *string)

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.

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.

Jump to

Keyboard shortcuts

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