Skip to content

Commit 5893b38

Browse files
authored
Merge pull request #12689 from k8s-infra-cherrypick-robot/cherry-pick-12685-to-release-1.11
[release-1.11] 🐛 Always use latest apiVersion when getting owner of KubeadmConfig in CABPK
2 parents b65847e + d57c6c5 commit 5893b38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bootstrap/util/configowner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ func getConfigOwner(ctx context.Context, c client.Client, obj metav1.Object, get
162162
for _, gk := range allowedGKs {
163163
if refGVK.Group == gk.Group && refGVK.Kind == gk.Kind {
164164
return getFn(ctx, c, &corev1.ObjectReference{
165-
APIVersion: ref.APIVersion,
165+
// Intentionally always using the latest apiVersion to get Machine or MachinePool,
166+
// even if the apiVersion in the ownerRef has not been bumped yet.
167+
APIVersion: clusterv1.GroupVersion.String(),
166168
Kind: ref.Kind,
167169
Name: ref.Name,
168170
Namespace: obj.GetNamespace(),

0 commit comments

Comments
 (0)