scope

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package scope provides types for handling all the information to process a request in the topology/ClusterReconciler controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterBlueprint

type ClusterBlueprint struct {
	// Topology holds the topology info from Cluster.Spec.
	Topology *clusterv1.Topology

	// ClusterClass holds the ClusterClass object referenced from Cluster.Spec.Topology.
	ClusterClass *clusterv1.ClusterClass

	// InfrastructureClusterTemplate holds the InfrastructureClusterTemplate referenced from ClusterClass.
	InfrastructureClusterTemplate *unstructured.Unstructured

	// ControlPlane holds the ControlPlaneBlueprint derived from ClusterClass.
	ControlPlane *ControlPlaneBlueprint

	// MachineDeployments holds the MachineDeploymentBlueprints derived from ClusterClass.
	MachineDeployments map[string]*MachineDeploymentBlueprint
}

ClusterBlueprint holds all the objects required for computing the desired state of a managed Cluster topology, including the ClusterClass and all the referenced templates.

func (*ClusterBlueprint) HasControlPlaneInfrastructureMachine

func (b *ClusterBlueprint) HasControlPlaneInfrastructureMachine() bool

HasControlPlaneInfrastructureMachine checks whether the clusterClass mandates the controlPlane has infrastructureMachines.

func (*ClusterBlueprint) HasMachineDeployments

func (b *ClusterBlueprint) HasMachineDeployments() bool

HasMachineDeployments checks whether the topology has MachineDeployments.

type ClusterState

type ClusterState struct {
	// Cluster holds the Cluster object.
	Cluster *clusterv1.Cluster

	// InfrastructureCluster holds the infrastructure cluster object referenced by the Cluster.
	InfrastructureCluster *unstructured.Unstructured

	// ControlPlane holds the controlplane object referenced by the Cluster.
	ControlPlane *ControlPlaneState

	// MachineDeployments holds the machine deployments in the Cluster.
	MachineDeployments MachineDeploymentsStateMap
}

ClusterState holds all the objects representing the state of a managed Cluster topology. NOTE: please note that we are going to deal with two different type state, the current state as read from the API server, and the desired state resulting from processing the ClusterBlueprint.

type ControlPlaneBlueprint

type ControlPlaneBlueprint struct {
	// Template holds the control plane template referenced from ClusterClass.
	Template *unstructured.Unstructured

	// InfrastructureMachineTemplate holds the infrastructure machine template for the control plane, if defined in the ClusterClass.
	InfrastructureMachineTemplate *unstructured.Unstructured
}

ControlPlaneBlueprint holds the templates required for computing the desired state of a managed control plane.

type ControlPlaneState

type ControlPlaneState struct {
	// Object holds the ControlPlane object.
	Object *unstructured.Unstructured

	// InfrastructureMachineTemplate holds the infrastructure template referenced by the ControlPlane object.
	InfrastructureMachineTemplate *unstructured.Unstructured
}

ControlPlaneState holds all the objects representing the state of a managed control plane.

type MachineDeploymentBlueprint

type MachineDeploymentBlueprint struct {
	// Metadata holds the metadata for a MachineDeployment.
	// NOTE: This is a convenience copy of the metadata field from Cluster.Spec.Topology.Workers.MachineDeployments[x].
	Metadata clusterv1.ObjectMeta

	// BootstrapTemplate holds the bootstrap template for a MachineDeployment referenced from ClusterClass.
	BootstrapTemplate *unstructured.Unstructured

	// InfrastructureMachineTemplate holds the infrastructure machine template for a MachineDeployment referenced from ClusterClass.
	InfrastructureMachineTemplate *unstructured.Unstructured
}

MachineDeploymentBlueprint holds the templates required for computing the desired state of a managed MachineDeployment; it also holds a copy of the MachineDeployment metadata from Cluster.Topology, thus providing all the required info in a single place.

type MachineDeploymentState

type MachineDeploymentState struct {
	// Object holds the MachineDeployment object.
	Object *clusterv1.MachineDeployment

	// BootstrapTemplate holds the bootstrap template referenced by the MachineDeployment object.
	BootstrapTemplate *unstructured.Unstructured

	// InfrastructureMachineTemplate holds the infrastructure machine template referenced by the MachineDeployment object.
	InfrastructureMachineTemplate *unstructured.Unstructured
}

MachineDeploymentState holds all the objects representing the state of a managed deployment.

func (*MachineDeploymentState) IsRollingOut added in v0.4.3

func (md *MachineDeploymentState) IsRollingOut() bool

IsRollingOut determines if the machine deployment is upgrading. A machine deployment is considered upgrading if: - if any of the replicas of the the machine deployment is not ready.

type MachineDeploymentUpgradeTracker added in v0.4.3

type MachineDeploymentUpgradeTracker struct {
	// contains filtered or unexported fields
}

MachineDeploymentUpgradeTracker holds the current upgrade status and makes upgrade decisions for MachineDeployments.

func (*MachineDeploymentUpgradeTracker) AllowUpgrade added in v0.4.3

func (m *MachineDeploymentUpgradeTracker) AllowUpgrade() bool

AllowUpgrade returns true if a MachineDeployment is allowed to upgrade, returns false otherwise.

func (*MachineDeploymentUpgradeTracker) Insert added in v0.4.3

func (m *MachineDeploymentUpgradeTracker) Insert(name string)

Insert adds name to the set of MachineDeployments that will be upgraded.

type MachineDeploymentsStateMap added in v0.4.3

type MachineDeploymentsStateMap map[string]*MachineDeploymentState

MachineDeploymentsStateMap holds a collection of MachineDeployment states.

func (MachineDeploymentsStateMap) IsAnyRollingOut added in v0.4.3

func (mds MachineDeploymentsStateMap) IsAnyRollingOut() bool

IsAnyRollingOut returns true if at least one of the machine deployments is upgrading.

type Scope

type Scope struct {
	// Blueprint holds all the objects required for computing the desired state of a managed topology.
	Blueprint *ClusterBlueprint

	// Current holds the current state of the managed topology.
	Current *ClusterState

	// Desired holds the desired state of the managed topology.
	Desired *ClusterState

	// UpgradeTracker holds information about ongoing upgrades in the managed topology.
	UpgradeTracker *UpgradeTracker
}

Scope holds all the information to process a request in the topology/ClusterReconciler controller.

func New

func New(cluster *clusterv1.Cluster) *Scope

New returns a new Scope with only the cluster; while processing a request in the topology/ClusterReconciler controller additional information will be added about the Cluster blueprint, current state and desired state.

type UpgradeTracker added in v0.4.3

type UpgradeTracker struct {
	MachineDeployments MachineDeploymentUpgradeTracker
}

UpgradeTracker is a helper to capture the upgrade status and make upgrade decisions.

func NewUpgradeTracker added in v0.4.3

func NewUpgradeTracker() *UpgradeTracker

NewUpgradeTracker returns an upgrade tracker with empty tracking information.

Jump to

Keyboard shortcuts

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