-
Notifications
You must be signed in to change notification settings - Fork 235
Add support for generating kube.yaml and quadlet/kube files for llama… #1457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR extends the serve command to support generating Kubernetes YAML and quadlet unit files when using the llama-stack API, refactors common generation logic into reusable helpers, and updates tests and documentation accordingly. Sequence Diagram for Kube YAML Generation via --generate=kubesequenceDiagram
actor User
participant CLI as "ramalama serve"
participant StackServe as "Stack.serve()"
participant KubeGenfile as "kube.genfile()"
participant PlainFileObj as "PlainFile Object"
participant Filesystem
User->>CLI: ramalama serve --generate=kube ...
CLI->>StackServe: Invoke with args
StackServe->>KubeGenfile: genfile(name, yamlContent)
activate KubeGenfile
KubeGenfile->>PlainFileObj: new PlainFile(name.yaml)
KubeGenfile->>PlainFileObj: .content = yamlContent
PlainFileObj->>Filesystem: write(name.yaml)
KubeGenfile-->>StackServe: Return PlainFile
deactivate KubeGenfile
StackServe-->>CLI:
CLI-->>User: Output: "Generating Kubernetes YAML file: name.yaml"
Sequence Diagram for Kube YAML and Quadlet File Generation via --generate=quadlet/kubesequenceDiagram
actor User
participant CLI as "ramalama serve"
participant StackServe as "Stack.serve()"
participant KubeGenfile as "kube.genfile()"
participant QuadletKube as "quadlet.kube()"
participant PlainFileObj as "PlainFile Object"
participant UnitFileObj as "UnitFile Object"
participant Filesystem
User->>CLI: ramalama serve --generate=quadlet/kube ...
CLI->>StackServe: Invoke with args
StackServe->>KubeGenfile: genfile(name, yamlContent)
activate KubeGenfile
KubeGenfile->>PlainFileObj: new PlainFile(name.yaml)
KubeGenfile->>PlainFileObj: .content = yamlContent
PlainFileObj->>Filesystem: write(name.yaml)
KubeGenfile-->>StackServe: Return PlainFile
deactivate KubeGenfile
StackServe->>QuadletKube: kube(name, description)
activate QuadletKube
QuadletKube->>UnitFileObj: new UnitFile(name.kube)
QuadletKube->>UnitFileObj: Add Kube, Unit, Install sections
UnitFileObj->>Filesystem: write(name.kube)
QuadletKube-->>StackServe: Return UnitFile
deactivate QuadletKube
StackServe-->>CLI:
CLI-->>User: Output: Generation messages
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rhatdan - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ramalama/file.py
Outdated
@@ -63,7 +63,12 @@ def write(self, dirpath: str): | |||
self._write(f) | |||
|
|||
def _write(self, f): | |||
for section in self.sections["comment"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Guard against missing 'comment' section before iterating
Accessing self.sections['comment'] directly may raise a KeyError if the section is missing. Use self.sections.get('comment', {}) to avoid this.
934f9fb
to
22e488e
Compare
…-stack Signed-off-by: Daniel J Walsh <[email protected]>
@ericcurtin PTAL |
Looks good to me but the serve.bats file spacing seems to have changed |
…-stack
Summary by Sourcery
Enable the serve command to produce Kubernetes YAML and quadlet unit files via --generate flags when using the llama-stack API, refactor file generation into shared helpers, and update documentation and tests to cover the new functionality.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: