Skip to content

Commit 8fc17df

Browse files
committed
fix(rhel): azure not supporting gen2 with Rhel images
This commit set the right offering for rhel machines to use gen2 Signed-off-by: Adrian Riobo <ariobolo@redhat.com>
1 parent b5d31c3 commit 8fc17df

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

cmd/mapt/cmd/azure/hosts/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ const (
99
paramLinuxVersion = "version"
1010
paramLinuxVersionDesc = "linux version. Version should be formated as X.Y (Major.minor)"
1111
defaultUbuntuVersion = "24.04"
12-
defaultRHELVersion = "9.4"
12+
defaultRHELVersion = "9.7"
1313
defaultFedoraVersion = "42"
1414
)

pkg/provider/azure/action/rhel/rhel.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package rhel
22

33
import (
4+
"fmt"
5+
"strings"
6+
47
maptContext "github.com/redhat-developer/mapt/pkg/manager/context"
58
cr "github.com/redhat-developer/mapt/pkg/provider/api/compute-request"
69
spotTypes "github.com/redhat-developer/mapt/pkg/provider/api/spot"
@@ -24,6 +27,23 @@ type RhelArgs struct {
2427
Spot *spotTypes.SpotArgs
2528
}
2629

30+
func imageRef(version, arch string) *data.ImageReference {
31+
if arch == "arm64" {
32+
return &data.ImageReference{
33+
Publisher: "rhel-arm64",
34+
Offer: "RHEL",
35+
Sku: fmt.Sprintf(
36+
"%s-arm64",
37+
strings.ReplaceAll(version, ".", "_"))}
38+
}
39+
return &data.ImageReference{
40+
Publisher: "RedHat",
41+
Offer: "RHEL",
42+
Sku: fmt.Sprintf(
43+
"%s-gen2",
44+
strings.ReplaceAll(version, ".", ""))}
45+
}
46+
2747
func Create(mCtxArgs *maptContext.ContextArgs, r *RhelArgs) (err error) {
2848
logging.Debug("Creating RHEL Server")
2949
rhelCloudConfig := &rhelApi.CloudConfigArgs{
@@ -37,6 +57,7 @@ func Create(mCtxArgs *maptContext.ContextArgs, r *RhelArgs) (err error) {
3757
Location: r.Location,
3858
ComputeRequest: r.ComputeRequest,
3959
Spot: r.Spot,
60+
ImageRef: imageRef(r.Version, r.Arch),
4061
Version: r.Version,
4162
Arch: r.Arch,
4263
OSType: data.RHEL,

0 commit comments

Comments
 (0)