kubernetes: Server Side Apply causing spurious resourceVersion bumps on no-op patch

What happened:

Running kubectl apply --server-side -f tmp.yml with

apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata:
  name: dummy-0-6
  namespace: pipeline
spec:
  cooldownPeriod: 600

the generation, resource version, and managedFields timestamp all change even when running it multiple times in a row (i.e. when the apply should result in no changes).

The relevant via of the CRD from KEDA 1.4.1 is:

              cooldownPeriod:
                format: int32
                type: integer

What you expected to happen:

No change to resource version (or generation or managedFields timestamp) is expected.

How to reproduce it (as minimally and precisely as possible):

kubectl get scaledobject -n pipeline dummy-0-6 -o yaml > old.yml
kubectl apply --server-side=true -f tmp.yml
kubectl get scaledobject -n pipeline dummy-0-6 -o yaml | diff -u old.yml -

Anything else we need to know?:

This may be related to #94275. I tried manually editing the CRD to format int64 and int but still saw the issue. Applying non-int32 fields in the same object does not show the same behavior.

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.3", GitCommit:"06ad960bfd03b39c8310aaf92d1e7c12ce618213", GitTreeState:"clean", BuildDate:"2020-02-13T18:08:14Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.9-gke.6300", GitCommit:"eb6985a7ebfd53457b0b91ba08fac07597bb87af", GitTreeState:"clean", BuildDate:"2020-09-15T09:20:11Z", GoVersion:"go1.13.9b4", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: Server is GKE.

You can find the CRD for this version of KEDA at https://github.com/kedacore/keda/blob/v1.4.1/deploy/crds/keda.k8s.io_scaledobjects_crd.yaml. Reproducing it didn’t require actually running the KEDA controller, it was 100% just on the apiserver side.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 39 (24 by maintainers)

Commits related to this issue

Most upvoted comments

/reopen /lifecycle frozen

Don’t worry, this is high on our list

This will be fixed by #106388 which we’re planning on cherry-picking as far back as possible! Thanks for the reminder 😃

That’s definitely an important issue to look at, I’ll give it a look.

Yes, I think we have a fix ready, we should be able to get it merged soon, thank you for your patience!

I’m closing this since we can’t reproduce with the latest version, thanks!