Skip to content

feat(tkn): add compute-sizes, GPU, and spot-excluded-regions params to SNC task#867

Merged
adrianriobo merged 1 commit into
redhat-developer:mainfrom
amastbau:feat/snc-compute-sizes
Jul 27, 2026
Merged

feat(tkn): add compute-sizes, GPU, and spot-excluded-regions params to SNC task#867
adrianriobo merged 1 commit into
redhat-developer:mainfrom
amastbau:feat/snc-compute-sizes

Conversation

@amastbau

@amastbau amastbau commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • Add compute-sizes, gpus, gpu-manufacturer, and spot-excluded-regions params to the SNC Tekton task template
  • When compute-sizes is set, it takes precedence over cpus/memory/gpus args (same pattern as RHEL task)
  • Regenerated tkn/infra-aws-ocp-snc.yaml via make tkn-update

Closes #858

Verification results

Script logic dry-run (3 scenarios)

Scenario compute-sizes spot Result
compute-sizes + spot + excluded regions m5.xlarge,m5.2xlarge on --compute-sizes used, no --cpus/--memory/--gpus, all spot flags present
empty compute-sizes (fallback) empty on Falls back to --cpus/--memory/--gpus/--gpu-manufacturer, spot flags present
compute-sizes + spot off c5.4xlarge off --compute-sizes used, zero spot flags

Live Tekton TaskRun (OCP 4.21.0 cluster)

Deployed SNO cluster, installed OpenShift Pipelines v1.22.4, applied the modified task, and ran a TaskRun with debug=true to inspect the built command. Debug output confirms correct param resolution:

mapt aws ocp-snc create \
  --arch x86_64 \
  --compute-sizes m5.4xlarge,m6i.4xlarge \
  --disk-size 200 \
  --spot \
  --spot-increase-rate 20 \
  --spot-eviction-tolerance lowest \
  --spot-excluded-regions us-east-1a,us-west-2b
  • --compute-sizes present, --cpus/--memory/--gpus correctly absent (if/else branch works)
  • --spot-excluded-regions passed through with correct value
  • No --cpus/--memory leakage when compute-sizes is set

Test plan

  • Verify generated YAML matches template (only <IMAGE>/<VERSION> substitution differs)
  • Dry-run script logic with param substitution — all 3 scenarios pass
  • Live Tekton TaskRun with compute-sizes set — confirmed --compute-sizes used, no fallback params
  • Live Tekton TaskRun with spot-excluded-regions — confirmed value passed through
  • Run SNC task without compute-sizes — confirm fallback to cpus/memory/gpus works as before (covered by dry-run scenario 2)

🤖 Generated with Claude Code

…o SNC task

The SNC Tekton task template was missing several params that the Go CLI
already supports via AddComputeRequestFlags(). This prevented Tekton
pipeline users from specifying exact instance types or GPU requirements
for SNC clusters.

Add compute-sizes, gpus, gpu-manufacturer, and spot-excluded-regions
params to the SNC task template, matching the pattern already used in
the RHEL task template. When compute-sizes is set, it takes precedence
over cpus/memory/gpus args.

Closes redhat-developer#858

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The SNC Tekton task and template add explicit compute-size, GPU, and spot-excluded-region parameters. Cluster creation conditionally passes compute sizes or CPU, memory, and GPU flags, while spot arguments include excluded regions and quoted values.

Changes

SNC provisioning configuration

Layer / File(s) Summary
Compute and GPU selection
tkn/infra-aws-ocp-snc.yaml, tkn/template/infra-aws-ocp-snc.yaml
Adds compute-size and GPU parameters and conditionally emits --compute-sizes or CPU, memory, and GPU flags during creation.
Spot-instance configuration
tkn/infra-aws-ocp-snc.yaml, tkn/template/infra-aws-ocp-snc.yaml
Adds spot-excluded-regions and passes it with the existing spot options using quoted parameter values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: jangel97, ppitonak, anjannath

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR covers compute-sizes and spot passthrough, but it չի show the required profile compatibility validation for nvidia/non-GPU instances. Add validation that rejects incompatible profiles and instance types, such as nvidia with non-GPU sizes, and cover it in the task logic.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changed files only add SNC task parameters and related command wiring, which align with the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: adding compute-sizes, GPU, and spot-excluded-regions params to the SNC task.
Description check ✅ Passed The description is directly related and accurately summarizes the Tekton task parameter and command construction changes.

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.

@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: 1

🤖 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 `@tkn/infra-aws-ocp-snc.yaml`:
- Around line 258-265: Remove eval-based command-string construction from the
mapt invocation. In tkn/infra-aws-ocp-snc.yaml at lines 258-265 and 283-287, and
tkn/template/infra-aws-ocp-snc.yaml at lines 258-265 and 283-287, build
arguments with safe quoting and invoke mapt directly for compute/GPU and spot
parameters, preserving the existing parameter selection behavior.
🪄 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: Pro Plus

Run ID: a68abbb3-1b59-4aa9-9d4c-de13458eae8c

📥 Commits

Reviewing files that changed from the base of the PR and between 25cc0d1 and 857f548.

📒 Files selected for processing (2)
  • tkn/infra-aws-ocp-snc.yaml
  • tkn/template/infra-aws-ocp-snc.yaml

Comment on lines +258 to +265
if [[ "$(params.compute-sizes)" != "" ]]; then
cmd+="--compute-sizes '$(params.compute-sizes)' "
else
cmd+="--cpus '$(params.cpus)' "
cmd+="--memory '$(params.memory)' "
cmd+="--gpus '$(params.gpus)' "
cmd+="--gpu-manufacturer '$(params.gpu-manufacturer)' "
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift

Remove eval from the new parameter wiring.

The compute, GPU, and spot values are inserted into a shell command string and reparsed by eval at Line [307]. The surrounding quotes do not safely escape Tekton substitutions, allowing caller-controlled shell syntax to execute with AWS credentials.

  • tkn/infra-aws-ocp-snc.yaml#L258-L265: build quoted arguments and directly invoke mapt for compute and GPU parameters.
  • tkn/infra-aws-ocp-snc.yaml#L283-L287: apply the same safe argument handling to spot parameters.
  • tkn/template/infra-aws-ocp-snc.yaml#L258-L265: update the source template's compute and GPU argument handling.
  • tkn/template/infra-aws-ocp-snc.yaml#L283-L287: update the source template's spot argument handling.

As per path instructions, this is a major security issue rather than a shell-style nit.

📍 Affects 2 files
  • tkn/infra-aws-ocp-snc.yaml#L258-L265 (this comment)
  • tkn/infra-aws-ocp-snc.yaml#L283-L287
  • tkn/template/infra-aws-ocp-snc.yaml#L258-L265
  • tkn/template/infra-aws-ocp-snc.yaml#L283-L287
🤖 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 `@tkn/infra-aws-ocp-snc.yaml` around lines 258 - 265, Remove eval-based
command-string construction from the mapt invocation. In
tkn/infra-aws-ocp-snc.yaml at lines 258-265 and 283-287, and
tkn/template/infra-aws-ocp-snc.yaml at lines 258-265 and 283-287, build
arguments with safe quoting and invoke mapt directly for compute/GPU and spot
parameters, preserving the existing parameter selection behavior.

Source: Path instructions

@adrianriobo adrianriobo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@adrianriobo
adrianriobo merged commit 2d977b2 into redhat-developer:main Jul 27, 2026
9 checks passed
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.

feat(snc): add compute-sizes parameter for instance type selection

2 participants