Skip to content

feat: Add network field to LlamaStackDistribution#2647

Open
jgarciao wants to merge 2 commits intoRedHatQE:mainfrom
jgarciao:add-network-lsd
Open

feat: Add network field to LlamaStackDistribution#2647
jgarciao wants to merge 2 commits intoRedHatQE:mainfrom
jgarciao:add-network-lsd

Conversation

@jgarciao
Copy link

@jgarciao jgarciao commented Feb 13, 2026

This PR is a follow-up of #2637, updating the LlamaStackDistribution resource and schema following the steps at class_generator/README.md

$ class-generator --update-schema-for LlamaStackDistribution
2026-02-13T12:46:32.505844 class_generator.cli INFO Updating schema for single resource: LlamaStackDistribution
2026-02-13T12:46:32.505977 pyhelper_utils.shell INFO Running which oc command
2026-02-13T12:46:32.507181 class_generator.core.schema INFO Updating schema for single resource: LlamaStackDistribution
2026-02-13T12:46:32.507258 pyhelper_utils.shell INFO Running oc api-resources -o wide --no-headers command
2026-02-13T12:46:33.260902 class_generator.core.schema INFO Built dynamic resource-to-API mapping with 365 resource kinds
2026-02-13T12:46:33.261052 class_generator.core.schema INFO Found API paths for LlamaStackDistribution: ['apis/llamastack.io/v1alpha1']
2026-02-13T12:46:33.261113 class_generator.core.schema INFO Fetching OpenAPI v3 index...
2026-02-13T12:46:33.261201 pyhelper_utils.shell INFO Running oc get --raw /openapi/v3 command
2026-02-13T12:46:34.161310 class_generator.core.schema INFO Found 186 API groups to process
2026-02-13T12:46:34.161479 class_generator.core.schema INFO Fetching schemas from 1 API path(s): {'apis/llamastack.io/v1alpha1'}
2026-02-13T12:46:34.161560 class_generator.core.schema INFO Filtering to 1 specific API paths out of 186 total
2026-02-13T12:46:34.162067 class_generator.core.schema INFO Processing apis/llamastack.io/v1alpha1...
2026-02-13T12:46:34.162477 pyhelper_utils.shell INFO Running oc get --raw /openapi/v3/apis/llamastack.io/v1alpha1?hash=8CDEDB58101826A7F8F26667FD53792B4639747AE85B60D1E472AB638E1C067A095209AC01707FA252D67EA4F9D0F7BF4842EBF0B93B57E3A0B05D25A59A15B0 command
2026-02-13T12:46:35.360016 pyhelper_utils.shell INFO Running oc api-resources --namespaced=true --no-headers command
2026-02-13T12:46:36.091786 pyhelper_utils.shell INFO Running oc api-resources --namespaced=false --no-headers command
2026-02-13T12:46:36.820920 class_generator.core.schema INFO Built namespacing dictionary with 365 resources
2026-02-13T12:46:36.821092 class_generator.core.schema INFO Resource LlamaStackDistribution is namespaced: True
2026-02-13T12:46:36.821258 ocp_resources.utils.archive_utils INFO Loading JSON from archive: class_generator/schema/__resources-mappings.json.gz
2026-02-13T12:46:37.069446 class_generator.core.schema INFO Loaded 1371 existing resources from mapping
2026-02-13T12:46:37.069646 class_generator.core.schema INFO Updated existing schema for LlamaStackDistribution (llamastack.io/v1alpha1)
2026-02-13T12:46:38.453644 ocp_resources.utils.archive_utils INFO Saved and archived: class_generator/schema/__resources-mappings.json.gz
2026-02-13T12:46:38.453785 class_generator.core.schema INFO Successfully updated schema for LlamaStackDistribution
2026-02-13T12:46:38.453828 class_generator.core.schema INFO Total resources in mapping: 1371
2026-02-13T12:46:38.453945 class_generator.cli INFO Schema updated for LlamaStackDistribution.



$ class-generator --kind LlamaStackDistribution --overwrite
2026-02-13T12:46:53.228987 ocp_resources.utils.archive_utils INFO Loading JSON from archive: class_generator/schema/__resources-mappings.json.gz
2026-02-13T12:46:53.608548 class_generator.core.generator INFO Generating class for LlamaStackDistribution
2026-02-13T12:46:53.623754 class_generator.core.generator WARNING Overwriting ocp_resources/llama_stack_distribution.py
2026-02-13T12:46:53.623905 pyhelper_utils.shell INFO Running uvx prek run --files ocp_resources/llama_stack_distribution.py command
2026-02-13T12:46:53.628882 class_generator.formatters.file_writer WARNING Prek hooks failed for ocp_resources/llama_stack_distribution.py. This is non-fatal and generation will continue.

