Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Miouge1
Copy link

@Miouge1 Miouge1 commented Sep 24, 2019

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.

chaoskube/chaoskube.go Outdated Show resolved Hide resolved
@Miouge1 Miouge1 force-pushed the webhook branch 3 times, most recently from e19e2a5 to a08884a Compare September 24, 2019 14:39
@Miouge1
Copy link
Author

Miouge1 commented Sep 24, 2019

It took a couple of tries, but I've added unit tests and fixed the comments from @golangcibot

@linki
Copy link
Owner

linki commented Oct 16, 2019

@Miouge1 Interesting idea. I'll take a look.

@linki
Copy link
Owner

linki commented Nov 8, 2019

Merged in latest master.

@Miouge1
Copy link
Author

Miouge1 commented Nov 12, 2019

@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)
}
}
Copy link
Owner

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.

Copy link
Author

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?

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

Successfully merging this pull request may close these issues.

3 participants