Skip to content

Skip uninstall action if SA is not available  #536

@stefanprodan

Description

@stefanprodan

To avoid HelmReleases being stuck in finalization when a tenant is deleted, we should skip the uninstall action if the service account is no longer available.

To make helm-controller play nice with multi-tenancy, we could adapt this logic from kustomize-controller:

func (r *KustomizationReconciler) finalize(ctx context.Context, kustomization kustomizev1.Kustomization) (ctrl.Result, error) {
		if impersonation.CanFinalize(ctx) {
			// purne
		} else {
			// when the account to impersonate is gone, log the stale objects and continue with the finalization
			msg := fmt.Sprintf("unable to prune objects: \n%s", ssa.FmtUnstructuredList(objects))
			log.Error(fmt.Errorf("skiping pruning, failed to find account to impersonate"), msg)
}

Ref: https://github.com/fluxcd/kustomize-controller/blob/main/controllers/kustomization_controller.go#L916-L974

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions