scope

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AccessKeyNameTemplate = "%s-bucket-details"
View Source
const NumAccessKeys = 2

Variables

This section is empty.

Functions

func CreateLinodeClient

func CreateLinodeClient(apiKey string) (*linodego.Client, error)

Types

type ClusterScope

type ClusterScope struct {
	PatchHelper   *patch.Helper
	LinodeClient  LinodeNodeBalancerClient
	Cluster       *clusterv1.Cluster
	LinodeCluster *infrav1alpha1.LinodeCluster
	// contains filtered or unexported fields
}

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

func NewClusterScope

func NewClusterScope(ctx context.Context, apiKey string, 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) AddFinalizer

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

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

func (*ClusterScope) Close

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

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

func (*ClusterScope) PatchObject

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

PatchObject persists the cluster configuration and status.

type ClusterScopeParams

type ClusterScopeParams struct {
	Client        k8sClient
	Cluster       *clusterv1.Cluster
	LinodeCluster *infrav1alpha1.LinodeCluster
}

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

type LinodeInstanceClient

type LinodeInstanceClient interface {
	GetInstanceIPAddresses(ctx context.Context, linodeID int) (*linodego.InstanceIPAddressResponse, error)
	ListInstances(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Instance, error)
	CreateInstance(ctx context.Context, opts linodego.InstanceCreateOptions) (*linodego.Instance, error)
	BootInstance(ctx context.Context, linodeID int, configID int) error
	ListInstanceConfigs(ctx context.Context, linodeID int, opts *linodego.ListOptions) ([]linodego.InstanceConfig, error)
	UpdateInstanceConfig(ctx context.Context, linodeID int, configID int, opts linodego.InstanceConfigUpdateOptions) (*linodego.InstanceConfig, error)
	GetInstanceDisk(ctx context.Context, linodeID int, diskID int) (*linodego.InstanceDisk, error)
	ResizeInstanceDisk(ctx context.Context, linodeID int, diskID int, size int) error
	CreateInstanceDisk(ctx context.Context, linodeID int, opts linodego.InstanceDiskCreateOptions) (*linodego.InstanceDisk, error)
	GetInstance(ctx context.Context, linodeID int) (*linodego.Instance, error)
	DeleteInstance(ctx context.Context, linodeID int) error
	GetRegion(ctx context.Context, regionID string) (*linodego.Region, error)
	GetImage(ctx context.Context, imageID string) (*linodego.Image, error)
	CreateStackscript(ctx context.Context, opts linodego.StackscriptCreateOptions) (*linodego.Stackscript, error)
	ListStackscripts(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Stackscript, error)
	WaitForInstanceDiskStatus(ctx context.Context, instanceID int, diskID int, status linodego.DiskStatus, timeoutSeconds int) (*linodego.InstanceDisk, error)
}

LinodeInstanceClient defines the methods that a Linode client must have to interact with Linode's Instance service.

type LinodeMachineClient

type LinodeMachineClient interface {
	LinodeNodeBalancerClient
	LinodeInstanceClient
	LinodeVPCClient
}

LinodeClient is an interface that defines the methods that a Linode client must have to interact with Linode. It defines all the functions that are required to create, delete, and get resources from Linode such as object storage buckets, node balancers, linodes, and VPCs.

type LinodeNodeBalancerClient

type LinodeNodeBalancerClient interface {
	ListNodeBalancers(ctx context.Context, opts *linodego.ListOptions) ([]linodego.NodeBalancer, error)
	CreateNodeBalancer(ctx context.Context, opts linodego.NodeBalancerCreateOptions) (*linodego.NodeBalancer, error)
	CreateNodeBalancerConfig(ctx context.Context, nodebalancerID int, opts linodego.NodeBalancerConfigCreateOptions) (*linodego.NodeBalancerConfig, error)
	DeleteNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int) error
	DeleteNodeBalancer(ctx context.Context, nodebalancerID int) error
	CreateNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, opts linodego.NodeBalancerNodeCreateOptions) (*linodego.NodeBalancerNode, error)
}

LinodeNodeBalancerClient defines the methods that a Linode client must have to interact with Linode's Node Balancer service.

type LinodeObjectStorageClient

type LinodeObjectStorageClient interface {
	GetObjectStorageBucket(ctx context.Context, cluster, label string) (*linodego.ObjectStorageBucket, error)
	CreateObjectStorageBucket(ctx context.Context, opts linodego.ObjectStorageBucketCreateOptions) (*linodego.ObjectStorageBucket, error)
	GetObjectStorageKey(ctx context.Context, keyID int) (*linodego.ObjectStorageKey, error)
	CreateObjectStorageKey(ctx context.Context, opts linodego.ObjectStorageKeyCreateOptions) (*linodego.ObjectStorageKey, error)
	DeleteObjectStorageKey(ctx context.Context, keyID int) error
}

LinodeObjectStorageClient defines the methods that a Linode client must have to interact with Linode's Object Storage service.

func CreateLinodeObjectStorageClient

func CreateLinodeObjectStorageClient(apiKey string) (LinodeObjectStorageClient, error)

type LinodeObjectStorageClientBuilder

type LinodeObjectStorageClientBuilder func(apiKey string) (LinodeObjectStorageClient, error)

type LinodeVPCClient

type LinodeVPCClient interface {
	GetVPC(ctx context.Context, vpcID int) (*linodego.VPC, error)
}

LinodeVPCClient defines the methods that a Linode client must have to interact with Linode's VPC service.

type MachineScope

type MachineScope struct {
	Client        k8sClient
	PatchHelper   *patch.Helper
	Cluster       *clusterv1.Cluster
	Machine       *clusterv1.Machine
	LinodeClient  LinodeMachineClient
	LinodeCluster *infrav1alpha1.LinodeCluster
	LinodeMachine *infrav1alpha1.LinodeMachine
}

func NewMachineScope

func NewMachineScope(ctx context.Context, apiKey string, params MachineScopeParams) (*MachineScope, error)

func (*MachineScope) AddFinalizer

func (s *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(ctx context.Context) error

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

func (*MachineScope) GetBootstrapData

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

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

func (*MachineScope) PatchObject

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

PatchObject persists the machine configuration and status.

type MachineScopeParams

type MachineScopeParams struct {
	Client        k8sClient
	Cluster       *clusterv1.Cluster
	Machine       *clusterv1.Machine
	LinodeCluster *infrav1alpha1.LinodeCluster
	LinodeMachine *infrav1alpha1.LinodeMachine
}

type ObjectStorageBucketScope

type ObjectStorageBucketScope struct {
	Client       k8sClient
	Bucket       *infrav1alpha1.LinodeObjectStorageBucket
	Logger       logr.Logger
	LinodeClient LinodeObjectStorageClient
	PatchHelper  *patch.Helper
}

func NewObjectStorageBucketScope

func NewObjectStorageBucketScope(ctx context.Context, apiKey string, params ObjectStorageBucketScopeParams) (*ObjectStorageBucketScope, error)

func (*ObjectStorageBucketScope) AddFinalizer

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

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

func (*ObjectStorageBucketScope) Close

Close closes the current scope persisting the object storage bucket configuration and status.

func (*ObjectStorageBucketScope) GenerateKeySecret

GenerateKeySecret returns a secret suitable for submission to the Kubernetes API. The secret is expected to contain keys for accessing the bucket, as well as owner and controller references.

func (*ObjectStorageBucketScope) PatchObject

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

PatchObject persists the object storage bucket configuration and status.

func (*ObjectStorageBucketScope) ShouldInitKeys

func (s *ObjectStorageBucketScope) ShouldInitKeys() bool

func (*ObjectStorageBucketScope) ShouldRestoreKeySecret

func (s *ObjectStorageBucketScope) ShouldRestoreKeySecret(ctx context.Context) (bool, error)

func (*ObjectStorageBucketScope) ShouldRotateKeys

func (s *ObjectStorageBucketScope) ShouldRotateKeys() bool

type ObjectStorageBucketScopeParams

type ObjectStorageBucketScopeParams struct {
	Client              k8sClient
	LinodeClientBuilder LinodeObjectStorageClientBuilder
	Bucket              *infrav1alpha1.LinodeObjectStorageBucket
	Logger              *logr.Logger
}

type VPCScope

type VPCScope struct {
	PatchHelper  *patch.Helper
	LinodeClient *linodego.Client
	LinodeVPC    *infrav1alpha1.LinodeVPC
	// contains filtered or unexported fields
}

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

func NewVPCScope

func NewVPCScope(ctx context.Context, apiKey string, params VPCScopeParams) (*VPCScope, error)

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

func (*VPCScope) AddFinalizer

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

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

func (*VPCScope) Close

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

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

func (*VPCScope) PatchObject

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

PatchObject persists the machine configuration and status.

type VPCScopeParams

type VPCScopeParams struct {
	Client    k8sClient
	LinodeVPC *infrav1alpha1.LinodeVPC
}

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

Jump to

Keyboard shortcuts

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