From 58c46487d00e930883a12bc99bf6d3d7521624ea Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 11:45:52 +0530 Subject: [PATCH 01/10] Fix machinepool infrastructure cluster lookup --- exp/controllers/ocimachinepool_controller.go | 31 ++++++++++++------- .../ocimanaged_machinepool_controller.go | 2 +- .../ocivirtual_machinepool_controller.go | 2 +- .../cluster.yaml | 4 +-- .../cluster-template-managed/cluster.yaml | 4 +-- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 5f1422a0..227e5411 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -113,15 +113,23 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque logger.Info("OCIMachinePool or linked Cluster is marked as paused. Won't reconcile") return ctrl.Result{}, nil } - - ociCluster := &infrastructurev1beta2.OCICluster{} - ociClusterName := client.ObjectKey{ - Namespace: cluster.Namespace, - Name: cluster.Name, - } - var clusterAccessor scope.OCIClusterAccessor - if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { + if cluster.Spec.InfrastructureRef.Kind == "OCICluster" { + ociCluster := &infrastructurev1beta2.OCICluster{} + ociClusterName := client.ObjectKey{ + Namespace: cluster.Namespace, + Name: cluster.Spec.InfrastructureRef.Name, + } + if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { + logger.Info("Cluster is not available yet") + r.Recorder.Eventf(ociMachinePool, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") + logger.V(2).Info("OCICluster is not available yet") + return ctrl.Result{}, nil + } + clusterAccessor = scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + } + } else if cluster.Spec.InfrastructureRef.Kind == "OCIManagedCluster" { ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociManagedClusterName := client.ObjectKey{ Namespace: cluster.Namespace, @@ -130,16 +138,15 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque if err := r.Client.Get(ctx, ociManagedClusterName, ociManagedCluster); err != nil { logger.Info("Cluster is not available yet") r.Recorder.Eventf(ociMachinePool, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") - logger.V(2).Info("OCICluster is not available yet") + logger.V(2).Info("OCIManagedCluster is not available yet") return ctrl.Result{}, nil } clusterAccessor = scope.OCIManagedCluster{ OCIManagedCluster: ociManagedCluster, } } else { - clusterAccessor = scope.OCISelfManagedCluster{ - OCICluster: ociCluster, - } + r.Recorder.Eventf(ociMachinePool, corev1.EventTypeWarning, "InfrastructureClusterTypeNotSupported", fmt.Sprintf("Infrastructure Cluster Type %s is not supported", cluster.Spec.InfrastructureRef.Kind)) + return ctrl.Result{}, errors.New(fmt.Sprintf("Infrastructure Cluster Type %s is not supported", cluster.Spec.InfrastructureRef.Kind)) } _, _, clients, err := cloudutil.InitClientsAndRegion(ctx, r.Client, r.Region, clusterAccessor, r.ClientProvider) diff --git a/exp/controllers/ocimanaged_machinepool_controller.go b/exp/controllers/ocimanaged_machinepool_controller.go index e8a1fe41..a9108ad0 100644 --- a/exp/controllers/ocimanaged_machinepool_controller.go +++ b/exp/controllers/ocimanaged_machinepool_controller.go @@ -117,7 +117,7 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, - Name: cluster.Name, + Name: cluster.Spec.InfrastructureRef.Name, } if err := r.Client.Get(ctx, ociClusterName, ociManagedCluster); err != nil { diff --git a/exp/controllers/ocivirtual_machinepool_controller.go b/exp/controllers/ocivirtual_machinepool_controller.go index 16089f4a..cf0c61a2 100644 --- a/exp/controllers/ocivirtual_machinepool_controller.go +++ b/exp/controllers/ocivirtual_machinepool_controller.go @@ -116,7 +116,7 @@ func (r *OCIVirtualMachinePoolReconciler) Reconcile(ctx context.Context, req ctr ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, - Name: cluster.Name, + Name: cluster.Spec.InfrastructureRef.Name, } if err := r.Client.Get(ctx, ociClusterName, ociManagedCluster); err != nil { diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml index 50f9c4ca..77d91855 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml @@ -9,7 +9,7 @@ spec: infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIManagedCluster - name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}"-virtual namespace: "${NAMESPACE}" controlPlaneRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -22,7 +22,7 @@ kind: OCIManagedCluster metadata: labels: cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" - name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}"-virtual spec: compartmentId: "${OCI_COMPARTMENT_ID}" identityRef: diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml index c5370726..aef9d5dd 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml @@ -9,7 +9,7 @@ spec: infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIManagedCluster - name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}"-managed namespace: "${NAMESPACE}" controlPlaneRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -22,7 +22,7 @@ kind: OCIManagedCluster metadata: labels: cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" - name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}"-managed spec: compartmentId: "${OCI_COMPARTMENT_ID}" --- From e274d309f643b9421d154f73f76625646d9d9944 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 11:56:33 +0530 Subject: [PATCH 02/10] Fix machinepool infrastructure cluster lookup --- exp/controllers/ocimanaged_machinepool_controller_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/exp/controllers/ocimanaged_machinepool_controller_test.go b/exp/controllers/ocimanaged_machinepool_controller_test.go index ad78672e..85de3534 100644 --- a/exp/controllers/ocimanaged_machinepool_controller_test.go +++ b/exp/controllers/ocimanaged_machinepool_controller_test.go @@ -802,6 +802,7 @@ func getMachinePool() *expclusterv1.MachinePool { func getCluster() *clusterv1.Cluster { infraRef := corev1.ObjectReference{ Name: "oci-cluster", + Kind: "OCICluster", } return &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ From aa99272f282f6cedc1821d1a5faff7f1830d1085 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 12:12:25 +0530 Subject: [PATCH 03/10] Fix machinepool infrastructure cluster lookup --- .../v1beta2/cluster-template-managed-virtual/cluster.yaml | 4 ++-- .../v1beta2/cluster-template-managed/cluster.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml index 77d91855..5dd8d864 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-virtual/cluster.yaml @@ -9,7 +9,7 @@ spec: infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIManagedCluster - name: "${CLUSTER_NAME}"-virtual + name: "${CLUSTER_NAME}-virtual" namespace: "${NAMESPACE}" controlPlaneRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -22,7 +22,7 @@ kind: OCIManagedCluster metadata: labels: cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" - name: "${CLUSTER_NAME}"-virtual + name: "${CLUSTER_NAME}-virtual" spec: compartmentId: "${OCI_COMPARTMENT_ID}" identityRef: diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml index aef9d5dd..f38dcbb4 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed/cluster.yaml @@ -9,7 +9,7 @@ spec: infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIManagedCluster - name: "${CLUSTER_NAME}"-managed + name: "${CLUSTER_NAME}-managed" namespace: "${NAMESPACE}" controlPlaneRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -22,7 +22,7 @@ kind: OCIManagedCluster metadata: labels: cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" - name: "${CLUSTER_NAME}"-managed + name: "${CLUSTER_NAME}-managed" spec: compartmentId: "${OCI_COMPARTMENT_ID}" --- From 8460bbd0c061343f6210abaa6fae89e336b3d7ca Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 14:14:14 +0530 Subject: [PATCH 04/10] Fix machinepool infrastructure cluster lookup --- controllers/ocimachine_controller.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index 87e4d776..e0388e4b 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -112,7 +112,16 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) } var clusterAccessor scope.OCIClusterAccessor - if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { + if cluster.Spec.InfrastructureRef.Kind == "OCICluster" { + if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { + logger.Info("Cluster is not available yet") + r.Recorder.Eventf(ociMachine, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") + return ctrl.Result{}, nil + } + clusterAccessor = scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + } + } else if cluster.Spec.InfrastructureRef.Kind == "OCIManagedCluster" { // check for oci managed cluster ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociManagedClusterName := client.ObjectKey{ @@ -120,17 +129,14 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) Name: cluster.Spec.InfrastructureRef.Name, } if err := r.Client.Get(ctx, ociManagedClusterName, ociManagedCluster); err != nil { - logger.Info("Cluster is not available yet") - r.Recorder.Eventf(ociMachine, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") - return ctrl.Result{}, nil + } clusterAccessor = scope.OCIManagedCluster{ OCIManagedCluster: ociManagedCluster, } } else { - clusterAccessor = scope.OCISelfManagedCluster{ - OCICluster: ociCluster, - } + r.Recorder.Eventf(ociMachine, corev1.EventTypeWarning, "InfrastructureClusterTypeNotSupported", fmt.Sprintf("Infrastructure Cluster Type %s is not supported", cluster.Spec.InfrastructureRef.Kind)) + return ctrl.Result{}, errors.New(fmt.Sprintf("Infrastructure Cluster Type %s is not supported", cluster.Spec.InfrastructureRef.Kind)) } _, _, clients, err := cloudutil.InitClientsAndRegion(ctx, r.Client, r.Region, clusterAccessor, r.ClientProvider) From e4969f34fe9028f6342047434d5d519ea9f2008b Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 14:17:25 +0530 Subject: [PATCH 05/10] Fix machinepool infrastructure cluster lookup --- controllers/ocimachine_controller_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/ocimachine_controller_test.go b/controllers/ocimachine_controller_test.go index 988b839d..e3eb343b 100644 --- a/controllers/ocimachine_controller_test.go +++ b/controllers/ocimachine_controller_test.go @@ -954,6 +954,7 @@ func getOciMachineWithNoOwner() *infrastructurev1beta2.OCIMachine { func getCluster() *clusterv1.Cluster { infraRef := corev1.ObjectReference{ Name: "oci-cluster", + Kind: "OCICluster", } return &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ From 32a1a9d009cd1fd6e01b5e0ed794d1d50a92d582 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 14:47:06 +0530 Subject: [PATCH 06/10] Fix machinepool infrastructure cluster lookup --- controllers/ocimachine_controller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index e0388e4b..678418b1 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -200,6 +200,7 @@ func (r *OCIMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc), builder.WithPredicates( predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)), + predicates.ClusterControlPlaneInitialized(ctrl.LoggerFrom(ctx)), ), ). // don't queue reconcile if resource is paused From 2de68e8ca48d711a84a59cd540bbc6f8ac54b647 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 17:24:32 +0530 Subject: [PATCH 07/10] Fix machinepool infrastructure cluster lookup --- controllers/ocimachine_controller.go | 43 +++++++++++++++++++- exp/controllers/ocimachinepool_controller.go | 11 +++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index 678418b1..bbd8e9ad 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -195,12 +195,15 @@ func (r *OCIMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma &infrastructurev1beta2.OCICluster{}, handler.EnqueueRequestsFromMapFunc(r.OCIClusterToOCIMachines()), ). + Watches( + &infrastructurev1beta2.OCIManagedCluster{}, + handler.EnqueueRequestsFromMapFunc(r.OCIManagedClusterToOCIMachines()), + ). Watches( &clusterv1.Cluster{}, handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc), builder.WithPredicates( predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)), - predicates.ClusterControlPlaneInitialized(ctrl.LoggerFrom(ctx)), ), ). // don't queue reconcile if resource is paused @@ -249,6 +252,44 @@ func (r *OCIMachineReconciler) OCIClusterToOCIMachines() handler.MapFunc { } } +func (r *OCIMachineReconciler) OCIManagedClusterToOCIMachines() handler.MapFunc { + return func(ctx context.Context, o client.Object) []ctrl.Request { + log := ctrl.LoggerFrom(ctx) + result := []ctrl.Request{} + + c, ok := o.(*infrastructurev1beta2.OCIManagedCluster) + if !ok { + log.Error(errors.Errorf("expected a OCICluster but got a %T", o), "failed to get OCIMachine for OCICluster") + return nil + } + + cluster, err := util.GetOwnerCluster(ctx, r.Client, c.ObjectMeta) + switch { + case apierrors.IsNotFound(err) || cluster == nil: + return result + case err != nil: + log.Error(err, "failed to get owning cluster") + return result + } + + labels := map[string]string{clusterv1.ClusterNameLabel: cluster.Name} + machineList := &clusterv1.MachineList{} + if err := r.List(ctx, machineList, client.InNamespace(c.Namespace), client.MatchingLabels(labels)); err != nil { + log.Error(err, "failed to list Machines") + return nil + } + for _, m := range machineList.Items { + if m.Spec.InfrastructureRef.Name == "" { + continue + } + name := client.ObjectKey{Namespace: m.Namespace, Name: m.Spec.InfrastructureRef.Name} + result = append(result, ctrl.Request{NamespacedName: name}) + } + + return result + } +} + func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr.Logger, machineScope *scope.MachineScope) (ctrl.Result, error) { controllerutil.AddFinalizer(machineScope.OCIMachine, infrastructurev1beta2.MachineFinalizer) machine := machineScope.OCIMachine diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 227e5411..d00167c9 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" "fmt" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "time" "github.com/go-logr/logr" @@ -191,6 +192,12 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr if err != nil { return errors.Wrapf(err, "failed to create mapper for Cluster to OCIMachinePool") } + gvk, err := apiutil.GVKForObject(new(infrav2exp.OCIMachinePoolList), mgr.GetScheme()) + if err != nil { + return errors.Wrapf(err, "failed to find GVK for OCIMachinePool") + } + managedClusterToMachinePoolMap := managedClusterToManagedMachinePoolMapFunc(r.Client, gvk, logger) + err = ctrl.NewControllerManagedBy(mgr). WithOptions(options). For(&infrav2exp.OCIMachinePool{}). @@ -200,6 +207,10 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrav2exp. GroupVersion.WithKind(scope.OCIMachinePoolKind), logger)), ). + Watches( + &infrastructurev1beta2.OCIManagedCluster{}, + handler.EnqueueRequestsFromMapFunc(managedClusterToMachinePoolMap), + ). Watches( &clusterv1.Cluster{}, handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc), From 26bf57e9ce0eae0706b87ac0915e15ed63d3ac93 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 18:58:33 +0530 Subject: [PATCH 08/10] Fix machinepool infrastructure cluster lookup --- exp/controllers/ocimachinepool_controller.go | 2 +- exp/controllers/ocimanaged_machinepool_controller.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index d00167c9..72be4316 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -201,7 +201,6 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr err = ctrl.NewControllerManagedBy(mgr). WithOptions(options). For(&infrav2exp.OCIMachinePool{}). - WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). Watches( &expclusterv1.MachinePool{}, handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrav2exp. @@ -218,6 +217,7 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)), ), ). + WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). Complete(r) if err != nil { diff --git a/exp/controllers/ocimanaged_machinepool_controller.go b/exp/controllers/ocimanaged_machinepool_controller.go index a9108ad0..09fbcfb1 100644 --- a/exp/controllers/ocimanaged_machinepool_controller.go +++ b/exp/controllers/ocimanaged_machinepool_controller.go @@ -216,7 +216,7 @@ func managedClusterToManagedMachinePoolMapFunc(c client.Client, gvk schema.Group return func(ctx context.Context, o client.Object) []reconcile.Request { ociCluster, ok := o.(*infrastructurev1beta2.OCIManagedCluster) if !ok { - panic(fmt.Sprintf("Expected a OCIManagedControlPlane but got a %T", o)) + panic(fmt.Sprintf("Expected a OCIManagedCluster but got a %T", o)) } if !ociCluster.ObjectMeta.DeletionTimestamp.IsZero() { @@ -225,7 +225,7 @@ func managedClusterToManagedMachinePoolMapFunc(c client.Client, gvk schema.Group cluster, err := util.GetOwnerCluster(ctx, c, ociCluster.ObjectMeta) if err != nil { - log.Error(err, "couldn't get OCI control plane owner ObjectKey") + log.Error(err, "couldn't get OCIManagedCluster owner ObjectKey") return nil } if cluster == nil { From 4156671bad40ee7b138e931cacf92233e21b8c98 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 19:11:18 +0530 Subject: [PATCH 09/10] Fix machinepool infrastructure cluster lookup --- exp/controllers/ocimachinepool_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 72be4316..bf7b82ee 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -192,7 +192,7 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr if err != nil { return errors.Wrapf(err, "failed to create mapper for Cluster to OCIMachinePool") } - gvk, err := apiutil.GVKForObject(new(infrav2exp.OCIMachinePoolList), mgr.GetScheme()) + gvk, err := apiutil.GVKForObject(new(infrav2exp.OCIMachinePool), mgr.GetScheme()) if err != nil { return errors.Wrapf(err, "failed to find GVK for OCIMachinePool") } From 340fa9d026745601c91a274959c12f0e26e49dcb Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Wed, 23 Aug 2023 20:00:21 +0530 Subject: [PATCH 10/10] Fix machinepool infrastructure cluster lookup --- exp/controllers/ocimachinepool_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index bf7b82ee..5848b5af 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -19,7 +19,6 @@ package controllers import ( "context" "fmt" - "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "time" "github.com/go-logr/logr" @@ -48,6 +47,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler"