fix: avoid NPE in DeploymentHelper.equalIgnoreHash on templates with no labels - #4900
Conversation
|
|
|
Welcome @sureshmelvinsigera! |
|
Thank you for the PR. Before further review, please remove all whitespace changes, the easiest way to do this is probably to run Thanks |
4158a3c to
0003049
Compare
…no labels getLabels() and Yaml.dump() can both receive null when a pod template has no labels/metadata set, which is valid per the k8s API but wasn't handled here. Added null checks and a regression test.
0003049 to
5566ed8
Compare
|
Fixed - IntelliJ had reformatted some unrelated lines on save. Reset the file and reapplied just the two intended edits. Diff is clean now. |
|
/lgtm Thanks for fixing the whitespace. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, sureshmelvinsigera The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c1a7346
into
kubernetes-client:master
DeploymentHelper.equalIgnoreHashNPEs when a pod template has no labels (or no metadata at all), both are valid per the k8s API but weren't null-checked. This breaksgetAllReplicaSets, which is used for deployment rollout status.Added null checks before removing the pod-template-hash label, and a fallback for when metadata itself is null. Added a test that repros the old NPE and confirms it's fixed.