Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

KeyError 'conditions' #10

Closed
brosner opened this issue Feb 13, 2016 · 4 comments
Closed

KeyError 'conditions' #10

brosner opened this issue Feb 13, 2016 · 4 comments

Comments

@brosner
Copy link
Contributor

brosner commented Feb 13, 2016

I have noticed from time to time that I see this exception:

File "/Users/brian/Development/Envs/tmp-98df323c389668d/lib/python3.5/site-packages/pykube/rolling_updater.py", line 53, in update
    min_available, max_surge,
  File "/Users/brian/Development/Envs/tmp-98df323c389668d/lib/python3.5/site-packages/pykube/rolling_updater.py", line 83, in scale_down
    _, new_available = self.poll_for_ready_pods(old_rc, new_rc)
  File "/Users/brian/Development/Envs/tmp-98df323c389668d/lib/python3.5/site-packages/pykube/rolling_updater.py", line 126, in poll_for_ready_pods
    if pod.ready:
  File "/Users/brian/Development/Envs/tmp-98df323c389668d/lib/python3.5/site-packages/pykube/objects.py", line 158, in ready
    cs = self.obj["status"]["conditions"]
KeyError: 'conditions'

during a rolling update. Need to investigate why conditions is not present.

@iliakur
Copy link
Contributor

iliakur commented May 19, 2016

+1 . Just ran into this problem as well.
Could it be that the key is actually Condition?
See the object representation at this link, for instance:
kubernetes/kubernetes#8335 (comment)

@iliakur
Copy link
Contributor

iliakur commented May 19, 2016

So I did some more digging. I'm no Golang expert, but this seems to indicate that .status.conditions may be omitted if empty. I think I'd have to read more or bug k8s folks about this to find out more.

@iliakur
Copy link
Contributor

iliakur commented May 19, 2016

Sorry for the spam, but I've been investigating this today on and off.
I asked in the Kubernetes slack and was told the following:

so user creates pod, scheduler assigns pod, kubelet sees pod changed and then updates it to say that it saw it (setting conditions)
between the second and third spot there’s a window (typically a few hundred ms, but could be much longer if the system is loaded)

So it seems to me in most cases it should be ok to simply wait a couple of seconds before updating the pod's status and trying to access the key again.

@brosner
Copy link
Contributor Author

brosner commented Jun 14, 2016

Fixed in ce140a1

@brosner brosner closed this as completed Jun 14, 2016
zardus pushed a commit to mechaphish/meister that referenced this issue Aug 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants