Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM-17553: Save version of imported clusters - ACM 2.12 #7250

Open
wants to merge 1 commit into
base: release-ocm-2.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/bminventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ func (b *bareMetalInventory) V2ImportClusterInternal(ctx context.Context, kubeKe
Kind: swag.String(models.ClusterKindAddHostsCluster),
Name: clusterName,
OpenshiftClusterID: common.StrFmtUUIDVal(params.NewImportClusterParams.OpenshiftClusterID),
OpenshiftVersion: params.NewImportClusterParams.OpenshiftVersion,
UserName: ocm.UserNameFromContext(ctx),
OrgID: ocm.OrgIDFromContext(ctx),
EmailDomain: ocm.EmailDomainFromContext(ctx),
Expand Down
4 changes: 2 additions & 2 deletions internal/bminventory/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12670,7 +12670,7 @@ var _ = Describe("Register AddHostsCluster test", func() {

Expect(actual.Payload.HostNetworks).To(Equal(defaultHostNetworks))
Expect(actual.Payload.Hosts).To(Equal(defaultHosts))
Expect(actual.Payload.OpenshiftVersion).To(BeEmpty())
Expect(actual.Payload.OpenshiftVersion).To(Equal(common.TestDefaultConfig.OpenShiftVersion))
Expect(actual.Payload.OcpReleaseImage).To(BeEmpty())
Expect(actual.Payload.OpenshiftClusterID).To(Equal(openshiftClusterID))
Expect(res).Should(BeAssignableToTypeOf(installer.NewV2ImportClusterCreated()))
Expand All @@ -12697,7 +12697,7 @@ var _ = Describe("Register AddHostsCluster test", func() {

Expect(actual.Payload.HostNetworks).To(Equal(defaultHostNetworks))
Expect(actual.Payload.Hosts).To(Equal(defaultHosts))
Expect(actual.Payload.OpenshiftVersion).To(BeEmpty())
Expect(actual.Payload.OpenshiftVersion).To(Equal(common.TestDefaultConfig.OpenShiftVersion))
Expect(actual.Payload.OcpReleaseImage).To(BeEmpty())
Expect(actual.Payload.OpenshiftClusterID).To(Equal(openshiftClusterID))
Expect(res).Should(BeAssignableToTypeOf(installer.NewV2ImportClusterCreated()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (r *ClusterDeploymentsReconciler) Reconcile(origCtx context.Context, req ct
return r.createNewCluster(ctx, log, req.NamespacedName, pullSecret, releaseImage, clusterDeployment, clusterInstall)
}

return r.createNewDay2Cluster(ctx, log, req.NamespacedName, clusterDeployment, clusterInstall)
return r.createNewDay2Cluster(ctx, log, req.NamespacedName, releaseImage, clusterDeployment, clusterInstall)
}
if err != nil {
return r.updateStatus(ctx, log, clusterInstall, clusterDeployment, cluster, err)
Expand Down Expand Up @@ -1410,6 +1410,7 @@ func (r *ClusterDeploymentsReconciler) createNewDay2Cluster(
ctx context.Context,
log logrus.FieldLogger,
key types.NamespacedName,
releaseImage *models.ReleaseImage,
clusterDeployment *hivev1.ClusterDeployment,
clusterInstall *hiveext.AgentClusterInstall) (ctrl.Result, error) {

Expand All @@ -1422,6 +1423,9 @@ func (r *ClusterDeploymentsReconciler) createNewDay2Cluster(
APIVipDnsname: swag.String(apiVipDnsname),
Name: swag.String(spec.ClusterName),
}
if releaseImage != nil && releaseImage.OpenshiftVersion != nil {
clusterParams.OpenshiftVersion = *releaseImage.OpenshiftVersion
}

// add optional parameter
if clusterInstall.Spec.ClusterMetadata != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3387,6 +3387,7 @@ var _ = Describe("cluster reconcile", func() {
V2ImportClusterInternal := func(ctx context.Context, kubeKey *types.NamespacedName, id *strfmt.UUID,
params installer.V2ImportClusterParams) (*common.Cluster, error) {
Expect(string(*params.NewImportClusterParams.OpenshiftClusterID)).To(Equal(cid))
Expect(params.NewImportClusterParams.OpenshiftVersion).To(Equal(ocpVersion))
return clusterReply, nil
}
mockInstallerInternal.EXPECT().
Expand Down