machineset

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package machineset implements the machineset topology controller. NOTE: It is required to enable the ClusterTopology feature gate flag to activate managed topologies support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateTemplatesInUse

func CalculateTemplatesInUse(md *clusterv1.MachineDeployment, msList []*clusterv1.MachineSet) (map[string]bool, error)

CalculateTemplatesInUse returns all templates referenced in non-deleting MachineDeployment and MachineSets.

func DeleteTemplateIfUnused

func DeleteTemplateIfUnused(ctx context.Context, c client.Client, templatesInUse map[string]bool, ref *corev1.ObjectReference) error

DeleteTemplateIfUnused deletes the template (ref), if it is not in use (i.e. in templatesInUse).

func GetMachineSetsForDeployment

func GetMachineSetsForDeployment(ctx context.Context, c client.Reader, md types.NamespacedName) ([]*clusterv1.MachineSet, error)

GetMachineSetsForDeployment returns a list of MachineSets associated with a MachineDeployment.

Types

type Reconciler

type Reconciler struct {
	Client client.Client
	// APIReader is used to list MachineSets directly via the API server to avoid
	// race conditions caused by an outdated cache.
	APIReader        client.Reader
	WatchFilterValue string
}

Reconciler deletes referenced templates during deletion of topology-owned MachineSets. The templates are only deleted, if they are not used in other MachineDeployments or MachineSets which are not in deleting state, i.e. the templates would otherwise be orphaned after the MachineSet deletion completes. Note: To achieve this the reconciler sets a finalizer to hook into the MachineSet deletions.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile deletes referenced templates during deletion of topology-owned MachineSets. The templates are only deleted, if they are not used in other MachineDeployments or MachineSets which are not in deleting state, i.e. the templates would otherwise be orphaned after the MachineSet deletion completes. Additional context: * MachineSet deletion:

  • MachineSets are deleted and garbage collected first (without waiting until all Machines are also deleted)
  • After that, deletion of Machines is automatically triggered by Kubernetes based on owner references.

Note: We assume templates are not reused by different MachineDeployments, which is (only) true for topology-owned

MachineDeployments.

We don't have to set the finalizer, as it's already set during MachineSet creation in the MachineSet controller.

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error

Jump to

Keyboard shortcuts

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