kubernetes / api

The canonical location of the Kubernetes API definition.
Apache License 2.0
652 stars 433 forks source link

`Divisor` `resource.Quantity` `omitempty` doesn't make sense #75

Open regnaio opened 4 months ago

regnaio commented 4 months ago

https://github.com/kubernetes/api/blob/master/core/v1/types.go#L2309

When you json.Marshal() a ResourceFieldSelector with undefined Divisor, you get divisor: "0"

This is bad for 2 reasons:

  1. omitempty is meaningless here
  2. According to the docs, Divisor should default to 1. Since it actually defaults to 0, you get unintended behavior and incorrect results

Divisor instead should be a pointer *resource.Quantity instead of just resource.Quantity

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

ciphx commented 3 weeks ago

/assign