Skip to content

Commit

Permalink
Translate aarch64 -> arm64 for rhcos/infra validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdyoung committed Sep 28, 2022
1 parent a40422b commit e448af5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 6 additions & 2 deletions internal/bminventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ func (b *bareMetalInventory) getNewClusterCPUArchitecture(newClusterParams *mode
// TODO: remove once release images list is exclusively used.
return common.DefaultCPUArchitecture, nil
}

if newClusterParams.CPUArchitecture == "arm64" {
return common.ARM64CPUArchitecture, nil
}
if !swag.BoolValue(newClusterParams.UserManagedNetworking) && !featuresupport.IsFeatureSupported(swag.StringValue(newClusterParams.OpenshiftVersion),
models.FeatureSupportLevelFeaturesItems0FeatureIDARM64ARCHITECTUREWITHCLUSTERMANAGEDNETWORKING) {

Expand Down Expand Up @@ -3955,7 +3957,9 @@ func validateArchitectureAndVersion(v versions.Handler, c *common.Cluster, cpuAr
ocpVersion = c.OpenshiftVersion
}
if c.CPUArchitecture != common.MultiCPUArchitecture {
if c.CPUArchitecture != "" && c.CPUArchitecture != cpuArch {
if c.CPUArchitecture == "aarch64" && cpuArch == "arm64" {
return nil
} else if c.CPUArchitecture != "" && c.CPUArchitecture != cpuArch {
return errors.Errorf("Specified CPU architecture (%s) doesn't match the cluster (%s)", cpuArch, c.CPUArchitecture)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (

X86CPUArchitecture = "x86_64"
DefaultCPUArchitecture = X86CPUArchitecture
ARM64CPUArchitecture = "arm64"
ARM64CPUArchitecture = "aarch64"
PowerCPUArchitecture = "ppc64le"
MultiCPUArchitecture = "multi"
)
Expand Down
3 changes: 2 additions & 1 deletion internal/oc/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ func (r *release) GetReleaseArchitecture(log logrus.FieldLogger, releaseImage st
switch architecture {
case "amd64":
architecture = common.DefaultCPUArchitecture
case "arm64":
architecture = common.ARM64CPUArchitecture
}

return []string{architecture}, nil
}

Expand Down
7 changes: 7 additions & 0 deletions internal/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ func (h *handler) V2ListSupportedOpenshiftVersions(ctx context.Context, params o
arch = common.DefaultCPUArchitecture
}

if arch == "arm64" {
arch = "aarch64"
}
// In order to mark a specific version and architecture as supported we do not
// only need to have an available release image, but we need RHCOS image as well.
if _, err := h.GetOsImage(key, arch); err != nil {
Expand Down Expand Up @@ -228,6 +231,10 @@ func (h *handler) GetOsImage(openshiftVersion, cpuArchitecture string) (*models.
// Empty implies default CPU architecture
cpuArchitecture = common.DefaultCPUArchitecture
}
// RHCOS uses aarch64 for arm64
if cpuArchitecture == "arm64" {
cpuArchitecture = "aarch64"
}
// Filter OS images by specified CPU architecture
osImages := funk.Filter(h.osImages, func(osImage *models.OsImage) bool {
if swag.StringValue(osImage.CPUArchitecture) == "" {
Expand Down

0 comments on commit e448af5

Please sign in to comment.