Skip to content

feat: update ModelArtifact CRD to include registry field and improve …#27

Merged
iasthc merged 1 commit intomainfrom
rename
Feb 28, 2026
Merged

feat: update ModelArtifact CRD to include registry field and improve …#27
iasthc merged 1 commit intomainfrom
rename

Conversation

@iasthc
Copy link
Member

@iasthc iasthc commented Feb 28, 2026

…validation

  • Added 'registry' field to the ModelArtifact CRD for specifying the OCI registry host.
  • Renamed 'repository' field in HuggingFaceSource to 'model' for clarity.
  • Updated descriptions and validation patterns for 'repository' and 'model' fields to enhance understanding and enforce naming conventions.
  • Adjusted required fields in the CRD to include the new 'registry' field.

…validation

- Added 'registry' field to the ModelArtifact CRD for specifying the OCI registry host.
- Renamed 'repository' field in HuggingFaceSource to 'model' for clarity.
- Updated descriptions and validation patterns for 'repository' and 'model' fields to enhance understanding and enforce naming conventions.
- Adjusted required fields in the CRD to include the new 'registry' field.
Copilot AI review requested due to automatic review settings February 28, 2026 15:37
@iasthc iasthc merged commit 1bea12d into main Feb 28, 2026
5 checks passed
@iasthc iasthc deleted the rename branch February 28, 2026 15:37
@gemini-code-assist
Copy link

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 refines the ModelArtifact Custom Resource Definition (CRD) to provide more granular control and clearer semantics for managing model artifacts. It introduces a dedicated field for specifying OCI registry hosts, separates the registry host from the repository path, and renames a field in the HuggingFace source configuration for better clarity. These changes aim to improve the robustness and user-friendliness of model artifact definitions and validation.

Highlights

  • New Registry Field: Introduced a registry field to the ModelArtifact Custom Resource Definition (CRD) for specifying OCI registry hosts.
  • HuggingFace Source Renaming: Renamed the repository field to model within the HuggingFaceSource configuration for improved clarity.
  • Improved Validation and Descriptions: Enhanced validation patterns and descriptions for both repository and model fields to ensure better data integrity and understanding.
  • Required Field Adjustment: Updated the CRD's required fields to mandate the presence of the new registry field.
Changelog
  • config/crd/bases/model.otterscale.io_modelartifacts.yaml
    • Added registry field to spec.target with description, length constraints, and pattern validation.
    • Updated HuggingFaceSource to rename repository to model and adjusted its description and validation.
    • Modified OCITarget.repository description to clarify it should not include the registry host.
    • Made registry a required field within OCITarget.
    • Added Registry as a new print column for ModelArtifact CRDs.
  • model/v1alpha1/modelartifact_types.go
    • Added blank lines between ArtifactPhase constants for improved readability.
    • Renamed the Repository field to Model in the HuggingFaceSource struct, updating its JSON tag and comments.
    • Introduced a new Registry field in the OCITarget struct, including its JSON tag, description, and validation annotations.
    • Updated the OCITarget.Repository field's description to reflect the separation of registry host.
    • Modified security comments to include Registry as a passed parameter.
    • Added Registry to the kubebuilder:printcolumn annotations for the ModelArtifact type.
Activity
  • No human activity (comments, reviews, approvals) has occurred on 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

@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 a registry field to the ModelArtifact CRD, separating it from the repository path for better clarity and validation. It also improves the HuggingFace source definition by renaming repository to model. The changes are well-structured and improve the API. I've found one issue with the validation pattern for the new registry field, which is too permissive and allows invalid characters for a registry host.

port (e.g. "ghcr.io", "registry.local:5001").
maxLength: 253
minLength: 1
pattern: ^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$

Choose a reason for hiding this comment

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

high

The validation pattern for registry allows slashes (/), which are not valid in a registry hostname. A registry host should be a DNS name or IP, optionally with a port, but should not contain path segments. Please remove the slash from the pattern to enforce a valid registry host format.

                    pattern: ^[a-zA-Z0-9][a-zA-Z0-9._:-]*$

// Registry is the OCI registry host, optionally with port (e.g. "ghcr.io", "registry.local:5001").
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$"

Choose a reason for hiding this comment

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

high

The validation pattern for Registry allows slashes (/), which are not valid in a registry hostname. A registry host should be a DNS name or IP, optionally with a port, but should not contain path segments. Please remove the slash from the pattern to enforce a valid registry host format. This will also fix the generated CRD YAML.

Suggested change
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$"
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._:-]*$"

Copy link

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 ModelArtifact Kubernetes API (Go types + generated CRD) to better structure OCI destination information and clarify HuggingFace source naming/validation.

Changes:

  • Add .spec.target.registry and expose it as an additional printer column.
  • Rename HuggingFace source field from repository to model and update schema/required fields accordingly.
  • Refine descriptions and validation patterns for the updated fields.

Reviewed changes

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

File Description
model/v1alpha1/modelartifact_types.go Adds registry to OCITarget, renames HuggingFace repository to model, and updates printer columns.
config/crd/bases/model.otterscale.io_modelartifacts.yaml Regenerates CRD schema/printer columns to reflect the API changes and required fields.

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

Comment on lines +81 to 85
model:
description: |-
Repository is the HuggingFace model repository identifier (e.g. "microsoft/phi-4").
Model is the HuggingFace model identifier (e.g. "microsoft/phi-4", "facebook/opt-125m").
Must contain only alphanumerics, dots, underscores, hyphens, and slashes.
maxLength: 253
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

Renaming the HuggingFace field from repository to model is a breaking CRD change: existing manifests using spec.source.huggingFace.repository will fail validation (and the unknown field may be pruned on write). If upgrades need to be supported, consider keeping repository as a deprecated alias (with validation to ensure only one is set) or providing a conversion/migration path.

Copilot uses AI. Check for mistakes.
pattern: ^[a-zA-Z0-9._/-]*$
type: string
required:
- registry
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

Making .spec.target.registry required is an API-breaking change for any existing ModelArtifacts that only set repository (as a full ref previously). If cluster upgrades must be smooth, consider temporarily allowing registry to be optional with defaulting/derivation from repository, or supporting both forms during a deprecation window.

Suggested change
- registry

Copilot uses AI. Check for mistakes.
// Registry is the OCI registry host, optionally with port (e.g. "ghcr.io", "registry.local:5001").
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$"
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The Registry field is documented as an OCI registry host (optionally with port), but the validation pattern currently allows /. That permits path segments (e.g. ghcr.io/myorg), which contradicts the field’s intent and undermines the separation between registry and repository. Tighten the regex to disallow / (and ideally validate host[:port]).

Suggested change
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$"
// +kubebuilder:validation:Pattern="^[a-zA-Z0-9][a-zA-Z0-9._-]*(?::[0-9]{1,5})?$"

Copilot uses AI. Check for mistakes.
port (e.g. "ghcr.io", "registry.local:5001").
maxLength: 253
minLength: 1
pattern: ^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The CRD schema for .spec.target.registry uses a pattern that allows /, even though registry is described as a host[:port]. This permits values like ghcr.io/myorg and blurs the boundary with .spec.target.repository. Update the regex to reject / and more closely match a registry host (optionally with port).

Suggested change
pattern: ^[a-zA-Z0-9][a-zA-Z0-9._/:-]*$
pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*(?::[0-9]{1,5})?$

Copilot uses AI. Check for mistakes.
Comment on lines 78 to 79
description: HuggingFace specifies a HuggingFace Hub repository
as the model source.
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The huggingFace source description still says it specifies a HuggingFace Hub "repository", but the field has been renamed to model. Update this text to avoid confusion for CRD users reading the generated schema.

Suggested change
description: HuggingFace specifies a HuggingFace Hub repository
as the model source.
description: HuggingFace specifies a HuggingFace Hub model
(via the model identifier) as the model source.

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