scope

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package scope implements scope types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateVultrClient

func CreateVultrClient() (*govultr.Client, error)

func MachineOnly

func MachineOnly() bool

Types

type ClusterScope

type ClusterScope struct {
	logr.Logger

	VultrAPIClients
	Cluster      *clusterv1.Cluster
	VultrCluster *infrav1.VultrCluster
	// contains filtered or unexported fields
}

ClusterScope defines the basic context for an actuator to operate upon.

func NewClusterScope

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

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*ClusterScope) APIServerLoadbalancers

func (s *ClusterScope) APIServerLoadbalancers() *infrav1.VultrLoadBalancer

APIServerLoadbalancers get the VultrCluster Spec Network APIServerLoadbalancers.

func (*ClusterScope) APIServerLoadbalancersRef

func (s *ClusterScope) APIServerLoadbalancersRef() *infrav1.VultrResourceReference

APIServerLoadbalancersRef get the VultrCluster status Network APIServerLoadbalancersRef.

func (*ClusterScope) AddFinalizer

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

func (*ClusterScope) Close

func (s *ClusterScope) Close() error

func (*ClusterScope) Name

func (s *ClusterScope) Name() string

Name returns the cluster name.

func (*ClusterScope) PatchObject

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

PatchObject persists the cluster configuration and status.

func (*ClusterScope) Region

func (s *ClusterScope) Region() string

Region returns the cluster region.

func (*ClusterScope) SetControlPlaneEndpoint

func (s *ClusterScope) SetControlPlaneEndpoint(apiEndpoint clusterv1.APIEndpoint)

SetControlPlaneEndpoint sets the VultrCluster status APIEndpoints.

func (*ClusterScope) SetReady

func (s *ClusterScope) SetReady()

SetReady sets the VultrCluster Ready Status.

func (*ClusterScope) UID

func (s *ClusterScope) UID() string

UID returns the cluster UID.

func (*ClusterScope) VPC added in v0.4.0

func (s *ClusterScope) VPC() *string

VPC returns the cluster VPCID if set

type ClusterScopeParams

type ClusterScopeParams struct {
	VultrAPIClients
	Client       client.Client
	Logger       logr.Logger
	Cluster      *clusterv1.Cluster
	VultrCluster *infrav1.VultrCluster
}

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

type MachineScope

type MachineScope struct {
	logr.Logger

	Machine      *clusterv1.Machine
	Cluster      *clusterv1.Cluster
	VultrMachine *infrav1.VultrMachine
	VultrCluster *infrav1.VultrCluster
	// 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 Scope from the supplied parameters. This is meant to be called for each reconcile iteration

func (*MachineScope) AddFinalizer

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

AddFinalizer adds a finalizer if not present and immediately patches the object to avoid any race conditions.

func (*MachineScope) Close

func (s *MachineScope) Close() error

func (*MachineScope) GetBootstrapData

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

func (*MachineScope) GetInstanceID

func (m *MachineScope) GetInstanceID() string

GetInstanceID returns the VultrMachine instance id by parsing Spec.ProviderID.

func (*MachineScope) GetInstancePowerStatus

func (m *MachineScope) GetInstancePowerStatus() *infrav1.PowerStatus

GetInstanceStatus returns the VultrMachine instance status from the status.

func (*MachineScope) GetInstanceServerState

func (m *MachineScope) GetInstanceServerState() *infrav1.ServerState

GetInstanceStatus returns the VultrMachine instance server state status .

func (*MachineScope) GetInstanceStatus

func (m *MachineScope) GetInstanceStatus() *infrav1.SubscriptionStatus

GetInstanceStatus returns the VultrMachine instance status from the status.

func (*MachineScope) GetProviderID

func (m *MachineScope) GetProviderID() string

GetProviderID returns the VultrMachine providerID from the spec.

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the VultrMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

func (*MachineScope) PatchObject

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

PatchObject persists the machine spec and status.

func (*MachineScope) Role

func (m *MachineScope) Role() string

Role returns the machine role from the labels.

func (*MachineScope) SetAddresses

func (m *MachineScope) SetAddresses(addrs []corev1.NodeAddress)

SetAddresses sets the address status.

func (*MachineScope) SetFailureMessage

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the VultrMachine status error message.

func (*MachineScope) SetFailureReason

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

SetFailureReason sets the VultrMachine status error reason.

func (*MachineScope) SetInstancePowerStatus

func (m *MachineScope) SetInstancePowerStatus(v infrav1.PowerStatus)

SetInstanceStatus sets the VultrMachine Instance.

func (*MachineScope) SetInstanceServerState

func (m *MachineScope) SetInstanceServerState(v infrav1.ServerState)

GetInstanceStatus returns the VultrMachine instance server state status .

func (*MachineScope) SetInstanceStatus

func (m *MachineScope) SetInstanceStatus(v infrav1.SubscriptionStatus)

SetInstanceStatus sets the VultrMachine Instance.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(instanceID string)

SetProviderID sets the VultrMachine providerID in spec from instance id.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the VultrMachine Ready Status.

type MachineScopeParams

type MachineScopeParams struct {
	VultrAPIClients
	Client       client.Client
	Logger       logr.Logger
	Machine      *clusterv1.Machine
	Cluster      *clusterv1.Cluster
	VultrMachine *infrav1.VultrMachine
	VultrCluster *infrav1.VultrCluster
}

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

type VultrAPIClients

type VultrAPIClients struct {
	Instances     govultr.InstanceService
	LoadBalancers govultr.LoadBalancerService
	// Deprecated: VPC2 is no longer supported
	VPC2s     govultr.VPC2Service //nolint:staticcheck
	VPCs      govultr.VPCService
	SSHKeys   govultr.SSHKeyService
	Snapshots govultr.SnapshotService
}

VultrClients hold all necessary clients to work with the Vultr API.

Jump to

Keyboard shortcuts

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