Closed leseb closed 4 years ago
Hi! I've stumbled upon the same issue and I think it's related to the use of json "github.com/json-iterator/go"
instead of the default "encoding/json"
.
The json-iterator package exposes a config with sorting enabled ConfigCompatibleWithStandardLibrary
but the DeleteNullInJson
and other methods uses the default config which doesn't include sorting.
I've created a fork with the modifications (which work at first sight), but I don't know if there are other implications to these modifications: https://github.com/eachirei/k8s-objectmatcher/releases/tag/v1.3.3-alpha-2.
@eachirei sounds reasonable. Would you mind opening a PR?
Just did it ^
Describe the bug Since https://github.com/banzaicloud/k8s-objectmatcher/commit/4236369cea697476fc5d834d1e5b6e80f99a3e35, every time
SetLastAppliedAnnotation()
is applied the.metadata.annotations
of my Deployment has a different order.See, the first iteration:
Second iteration:
Basically
.metadata.labels
and.metadata.name
are reversed.Steps to reproduce the issue:
Deploy a Deployment resource with Labels.
Expected behavior
Annotations will get the same order all the time so that I don't get an endless reconcile loop.
Additional context
v1.1.0 worked well, the bug was introduced in v1.1.1 with https://github.com/banzaicloud/k8s-objectmatcher/commit/4236369cea697476fc5d834d1e5b6e80f99a3e35.
Thanks in advance for your help.