scope

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 21 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.Interface
	// 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) Cloud added in v0.1.3

func (c *Cluster) Cloud() scwClient.Interface

Cloud returns the initialized Scaleway client object.

func (*Cluster) ControlPlaneDNSZoneAndName added in v0.1.1

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

ControlPlaneDNSZoneAndName returns the DNS zone and the name of the records that should be updated.

func (*Cluster) ControlPlaneHost

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

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) ControlPlaneLoadBalancerPrivate added in v0.1.1

func (c *Cluster) ControlPlaneLoadBalancerPrivate() bool

ControlPlaneLoadBalancerPrivate returns true if the control plane should only be accessible through a private endpoint.

func (*Cluster) HasControlPlaneDNS

func (c *Cluster) HasControlPlaneDNS() bool

HasControlPlaneDNS returns true if the cluster has an associated domain (public or private).

func (*Cluster) HasPrivateNetwork

func (c *Cluster) HasPrivateNetwork() bool

HasPrivateNetwork returns true if the cluster has a Private Network.

func (*Cluster) IsVPCStatusSet added in v0.1.3

func (c *Cluster) IsVPCStatusSet() bool

IsVPCStatusSet if the VPC fields are set in the status.

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) PrivateNetworkParams added in v0.1.3

func (c *Cluster) PrivateNetworkParams() infrav1.PrivateNetworkParams

PrivateNetworkParams returns the private network parameters.

func (*Cluster) PublicGateways added in v0.1.3

func (c *Cluster) PublicGateways() []infrav1.PublicGatewaySpec

PublicGateways returns the desired Public Gateways.

func (*Cluster) ResourceName

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

ResourceName 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) SetCloud added in v0.1.3

func (c *Cluster) SetCloud(sc scwClient.Interface)

SetCloud sets the Scaleway client object.

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) SetVPCStatus added in v0.1.3

func (c *Cluster) SetVPCStatus(pnID, vpcID string)

SetVPCStatus sets the VPC fields in the status.

type ClusterParams

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

ClusterParams contains mandatory params for creating the Cluster scope.

type Interface added in v0.1.3

type Interface interface {
	Cloud() client.Interface
	SetCloud(client.Interface) // SetCloud is used for testing.
	ResourceName(suffixes ...string) string
	ResourceTags(additional ...string) []string
}

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.

type ManagedCluster added in v0.1.3

type ManagedCluster struct {
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane // ManagedControlPlane may be nil, on Cluster deletion.
	ScalewayClient      scwClient.Interface
	// contains filtered or unexported fields
}

func NewManagedCluster added in v0.1.3

func NewManagedCluster(ctx context.Context, params *ManagedClusterParams) (*ManagedCluster, error)

NewManagedCluster creates a new Cluster scope.

func (*ManagedCluster) Close added in v0.1.3

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

Close closes the Machine scope by patching the ScalewayManagedCluster object.

func (*ManagedCluster) Cloud added in v0.1.3

func (c *ManagedCluster) Cloud() scwClient.Interface

Cloud returns the initialized Scaleway client object.

func (*ManagedCluster) HasPrivateNetwork added in v0.1.3

func (c *ManagedCluster) HasPrivateNetwork() bool

HasPrivateNetwork returns true if the cluster should have a Private Network. It's only false if the multicloud cluster type is used.

func (*ManagedCluster) IsVPCStatusSet added in v0.1.3

func (c *ManagedCluster) IsVPCStatusSet() bool

IsVPCStatusSet if the VPC fields are set in the status.

func (*ManagedCluster) PatchObject added in v0.1.3

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

PatchObject patches the ScalewayManagedCluster object.

func (*ManagedCluster) PrivateNetworkID added in v0.1.3

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

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

func (*ManagedCluster) PrivateNetworkParams added in v0.1.3

func (c *ManagedCluster) PrivateNetworkParams() infrav1.PrivateNetworkParams

PrivateNetworkParams returns the private network parameters.

func (*ManagedCluster) PublicGateways added in v0.1.3

func (c *ManagedCluster) PublicGateways() []infrav1.PublicGatewaySpec

PublicGateways returns the desired Public Gateways.

func (*ManagedCluster) ResourceName added in v0.1.3

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

ResourceName 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 (*ManagedCluster) ResourceTags added in v0.1.3

func (c *ManagedCluster) 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 (*ManagedCluster) SetCloud added in v0.1.3

func (c *ManagedCluster) SetCloud(sc scwClient.Interface)

SetCloud sets the Scaleway client object.

func (*ManagedCluster) SetVPCStatus added in v0.1.3

func (c *ManagedCluster) SetVPCStatus(pnID, _ string)

SetVPCStatus sets the VPC fields in the status.

type ManagedClusterParams added in v0.1.3

type ManagedClusterParams struct {
	Client              client.Client
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane
}

ClusterParams contains mandatory params for creating the Cluster scope.

type ManagedControlPlane added in v0.1.3

type ManagedControlPlane struct {
	Client              client.Client
	Cluster             *clusterv1.Cluster
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane
	ScalewayClient      scwClient.Interface
	// contains filtered or unexported fields
}

func NewManagedControlPlane added in v0.1.3

func NewManagedControlPlane(ctx context.Context, params *ManagedControlPlaneParams) (*ManagedControlPlane, error)

NewCluster creates a new Cluster scope.

func (*ManagedControlPlane) Close added in v0.1.3

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

Close closes the Machine scope by patching the ScalewayManagedControlPlane object.

func (*ManagedControlPlane) ClusterEndpoint added in v0.1.3

func (m *ManagedControlPlane) ClusterEndpoint(cluster *k8s.Cluster) string

func (*ManagedControlPlane) ClusterName added in v0.1.3

func (m *ManagedControlPlane) ClusterName() string

func (*ManagedControlPlane) DeleteWithAdditionalResources added in v0.1.3

func (m *ManagedControlPlane) DeleteWithAdditionalResources() bool

DeleteWithAdditionalResources returns true if we should tell Scaleway k8s API to delete additional resources when cluster is deleted.

func (*ManagedControlPlane) DesiredAllowedRanges added in v0.1.3

func (m *ManagedControlPlane) DesiredAllowedRanges() []string

func (*ManagedControlPlane) DesiredAutoUpgrade added in v0.1.3

func (m *ManagedControlPlane) DesiredAutoUpgrade() *k8s.ClusterAutoUpgrade

func (*ManagedControlPlane) DesiredCNI added in v0.1.3

func (m *ManagedControlPlane) DesiredCNI() k8s.CNI

func (*ManagedControlPlane) DesiredClusterAutoscalerConfig added in v0.1.3

func (m *ManagedControlPlane) DesiredClusterAutoscalerConfig() (*k8s.ClusterAutoscalerConfig, error)

func (*ManagedControlPlane) DesiredClusterOpenIDConnectConfig added in v0.1.3

func (m *ManagedControlPlane) DesiredClusterOpenIDConnectConfig() *k8s.ClusterOpenIDConnectConfig

func (*ManagedControlPlane) DesiredTags added in v0.1.3

func (m *ManagedControlPlane) DesiredTags() []string

func (*ManagedControlPlane) DesiredType added in v0.1.3

func (m *ManagedControlPlane) DesiredType() string

func (*ManagedControlPlane) DesiredVersion added in v0.1.3

func (m *ManagedControlPlane) DesiredVersion() string

DesiredVersion returns the desired Kubernetes version, without leading "v".

func (*ManagedControlPlane) FixedVersion added in v0.1.3

func (m *ManagedControlPlane) FixedVersion() string

FixedVersion returns the desired Kubernetes version, with a leading "v" if it's missing.

func (*ManagedControlPlane) PatchObject added in v0.1.3

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

PatchObject patches the ScalewayManagedControlPlane object.

func (*ManagedControlPlane) PrivateNetworkID added in v0.1.3

func (m *ManagedControlPlane) PrivateNetworkID() *string

PrivateNetworkID returns the Private Network ID that should be used when creating the managed cluster. It's nil if no Private Network ID is needed.

func (*ManagedControlPlane) ResourceTags added in v0.1.3

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

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

