diff --git a/hypershift-operator/controllers/nodepool/capi.go b/hypershift-operator/controllers/nodepool/capi.go index 2448a9bec4..17f894b532 100644 --- a/hypershift-operator/controllers/nodepool/capi.go +++ b/hypershift-operator/controllers/nodepool/capi.go @@ -849,7 +849,7 @@ func (c *CAPI) machineTemplateBuilders() (client.Object, func(object client.Obje case hyperv1.OpenStackPlatform: template = &capiopenstackv1beta1.OpenStackMachineTemplate{} var err error - machineTemplateSpec, err = openstack.MachineTemplateSpec(hcluster, nodePool) + machineTemplateSpec, err = openstack.MachineTemplateSpec(hcluster, nodePool, c.releaseImage) if err != nil { SetStatusCondition(&nodePool.Status.Conditions, hyperv1.NodePoolCondition{ Type: hyperv1.NodePoolValidMachineTemplateConditionType, diff --git a/hypershift-operator/controllers/nodepool/openstack/openstack.go b/hypershift-operator/controllers/nodepool/openstack/openstack.go index 470fcb4c77..a80bd457eb 100644 --- a/hypershift-operator/controllers/nodepool/openstack/openstack.go +++ b/hypershift-operator/controllers/nodepool/openstack/openstack.go @@ -17,7 +17,7 @@ import ( capiopenstackv1beta1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1" ) -func MachineTemplateSpec(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.NodePool) (*capiopenstackv1beta1.OpenStackMachineTemplateSpec, error) { +func MachineTemplateSpec(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.NodePool, releaseImage *releaseinfo.ReleaseImage) (*capiopenstackv1beta1.OpenStackMachineTemplateSpec, error) { openStackMachineTemplate := &capiopenstackv1beta1.OpenStackMachineTemplateSpec{Template: capiopenstackv1beta1.OpenStackMachineTemplateResource{Spec: capiopenstackv1beta1.OpenStackMachineSpec{ Flavor: ptr.To(nodePool.Spec.Platform.OpenStack.Flavor), }}} @@ -28,7 +28,7 @@ func MachineTemplateSpec(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.Node } } else { openStackMachineTemplate.Template.Spec.Image.ImageRef = &capiopenstackv1beta1.ResourceReference{ - Name: "rhcos-" + hcluster.Name, + Name: "rhcos-" + releaseImage.Version() + hcluster.Name, } } @@ -80,7 +80,7 @@ func MachineTemplateSpec(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.Node func ReconcileOpenStackImageCR(ctx context.Context, client client.Client, createOrUpdate upsert.CreateOrUpdateFN, hcluster *hyperv1.HostedCluster, release *releaseinfo.ReleaseImage) error { openStackImage := orc.Image{ ObjectMeta: metav1.ObjectMeta{ - Name: "rhcos-" + hcluster.Name, + Name: "rhcos-" + release.Version() + hcluster.Name, Namespace: hcluster.Namespace, // TODO: add proper cleanup in CAPI resources cleanup OwnerReferences: []metav1.OwnerReference{ @@ -119,7 +119,7 @@ func reconcileOpenStackImageSpec(hcluster *hyperv1.HostedCluster, openStackImage } openStackImageSpec.Resource = &orc.ImageResourceSpec{ - Name: "rhcos-" + hcluster.Name, + Name: "rhcos-" + release.Version() + hcluster.Name, Content: &orc.ImageContent{ DiskFormat: "qcow2", Download: &orc.ImageContentSourceDownload{