Skip to content

Conversation

@sbueringer
Copy link
Member

@sbueringer sbueringer commented Aug 26, 2025

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:

I noticed the following errors in v0.3 => and v0.4 => upgrade tests:

E0825 18:05:01.890564 1 conversion.go:74] "failed to convert" err="failed to convert object: failed to get apiVersion for kind : failed to get CustomResourceDefinition metadata: CustomResourceDefinition.apiextensions.k8s.io "." not found" logger="conversion-webhook" request="28fca41f-db58-429b-93eb-6a6fbce2564c"
I0825 18:05:01.897137 1 recorder.go:104] "Failed to update MachineSet clusterctl-upgrade/clusterctl-upgrade-workload-qdpc77-md-0-578956d7b6: failed to apply MachineSet clusterctl-upgrade/clusterctl-upgrade-workload-qdpc77-md-0-578956d7b6: failed to prune fields: failed add back owned items: failed to convert pruned object at version cluster.x-k8s.io/v1beta1: conversion webhook for cluster.x-k8s.io/v1beta2, Kind=MachineSet failed: failed to convert object: failed to get apiVersion for kind : failed to get CustomResourceDefinition metadata: CustomResourceDefinition.apiextensions.k8s.io "." not found" logger="events" type="Warning" object={"kind":"MachineDeployment","namespace":"clusterctl-upgrade","name":"clusterctl-upgrade-workload-qdpc77-md-0","uid":"56a54e62-9be5-4e1d-8d83-d7abbf76cc76","apiVersion":"cluster.x-k8s.io/v1beta2","resourceVersion":"4425"} reason="FailedUpdate"
E0825 18:05:02.025429 1 controller.go:353] "Reconciler error" err="failed to update MachineSet clusterctl-upgrade/clusterctl-upgrade-workload-qdpc77-md-0-578956d7b6: failed to apply MachineSet clusterctl-upgrade/clusterctl-upgrade-workload-qdpc77-md-0-578956d7b6: failed to prune fields: failed add back owned items: failed to convert pruned object at version cluster.x-k8s.io/v1beta1: conversion webhook for cluster.x-k8s.io/v1beta2, Kind=MachineSet failed: failed to convert object: failed to get apiVersion for kind : failed to get CustomResourceDefinition metadata: CustomResourceDefinition.apiextensions.k8s.io "." not found" controller="machinedeployment" controllerGroup="cluster.x-k8s.io" controllerKind="MachineDeployment" MachineDeployment="clusterctl-upgrade/clusterctl-upgrade-workload-qdpc77-md-0" namespace="clusterctl-upgrade" name="clusterctl-upgrade-workload-qdpc77-md-0" reconcileID="97c28cf4-2b26-45a1-8743-0eb23fecd4a4"

See:

I think the problem is that we are always trying to convert infraRefs, even if they are not set. So this PR fixes that.

I think in general the apiserver only hits this code path on Kubernetes < v1.29. See: kubernetes/kubernetes#117356
(we only use kube-apiservers older than that in the v0.3 and v0.4 upgrade tests)

Independent of that we should fix the conversion for cases where infraRef is not set

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 26, 2025
@sbueringer sbueringer added the area/api Issues or PRs related to the APIs label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-area PR is missing an area label label Aug 26, 2025
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member Author

/assign @fabriziopandini @chrischdi

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 97cb7da08185b9a5658c3c29a3b8c81955e47e2b

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4137a55 into kubernetes-sigs:main Aug 26, 2025
37 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Aug 26, 2025
@sbueringer sbueringer deleted the pr-fix-infra-ref-conversion branch August 26, 2025 15:16
@sbueringer
Copy link
Member Author

/cherry-pick release-1.11

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #12693

In response to this:

/cherry-pick release-1.11

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api Issues or PRs related to the APIs cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants