Skip to content

Commit 4d3f5cd

Browse files
committed
kubelet: Add description for failed predicate Events
**Problem:** When a Pod fails to run due to kubelet-side admission checks, the v1.Event objects emitted looks like these: Reason="NodeAffinity" Message="Predicate NodeAffinity failed" Reason="NodeName" Message="Predicate NodeName failed" Reason="NodePorts" Message="Predicate NodePorts failed" **Solution:** Expose human-readable predicate description in the failure so that kubelet submits an Event with this description, such as: Reason="NodeAffinity" Message="Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector" Reason="NodeName" Message="Predicate NodeName failed: node(s) didn't match the requested node name" Reason="NodePorts" Message="Predicate NodePorts failed: node(s) didn't have free ports for the requested pod ports"
1 parent 9d63e57 commit 4d3f5cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/kubelet/lifecycle/predicate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ type PredicateFailureError struct {
269269
}
270270

271271
func (e *PredicateFailureError) Error() string {
272-
return fmt.Sprintf("Predicate %s failed", e.PredicateName)
272+
return fmt.Sprintf("Predicate %s failed: %s", e.PredicateName, e.PredicateDesc)
273273
}
274274

275275
// GetReason returns the reason of the PredicateFailureError.

0 commit comments

Comments
 (0)