cluster-api-cleaner-openstack

command module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

cluster-api-cleaner-openstack

A helper operator for CAPO to delete resources created by apps in workload clusters.

OpenstackClusterController

Why?

openstack-cloud-controller-manager in workload cluster creates loadbalancers in OpenStack for services in the cluster. openstack-cinder-csi also creates some volumes in OpenStack for persistentvolumes in the cluster. When the worklaod cluster is deleted, cluster-api-provider-openstack doesn't clean these resources. This controller helps for clean-up of workload clusters.

How does it work?
  • It observes OpenStackCluster objects.
  • It doesn't do anything in reconcileNormal other than adding finalizer.
  • It respects cluster.x-k8s.io/cluster-name label in OpenStackCluster objects to get the actual cluster names.
  • clusterTag is built as giant_swarm_cluster_<management-cluster-name>_<workload_cluster-name>.
  • When an OpenStackCluster is deleted, it
    • cleans volumes ( whose metadata contains cinder.csi.openstack.org/cluster: <clusterTag> ) created by Cinder CSI
    • cleans loadbalancers ( whose tags contain kube_service_<clusterTag>.* ) created by openstack-cloud-controller-manager

OpenstackMachineTemplateController

Why?

cluster-openstack doesn't use ClusterClass and it creates new OpenStackMachineTemplate during upgrades if necessary. The old templates are necessary for CAPI controllers to complete machine updates so helm should not delete them during upgrades. cluster-openstack adds a finalizers into templates to prevent their deletion by helm. This controller helps us to clean unused templates after upgrades.

How does it work?
  • It observes OpenstackMachineTemplate objects.
  • It doesn't do anything in reconcileNormal. Finalizers are added by cluster-openstack during creation.
  • When a OpenstackMachineTemplate is deleted, the controller checks all machinesets of the cluster and whether there is a machineset that consumes the OpenstackMachineTemplate or not. If there is no consumer, the controller deletes the OpenstackMachineTemplate.

Note that machineset objects are not deleted by machinedeploymentcontroller just after rollout. revisionHistoryLimit is 1 by default. It means an unused machineset is deleted by machinedeploymentcontroller after the next upgrade and it triggers deletion of OpenStackMachineTemplate deletion.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
key

Jump to

Keyboard shortcuts

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