func (*ManagedControlPlane) SetControlPlaneEndpoint added in v0.1.3

func (m *ManagedControlPlane) SetControlPlaneEndpoint(host string, port int32)

SetControlPlaneEndpoint sets the control plane endpoint host and port.

func (*ManagedControlPlane) SetStatusVersion added in v0.1.3

func (m *ManagedControlPlane) SetStatusVersion(version string)

SetStatusVersion sets the current cluster Kubernetes version in the status.

type ManagedControlPlaneParams added in v0.1.3

type ManagedControlPlaneParams struct {
	Client              client.Client
	Cluster             *clusterv1.Cluster
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane
}

ClusterParams contains mandatory params for creating the Cluster scope.

type ManagedMachinePool added in v0.1.3

type ManagedMachinePool struct {
	Client              client.Client
	Cluster             *clusterv1.Cluster
	MachinePool         *expclusterv1.MachinePool
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane
	ManagedMachinePool  *infrav1.ScalewayManagedMachinePool
	ScalewayClient      scwClient.Interface
	// contains filtered or unexported fields
}

func NewManagedMachinePool added in v0.1.3

func NewManagedMachinePool(ctx context.Context, params *ManagedMachinePoolParams) (*ManagedMachinePool, error)

NewCluster creates a new Cluster scope.

func (*ManagedMachinePool) Autohealing added in v0.1.3

func (c *ManagedMachinePool) Autohealing() bool

func (*ManagedMachinePool) Close added in v0.1.3

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

Close closes the Machine scope by patching the ScalewayManagedControlPlane object.

func (*ManagedMachinePool) ClusterName added in v0.1.3

func (c *ManagedMachinePool) ClusterName() (string, bool)

func (*ManagedMachinePool) DesiredPoolUpgradePolicy added in v0.1.3

func (c *ManagedMachinePool) DesiredPoolUpgradePolicy() *k8s.PoolUpgradePolicy

func (*ManagedMachinePool) DesiredTags added in v0.1.3

func (m *ManagedMachinePool) DesiredTags() []string

func (*ManagedMachinePool) DesiredVersion added in v0.1.3

func (m *ManagedMachinePool) DesiredVersion() *string

func (*ManagedMachinePool) PatchObject added in v0.1.3

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

PatchObject patches the ScalewayManagedControlPlane object.

func (*ManagedMachinePool) PublicIPDisabled added in v0.1.3

func (c *ManagedMachinePool) PublicIPDisabled() bool

func (*ManagedMachinePool) ResourceName added in v0.1.3

func (m *ManagedMachinePool) ResourceName(suffixes ...string) string

ResourceName 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 (*ManagedMachinePool) ResourceTags added in v0.1.3

func (c *ManagedMachinePool) 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 (*ManagedMachinePool) RootVolumeSizeGB added in v0.1.3

func (c *ManagedMachinePool) RootVolumeSizeGB() *uint64

func (*ManagedMachinePool) RootVolumeType added in v0.1.3

func (c *ManagedMachinePool) RootVolumeType() k8s.PoolVolumeType

func (*ManagedMachinePool) Scaling added in v0.1.3

func (c *ManagedMachinePool) Scaling() (autoscaling bool, size, min, max uint32)

func (*ManagedMachinePool) SetProviderIDs added in v0.1.3

func (c *ManagedMachinePool) SetProviderIDs(nodes []*k8s.Node)

func (*ManagedMachinePool) SetStatusReplicas added in v0.1.3

func (c *ManagedMachinePool) SetStatusReplicas(replicas uint32)

type ManagedMachinePoolParams added in v0.1.3

type ManagedMachinePoolParams struct {
	Client              client.Client
	Cluster             *clusterv1.Cluster
	MachinePool         *expclusterv1.MachinePool
	ManagedCluster      *infrav1.ScalewayManagedCluster
	ManagedControlPlane *infrav1.ScalewayManagedControlPlane
	ManagedMachinePool  *infrav1.ScalewayManagedMachinePool
}

ClusterParams contains mandatory params for creating the Cluster scope.

Jump to

Keyboard shortcuts

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