Skip to content

Improve ClusterAccess library behavior #192

@Diaphteiros

Description

@Diaphteiros

What would you like to be added:
The ClusterAccess library can be improved in the following ways:

  • Currently, only a single AccessRequest or ClusterRequest is deleted, then the library returns and requests a requeue to wait for the deletion. This should instead delete all AccessRequests in the first step and then all ClusterRequests together, not only a single one.
  • Calling the library's Reconcile method during deletion is problematic at the moment: In theory, it should be called beginning of the reconciliation to ensure that the access to the clusters is available in order to undeploy stuff. However, at the end of the reconciliation, ReconcileDelete should be called, which then removes some resources (AccessRequests first) and requests a requeue. If then Reconcile is called again, it will restore the already deleted AccessRequest, causing a loop of infinite reconciliations.
    • It is possible to figure out whether the AccessRequest has already been deleted, but this is not intuitive.

Solution Proposal:
@reshnm proposed the following approach to solve the deletion problem: During the regular Reconcile, AccessRequests are created with a finalizer. This means that if Reconcile is called during deletion, it can recognize that via the resource's DeletionTimestamp and not update the AccessRequest. During ReconcileDelete, the finalizer is only removed when it is the only one remaining on the AccessRequest. This ensures that the corresponding resources have already been deleted by the responsible ClusterProvider.
We apply the same logic when deleting ClusterRequests.

Metadata

Metadata

Assignees

Labels

area/open-mcpAll ManagedControlPlane related issuesenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions