-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bubble up pod schedule errors to revision status #4191
Conversation
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.
@shashwathi: 1 warning.
In response to this:
Pod schedule error information is updated in revision status so user can debug what's happening from the knative revision, configuration and svc object.
Eg:
Sample configuration status (with pod spec that has unschedulable resource )conditions: - lastTransitionTime: 2019-05-30T18:42:45Z message: 'Revision "configuration-example-jmk22" failed with message: 0/3 nodes are available: 3 Insufficient cpu..' reason: RevisionFailed status: "False" type: Ready
Revision status
- lastTransitionTime: 2019-05-30T18:42:45Z message: '0/3 nodes are available: 3 Insufficient cpu.' reason: Unschedulable status: "False" type: ResourcesAvailable
Fixes #4153
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
@@ -197,6 +197,10 @@ func (rs *RevisionStatus) MarkResourcesAvailable() { | |||
revCondSet.Manage(rs).MarkTrue(RevisionConditionResourcesAvailable) | |||
} | |||
|
|||
func (rs *RevisionStatus) MarkResourcesUnavailable(reason, message string) { |
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.
Golint comments: exported method RevisionStatus.MarkResourcesUnavailable should have comment or be unexported. More info.
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.
Please fix this as well.
The following is the coverage report on pkg/.
|
Nice, I'll need |
/lgtm @shashwathi after rebasing/resolving conflict you'll need to assign this to Matt because of the API package changes |
/assign @mattmoor |
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
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
/approve
/hold Is an e2e test for this possible? If not, feel free to remove the hold. |
Perhaps you could ask for an unreasonably large amount of CPU? Like 50k cores :) |
@mattmoor : I have updated the PR to include e2e test with high CPU like you recommended :) Thanks for the suggestion. |
/hold cancel |
The following is the coverage report on pkg/.
|
/test pull-knative-serving-unit-tests |
@@ -0,0 +1,98 @@ | |||
package e2e |
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.
Needs:
// +build e2e
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
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.
Thank you so much
break | ||
} | ||
} | ||
|
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.
do we care about overriding this status with the statuses below if they all happen?
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.
Do you mean updating revision status if resources are present on nodes?
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.
NM, I think it's fine. But what I meant is code below would override the status value. But we don't have idea of priorities, so I guess it doesn't matter here.
test/e2e/pod_schedule_error_test.go
Outdated
|
||
names.Config = serviceresourcenames.Configuration(svc) | ||
|
||
errorReason := "RevisionFailed" |
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.
those both are constants.
test/e2e/pod_schedule_error_test.go
Outdated
t.Fatalf("Failed to get revision from configuration %s: %v", names.Config, err) | ||
} | ||
|
||
revisionReason := "Unschedulable" |
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.
as are these 2.
test/e2e/pod_schedule_error_test.go
Outdated
} | ||
|
||
// Get revision name from configuration. | ||
func getRevisionFromConfiguration(clients *test.Clients, configName string) (string, error) { |
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.
just revisionFromConfiguration
.
The following is the coverage report on pkg/.
|
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.
superficial issues only
test/e2e/pod_schedule_error_test.go
Outdated
revisionName, revisionReason, errorMsg, cond.Reason, cond.Message) | ||
} | ||
return false, nil | ||
}, "RevisionFailed") |
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.
use errorReason
here?
test/e2e/pod_schedule_error_test.go
Outdated
if config.Status.LatestCreatedRevisionName != "" { | ||
return config.Status.LatestCreatedRevisionName, nil | ||
} | ||
return "", fmt.Errorf("No valid revision name found in configuration %s", configName) |
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.
errors start with lowercase in Go.
return "", fmt.Errorf("No valid revision name found in configuration %s", configName) | |
return "", fmt.Errorf("no valid revision name found in configuration %s", configName) |
test/e2e/pod_schedule_error_test.go
Outdated
if cond.Reason == revisionReason && strings.Contains(cond.Message, errorMsg) { | ||
return true, nil | ||
} | ||
return true, fmt.Errorf("The revision %s was not marked with expected error condition (Reason=%q, Message=%q), but with (Reason=%q, Message=%q)", |
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, fmt.Errorf("The revision %s was not marked with expected error condition (Reason=%q, Message=%q), but with (Reason=%q, Message=%q)", | |
return true, fmt.Errorf("the revision %s was not marked with expected error condition (Reason=%q, Message=%q), but with (Reason=%q, Message=%q)", |
@vagababov Addressed your comments. Ready for another review |
The following is the coverage report on pkg/.
|
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.
Please do the linter error and found one more error string :)
But I am sure those are the last ones :)
@@ -197,6 +197,10 @@ func (rs *RevisionStatus) MarkResourcesAvailable() { | |||
revCondSet.Manage(rs).MarkTrue(RevisionConditionResourcesAvailable) | |||
} | |||
|
|||
func (rs *RevisionStatus) MarkResourcesUnavailable(reason, message string) { |
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.
Please fix this as well.
test/e2e/pod_schedule_error_test.go
Outdated
return true, nil | ||
} | ||
t.Logf("Reason: %s ; Message: %s ; Status: %s", cond.Reason, cond.Message, cond.Status) | ||
return true, fmt.Errorf("The service %s was not marked with expected error condition (Reason=\"%s\", Message=\"%s\", Status=\"%s\"), but with (Reason=\"%s\", Message=\"%s\", Status=\"%s\")", |
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, fmt.Errorf("The service %s was not marked with expected error condition (Reason=\"%s\", Message=\"%s\", Status=\"%s\"), but with (Reason=\"%s\", Message=\"%s\", Status=\"%s\")", | |
return true, fmt.Errorf("the service %s was not marked with expected error condition (Reason=\"%s\", Message=\"%s\", Status=\"%s\"), but with (Reason=\"%s\", Message=\"%s\", Status=\"%s\")", |
The following is the coverage report on pkg/.
|
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
/approve
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, shashwathi, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pod schedule error information is updated in revision status so user can debug what's happening from the knative revision, configuration and svc object.
Eg:
Sample configuration status (with pod spec that has unschedulable resource )
Revision status
Fixes #4153