-
Notifications
You must be signed in to change notification settings - Fork 231
Fix bug where Init:Error failed pods displayed "Pod initializing" #2676
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
Conversation
app/scripts/filters/resources.js
Outdated
|
|
||
| if (containerReason) { | ||
| // only show containerReason if pod.status.phase is not 'Failed' | ||
| if (reason !== 'Failed' && containerReason) { |
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.
@spadgett can you think of a case where this isn't what we would want?
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.
I feel like there might be specific reasons you'd want to see even for failed pods. Evicted? Deadline exceeded?
This logic was modeled after the CLI, so it would be good to stay consistent. I'm curious what the CLI shows for these pods.
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.
NAME READY STATUS RESTARTS AGE
dancer-ex-1-build 0/1 Init:Error 0 1h
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.
@jwforres Do we need to iterate over initContainerStatuses here too?
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.
I believe this is the current CLI logic if we want to be consistent:
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.
yeah i think that is probably the correct fix for this
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.
Looks like CLI has special initializing logic.
|
Take 2. I didn't add all the initializing logic since it seems we only care about errors. Thoughts? |
|
/hold I'm not sure the logic is right. I'll follow up with a review, but hold for now. |
app/scripts/filters/resources.js
Outdated
| var initReason; | ||
|
|
||
| angular.forEach(pod.status.initContainerStatuses, function(initContainerStatus) { | ||
| var initContainerReason = _.get(initContainerStatus, 'state.terminated.reason'); |
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.
It looks like there is a state.terminated.reason even for successful init containters. We probably need to check exitCode, too.
initContainerStatuses:
- containerID: >-
docker://695625642cd6a776c8fe86a0ee530e0acbe04cfbb7187552c55b068f60df1333
image: 'docker.io/openshift/origin-sti-builder:v3.9.0-alpha.3'
imageID: >-
docker-pullable://docker.io/openshift/origin-sti-builder@sha256:1120189696907b0451dcd081b39406be02c14b988cc7fc655af39002a0953ced
lastState: {}
name: git-clone
ready: true
restartCount: 0
state:
terminated:
containerID: >-
docker://695625642cd6a776c8fe86a0ee530e0acbe04cfbb7187552c55b068f60df1333
exitCode: 0
finishedAt: '2018-01-19T23:18:35Z'
reason: Completed
startedAt: '2018-01-19T23:18:33Z'If there are multiple init containers and only the first init container has it, it looks like initContainerReason will be unset since we don't break the loop early.
|
Take 3. No idea if this is right, but I gave it a go. |
app/scripts/filters/resources.js
Outdated
| return; | ||
| if (initContainerState.terminated && initContainerState.terminated.exitCode === 0) { | ||
| // initialization is complete | ||
| return true; |
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.
return true will short-circuit here and skip the remaining init containers. Since this container was successful, it's not what we want. We want to short0circuit only when we find one that is not complete or failed.
I think you want just return;
app/scripts/filters/resources.js
Outdated
| var containerReason = _.get(containerStatus, 'state.waiting.reason') || _.get(containerStatus, 'state.terminated.reason'), | ||
| signal, | ||
| exitCode; | ||
| _.forEach(pod.status.initContainerStatuses, function(initContainerStatus) { |
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.
nit: We try to consistently use _.each (alias to _.forEach) so we don't have a mix of one and the other. They're the same, but if you don't know that, it might be confusing to see both in the code.
app/scripts/filters/resources.js
Outdated
|
|
||
| // Print detailed container reasons if available. Only the last will be | ||
| // displayed if multiple containers have this detail. | ||
| _.forEach(pod.status.containerStatuses, function(containerStatus) { |
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.
nit: _.each
|
Take 3 comments address. |
app/scripts/filters/resources.js
Outdated
| if (!initializing) { | ||
| reason = pod.status.reason || pod.status.phase; | ||
|
|
||
| // Print detailed container reasons if available. Only the last will be |
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.
Update comment to say only first will be displayed if multiple containers have a reason. The comment no longer matches the code.
|
|
||
| exitCode = _.get(containerStatus, 'state.terminated.exitCode'); | ||
| if (exitCode) { | ||
| reason = "Exit Code: " + exitCode; |
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.
We should return true after this line, too, so we stop looking at other containers like the other checks above. Otherwise it'll keep iterating.
|
Round 4. Thank you for your patience, @spadgett. |
spadgett
left a comment
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.
/lgtm
|
Sorry didn't realize this still had the hold label /hold cancel |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue. |
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1512473