[release-2.9] 🐛 fix: CAPA v1beta1 to v1beta2 generated conversion webhook #5744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Manual cherry-pick of #5739
/kind regression
This PR addresses a conversion webhook failure introduced in CAPA v2.9.x.
Users upgrading from CAPA v1.x (who have v1beta1 resources like AWSClusterControllerIdentity still stored in etcd) are unable to access these resources after upgrading to v2.9.x.
Any attempt to get these objects fails with an invalid groupVersion error, as the webhook incorrectly returns a v1beta1 object when v1beta2 is expected.
The root cause was identified in our old and custom copy of the upstream conversion-gen tooling.
A change (introduced in PR #5447 ) caused the generator to incorrectly add
out.TypeMeta = in.TypeMetato the generated conversion functions (zz_generated.conversion.go).This line improperly copies the
apiVersionfrom thev1beta1input object to thev1beta2output object, causing the webhook to return an invalid payload.This pull request resolves the issue by removing the old custom copy of the upstream conversion-gen, in favour of the up-to-date/latest mainline conversion-gen.
It follow that up with a regeneration of the conversion code which removes the problematic TypeMeta assignment.
More details in the Slack thread: https://kubernetes.slack.com/archives/CD6U2V71N/p1762863174053729