scope

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Cluster         *clusterv1.Cluster
	ScalewayCluster *infrav1.ScalewayCluster
	ScalewayClient  *scwClient.Client
	// contains filtered or unexported fields
}

Cluster is a Cluster scope.

func NewCluster

func NewCluster(ctx context.Context, params *ClusterParams) (*Cluster, error)

NewCluster creates a new Cluster scope.

func (*Cluster) Close

func (c *Cluster) Close(ctx context.Context) error

Close closes the Cluster scope by patching the ScalewayCluster object.

func (*Cluster) ControlPlaneHost

func (c *Cluster) ControlPlaneHost() string

ControlPlaneHost returns the control plane host.

func (*Cluster) ControlPlaneLoadBalancerAllowedRanges

func (c *Cluster) ControlPlaneLoadBalancerAllowedRanges() []string

ControlPlaneLoadBalancerAllowedRanges returns the control plane loadbalancer allowed ranges.

func (*Cluster) ControlPlaneLoadBalancerIPs

func (c *Cluster) ControlPlaneLoadBalancerIPs() []string

ControlPlaneLoadBalancerIPs returns the IPs of the control plane loadbalancers.

func (*Cluster) ControlPlaneLoadBalancerPort

func (c *Cluster) ControlPlaneLoadBalancerPort() int32

ControlPlaneLoadBalancerPort returns the port to use for the control plane loadbalancer frontend.

func (*Cluster) HasControlPlaneDNS

func (c *Cluster) HasControlPlaneDNS() bool

HasControlPlaneDNS returns true if the cluster has an associated domain.

func (*Cluster) HasPrivateNetwork

func (c *Cluster) HasPrivateNetwork() bool

HasPrivateNetwork returns true if the cluster has a Private Network.

func (*Cluster) PatchObject

func (c *Cluster) PatchObject(ctx context.Context) error

PatchObject patches the ScalewayCluster object.

func (*Cluster) PrivateNetworkID

func (c *Cluster) PrivateNetworkID() (string, error)

PrivateNetworkID returns the PrivateNetwork ID of the cluster, obtained from the status of the ScalewayCluster resource.

func (*Cluster) ResourceName

func (c *Cluster) ResourceName(suffixes ...string) string

ResourceNameName returns the name/prefix that resources created for the cluster should have. It is possible to provide additional suffixes that will be appended to the name with a leading "-".

func (*Cluster) ResourceTags

func (c *Cluster) ResourceTags(additional ...string) []string

ResourceTags returns the tags that resources created for the cluster should have. It is possible to provide additional tags that will be added to the default tags.

func (*Cluster) SetFailureDomains

func (c *Cluster) SetFailureDomains(zones []scw.Zone)

SetFailureDomains sets the failure domains of the cluster.

func (*Cluster) SetStatusExtraLoadBalancerIPs

func (c *Cluster) SetStatusExtraLoadBalancerIPs(ips []string)

SetStatusExtraLoadBalancerIPs sets the extra loadbalancer IPs in the status.

func (*Cluster) SetStatusLoadBalancerIP

func (c *Cluster) SetStatusLoadBalancerIP(ip string)

SetStatusLoadBalancerIP sets the loadbalancer IP in the status.

func (*Cluster) SetStatusPrivateNetworkID

func (c *Cluster) SetStatusPrivateNetworkID(pnID string)

SetStatusPrivateNetworkID sets the Private Network ID in the status of the ScalewayCluster object.

func (*Cluster) ShouldManagePrivateNetwork

func (c *Cluster) ShouldManagePrivateNetwork() bool

ShouldManagePrivateNetwork returns true if the provider should manage the Private Network of the cluster.

type ClusterParams

type ClusterParams struct {
	Client          client.Client
	Cluster         *clusterv1.Cluster
	ScalewayCluster *infrav1.ScalewayCluster
}

ClusterParams contains mandatory params for creating the Cluster scope.

type Machine

type Machine struct {
	Client client.Client

	*Cluster

	Machine         *clusterv1.Machine
	ScalewayMachine *infrav1.ScalewayMachine
	// contains filtered or unexported fields
}

func NewMachine

func NewMachine(params *MachineParams) (*Machine, error)

NewMachine creates a new Machine scope.

func (*Machine) Close

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

Close closes the Machine scope by patching the ScalewayMachine object.

func (*Machine) GetBootstrapData

func (m *Machine) GetBootstrapData(ctx context.Context) ([]byte, error)

GetBootstrapData retrieves the bootstrap data from the secret specified in the ScalewayMachine. It returns an error if the secret is not found or if the value key is missing.

func (*Machine) HasJoinedCluster

func (m *Machine) HasJoinedCluster() bool

HasJoinedCluster returns true if the machine has joined the cluster. A machine is considered to have joined the cluster if it has a NodeRef with a non-empty name.

func (*Machine) HasPublicIPv4

func (m *Machine) HasPublicIPv4() bool

HasPublicIPv4 returns true if the machine should have a Public IPv4 address.

func (*Machine) HasPublicIPv6

func (m *Machine) HasPublicIPv6() bool

HasPublicIPv6 returns true if the machine should have a Public IPv6 address.

func (*Machine) IsControlPlane

func (m *Machine) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane machine.

func (*Machine) PatchObject

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

PatchObject patches the ScalewayMachine object.

func (*Machine) ResourceName

func (m *Machine) ResourceName() string

ResourceNameName returns the name that resources created for the machine should have.

func (*Machine) ResourceTags

func (m *Machine) ResourceTags() []string

ResourceTags returns the tags that resources created for the machine should have.

func (*Machine) RootVolumeIOPS

func (m *Machine) RootVolumeIOPS() *int64

RootVolumeIOPS returns the IOPS of the root volume for the machine. If not specified, it returns nil. Note: IOPS is only applicable for block volumes.

func (*Machine) RootVolumeSize

func (m *Machine) RootVolumeSize() scw.Size

RootVolumeSize returns the size of the root volume for the machine.

func (*Machine) RootVolumeType

func (m *Machine) RootVolumeType() (instance.VolumeVolumeType, error)

RootVolumeType returns the type of the root volume for the machine.

func (*Machine) SetAddresses

func (m *Machine) SetAddresses(addresses []clusterv1.MachineAddress)

SetAddresses sets the addresses of the ScalewayMachine. It replaces the existing addresses with the provided ones.

func (*Machine) SetProviderID

func (m *Machine) SetProviderID(providerID string)

SetProviderID sets the ProviderID of the ScalewayMachine if it is not already set.

func (*Machine) Zone

func (m *Machine) Zone() (scw.Zone, error)

Zone returns the zone of the machine.

type MachineParams

type MachineParams struct {
	Client          client.Client
	ClusterScope    *Cluster
	Machine         *clusterv1.Machine
	ScalewayMachine *infrav1.ScalewayMachine
}

MachineParams contains mandatory params for creating the Machine scope.

Jump to

Keyboard shortcuts

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