scope

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package scope implements scope types.

Package scope implement the scope for the DO Cluster when doing the reconciliation process.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultClusterScopeGetter ...
	DefaultClusterScopeGetter ClusterScopeGetter = ClusterScopeGetterFunc(NewClusterScope)
	// DefaultMachineScopeGetter ...
	DefaultMachineScopeGetter MachineScopeGetter = MachineScopeGetterFunc(NewMachineScope)
)

Functions

This section is empty.

Types

type ClusterScope

type ClusterScope struct {
	logr.Logger

	DOClients
	Cluster   *clusterv1.Cluster
	DOCluster *infrav1.DOCluster
	// 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 DOClusterReconciler.

func (*ClusterScope) APIServerLoadbalancers

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

APIServerLoadbalancers get the DOCluster Spec Network APIServerLoadbalancers.

func (*ClusterScope) APIServerLoadbalancersRef

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

APIServerLoadbalancersRef get the DOCluster status Network APIServerLoadbalancersRef.

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

func (s *ClusterScope) Network() *infrav1.DONetworkResource

Network returns the cluster network object.

func (*ClusterScope) Region

func (s *ClusterScope) Region() string

Region returns the cluster region.

func (*ClusterScope) SetControlPlaneDNSRecordReady added in v0.4.2

func (s *ClusterScope) SetControlPlaneDNSRecordReady(ready bool)

SetControlPlaneDNSRecordReady sets the DOCluster ControlPlaneDNSRecordReady Status.

func (*ClusterScope) SetControlPlaneEndpoint added in v0.4.0

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

SetControlPlaneEndpoint sets the DOCluster status APIEndpoints.

func (*ClusterScope) SetReady

func (s *ClusterScope) SetReady()

SetReady sets the DOCluster Ready Status.

func (*ClusterScope) UID added in v0.4.2

func (s *ClusterScope) UID() string

UID returns the cluster UID.

func (*ClusterScope) VPC added in v0.4.2

func (s *ClusterScope) VPC() *infrav1.DOVPC

VPC gets the DOCluster Spec Network VPC.

type ClusterScopeGetter

type ClusterScopeGetter interface {
	ClusterScope(params ClusterScopeParams) (*ClusterScope, error)
}

ClusterScopeGetter ...

type ClusterScopeGetterFunc

type ClusterScopeGetterFunc func(params ClusterScopeParams) (*ClusterScope, error)

ClusterScopeGetterFunc ...

func (ClusterScopeGetterFunc) ClusterScope

func (f ClusterScopeGetterFunc) ClusterScope(params ClusterScopeParams) (*ClusterScope, error)

ClusterScope ...

type ClusterScopeParams

type ClusterScopeParams struct {
	DOClients
	Client    client.Client
	Logger    logr.Logger
	Cluster   *clusterv1.Cluster
	DOCluster *infrav1.DOCluster
}

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

type DOClients

type DOClients struct {
	Actions       godo.ActionsService
	Droplets      godo.DropletsService
	Storage       godo.StorageService
	Images        godo.ImagesService
	Keys          godo.KeysService
	LoadBalancers godo.LoadBalancersService
	Domains       godo.DomainsService
}

DOClients hold all necessary clients to work with the DO API.

func (*DOClients) Session

func (c *DOClients) Session() (*godo.Client, error)

Session return the DO session.

type MachineScope

type MachineScope struct {
	logr.Logger

	Cluster   *clusterv1.Cluster
	Machine   *clusterv1.Machine
	DOCluster *infrav1.DOCluster
	DOMachine *infrav1.DOMachine
	// 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 DOClusterReconciler and DOMachineReconciler.

func (*MachineScope) AdditionalTags

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

AdditionalTags returns AdditionalTags from the scope's DOMachine. The returned value will never be nil.

func (*MachineScope) Close

func (m *MachineScope) Close() error

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

func (*MachineScope) GetBootstrapData added in v0.4.0

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

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

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.DOResourceStatus

GetInstanceStatus returns the DOMachine droplet instance status from the status.

func (*MachineScope) GetProviderID

func (m *MachineScope) GetProviderID() string

GetProviderID returns the DOMachine 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 DOMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

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.4.0

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the DOMachine status error message.

func (*MachineScope) SetFailureReason added in v0.4.0

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

SetFailureReason sets the DOMachine status error reason.

func (*MachineScope) SetInstanceStatus

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

SetInstanceStatus sets the DOMachine droplet id.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(dropletID string)

SetProviderID sets the DOMachine providerID in spec from droplet id.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the DOMachine Ready Status.

func (*MachineScope) SetVolumes added in v1.2.0

func (m *MachineScope) SetVolumes(volumeIDs []string)

SetVolumes sets the DOMachine volume IDs from droplet in status.

type MachineScopeGetter

type MachineScopeGetter interface {
	MachineScope(params MachineScopeParams) (*MachineScope, error)
}

MachineScopeGetter ...

type MachineScopeGetterFunc

type MachineScopeGetterFunc func(params MachineScopeParams) (*MachineScope, error)

MachineScopeGetterFunc ...

func (MachineScopeGetterFunc) MachineScope

func (f MachineScopeGetterFunc) MachineScope(params MachineScopeParams) (*MachineScope, error)

MachineScope ...

type MachineScopeParams

type MachineScopeParams struct {
	DOClients
	Client    client.Client
	Logger    logr.Logger
	Cluster   *clusterv1.Cluster
	Machine   *clusterv1.Machine
	DOCluster *infrav1.DOCluster
	DOMachine *infrav1.DOMachine
}

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

type TokenSource

type TokenSource struct {
	AccessToken string
}

TokenSource ...

func (*TokenSource) Token

func (t *TokenSource) Token() (*oauth2.Token, error)

Token return the oauth token.

Jump to

Keyboard shortcuts

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