Unable to switch from manual to automatic composition revision policy
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
compositionRevisionRefand thenameis still present namewill still point torev: 1
- You will see the
- Check the composite of your claim
- You see the
generationis going to increase the whole time - do a
watchon the composition and you will see that thecompositionRevisionRef.nameis switching fromrev: 1torev: 2and 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
compositionRevisionRefusingkubectl edit ... - set the key
compositionRevisionRefto null usingkubectl edit ...
What environment did it happen in?
Crossplane version: 1.7.0
Linking to https://github.com/crossplane/crossplane/issues/2656