scope

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingClient              = errors.New("client is required when creating a MachineScope")
	ErrMissingCluster             = errors.New("cluster is required when creating a MachineScope")
	ErrMissingMachine             = errors.New("machine is required when creating a MachineScope")
	ErrMissingPacketCluster       = errors.New("packetCluster is required when creating a MachineScope")
	ErrMissingPacketMachine       = errors.New("packetMachine is required when creating a MachineScope")
	ErrMissingBootstrapDataSecret = errors.New("error retrieving bootstrap data: linked Machine's bootstrap.dataSecretName is nil")
	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() 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(ctx context.Context, 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() error

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

func (*MachineScope) GetInstanceID

func (m *MachineScope) GetInstanceID() string

GetInstanceID returns the DOMachine droplet instance id by parsing Spec.ProviderID.

func (*MachineScope) GetInstanceStatus

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

GetInstanceStatus returns the PacketMachine device instance status from the status.

func (*MachineScope) GetProviderID

func (m *MachineScope) GetProviderID() string

GetProviderID returns the DOMachine providerID from the spec.

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

AdditionalTags 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
	// contains filtered or unexported fields
}

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