Skip to content

feat: harden deletion with timeout, namespace cleanup, and force-remo…#66

Merged
vrdc-sap merged 3 commits into
kyma-project:mainfrom
vrdc-sap:vr-improve-deletion
Jun 1, 2026
Merged

feat: harden deletion with timeout, namespace cleanup, and force-remo…#66
vrdc-sap merged 3 commits into
kyma-project:mainfrom
vrdc-sap:vr-improve-deletion

Conversation

@vrdc-sap

@vrdc-sap vrdc-sap commented May 29, 2026

Copy link
Copy Markdown
Contributor

…ve on stuck uninstall

Description

Changes proposed in this pull request:

  • harden deletion with timeout, namespace cleanup, and force-remove on stuck uninstall

Related issue(s)
#56

@hyperspace-insights

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:

⚠️ Warnings:

  • Could not get issue kyma-project/gpu#123. Status: 404 - UnknownObjectException

Harden GPU Operator Deletion with Timeout, Namespace Cleanup, and Force-Remove on Stuck Uninstall

New Feature

🛡️ Hardens the GPU Operator deletion flow by introducing a configurable uninstall timeout, explicit gpu-operator namespace cleanup after Helm uninstall, and a force-remove fallback for the finalizer when Helm gets stuck.

Changes

  • internal/helm/interface.go: Updated the Installer interface — Uninstall now accepts a time.Duration timeout parameter.
  • internal/helm/installer.go: Updated Uninstall to enable Wait: true and pass the timeout to Helm's uninstall action, so the controller waits for pods to terminate before proceeding.
  • internal/controller/gpu_controller.go:
    • Added a deleteTimeout constant (3 minutes) passed to Uninstall.
    • On timeout (context.DeadlineExceeded), the finalizer is force-removed so the CR is not stuck forever; a warning is logged prompting manual namespace cleanup.
    • Added deleteNamespace() to explicitly delete the gpu-operator namespace (with foreground propagation) after a successful Helm uninstall, since Helm does not clean up namespaces on its own.
    • Extracted removeFinalizer() as a shared helper used by both the success and timeout paths.
    • Added isTimeoutError() helper to detect context.DeadlineExceeded.
  • internal/controller/gpu_controller_test.go: Expanded deletion tests into a BeforeEach-scoped suite with four new cases:
    • Non-timeout Helm failure keeps the finalizer and returns an error.
    • Helm timeout force-removes the finalizer without blocking the CR.
    • Successful uninstall triggers namespace deletion.
    • Missing namespace is ignored gracefully (idempotent).
  • config/rbac/role.yaml: Added delete verb to the namespaces resource permissions to allow the controller to clean up the namespace.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.21.0

@hyperspace-insights hyperspace-insights Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warnings:

  • Could not get issue kyma-project/gpu#123. Status: 404 - UnknownObjectException

The PR hardens the deletion path with a Helm uninstall timeout, force-finalizer removal on stuck uninstalls, and explicit namespace cleanup. The logic is mostly sound, but there are a few substantive issues: the timeout path skips namespace cleanup (contradicting the PR's goal), removeFinalizer doesn't guard against NotFound on re-fetch, isTimeoutError can false-positive on reconciler-context cancellation, the Helm context.Context parameter is silently discarded with no cancellation path during the blocking wait, and the namespace-deletion test is missing an assertion that Uninstall was actually invoked.

PR Bot Information

Version: 1.21.0

  • Agent Instructions:
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • File Content Strategy: Full file content
  • Correlation ID: a7b14c00-3239-4bba-8ce8-f8e10304b63f

Comment thread internal/controller/gpu_controller.go Outdated
Comment thread internal/controller/gpu_controller.go Outdated
Comment thread internal/helm/installer.go
Comment thread internal/controller/gpu_controller_test.go
Comment thread internal/controller/gpu_controller.go
@vrdc-sap vrdc-sap requested a review from dusglumac May 29, 2026 09:11
Comment thread internal/controller/gpu_controller.go Outdated
@vrdc-sap vrdc-sap merged commit f374249 into kyma-project:main Jun 1, 2026
10 checks passed
@vrdc-sap vrdc-sap deleted the vr-improve-deletion branch June 1, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants