-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application stuck in deletion because of a postDelete hook #18270
Comments
What kind of hook are you using? A |
I think https://github.com/argoproj/argo-cd/blob/v2.11.0/controller/hook.go just misses necessary nil-checks after calling |
@joffreychambrin You can probably workaround the bug by adding this to your argocd-cm configmap: resource.customizations: |
batch/Job:
health.lua: |
hs = {}
hs.status = "Progressing"
hs.message = ""
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
if condition.type == "Complete" and condition.status == "True" then
hs.status = "Healthy"
return hs
end
if condition.type == "Failed" and condition.status == "True" then
hs.status = "Degraded"
return hs
end
end
end
end
return hs Completely untested, and I would advise against it. The idea here is to guarantee a non-nil Line 101 in d3f33c0
nil check there.
|
@joffreychambrin The unit test introduced in #16595 only tests this feature by using a bare |
@alexmt Maybe you want to know about this :) |
@ChristianCiach Yes the hook I am using is a job. It is the default one from Teleport here: https://github.com/gravitational/teleport/blob/70ba6be2eac4f8e5c275ffac6246197ef798392a/examples/chart/teleport-kube-agent/templates/delete_hook.yaml#L47 I think you are right in your analysis, because as you can see in the above link, there are multiple resources with the |
@Yuni-sa you recently made a pull request for another bug related to heath check, would you be interested in fixing this one? |
@agaudreault Yeah, sure! I can help fix this. How should we handle cases where the health check is nil for some resources? I was thinking of logging a message and skipping those checks.
|
@Yuni-sa awesome! I think when there are no health check, a log is good. If possible it should include the group, version and kind of the object as log fields. Then I think the behavior should be the same one as we have during the sync. We consider resources healthy if there is no health check defined or built-in. |
* fix: Handle nil health check in post-delete hooks Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * test: Validate deletion of RBAC resources for post-delete hook Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * Update appcontroller_test.go Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> --------- Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com>
* fix: Handle nil health check in post-delete hooks Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * test: Validate deletion of RBAC resources for post-delete hook Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * Update appcontroller_test.go Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> --------- Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com>
…18828) * fix: Handle nil health check in post-delete hooks * test: Validate deletion of RBAC resources for post-delete hook * Update appcontroller_test.go --------- Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> Co-authored-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com>
…rgoproj#18767) * fix: Handle nil health check in post-delete hooks Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * test: Validate deletion of RBAC resources for post-delete hook Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * Update appcontroller_test.go Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> --------- Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com>
…rgoproj#18767) * fix: Handle nil health check in post-delete hooks Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * test: Validate deletion of RBAC resources for post-delete hook Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> * Update appcontroller_test.go Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> --------- Signed-off-by: Yonatan Sasson <yonatanxd7@gmail.com> Signed-off-by: Yonatan Sasson <107778824+Yuni-sa@users.noreply.github.com> Signed-off-by: Javier Solana <javier.solana@cabify.com> Signed-off-by: Javier Solana <javier.solana@cabify.com>
Checklist:
argocd version
.Describe the bug
Since we've upgrade to to ArgoCD v2.10.0, we have a specific application that gets stuck in Deletion. The only solution I have found is to manually remove the finalizers from the App.
To Reproduce
URL: https://charts.releases.teleport.dev
Chart: teleport-kube-agent.
Version: 15.0.2
Expected behavior
The post hook delete job will be launch, and once completed the app should be automatically deleted from ArgoCD.
Version
Logs
The text was updated successfully, but these errors were encountered: