Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit aff07ea

Browse files
committed
Fix machine ref matching
Signed-off-by: Chuck Ha <[email protected]>
1 parent 40fcceb commit aff07ea

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

controllers/kubeadmconfig_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (r *KubeadmConfigReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
7777
// Find the owner reference
7878
var machineRef *v1.OwnerReference
7979
for _, ref := range config.OwnerReferences {
80-
if ref.Kind == machineKind.Kind && ref.APIVersion == machineKind.Version {
80+
if ref.Kind == machineKind.Kind && ref.APIVersion == machineKind.GroupVersion().String() {
8181
machineRef = &ref
8282
break
8383
}

controllers/kubeadmconfig_controller_reconciler_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package controllers
1818

1919
import (
2020
"context"
21+
"time"
2122

2223
. "github.com/onsi/ginkgo"
2324
. "github.com/onsi/gomega"
@@ -57,7 +58,8 @@ var _ = Describe("KubeadmConfigReconciler", func() {
5758
Bootstrap: clusterv1alpha2.Bootstrap{
5859
ConfigRef: &v1.ObjectReference{
5960
Kind: "KubeadmConfig",
60-
APIVersion: "v1alpha2",
61+
APIVersion: v1alpha2.GroupVersion.String(),
62+
Name: "my-config",
6163
},
6264
},
6365
},
@@ -93,7 +95,7 @@ var _ = Describe("KubeadmConfigReconciler", func() {
9395
})
9496
Expect(err).To(Succeed())
9597
Expect(result.Requeue).To(BeFalse())
96-
Expect(result.RequeueAfter).To(BeZero())
98+
Expect(result.RequeueAfter).To(Equal(30 * time.Second))
9799
})
98100
})
99101
})

0 commit comments

Comments
 (0)