Skip to content

feat(aws): add marketplace RHEL AI image support#863

Open
ppitonak wants to merge 1 commit into
mainfrom
aws_marketplace
Open

feat(aws): add marketplace RHEL AI image support#863
ppitonak wants to merge 1 commit into
mainfrom
aws_marketplace

Conversation

@ppitonak

Copy link
Copy Markdown
Collaborator

Enable provisioning RHEL AI instances from AWS Marketplace AMIs using the --marketplace flag, matching the existing Azure marketplace support.

Uses EC2 product-code filter (prod-usfzkgvxvt65w) to discover marketplace AMIs without requiring additional SDK dependencies. Handles marketplace- specific spot pricing product description and subscription error messages.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6495a4bf-fb26-4bd4-a778-cc65fdf38b24

📥 Commits

Reviewing files that changed from the base of the PR and between d8ec785 and a6b56ec.

📒 Files selected for processing (9)
  • cmd/mapt/cmd/aws/hosts/rhelai.go
  • pkg/provider/aws/action/rhel-ai/constants.go
  • pkg/provider/aws/action/rhel-ai/rhelai.go
  • pkg/provider/aws/data/ami.go
  • pkg/provider/aws/data/spot.go
  • pkg/provider/aws/modules/allocation/allocation.go
  • pkg/provider/aws/modules/spot/stack.go
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-rhel-ai.yaml
🚧 Files skipped from review as they are similar to previous changes (8)
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-rhel-ai.yaml
  • pkg/provider/aws/data/ami.go
  • pkg/provider/aws/modules/allocation/allocation.go
  • cmd/mapt/cmd/aws/hosts/rhelai.go
  • pkg/provider/aws/data/spot.go
  • pkg/provider/aws/modules/spot/stack.go
  • pkg/provider/aws/action/rhel-ai/rhelai.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added optional AWS Marketplace support for RHEL AI deployments, including a marketplace task parameter and CLI marketplace flag.
    • Marketplace mode now affects both version listing and AMI/region selection, and automatically constrains compute sizes to supported options.
    • When enabled, Marketplace AMIs are treated as public and the flow handles required subscription opt-in messaging.
  • Bug Fixes
    • Improved AMI and region selection accuracy for Marketplace images (and added clearer failures when subscription access is needed).

Walkthrough

Changes

RHEL AI Marketplace provisioning

Layer / File(s) Summary
Public AMI selection contracts
pkg/provider/aws/data/ami.go, pkg/provider/aws/data/spot.go
AMI requests and Spot region filtering now support public AMI visibility and explicit ownership criteria.
Spot allocation AMI propagation
pkg/provider/aws/modules/allocation/allocation.go, pkg/provider/aws/modules/spot/stack.go
Allocation and Spot stack layers carry Marketplace AMI owner and visibility settings into region selection.
Marketplace RHEL AI action flow
pkg/provider/aws/action/rhel-ai/*
RHEL AI creation and version listing now validate Marketplace options, discover Marketplace AMIs, construct Marketplace names, and handle subscription requirements.
Marketplace command and task entrypoints
cmd/mapt/cmd/aws/hosts/rhelai.go, tkn/*/infra-aws-rhel-ai.yaml
CLI commands and Tekton tasks expose the Marketplace option and pass --marketplace during provisioning.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant RHELAICLI
  participant RHELAIAction
  participant AWSAMI
  participant SpotAllocation
  Operator->>RHELAICLI: select --marketplace
  RHELAICLI->>RHELAIAction: create Marketplace request
  RHELAIAction->>AWSAMI: query public Marketplace AMI
  RHELAIAction->>SpotAllocation: pass AMI owner and visibility
  SpotAllocation->>AWSAMI: filter regions by AMI offer
  AWSAMI-->>RHELAIAction: return AMI or subscription error
Loading

Suggested reviewers: adrianriobo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding AWS Marketplace support for RHEL AI images.
Description check ✅ Passed The description matches the changeset by describing AWS Marketplace AMI support and the marketplace flag.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
tkn/infra-aws-rhel-ai.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

tkn/template/infra-aws-rhel-ai.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ppitonak
ppitonak force-pushed the aws_marketplace branch 5 times, most recently from 31dedc6 to d8ec785 Compare July 22, 2026 09:39
@ppitonak
ppitonak marked this pull request as ready for review July 22, 2026 13:53
@ppitonak
ppitonak requested a review from adrianriobo July 22, 2026 13:53
@ppitonak

Copy link
Copy Markdown
Collaborator Author

Not tested because RHEL AI only allows 3 instance types and I couldn't get actual machine in any of 5 regions (tried bot h spot and on-demand).

  1. When --marketplace is specified with --compute-sizes, it checks that requested types are allowed
  2. When only --marketplace is specified, it uses types defined in RHEL AI marketplace listing
  3. When --marketplace is specified together with --version, it looks up specified version (e.g. 3.4)
  4. if no version is specified, it uses the most recent version

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/provider/aws/action/rhel-ai/rhelai.go (1)

176-256: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

listMarketplaceVersions returns raw AMI names instead of extracted version strings.

Unlike the non-marketplace ListVersions, which strips the accelerator prefix and arch/qualifier suffixes to yield a plain version (e.g., 3.4.0), listMarketplaceVersions dedups on and returns the full AMI name (seen[*img.Name]). The seen map is otherwise pointless since raw AMI names are already unique — this strongly suggests the version-extraction step was omitted. Any consumer feeding a listed value back into --version for --marketplace would produce a malformed AMI name pattern in marketplaceAMIName. Also note this branch (line 180-183) skips the cuda/rocm accelerator validation that the non-marketplace path performs.

Please extract the version substring (mirroring the prefix/suffix trimming used in ListVersions) before dedup/sort.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/provider/aws/action/rhel-ai/rhelai.go` around lines 176 - 256, Update
listMarketplaceVersions to validate the normalized accelerator as ListVersions
does, then extract each AMI’s plain version by removing the marketplace name
prefix and architecture/qualifier suffixes before inserting it into seen.
Deduplicate and sort the extracted versions, ensuring returned values can be
passed back to marketplaceAMIName as version arguments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/provider/aws/action/rhel-ai/rhelai.go`:
- Line 136: Update checkMarketplaceAMIExists to validate the exact resolved
amiName rather than deriving a wildcard with marketplaceAMIName(accelerator,
nil). Pass the version-pinned amiName computed by Create() at both call sites,
including the on-demand/non-spot path, while preserving the existing region and
architecture checks.
- Around line 119-130: Propagate the selected amiName to allocArgs.AMIName for
both marketplace and non-marketplace flows in the allocation setup. Keep the
marketplace-specific AMIOwner and AMIPublic assignments conditional, while
ensuring allocation.Allocation receives the AMI name so downstream spot region
filtering remains active.
- Line 29: Separate the RHEL AI version-presence signal from its value in the
CLI argument flow, and pass that explicit signal or an optional version into the
provider instead of comparing args.Version with RhelAIVersionDefault. Update the
relevant RHEL AI action symbols to distinguish an explicitly supplied version
such as 3.0.0 from an omitted version, preserve wildcard/latest fallback only
when absent, and remove the dependency on cmd/mapt/cmd/params.

---

Outside diff comments:
In `@pkg/provider/aws/action/rhel-ai/rhelai.go`:
- Around line 176-256: Update listMarketplaceVersions to validate the normalized
accelerator as ListVersions does, then extract each AMI’s plain version by
removing the marketplace name prefix and architecture/qualifier suffixes before
inserting it into seen. Deduplicate and sort the extracted versions, ensuring
returned values can be passed back to marketplaceAMIName as version arguments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 91807123-5fd4-432d-b88e-180ae0a9fc12

📥 Commits

Reviewing files that changed from the base of the PR and between f5ae0c0 and d8ec785.

📒 Files selected for processing (9)
  • cmd/mapt/cmd/aws/hosts/rhelai.go
  • pkg/provider/aws/action/rhel-ai/constants.go
  • pkg/provider/aws/action/rhel-ai/rhelai.go
  • pkg/provider/aws/data/ami.go
  • pkg/provider/aws/data/spot.go
  • pkg/provider/aws/modules/allocation/allocation.go
  • pkg/provider/aws/modules/spot/stack.go
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-rhel-ai.yaml

Comment thread pkg/provider/aws/action/rhel-ai/rhelai.go
Comment thread pkg/provider/aws/action/rhel-ai/rhelai.go
Comment thread pkg/provider/aws/action/rhel-ai/rhelai.go Outdated
Enable provisioning RHEL AI instances from AWS Marketplace AMIs using
the --marketplace flag, matching the existing Azure marketplace support.

Marketplace AMIs are discovered by name pattern and owner ID (679593333241),
using the naming convention rhel-ai-{accelerator}-*-prod-usfzkgvxvt65w.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Pavol Pitonak <ppitonak@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant