Skip to content
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
4 changes: 2 additions & 2 deletions cmd/mapt/cmd/azure/hosts/rhelai.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func getRHELAICreate() *cobra.Command {
Prefix: "main",
Version: viper.GetString(params.RhelAIVersion),
Accelerator: viper.GetString(params.RhelAIAccelerator),
CustomAMI: viper.GetString(params.RhelAIAMICustom),
CustomImage: viper.GetString(params.RhelAIImageCustom),
ComputeRequest: params.ComputeRequestArgs(),
Spot: params.SpotArgs(),
Timeout: viper.GetString(params.Timeout),
Expand All @@ -69,7 +69,7 @@ func getRHELAICreate() *cobra.Command {
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
flagSet.StringP(params.RhelAIVersion, "", params.RhelAIVersionDefault, params.RhelAIVersionDesc)
flagSet.StringP(params.RhelAIAccelerator, "", params.RhelAIAccelearatorDefault, params.RhelAIAccelearatorDesc)
flagSet.StringP(params.RhelAIAMICustom, "", "", params.RhelAIAMICustomDesc)
flagSet.StringP(params.RhelAIImageCustom, "", "", params.RhelAIImageCustomDesc)
flagSet.StringP(params.Timeout, "", "", params.TimeoutDesc)
params.AddComputeRequestFlags(flagSet)
params.AddSpotFlags(flagSet)
Expand Down
2 changes: 2 additions & 0 deletions cmd/mapt/cmd/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const (
RhelAIAccelearatorDefault string = "cuda"
RhelAIAMICustom string = "custom-ami"
RhelAIAMICustomDesc string = "custom AMI to spin RHEL AI OS"
RhelAIImageCustom string = "custom-image"
RhelAIImageCustomDesc string = "custom image ID to spin RHEL AI OS"

// Serverless
Timeout string = "timeout"
Expand Down
17 changes: 12 additions & 5 deletions pkg/provider/azure/action/rhel-ai/rhelai.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,32 @@ const (
username = "azureuser"
)

func imageId(accelerator, version string) string {
iName := fmt.Sprintf(imageNameRegex, accelerator, version)
gName := strings.ReplaceAll(iName, "-", "_")
func imageIdFromName(imageName string) string {
gName := strings.ReplaceAll(imageName, "-", "_")
return fmt.Sprintf(imageIdRegex,
imageOwnerSubscriptionId,
gName,
iName)
imageName)
}

func imageId(accelerator, version string) string {
return imageIdFromName(fmt.Sprintf(imageNameRegex, accelerator, version))
}

func Create(mCtxArgs *maptContext.ContextArgs, args *apiRHELAI.RHELAIArgs) (err error) {
logging.Debug("Creating RHEL Server")
sharedImageID := imageId(args.Accelerator, args.Version)
if args.CustomImage != "" {
sharedImageID = imageIdFromName(args.CustomImage)
}
azureLinuxRequest :=
&azureLinux.LinuxArgs{
Prefix: args.Prefix,
// Location: args.Location,
ComputeRequest: args.ComputeRequest,
Spot: args.Spot,
ImageRef: &data.ImageReference{
SharedImageID: imageId(args.Accelerator, args.Version),
SharedImageID: sharedImageID,
},
Username: username,
ReadinessCommand: command.CommandPing}
Expand Down
1 change: 1 addition & 0 deletions pkg/target/host/rhelai/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type RHELAIArgs struct {
Accelerator string
Version string
CustomAMI string
CustomImage string
Arch string
ComputeRequest *cr.ComputeRequestArgs
Spot *spotTypes.SpotArgs
Expand Down