scope

package
v0.0.0-...-b2eb650 Latest Latest
Warning

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

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

Documentation

Overview

Package scope defines the basic context for an actuator to operate upon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterScope

type ClusterScope struct {
	logr.Logger

	Cluster   *clusterv1.Cluster
	KKCluster *infrav1.KKCluster
	// 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) APIServerPort

func (s *ClusterScope) APIServerPort() int32

APIServerPort returns the APIServerPort to use when creating the load balancer.

func (*ClusterScope) AllInstances

func (s *ClusterScope) AllInstances() ([]*infrav1.KKInstance, error)

AllInstances returns all existing KKInstances in the cluster.

func (*ClusterScope) AllInstancesInfo

func (s *ClusterScope) AllInstancesInfo() []infrav1.InstanceInfo

AllInstancesInfo returns the all instance specs.

func (*ClusterScope) Close

func (s *ClusterScope) Close() error

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

func (*ClusterScope) ComponentHost

func (s *ClusterScope) ComponentHost() string

ComponentHost returns the KKCluster binaries host.

func (*ClusterScope) ComponentOverrides

func (s *ClusterScope) ComponentOverrides() []infrav1.Override

ComponentOverrides returns the KKCluster binaries overrides.

func (*ClusterScope) ComponentZone

func (s *ClusterScope) ComponentZone() string

ComponentZone returns the KKCluster binaries zone.

func (*ClusterScope) ControlPlaneEndpoint

func (s *ClusterScope) ControlPlaneEndpoint() clusterv1.APIEndpoint

ControlPlaneEndpoint returns the control plane endpoint.

func (*ClusterScope) ControlPlaneLoadBalancer

func (s *ClusterScope) ControlPlaneLoadBalancer() *infrav1.KKLoadBalancerSpec

ControlPlaneLoadBalancer returns the KKLoadBalancerSpec.

func (*ClusterScope) ControllerName

func (s *ClusterScope) ControllerName() string

ControllerName returns the name of the controller that created the ClusterScope.

func (*ClusterScope) GetInstancesSpecByRole

func (s *ClusterScope) GetInstancesSpecByRole(role infrav1.Role) []infrav1.KKInstanceSpec

GetInstancesSpecByRole returns the KKInstance spec for the given role.

func (*ClusterScope) GlobalAuth

func (s *ClusterScope) GlobalAuth() *infrav1.Auth

GlobalAuth returns the global auth spec.

func (*ClusterScope) GlobalRegistry

func (s *ClusterScope) GlobalRegistry() *infrav1.Registry

GlobalRegistry returns the global registry spec.

func (*ClusterScope) InfraClusterName

func (s *ClusterScope) InfraClusterName() string

InfraClusterName returns the KK cluster name.

func (*ClusterScope) KubernetesClusterName

func (s *ClusterScope) KubernetesClusterName() string

KubernetesClusterName is the name of the Kubernetes cluster.

func (*ClusterScope) Name

func (s *ClusterScope) Name() string

Name returns the CAPI cluster name.

func (*ClusterScope) Namespace

func (s *ClusterScope) Namespace() string

Namespace returns the cluster namespace.

func (*ClusterScope) PatchObject

func (s *ClusterScope) PatchObject() error

PatchObject persists the cluster configuration and status.

func (*ClusterScope) RootFs

func (s *ClusterScope) RootFs() rootfs.Interface

RootFs returns the CAPKK rootfs interface.

type ClusterScopeParams

type ClusterScopeParams struct {
	Client         client.Client
	Logger         *logr.Logger
	Cluster        *clusterv1.Cluster
	KKCluster      *infrav1.KKCluster
	ControllerName string
	RootFsBasePath string
}

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

type InstanceScope

type InstanceScope struct {
	logr.Logger

	Cluster      *clusterv1.Cluster
	InfraCluster pkg.ClusterScoper
	Machine      *clusterv1.Machine
	KKMachine    *infrav1.KKMachine
	KKInstance   *infrav1.KKInstance
	// contains filtered or unexported fields
}

InstanceScope defines a scope defined around a machine instance and its cluster.

func NewInstanceScope

func NewInstanceScope(params InstanceScopeParams) (*InstanceScope, error)

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

func (*InstanceScope) Arch

func (i *InstanceScope) Arch() string

Arch returns the architecture of the KKInstance.

func (*InstanceScope) Close

func (i *InstanceScope) Close() error

Close the InstanceScope by updating the instance spec, instance status.

func (*InstanceScope) ContainerManager

func (i *InstanceScope) ContainerManager() *infrav1.ContainerManager

ContainerManager returns the ContainerManager struct of the KKInstance.

func (*InstanceScope) GetRawBootstrapDataWithFormat

func (i *InstanceScope) GetRawBootstrapDataWithFormat(ctx context.Context) ([]byte, bootstrapv1.Format, error)

GetRawBootstrapDataWithFormat returns the raw bootstrap data from the corresponding machine.spec.bootstrap.

func (*InstanceScope) HasFailed

func (i *InstanceScope) HasFailed() bool

HasFailed returns the failure state of the instance scope.

func (*InstanceScope) HostName

func (i *InstanceScope) HostName() string

HostName returns the hostname of the KKInstance corresponding remote host.

func (*InstanceScope) InternalAddress

func (i *InstanceScope) InternalAddress() string

InternalAddress returns the internal address of the KKInstance.

func (*InstanceScope) KubernetesVersion

func (i *InstanceScope) KubernetesVersion() string

KubernetesVersion returns the Kubernetes version of the KKInstance.

func (*InstanceScope) Name

func (i *InstanceScope) Name() string

Name returns the name of the KKInstance.

func (*InstanceScope) Namespace

func (i *InstanceScope) Namespace() string

Namespace returns the namespace of the KKInstance.

func (*InstanceScope) PatchObject

func (i *InstanceScope) PatchObject() error

PatchObject persists the machine spec and status.

func (*InstanceScope) Repository

func (i *InstanceScope) Repository() *infrav1.Repository

Repository returns the repository of the KKInstance.

func (*InstanceScope) RepositoryEnabled

func (i *InstanceScope) RepositoryEnabled() bool

RepositoryEnabled returns whether the repository is enabled.

func (*InstanceScope) RepositoryUseISO

func (i *InstanceScope) RepositoryUseISO() bool

RepositoryUseISO returns whether the repository uses ISO.

func (*InstanceScope) SetState

func (i *InstanceScope) SetState(state infrav1.InstanceState)

SetState sets the state of the KKInstance.

type InstanceScopeParams

type InstanceScopeParams struct {
	Client       client.Client
	Logger       *logr.Logger
	Cluster      *clusterv1.Cluster
	InfraCluster *ClusterScope
	Machine      *clusterv1.Machine
	KKInstance   *infrav1.KKInstance
}

InstanceScopeParams defines the input parameters used to create a new InstanceScope.

type KKInstanceScope

type KKInstanceScope interface {
	pkg.ClusterScoper
	// ComponentZone returns the cluster zone.
	ComponentZone() string
	// ComponentHost returns the host to download the binaries.
	ComponentHost() string
	// ComponentOverrides returns the component overrides.
	ComponentOverrides() []infrav1.Override
	// GlobalAuth returns the global auth configuration of all instances.
	GlobalAuth() *infrav1.Auth
	// GlobalRegistry returns the global registry configuration of all instances.
	GlobalRegistry() *infrav1.Registry
	// GetInstancesSpecByRole returns all instances filtered by role.
	GetInstancesSpecByRole(role infrav1.Role) []infrav1.KKInstanceSpec
	// AllInstances returns all KKInstance existing in cluster.
	AllInstances() ([]*infrav1.KKInstance, error)
}

KKInstanceScope is a scope for global KKInstance.

type LBScope

type LBScope interface {
	pkg.ClusterScoper
	// ControlPlaneEndpoint returns KKCluster control plane endpoint
	ControlPlaneEndpoint() clusterv1.APIEndpoint
	// ControlPlaneLoadBalancer returns the KKLoadBalancerSpec
	ControlPlaneLoadBalancer() *infrav1.KKLoadBalancerSpec
	// AllInstancesInfo returns the instance info.
	AllInstancesInfo() []infrav1.InstanceInfo
}

LBScope is a scope for LB.

type MachineScope

type MachineScope struct {
	logr.Logger

	Cluster      *clusterv1.Cluster
	InfraCluster *ClusterScope
	Machine      *clusterv1.Machine
	KKMachine    *infrav1.KKMachine
	// 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.

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 KKMachine instance id by parsing Spec.ProviderID.

func (*MachineScope) GetInstanceState

func (m *MachineScope) GetInstanceState() *infrav1.InstanceState

GetInstanceState returns the KKMachine instance state from the status.

func (*MachineScope) GetProviderID

func (m *MachineScope) GetProviderID() string

GetProviderID returns the KKMachine providerID from the spec.

func (*MachineScope) GetRoles

func (m *MachineScope) GetRoles() []infrav1.Role

GetRoles returns the KKMachine roles.

func (*MachineScope) HasFailed

func (m *MachineScope) HasFailed() bool

HasFailed returns the failure state of the machine scope.

func (*MachineScope) InstanceIsInKnownState

func (m *MachineScope) InstanceIsInKnownState() bool

InstanceIsInKnownState checks if the machine scope's instance state is known.

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) IsRole

func (m *MachineScope) IsRole(role infrav1.Role) bool

IsRole returns true if the machine has the given role.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the KKMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

func (*MachineScope) PatchObject

func (m *MachineScope) PatchObject() error

PatchObject persists the machine spec and status.

func (*MachineScope) SetAddresses

func (m *MachineScope) SetAddresses(addrs []clusterv1.MachineAddress)

SetAddresses sets the KKMachine address status.

func (*MachineScope) SetFailureMessage

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the KKMachine status failure message.

func (*MachineScope) SetFailureReason

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

SetFailureReason sets the KKMachine status failure reason.

func (*MachineScope) SetInstanceID

func (m *MachineScope) SetInstanceID(instanceID string)

SetInstanceID sets the KKMachine instanceID in spec.

func (*MachineScope) SetInstanceState

func (m *MachineScope) SetInstanceState(v infrav1.InstanceState)

SetInstanceState sets the KKMachine status instance state.

func (*MachineScope) SetNotReady

func (m *MachineScope) SetNotReady()

SetNotReady sets the KKMachine Ready Status to false.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(instanceID, clusterName string)

SetProviderID sets the KKMachine providerID in spec.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the KKMachine Ready Status.

type MachineScopeParams

type MachineScopeParams struct {
	Client       client.Client
	Logger       *logr.Logger
	Cluster      *clusterv1.Cluster
	InfraCluster *ClusterScope
	Machine      *clusterv1.Machine
	KKMachine    *infrav1.KKMachine
}

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

type RegistryScope

type RegistryScope interface {
	Registry() *infrav1.Registry
}

RegistryScope is the scope for global registry.

Jump to

Keyboard shortcuts

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