IBM / cloud-pak-deployer

Configuration-based installation of OpenShift and Cloud Pak for Data/Integration/Watson AIOps on various private and public cloud infrastructure providers. Deployment attempts to achieve the end-state defined in the configuration. If something fails along the way, you only need to restart the process to continue the deployment.
https://ibm.github.io/cloud-pak-deployer/
Apache License 2.0
140 stars 69 forks source link

cp4d-delete-instance.sh: Delete Finalizer on Instance After 5 Minutes of Waiting #807

Closed luigimolinaro closed 2 days ago

luigimolinaro commented 1 month ago

Problem Description: When deleting a namespace, the system may hang indefinitely due to finalizers not being removed automatically, even when all content is successfully deleted. This leads to namespaces being stuck in a terminating state. The Kubernetes/Oc API often shows the following message indicating that finalization is pending:

{
    "type": "NamespaceDeletionContentFailure",
    "status": "False",
    "lastTransitionTime": "2024-10-15T09:08:43Z",
    "reason": "ContentDeleted",
    "message": "All content successfully deleted, may be waiting on finalization"
}

Proposed Solution: Implement an automatic deletion of the finalizer after a 5-minute timeout if the system is waiting on finalization after content has been confirmed as deleted.

Desired Outcome:

Key Details for Implementation:

  1. Timeout Logic:

    • After detecting the status "reason": "ContentDeleted", start a 5-minute countdown.
    • If the finalizer is still present after the 5 minutes, proceed with its deletion.
  2. Safety and Error Handling:

    • Ensure that all necessary resources have been properly deleted before finalizer removal.
    • Provide logging and auditing for finalizer removal, ensuring it is traceable in case of issues.
  3. Custom Resource Definition (CRD) Updates:

    • Modify the current instance handling to include a finalizer removal mechanism after the timeout.
  4. Configuration Options:

    • Provide an option to disable automatic finalizer removal if stricter control is needed.

Expected Impact: