Skip to content

fix: update job handling to use consistent model tagging#32

Merged
iasthc merged 4 commits intomainfrom
fix
Mar 11, 2026
Merged

fix: update job handling to use consistent model tagging#32
iasthc merged 4 commits intomainfrom
fix

Conversation

@iasthc
Copy link
Copy Markdown
Member

@iasthc iasthc commented Mar 11, 2026

No description provided.

iasthc and others added 4 commits March 11, 2026 14:45
- Changed import and unpack commands to utilize a consistent model tag "model:latest" instead of dynamic tags.
- Updated tagging logic to reflect the new model tag for improved clarity and maintainability.
…, coordination, authentication, authorization, inference, and metrics endpoint.
Copilot AI review requested due to automatic review settings March 11, 2026 08:17
@iasthc iasthc merged commit da5d33e into main Mar 11, 2026
13 checks passed
@iasthc iasthc deleted the fix branch March 11, 2026 08:17
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the ModelService controller's underlying API dependency and expands its Kubernetes Role-Based Access Control (RBAC) permissions. Concurrently, it refines the model artifact handling logic to ensure a consistent tagging scheme for imported models. These changes collectively enhance the controller's operational capabilities and standardize internal model management practices.

Highlights

  • API Dependency Update: The github.com/otterscale/api dependency has been updated from v0.8.23 to v0.9.0-alpha.3, bringing in potential new features or changes.
  • RBAC Permissions Expansion: The ClusterRole and controller RBAC annotations have been significantly expanded to include permissions for accessing metrics, Kubernetes events, authentication and authorization reviews, coordination leases, and new inference networking resources.
  • Consistent Model Tagging: The model artifact handling jobs now use a consistent model:latest tag for imported models, standardizing the internal tagging process regardless of the source repository.
  • Sample Configuration Removal: An outdated sample ModelService configuration file (config/samples/model_v1alpha1_modelservice.yaml) has been removed.
Changelog
  • config/rbac/role.yaml
    • Added new RBAC rules for /metrics endpoint access.
    • Included permissions for events resources in core and events.k8s.io API groups.
    • Granted create verb for tokenreviews and subjectaccessreviews in authentication.k8s.io and authorization.k8s.io.
    • Added comprehensive permissions for leases resources in coordination.k8s.io.
    • Introduced get, list, watch permissions for inferencemodelrewrites and inferenceobjectives in inference.networking.x-k8s.io.
  • config/samples/model_v1alpha1_modelservice.yaml
    • Removed the sample ModelService configuration file.
  • go.mod
    • Updated github.com/otterscale/api dependency to v0.9.0-alpha.3.
  • go.sum
    • Updated checksums for the github.com/otterscale/api dependency.
  • internal/controller/modelservice_controller.go
    • Added new kubebuilder:rbac annotations to declare required permissions for pods, events, leases, inferenceobjectives, inferencemodelrewrites, tokenreviews, subjectaccessreviews, and /metrics.
  • internal/modelartifact/job.go
    • Modified kit import command to explicitly tag imported models with --tag model:latest.
    • Updated kit unpack and kit tag commands to consistently reference model:latest instead of the Hugging Face repository name.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several important updates to the ModelService controller, expanding RBAC permissions and refining model tagging logic in internal/modelartifact/job.go for consistent model handling. However, a critical security vulnerability was identified in the shell script within the model artifact job. The script is susceptible to argument injection due to unquoted shell expansions of variables derived from external sources (Secrets), and sensitive tokens are being passed as command-line arguments, which can lead to information leakage. It is strongly recommended to use safer shell scripting patterns and avoid passing secrets as CLI arguments to mitigate these risks.

Comment on lines +44 to +45
${HF_TOKEN:+--token "$HF_TOKEN"} \
--tag model:latest
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-medium medium

The shell script in pipelineScript uses an unquoted parameter expansion ${HF_TOKEN:+--token "$HF_TOKEN"} on line 44. This pattern is vulnerable to Argument Injection because the shell performs word splitting on the result of the expansion. If the HF_TOKEN variable (sourced from a Kubernetes Secret) contains shell metacharacters, it can inject arbitrary flags into the kit import command. Additionally, passing sensitive tokens like HF_TOKEN as command-line arguments is a security risk as they are visible to other processes. It is recommended to pass secrets via environment variables or files. While the change to explicitly tag the imported model with --tag model:latest and consistently use model:latest is a good improvement for clarity and consistency, this security vulnerability needs to be addressed first. To fix the argument injection in a POSIX-compliant way, consider using the set -- pattern to build the argument list safely: set --; [ -n "$HF_REVISION" ] && set -- "$@" --ref "$HF_REVISION"; [ -n "$HF_TOKEN" ] && set -- "$@" --token "$HF_TOKEN"; kit import "$HF_REPO" "$@" --tag model:latest

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the model artifact import/pack/push job to use a consistent intermediate OCI tag, and refreshes controller/manifest RBAC plus Go dependencies.

Changes:

  • Tag the imported model consistently as model:latest and reference it for unpack/tag steps.
  • Expand kubebuilder RBAC annotations and generated ClusterRole rules (pods/events/leases/metrics auth delegation, inference extension reads).
  • Bump github.com/otterscale/api to v0.9.0-alpha.3 and remove the ModelService sample manifest.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/modelartifact/job.go Switches job pipeline to a fixed intermediate tag (model:latest) for subsequent steps.
internal/controller/modelservice_controller.go Adds additional kubebuilder RBAC annotations that feed generated RBAC.
config/rbac/role.yaml Updates manager ClusterRole rules to match new/added RBAC requirements.
go.mod Bumps github.com/otterscale/api dependency to an alpha release.
go.sum Updates checksums for the dependency bump.
config/samples/model_v1alpha1_modelservice.yaml Removes the sample manifest.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod
github.com/onsi/ginkgo/v2 v2.28.1
github.com/onsi/gomega v1.39.1
github.com/otterscale/api v0.8.23
github.com/otterscale/api v0.9.0-alpha.3
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

This PR is titled as a job-handling/tagging fix, but it also bumps github.com/otterscale/api to a new alpha version and introduces broad RBAC/manifest changes. Please either (a) explain in the PR description why the API upgrade and RBAC changes are required for the tagging fix, or (b) split these into separate PRs to keep the scope and risk easier to review.

Copilot uses AI. Check for mistakes.
Comment on lines +48 to 52
kit unpack -o ${PLAIN_HTTP:+--plain-http} model:latest -d /workspace
kit pack . --use-model-pack -t "$OCI_TARGET"
else
kit tag "$import_tag" "$OCI_TARGET"
kit tag model:latest "$OCI_TARGET"
fi
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The pipeline script now uses a fixed intermediate tag (model:latest) in both branches, but the header comment above still says the ModelKit path “import tags as OCI_TARGET directly”. Please update that comment (or adjust the script) so the documented flow matches the actual commands.

Copilot uses AI. Check for mistakes.
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.

2 participants