scope

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package scope contains the scope interfaces for the Packet provider.

Index

Constants

View Source
const (
	// ProviderIDPrefix will be appended to the beginning of Equinix Metal resource IDs to form the Kubernetes Provider ID.
	// NOTE: this format matches the 2 slashes format used in cloud-provider and cluster-autoscaler.
	ProviderIDPrefix = "equinixmetal://"
)

Variables

View Source
var (
	// ErrMissingClient is returned when a client is not provided to the MachineScope.
	ErrMissingClient = errors.New("client is required when creating a MachineScope")
	// ErrMissingCluster is returned when a cluster is not provided to the MachineScope.
	ErrMissingCluster = errors.New("cluster is required when creating a MachineScope")
	// ErrMissingMachine is returned when a machine is not provided to the MachineScope.
	ErrMissingMachine = errors.New("machine is required when creating a MachineScope")
	// ErrMissingPacketCluster is returned when a packetCluster is not provided to the MachineScope.
	ErrMissingPacketCluster = errors.New("packetCluster is required when creating a MachineScope")
	// ErrMissingPacketMachine is returned when a packetMachine is not provided to the MachineScope.
	ErrMissingPacketMachine = errors.New("packetMachine is required when creating a MachineScope")
	// ErrMissingBootstrapDataSecret is returned when the bootstrap data secret is not found.
	ErrMissingBootstrapDataSecret = errors.New("error retrieving bootstrap data: linked Machine's bootstrap.dataSecretName is nil")
	// ErrBootstrapDataMissingKey is returned when the bootstrap data secret does not contain the "value" key.
	ErrBootstrapDataMissingKey = errors.New("error retrieving bootstrap data: secret value key is missing")
)

Functions

This section is empty.

Types

type ClusterScope

type ClusterScope struct {
	Cluster       *clusterv1.Cluster
	PacketCluster *infrav1.PacketCluster
	// 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 ClusterScope from the supplied parameters. This is meant to be called for each reconcile iteration only on PacketClusterReconciler.

func (*ClusterScope) Close

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

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

func (*ClusterScope) Name

func (s *ClusterScope) Name() string

Name returns the cluster name.

func (*ClusterScope) Namespace

func (s *ClusterScope) Namespace() string

Namespace returns the cluster namespace.

func (*ClusterScope) SetReady

func (s *ClusterScope) SetReady()

SetReady sets the PacketCluster Ready Status.

type ClusterScopeParams

type ClusterScopeParams struct {
	Client        client.Client
	Cluster       *clusterv1.Cluster
	PacketCluster *infrav1.PacketCluster
}

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

type MachineScope

type MachineScope struct {
	Cluster       *clusterv1.Cluster
	Machine       *clusterv1.Machine
	PacketCluster *infrav1.PacketCluster
	PacketMachine *infrav1.PacketMachine
	// 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. This is meant to be called for each reconcile iteration both PacketClusterReconciler and PacketMachineReconciler.

func (*MachineScope) Close

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

Close the MachineScope by updating the machine spec, machine status.

func (*MachineScope) GetDeviceID added in v0.8.0

func (m *MachineScope) GetDeviceID() string

GetDeviceID returns the PacketMachine device ID by parsing the scope's providerID.

func (*MachineScope) GetInstanceStatus

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

GetInstanceStatus returns the PacketMachine device instance status from the status.

func (*MachineScope) GetRawBootstrapData

func (m *MachineScope) GetRawBootstrapData(ctx context.Context) ([]byte, error)

GetRawBootstrapData returns the bootstrap data from the secret in the Machine's bootstrap.dataSecretName.

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 PacketMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the PacketMachine namespace.

func (*MachineScope) PatchObject added in v0.5.0

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

PatchObject persists the machine spec and status.

func (*MachineScope) ProviderID added in v0.8.0

func (m *MachineScope) ProviderID() string

ProviderID returns the PacketMachine providerID from the spec.

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

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the PacketMachine status error message.

func (*MachineScope) SetFailureReason added in v0.5.0

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

SetFailureReason sets the PacketMachine status error reason.

func (*MachineScope) SetInstanceStatus

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

SetInstanceStatus sets the PacketMachine device id.

func (*MachineScope) SetNotReady added in v0.5.0

func (m *MachineScope) SetNotReady()

SetNotReady sets the PacketMachine Ready Status.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(deviceID string)

SetProviderID sets the PacketMachine providerID in spec from device id.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the PacketMachine Ready Status.

func (*MachineScope) Tags

func (m *MachineScope) Tags() infrav1.Tags

Tags returns Tags from the scope's PacketMachine. The returned value will never be nil.

type MachineScopeParams

type MachineScopeParams struct {
	Client        client.Client
	Cluster       *clusterv1.Cluster
	Machine       *clusterv1.Machine
	PacketCluster *infrav1.PacketCluster
	PacketMachine *infrav1.PacketMachine
}

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

Jump to

Keyboard shortcuts

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