Documentation ¶
Overview ¶
Package scope provides types for handling all the information to process a request in the topology/ClusterReconciler controller.
Index ¶
- type ClusterBlueprint
- func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() *clusterv1.MachineHealthCheckClass
- func (b *ClusterBlueprint) HasControlPlaneInfrastructureMachine() bool
- func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool
- func (b *ClusterBlueprint) HasMachineDeployments() bool
- func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool
- func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool
- func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv1.MachineDeploymentTopology) *clusterv1.MachineHealthCheckClass
- type ClusterState
- type ControlPlaneBlueprint
- type ControlPlaneState
- type ControlPlaneUpgradeTracker
- type HookResponseTracker
- type MachineDeploymentBlueprint
- type MachineDeploymentState
- type MachineDeploymentUpgradeTracker
- func (m *MachineDeploymentUpgradeTracker) AllowUpgrade() bool
- func (m *MachineDeploymentUpgradeTracker) DeferredUpgrade() bool
- func (m *MachineDeploymentUpgradeTracker) DeferredUpgradeNames() []string
- func (m *MachineDeploymentUpgradeTracker) HoldUpgrades(val bool)
- func (m *MachineDeploymentUpgradeTracker) MarkDeferredUpgrade(name string)
- func (m *MachineDeploymentUpgradeTracker) MarkPendingUpgrade(name string)
- func (m *MachineDeploymentUpgradeTracker) MarkRollingOut(names ...string)
- func (m *MachineDeploymentUpgradeTracker) MarkUpgradingAndRollingOut(names ...string)
- func (m *MachineDeploymentUpgradeTracker) PendingUpgrade() bool
- func (m *MachineDeploymentUpgradeTracker) PendingUpgradeNames() []string
- func (m *MachineDeploymentUpgradeTracker) RolloutNames() []string
- func (m *MachineDeploymentUpgradeTracker) UpgradingNames() []string
- type MachineDeploymentsStateMap
- type MaxMDUpgradeConcurrency
- type Scope
- type UpgradeTracker
- type UpgradeTrackerOption
- type UpgradeTrackerOptions
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) ControlPlaneMachineHealthCheckClass ¶ added in v1.3.0
func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() *clusterv1.MachineHealthCheckClass
ControlPlaneMachineHealthCheckClass returns the MachineHealthCheckClass that should be used to create the MachineHealthCheck object.
func (*ClusterBlueprint) HasControlPlaneInfrastructureMachine ¶
func (b *ClusterBlueprint) HasControlPlaneInfrastructureMachine() bool
HasControlPlaneInfrastructureMachine checks whether the clusterClass mandates the controlPlane has infrastructureMachines.
func (*ClusterBlueprint) HasControlPlaneMachineHealthCheck ¶ added in v1.1.0
func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool
HasControlPlaneMachineHealthCheck returns true if the ControlPlaneClass has both MachineInfrastructure and a MachineHealthCheck defined.
func (*ClusterBlueprint) HasMachineDeployments ¶
func (b *ClusterBlueprint) HasMachineDeployments() bool
HasMachineDeployments checks whether the topology has MachineDeployments.
func (*ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled ¶ added in v1.3.0
func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool
IsControlPlaneMachineHealthCheckEnabled returns true if a MachineHealthCheck should be created for the control plane. Returns false otherwise.
func (*ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled ¶ added in v1.3.0
func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool
IsMachineDeploymentMachineHealthCheckEnabled returns true if a MachineHealthCheck should be created for the MachineDeployment. Returns false otherwise.
func (*ClusterBlueprint) MachineDeploymentMachineHealthCheckClass ¶ added in v1.3.0
func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv1.MachineDeploymentTopology) *clusterv1.MachineHealthCheckClass
MachineDeploymentMachineHealthCheckClass return the MachineHealthCheckClass that should be used to create the MachineHealthCheck object.
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 // MachineHealthCheck holds the MachineHealthCheckClass for this ControlPlane. // +optional MachineHealthCheck *clusterv1.MachineHealthCheckClass }
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 // MachineHealthCheckClass holds the MachineHealthCheck for this ControlPlane. // +optional MachineHealthCheck *clusterv1.MachineHealthCheck }
ControlPlaneState holds all the objects representing the state of a managed control plane.
type ControlPlaneUpgradeTracker ¶
type ControlPlaneUpgradeTracker struct { // PendingUpgrade is true if the control plane version needs to be updated. False otherwise. PendingUpgrade bool // IsProvisioning is true if the control plane is being provisioned for the first time. False otherwise. IsProvisioning bool // IsUpgrading is true if the control plane is in the middle of an upgrade. // Note: Refer to control plane contract for definition of upgrading. IsUpgrading bool // IsScaling is true if the control plane is in the middle of a scale operation. // Note: Refer to control plane contract for definition of scaling. IsScaling bool }
ControlPlaneUpgradeTracker holds the current upgrade status of the Control Plane.
type HookResponseTracker ¶ added in v1.2.0
type HookResponseTracker struct {
// contains filtered or unexported fields
}
HookResponseTracker is a helper to capture the responses of the various lifecycle hooks.
func NewHookResponseTracker ¶ added in v1.2.0
func NewHookResponseTracker() *HookResponseTracker
NewHookResponseTracker returns a new HookResponseTracker.
func (*HookResponseTracker) Add ¶ added in v1.2.0
func (h *HookResponseTracker) Add(hook runtimecatalog.Hook, response runtimehooksv1.ResponseObject)
Add add the response of a hook to the tracker.
func (*HookResponseTracker) AggregateMessage ¶ added in v1.2.0
func (h *HookResponseTracker) AggregateMessage() string
AggregateMessage returns a human friendly message about the blocking status of hooks.
func (*HookResponseTracker) AggregateRetryAfter ¶ added in v1.2.0
func (h *HookResponseTracker) AggregateRetryAfter() time.Duration
AggregateRetryAfter calculates the lowest non-zero retryAfterSeconds time from all the tracked responses.
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 // MachineHealthCheck holds the MachineHealthCheckClass for this MachineDeployment. // +optional MachineHealthCheck *clusterv1.MachineHealthCheckClass }
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 // MachineHealthCheck holds a MachineHealthCheck linked to the MachineDeployment object. // +optional MachineHealthCheck *clusterv1.MachineHealthCheck }
MachineDeploymentState holds all the objects representing the state of a managed deployment.
func (*MachineDeploymentState) IsRollingOut ¶
func (md *MachineDeploymentState) IsRollingOut() bool
IsRollingOut determines if the machine deployment is rolling out. A machine deployment is considered upgrading if: - if any of the replicas of the machine deployment is not ready.
func (*MachineDeploymentState) IsUpgrading ¶ added in v1.4.2
IsUpgrading determines if the MachineDeployment is upgrading. A machine deployment is considered upgrading if at least one of the Machines of this MachineDeployment has a different version.
type MachineDeploymentUpgradeTracker ¶
type MachineDeploymentUpgradeTracker struct {
// contains filtered or unexported fields
}
MachineDeploymentUpgradeTracker holds the current upgrade status and makes upgrade decisions for MachineDeployments.
func (*MachineDeploymentUpgradeTracker) AllowUpgrade ¶
func (m *MachineDeploymentUpgradeTracker) AllowUpgrade() bool
AllowUpgrade returns true if a MachineDeployment is allowed to upgrade, returns false otherwise. Note: If AllowUpgrade returns true the machine deployment will pick up the topology version. This will eventually trigger a machine deployment rollout.
func (*MachineDeploymentUpgradeTracker) DeferredUpgrade ¶ added in v1.4.0
func (m *MachineDeploymentUpgradeTracker) DeferredUpgrade() bool
DeferredUpgrade returns true if the upgrade has been deferred for any of the MachineDeployments. Returns false, otherwise.
func (*MachineDeploymentUpgradeTracker) DeferredUpgradeNames ¶ added in v1.4.0
func (m *MachineDeploymentUpgradeTracker) DeferredUpgradeNames() []string
DeferredUpgradeNames returns the list of MachineDeployment names for which the upgrade has been deferred.
func (*MachineDeploymentUpgradeTracker) HoldUpgrades ¶ added in v1.2.0
func (m *MachineDeploymentUpgradeTracker) HoldUpgrades(val bool)
HoldUpgrades is used to set if any subsequent upgrade operations should be paused, e.g. because a AfterControlPlaneUpgrade hook response asked to do so. If HoldUpgrades is called with `true` then AllowUpgrade would return false.
func (*MachineDeploymentUpgradeTracker) MarkDeferredUpgrade ¶ added in v1.4.0
func (m *MachineDeploymentUpgradeTracker) MarkDeferredUpgrade(name string)
MarkDeferredUpgrade marks that the upgrade for a MachineDeployment has been deferred.
func (*MachineDeploymentUpgradeTracker) MarkPendingUpgrade ¶
func (m *MachineDeploymentUpgradeTracker) MarkPendingUpgrade(name string)
MarkPendingUpgrade marks a machine deployment as in need of an upgrade. This is generally used to capture machine deployments that have not yet picked up the topology version.
func (*MachineDeploymentUpgradeTracker) MarkRollingOut ¶
func (m *MachineDeploymentUpgradeTracker) MarkRollingOut(names ...string)
MarkRollingOut marks a MachineDeployment as currently rolling out or is about to rollout. NOTE: We are using Rollout because this includes upgrades and also other changes that could imply Machines being created/deleted; in both cases we should wait for the operation to complete before moving to the next step of the Cluster upgrade.
func (*MachineDeploymentUpgradeTracker) MarkUpgradingAndRollingOut ¶ added in v1.4.2
func (m *MachineDeploymentUpgradeTracker) MarkUpgradingAndRollingOut(names ...string)
MarkUpgradingAndRollingOut marks a MachineDeployment as currently upgrading or about to upgrade. NOTE: Marking a MachineDeployment as upgrading also marks it as RollingOut.
func (*MachineDeploymentUpgradeTracker) PendingUpgrade ¶
func (m *MachineDeploymentUpgradeTracker) PendingUpgrade() bool
PendingUpgrade returns true if any of the machine deployments are pending an upgrade. Returns false, otherwise.
func (*MachineDeploymentUpgradeTracker) PendingUpgradeNames ¶
func (m *MachineDeploymentUpgradeTracker) PendingUpgradeNames() []string
PendingUpgradeNames returns the list of machine deployment names that are pending an upgrade.
func (*MachineDeploymentUpgradeTracker) RolloutNames ¶
func (m *MachineDeploymentUpgradeTracker) RolloutNames() []string
RolloutNames returns the list of machine deployments that are rolling out or are about to rollout. Note: This also includes the names of MachineDeployments that are upgrading MachineDeployments are also considered rolling out.
func (*MachineDeploymentUpgradeTracker) UpgradingNames ¶ added in v1.4.2
func (m *MachineDeploymentUpgradeTracker) UpgradingNames() []string
UpgradingNames returns the list of machine deployments that are upgrading or are about to upgrade.
type MachineDeploymentsStateMap ¶
type MachineDeploymentsStateMap map[string]*MachineDeploymentState
MachineDeploymentsStateMap holds a collection of MachineDeployment states.
func (MachineDeploymentsStateMap) IsAnyRollingOut ¶
func (mds MachineDeploymentsStateMap) IsAnyRollingOut() bool
IsAnyRollingOut returns true if at least one of the machine deployments is rolling out. False, otherwise.
func (MachineDeploymentsStateMap) RollingOut ¶
func (mds MachineDeploymentsStateMap) RollingOut() []string
RollingOut returns the list of the machine deployments that are rolling out.
type MaxMDUpgradeConcurrency ¶ added in v1.4.2
type MaxMDUpgradeConcurrency int
MaxMDUpgradeConcurrency sets the upper limit for the number of Machine Deployments that can upgrade concurrently.
func (MaxMDUpgradeConcurrency) ApplyToUpgradeTracker ¶ added in v1.4.2
func (m MaxMDUpgradeConcurrency) ApplyToUpgradeTracker(options *UpgradeTrackerOptions)
ApplyToUpgradeTracker applies the given UpgradeTrackerOptions.
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 // HookResponseTracker holds the hook responses that will be used to // calculate a combined reconcile result. HookResponseTracker *HookResponseTracker }
Scope holds all the information to process a request in the topology/ClusterReconciler controller.
type UpgradeTracker ¶
type UpgradeTracker struct { ControlPlane ControlPlaneUpgradeTracker MachineDeployments MachineDeploymentUpgradeTracker }
UpgradeTracker is a helper to capture the upgrade status and make upgrade decisions.
func NewUpgradeTracker ¶
func NewUpgradeTracker(opts ...UpgradeTrackerOption) *UpgradeTracker
NewUpgradeTracker returns an upgrade tracker with empty tracking information.
type UpgradeTrackerOption ¶ added in v1.4.2
type UpgradeTrackerOption interface {
ApplyToUpgradeTracker(options *UpgradeTrackerOptions)
}
UpgradeTrackerOption returns an option for the NewUpgradeTracker function.
type UpgradeTrackerOptions ¶ added in v1.4.2
type UpgradeTrackerOptions struct {
// contains filtered or unexported fields
}
UpgradeTrackerOptions contains the options for NewUpgradeTracker.