-
Notifications
You must be signed in to change notification settings - Fork 779
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
KeyError in kill-host-pods.py #4471
Comments
ianroberts
added a commit
to ianroberts/microk8s
that referenced
this issue
Mar 29, 2024
In certain circumstances pod["status"] may not have a containerStatuses child property at all (e.g. if the pod is Pending and not yet scheduled to any node). Guard against this by using .get (returns None) instead of [] (raises KeyError). Closes canonical#4471
ianroberts
added a commit
to ianroberts/microk8s
that referenced
this issue
Mar 29, 2024
In certain circumstances pod["status"] may not have a containerStatuses child property at all (e.g. if the pod is Pending and not yet scheduled to any node). Guard against this by using .get (returns None) instead of [] (raises KeyError).
3 tasks
ianroberts
added a commit
to ianroberts/microk8s
that referenced
this issue
Jan 27, 2025
In certain circumstances pod["status"] may not have a containerStatuses child property at all (e.g. if the pod is Pending and not yet scheduled to any node). Guard against this by using .get (returns None) instead of [] (raises KeyError).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
microk8s/scripts/kill-host-pods.py
Line 24 in f9eb294
It is possible for a pod not to have a
containerStatus
field, e.g. when it is in "Pending" state because no compatible node is available for it to be scheduled onto. Ifkill-host-pods.py
runs when there are one or more pods in this condition, it fails with the following traceback:Two possible fixes:
.get
instead of[]
for
loopThe text was updated successfully, but these errors were encountered: