Repository navigation
fix(clusterapi): use kind-aware version discovery for infra references - #9458
k8s-ci-robot merged 1 commit into
Conversation
|
Thanks for putting this together! The approach of resolving at the Kind level rather than just the API group makes sense A few thoughts while reading through: On
Future readers won't have issue #9439 in their head. On the test fix for the fake discovery client (good catch) On the original reporter's case the Nutanix error was: |
|
/retest |
Add getKindPreferredVersion to resolve the API version that actually serves a given infrastructure Kind, replacing the group-level getAPIGroupPreferredVersion. This fixes incorrect GVK construction when multiple versions exist in a CAPI infra provider group but not all versions serve every Kind (e.g. Nutanix vs AWS machine templates). Includes unit tests for getKindPreferredVersion and a test framework fix to populate Kind in the fake discovery client. Signed-off-by: Liangquan Li <[email protected]>
e4d6e47 to
4b1a5ec
Compare
updated
@yashrajshuklaaa The unit test TestGetKindPreferredVersion directly simulates this exact scenario — group preferred version is v1beta2 but the Kind only exists in v1beta1. Happy to test in a real environment if you'd like, but I think the unit coverage is sufficient here. |
|
/lgtm |
|
/lgtm |
elmiko
left a comment
There was a problem hiding this comment.
thanks @LiangquanLi930 , i just have a quick question.
also, could you update the description to add Fixes #9439
| if group.Name != apiGroup { | ||
| continue | ||
| } | ||
| for _, v := range group.Versions { |
There was a problem hiding this comment.
do we know what order these versions will be returned in?
i'm just curious if there is a case where we get an older version or something.
There was a problem hiding this comment.
group.Versions follows CRD .spec.versions definition order, not PreferredVersion. But for the Kinds we're fixing (e.g. AzureMachineTemplate), they only exist in v1beta1, so the order doesn't affect correctness here.
Should we also update the logic to try group.PreferredVersion first before iterating?
There was a problem hiding this comment.
ack, thanks.
Should we also update the logic to try group.PreferredVersion first before iterating?
good question, i don't think we need to but i'm trying to think through scenarios where this might fail.
There was a problem hiding this comment.
i'm having trouble thinking of a case where we would need it. let's move forward and see what breaks XD
updated, Thanks! |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: elmiko, LiangquanLi930 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/cherry-pick cluster-autoscaler-release-1.35 |
|
@elmiko: new pull request created: #9755 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The tenant cluster-autoscaler reads the newest Cluster API version the management cluster serves unless CAPI_VERSION names one. With Cluster API v1.13 that is v1beta2, and the 1.32 build shipped here predates the autoscaler fixes for reading v1beta2: scale from zero (kubernetes/autoscaler#8410, in 1.34) and infrastructure reference lookup (kubernetes/autoscaler#9458, in 1.36). The pools here carry capacity annotations for scale from zero, so that path is in use. Pinning v1beta1 keeps the autoscaler on the API it was built against. Cluster API serves v1beta1 until v1.16, which leaves time to move the image to a release with both fixes and drop the pin. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
The tenant cluster-autoscaler reads the newest Cluster API version the management cluster serves unless CAPI_VERSION names one. With Cluster API v1.13 that is v1beta2, and the 1.32 build shipped here predates the autoscaler fixes for reading v1beta2: scale from zero (kubernetes/autoscaler#8410, in 1.34) and infrastructure reference lookup (kubernetes/autoscaler#9458, in 1.36). The pools here carry capacity annotations for scale from zero, so that path is in use. Pinning v1beta1 keeps the autoscaler on the API it was built against. Cluster API serves v1beta1 until v1.16, which leaves time to move the image to a release with both fixes and drop the pin. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
What type of PR is this?
/kind bug
What this PR does / why we need it:
Add getKindPreferredVersion to resolve the API version that actually serves a given infrastructure Kind, replacing the group-level getAPIGroupPreferredVersion. This fixes incorrect GVK construction when multiple versions exist in a CAPI infra provider group but not all versions serve every Kind (e.g. Nutanix vs AWS machine templates).
Includes unit tests for getKindPreferredVersion and a test framework fix to populate Kind in the fake discovery client.
Which issue(s) this PR fixes:
Fixes #9439
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: