Skip to content

change: (helm) - keep attempting to helm uninstall even if the first helm uninstall was not successful#4347

Closed
mikeshng wants to merge 1 commit intooperator-framework:masterfrom
mikeshng:change-helm-uninstall
Closed

change: (helm) - keep attempting to helm uninstall even if the first helm uninstall was not successful#4347
mikeshng wants to merge 1 commit intooperator-framework:masterfrom
mikeshng:change-helm-uninstall

Conversation

@mikeshng
Copy link
Copy Markdown
Contributor

Signed-off-by: Mike Ng ming@redhat.com

Description of the change:
For Helm-based operators delete resource, if the Helm uninstall completed with error, then keep trying to uninstall until there is no error on the Helm uninstall.

Motivation for the change:
For the Helm client, the helm uninstall command removes the release record even if the uninstall completed with error(s). This is fine behaviour for regular CLI execution because a user is informed that there was an error with the uninstall and the user will perform the proper recovery procedures.

However, this is problematic with the current implementation of the Helm operator. The Helm uninstall might have error and not deleted anything but since the release record is removed, the Helm operator thinks the release is gone and proceed to remove it's finalizer. So unless the user double check the log, the uninstall error is hidden away. See #3407 (comment)

This change is to enhance the behaviour of the Helm operator uninstall scenario, where the error will persist on the resource status for user to debug.

Closes: #3407

before this change:

# resource is gone from k8s, only in the log, we can see there was an error
{"level":"error","ts":1608568023.8352385,"logger":"controller-runtime.manager.controller.nginx-controller","msg":"Reconciler error","name":"nginx-sample","namespace":"default","error":"uninstallation completed with 1 error(s): ....
{"level":"info","ts":1608568023.8640625,"logger":"helm.controller","msg":"Release not found, removing finalizer","namespace":"default","name":"nginx-sample","apiVersion":"example.com/v1alpha1","kind":"Nginx","release":"nginx-sample"}

after this change:

$ oc get nginx/nginx-sample -o yaml 
...
  - lastTransitionTime: "2020-12-21T19:40:48Z"
    message: 'uninstallation completed with 1 error(s): ...
    reason: UninstallError
    status: "True"
    type: ReleaseFailed
...

# continuously attempt uninstall until the problem is fixed.
# when the problem is fixed, the log will show:

{"level":"info","ts":1608580477.2366333,"logger":"helm.controller","msg":"Uninstalled release","namespace":"default","name":"nginx-sample","apiVersion":"example.com/v1alpha1","kind":"Nginx","release":"nginx-sample"}
----
-# Source: nginx/templates/serviceaccount.yaml
-apiVersion: v1
-kind: ServiceAccount
-metadata:

Checklist

If the pull request includes user-facing changes, extra documentation is required:


kind: "change"

breaking: true
Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 Mar 3, 2021

Choose a reason for hiding this comment

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

Shows that it is more bug fix. Am I right?
@joelanford. Could you please give a hand with this one? Do you think that we should remove the finalizer if Helm uninstallation completed with an error? WDYT?

@camilamacedo86
Copy link
Copy Markdown
Contributor

camilamacedo86 commented Mar 3, 2021

/retest

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 2021
…helm uninstall was not successful

Signed-off-by: Mike Ng <ming@redhat.com>
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2021
@mikeshng
Copy link
Copy Markdown
Contributor Author

Rebased but I don't feel too confident about this PR anymore.

Dear operator-sdk maintainers, please feel free to close this PR. Thanks.

@openshift-bot
Copy link
Copy Markdown

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci Bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 25, 2021
@openshift-bot
Copy link
Copy Markdown

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci Bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 24, 2021
@openshift-bot
Copy link
Copy Markdown

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci Bot closed this Oct 24, 2021
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Oct 24, 2021

@openshift-bot: Closed this PR.

Details

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting a Helm-based operator CR doesn't guarantee all it's associated resources are deleted

4 participants