abahmed / kwatch

:eyes: monitor & detect crashes in your Kubernetes(K8s) cluster instantly
https://kwatch.dev
MIT License
964 stars 75 forks source link

Describe the "reasons" config-field #140

Open Figedi opened 2 years ago

Figedi commented 2 years ago

Is your feature request related to a problem? Please describe. As it is a very handy feature to not alert on every pod shutting down/killing/whatever event, the reasons field could be very handy. However, there is a) no mentioning about it except this github repo (its missing on the page) b) there is no documentation about it (e.g. about what potential values are)

This makes it very hard to start using it Describe the solution you'd like Having a config-field which expects certain enums should document the enum-values

thomasLeclaire commented 1 year ago

Hey! I got a look on this subject in hope to improve filter of Error.

concretely for now, kwatch grab the reason field from the kubernetes-provided field for container.State.*.Reason : cf https://github.com/abahmed/kwatch/blob/main/controller/controller.go#L196

For a such field, I was unable to find some explicit docs from kubernetes, field is considered Experimental so they don't provide more details and it sounds this field can be provided by the container itself. We can only find that "reason is a unique, one-word, CamelCase"

from a few search here a list (probably incomplete and not up to date however ) :

For Waiting container status it is possible to get one of following reason:

ContainerCreating,
CrashLoopBackOff,
ErrImagePull,
ImagePullBackOff,
CreateContainerConfigError,
InvalidImageName,
CreateContainerError.

For Terminated container status there are different list of reasons:
OOMKilled,
Error,
Completed,
ContainerCannotRun,
DeadlineExceeded

if it can help someone!