crossplane icon indicating copy to clipboard operation
crossplane copied to clipboard

Unable to switch from manual to automatic composition revision policy

Open eloo opened this issue 3 years ago • 1 comments

What happened?

Hi we have tested around with the composition revisions and have found a bug. Currently it seems that its not possible to switch from "manual" to "automatic" revision policy because of a limitation in kubectl together wit crossplane.

How can we reproduce it?

  • Enable composition revisions in your cluster
  • Create any composition and xrd
  • Create a claim and set the revision policy to manual and set the compositionRevisionRef.name to the correlating value (rev: 1)
  • wait till all is in sync
  • Create another revision of your composition (rev: 2)
  • Update your claim to use automatic policy
  • Remove the compositionRevisionRef.name (delete the key "compositionRevisionRef") in your local claim.yaml
  • Apply the change with kubectl apply -f claim.yaml
  • Check the values of your claim
    • You will see the compositionRevisionRef and the name is still present
    • name will still point to rev: 1
  • Check the composite of your claim
  • You see the generation is going to increase the whole time
  • do a watch on the composition and you will see that the compositionRevisionRef.name is switching from rev: 1 to rev: 2 and vice versa

Details

So what see here is missing key in the claim.yaml will not delete the compositionRevisionRef in the deployed claim. This leads to a race condition between the crossplane reconciler and the claim spec rev: 1->2->1->2->...

I have tested to set the compositionRevisionRef to null but this does not change anything. Setting the compositionRef.name to null is not possible because of the validation:

ValidationError(RedisInstance.spec.compositionRevisionRef): missing required field "name"

Setting --validate=false is still complaining:

spec.compositionRevisionRef.name: Required value

Workaround

The only workaround i found so far is to:

  • delete the key compositionRevisionRef using kubectl edit ...
  • set the key compositionRevisionRef to null using kubectl edit ...

What environment did it happen in?

Crossplane version: 1.7.0

eloo avatar Aug 24 '22 13:08 eloo

Linking to https://github.com/crossplane/crossplane/issues/2656

negz avatar Aug 25 '22 00:08 negz