Commit c853d7d
committed
fix: ensure correct APIVersion in AWSClusterControllerIdentity conversion
The conversion webhook for AWSClusterControllerIdentity was failing with:
- expected infrastructure.cluster.x-k8s.io/v1beta2, received infrastructure.cluster.x-k8s.io/v1beta1
- Error from server: conversion webhook returned invalid object: invalid groupVersion
Root cause:
The auto-generated conversion function (Convert_v1beta1_AWSClusterControllerIdentity_To_v1beta2_AWSClusterControllerIdentity)
copies TypeMeta directly from the source object, which includes the APIVersion field. This results in
the converted v1beta2 object retaining the v1beta1 APIVersion, causing the conversion webhook to reject
it as invalid.
Fix:
Explicitly set the APIVersion to the target version (v1beta2) after calling the auto-generated
conversion function in both ConvertTo methods for AWSClusterControllerIdentity and
AWSClusterControllerIdentityList. This ensures the converted object has the correct APIVersion
that matches the target API version expected by Kubernetes.
This fix ensures that when Kubernetes requests conversion from v1beta1 to v1beta2, the webhook
returns objects with the correct APIVersion, allowing the conversion to succeed.1 parent 9274e10 commit c853d7d
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
0 commit comments