cisco-open / k8s-objectmatcher

A Kubernetes object matcher library to avoid unnecessary K8s object updates
Apache License 2.0
157 stars 29 forks source link

fixing numeric pointer diffs #18

Closed bonifaido closed 4 years ago

bonifaido commented 4 years ago

Signed-off-by: Nandor Kracser bonifaido@gmail.com

Q A
Bug fix? yes
New feature? no
API breaks? no
Deprecations? no
License Apache 2.0

What's in this PR?

Why?

k8s.io/apimachinery/pkg/util/intstr.IntOrString behaves really badly from JSON marshaling point of view, it can't be empty basically. So we need to override the defined marshaling behaviour and write nil instead of 0, because usually (in all observed cases) 0 means "not set" for IntOrStr types. To make this happen we need to pull in json-iterator and override the factory marshaling overrides.

Additional context