Skip to content

feat: Add network field to LlamaStackDistribution#2647

Open
jgarciao wants to merge 1 commit intoRedHatQE:mainfrom
jgarciao:add-network-lsd
Open

feat: Add network field to LlamaStackDistribution#2647
jgarciao wants to merge 1 commit 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 network configuration support to Llama Stack Distribution, allowing users to specify optional network settings for their deployments.

Update the LlamaStackDistribution resource and schema
following the steps at class_generator/README.md

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

coderabbitai bot commented Feb 13, 2026

Walkthrough

Modified LlamaStackDistribution class to add an optional network field to its initialization and serialization logic. Reorganized imports to move MissingRequiredArgumentError to the exceptions module. The new field is conditionally included in the to_dict() method output when provided.

Changes

Cohort / File(s) Summary
Import and Network Field Addition
ocp_resources/llama_stack_distribution.py
Reorganized imports (MissingRequiredArgumentError moved to exceptions module), added optional network parameter to __init__ with type dict[str, Any] | None, introduced corresponding public attribute, and extended to_dict() to conditionally include network in the spec dictionary when the field is populated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
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.
Description check ❓ Inconclusive The PR description provides context via command output but lacks the structured template sections like 'What this PR does', 'Why we need it', and 'Which issue(s) this PR fixes'. Add structured sections matching the template: explain what the PR does, why it's necessary, and reference the related issue #2637 mentioned in the description.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a network field to LlamaStackDistribution class.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

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

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Comment on lines 3 to +7
from ocp_resources.resource import MissingRequiredArgumentError, NamespacedResource

from typing import Any
from ocp_resources.resource import NamespacedResource
from ocp_resources.exceptions import MissingRequiredArgumentError
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate imports: line 3 was not removed when lines 5–7 were added.

Line 3 imports both MissingRequiredArgumentError and NamespacedResource from ocp_resources.resource, then lines 6–7 re-import them (with MissingRequiredArgumentError now sourced from ocp_resources.exceptions). Ruff F811 confirms the redefinition. Remove the stale line 3.

Proposed fix
-from ocp_resources.resource import MissingRequiredArgumentError, NamespacedResource
-
 from typing import Any
 from ocp_resources.resource import NamespacedResource
 from ocp_resources.exceptions import MissingRequiredArgumentError

As per coding guidelines, this file is auto-generated (# Generated using …# End of generated code). If the generator produced this duplicate, the fix should be applied in the class-generator tool itself; if the stale line was left over from a previous version and the generator didn't clean it up, re-running the generator cleanly should resolve it.

🧰 Tools
🪛 Ruff (0.15.0)

[error] 6-6: Redefinition of unused NamespacedResource from line 3: NamespacedResource redefined here

Remove definition: NamespacedResource

(F811)


[error] 7-7: Redefinition of unused MissingRequiredArgumentError from line 3: MissingRequiredArgumentError redefined here

(F811)

🤖 Prompt for AI Agents
In `@ocp_resources/llama_stack_distribution.py` around lines 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.

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.

3 participants