Summary by CodeRabbit

  • New Features
    • Added optional network configuration to Llama Stack Distribution so deployments can include custom network settings; when provided, these settings are retained in the distribution output.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a3260f8a-997f-4ffe-9173-6700cfc4b3af

📥 Commits

Reviewing files that changed from the base of the PR and between 460e6ca and aa2938f.

⛔ Files ignored due to path filters (1)
  • class_generator/schema/__resources-mappings.json.gz is excluded by !**/*.gz, !class_generator/schema/**
📒 Files selected for processing (1)
  • ocp_resources/llama_stack_distribution.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • ocp_resources/llama_stack_distribution.py

Walkthrough

Added an optional network: dict[str, Any] | None parameter to LlamaStackDistribution.__init__, stored as self.network, and updated to_dict() to include "network" in the _spec when present. Constructor docstring expanded; minor class docstring cosmetic change.

Changes

Cohort / File(s) Summary
LlamaStackDistribution (single file)
ocp_resources/llama_stack_distribution.py
Added `network: dict[str, Any]

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required template sections (short description, more details, what this PR does/why we need it, issue fixes, reviewer notes, bug). Fill in the PR description template with sections for short description, detailed explanation, PR purpose, issue reference, reviewer notes, and any bug information.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a network field to the LlamaStackDistribution class.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@rh-bot-1
Copy link

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 0 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@ocp_resources/llama_stack_distribution.py`:
- Around line 3-7: There are duplicate imports of MissingRequiredArgumentError
and NamespacedResource: remove the stale line that imports both from
ocp_resources.resource (the first import) so only the correct imports remain
(NamespacedResource from ocp_resources.resource and MissingRequiredArgumentError
from ocp_resources.exceptions); if this duplication stems from the generator,
fix the generator template that emits the import block so it doesn't produce a
leftover import for MissingRequiredArgumentError.

@rnetser
Copy link
Collaborator

rnetser commented Feb 19, 2026

@jgarciao please try with #2657
thank you

Copy link
Collaborator

@rnetser rnetser left a comment

Choose a reason for hiding this comment

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

my pr was merged; please re-generate the resouce

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
ocp_resources/llama_stack_distribution.py (1)

4-6: Fix the generator to import MissingRequiredArgumentError from ocp_resources.resource.

This generated output drifted from the repository convention: resource classes import MissingRequiredArgumentError via ocp_resources.resource, not ocp_resources.exceptions. Since this file is inside the generated block, please update the class-generator template/import mapping and regenerate instead of patching this file directly.

Based on learnings, MissingRequiredArgumentError should be imported from ocp_resources.resource, and generated code should be fixed in the class-generator rather than edited manually.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ocp_resources/llama_stack_distribution.py` around lines 4 - 6, The generated
file imports MissingRequiredArgumentError from ocp_resources.exceptions; update
the class-generator template so that generated resources import
MissingRequiredArgumentError from ocp_resources.resource instead (alongside
NamespacedResource), then regenerate the file rather than manually editing
llama_stack_distribution.py; ensure the template's import mapping and any
generator code that emits "MissingRequiredArgumentError" references
ocp_resources.resource so future generated classes (e.g., the
NamespacedResource-derived classes) use the correct import.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ocp_resources/llama_stack_distribution.py`:
- Around line 4-6: The generated file imports MissingRequiredArgumentError from
ocp_resources.exceptions; update the class-generator template so that generated
resources import MissingRequiredArgumentError from ocp_resources.resource
instead (alongside NamespacedResource), then regenerate the file rather than
manually editing llama_stack_distribution.py; ensure the template's import
mapping and any generator code that emits "MissingRequiredArgumentError"
references ocp_resources.resource so future generated classes (e.g., the
NamespacedResource-derived classes) use the correct import.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9490b3fe-efa6-4f6b-ba78-812cd12b4c76

📥 Commits

Reviewing files that changed from the base of the PR and between 71c4ebd and 460e6ca.

⛔ Files ignored due to path filters (1)
  • class_generator/schema/__resources-mappings.json.gz is excluded by !**/*.gz, !class_generator/schema/**
📒 Files selected for processing (1)
  • ocp_resources/llama_stack_distribution.py

Signed-off-by: Jorge Garcia Oncins <jgarciao@redhat.com>
@jgarciao
Copy link
Author

jgarciao commented Mar 6, 2026

I've recreated the file using version 11.0.119.
Note: after generating the file, I had to run run ruff format ... to fix one linter error

git fetch upstream
git reset --hard upstream/main
uv sync
source .venv/bin/activate
class-generator --update-schema-for LlamaStackDistribution
ruff format ocp_resources/llama_stack_distribution.py
git add --update
git commit -s
git push -f

@jgarciao
Copy link
Author

jgarciao commented Mar 6, 2026

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants