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
Handle nil elements when sorting, instead of panicking #94666
Conversation
/priority important-longterm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: soltysh 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 |
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
/milestone v1.20 |
…94666-upstream-release-1.18 Automated cherry pick of #94666: Handle nil elements when sorting, instead of panicking
…94666-upstream-release-1.17 Automated cherry pick of #94666: Handle nil elements when sorting, instead of panicking
…94666-upstream-release-1.19 Automated cherry pick of #94666: Handle nil elements when sorting, instead of panicking
What type of PR is this?
/kind bug
/sig cli
What this PR does / why we need it:
Currently if you try to sort using an optional field in the API, which can be empty you'll get a nasty error like this:
This PR treats those nil elements as 0/empty and sorts them this way, it might not be consistent with the output from
kubectl get
because that fetches that data from other fields. With Event'slastTimestamp
it sometimes is replaced with itsfirstTimestamp
, see here:kubernetes/pkg/printers/internalversion/printers.go
Lines 1724 to 1732 in b56d0ac
Special notes for your reviewer:
/assign @sallyom
Does this PR introduce a user-facing change?: