Skip to content

Commit

Permalink
Merge pull request openshift#1849 from davidleerh/OCM-6687
Browse files Browse the repository at this point in the history
OCM-6687 | fix: 4.14 nightly version not compatible with ROSA HCP
  • Loading branch information
openshift-merge-bot[bot] authored Mar 15, 2024
2 parents 307e360 + e759ca6 commit 4ff9a2d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
28 changes: 17 additions & 11 deletions pkg/helper/versions/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,32 @@ func GetFilteredVersionList(versionList []string, minVersion string, maxVersion

// Used for hosted machinepool minimal version
func GetMinimalHostedMachinePoolVersion(controlPlaneVersion string) (string, error) {
cpVersion, errcp := ver.NewVersion(controlPlaneVersion)
if errcp != nil {
return "", errcp
cpVersion, err := ver.NewVersion(controlPlaneVersion)
if err != nil {
return "", err
}
segments := cpVersion.Segments()
// Hosted machinepools can be created with a minimal of two minor versions from the control plane
minor := segments[1] - MinorVersionsSupported
version := fmt.Sprintf("%d.%d.%d", segments[0], minor, 0)
minimalVersion, errminver := ver.NewVersion(version)
if errminver != nil {
return "", errminver

minimalVersion, err := v1.NewVersion().ID(version).RawID(version).HostedControlPlaneEnabled(true).Build()
if err != nil {
return "", err
}

lowestHostedCPSupport, errlow := ver.NewVersion(ocm.LowestHostedCpSupport)
if errlow != nil {
return "", errlow
minimalVersionSupported, err := ocm.HasHostedCPSupport(minimalVersion)
if err != nil {
return "", err
}

if minimalVersion.LessThanOrEqual(lowestHostedCPSupport) {
return ocm.LowestHostedCpSupport, nil
if !minimalVersionSupported {
lowestVersionPermittedForHCP, err := ver.NewVersion(ocm.LowestHostedCpSupport)
if err != nil {
return "", err
}
segments := lowestVersionPermittedForHCP.Segments()
version = fmt.Sprintf("%d.%d.%d", segments[0], segments[1], segments[2])
}

return version, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
LowestHttpTokensRequiredSupport = "4.11.0"
LowestSTSMinor = "4.7"

LowestHostedCpSupport = "4.14.0"
LowestHostedCpSupport = "4.14.0-0.a"
MinVersionForManagedIngressV2 = "4.14.0-0.a"
MinVersionForMachinePoolRootDisk = "4.10.0-0.a"
VersionPrefix = "openshift-v"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ var _ = Describe("Versions", Ordered, func() {
func() string { return "4.11.0-0.nightly-2022-10-17-040259-nightly" },
func() string { return NightlyChannelGroup }, false, false, nil),
Entry("OK: Nightly channel group and good version",
func() string { return "4.14.1-0.nightly-2022-11-25-185455-nightly" },
func() string { return "4.14.0-0.nightly-2024-03-13-015516" },
func() string { return NightlyChannelGroup }, true, true, nil),
Entry("OK: When a greater version than the minimum is provided",
func() string { return "4.15.0" },
Expand Down

0 comments on commit 4ff9a2d

Please sign in to comment.