-
Notifications
You must be signed in to change notification settings - Fork 121
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
Call an optional webhook before killing a pod #149
base: master
Are you sure you want to change the base?
Conversation
e19e2a5
to
a08884a
Compare
It took a couple of tries, but I've added unit tests and fixed the comments from @golangcibot |
@Miouge1 Interesting idea. I'll take a look. |
Merged in latest master. |
@linki thanks for the rebase, what do you think about the PR? Anything I can do to help? |
if resp.StatusCode == http.StatusOK { | ||
filteredList = append(filteredList, pod) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make one request for each candidate pod. If you have a cluster with 1000 pods and none of them aren't filtered out by the previous filters, this will call your endpoint 1000 times.
Is that what you had in mind?
If we want to go with the current behaviour we should document it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was the idea, I understand that with a large number of pods that might not be workable.. Another option would be to call the webhook only for the randomly selected pod in Victim()
.
Either way would work for my use case, so maybe it's more wise to move things to Victim()
? What do you think?
Call an optional POST webhook before killing a pod.
The webhook sends the PodSpec as a JSON payload to the webhook. This could allow an external webhook service to make an informed decision about killing the pod.
This could be used to have more complex logic or simply checking the Docker Hub status page.