diff --git a/hypershift-operator/controllers/nodepool/capi.go b/hypershift-operator/controllers/nodepool/capi.go index 17f894b532..0f0dd32d1d 100644 --- a/hypershift-operator/controllers/nodepool/capi.go +++ b/hypershift-operator/controllers/nodepool/capi.go @@ -1325,5 +1325,5 @@ func (r *NodePoolReconciler) getMachinesForNodePool(ctx context.Context, nodePoo } func (c *CAPI) reconcileORCResources(ctx context.Context) error { - return openstack.ReconcileOpenStackImageCR(ctx, c.Client, c.CreateOrUpdate, c.hostedCluster, c.releaseImage) + return openstack.ReconcileOpenStackImageCR(ctx, c.Client, c.CreateOrUpdate, c.hostedCluster, c.releaseImage, c.controlplaneNamespace) } diff --git a/hypershift-operator/controllers/nodepool/openstack/openstack.go b/hypershift-operator/controllers/nodepool/openstack/openstack.go index ec96696e7e..49cb8704dc 100644 --- a/hypershift-operator/controllers/nodepool/openstack/openstack.go +++ b/hypershift-operator/controllers/nodepool/openstack/openstack.go @@ -81,7 +81,7 @@ func MachineTemplateSpec(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.Node return openStackMachineTemplate, nil } -func ReconcileOpenStackImageCR(ctx context.Context, client client.Client, createOrUpdate upsert.CreateOrUpdateFN, hcluster *hyperv1.HostedCluster, release *releaseinfo.ReleaseImage) error { +func ReconcileOpenStackImageCR(ctx context.Context, client client.Client, createOrUpdate upsert.CreateOrUpdateFN, hcluster *hyperv1.HostedCluster, release *releaseinfo.ReleaseImage, controlPlaneNamespace string) error { releaseVersion, err := releaseinfo.OpenStackReleaseImage(release) if err != nil { return err @@ -89,7 +89,7 @@ func ReconcileOpenStackImageCR(ctx context.Context, client client.Client, create openStackImage := orc.Image{ ObjectMeta: metav1.ObjectMeta{ Name: "rhcos-" + releaseVersion + "-" + hcluster.Name, - Namespace: hcluster.Namespace, + Namespace: controlPlaneNamespace, // TODO: add proper cleanup in CAPI resources cleanup OwnerReferences: []metav1.OwnerReference{ {