Skip to content

feat: add validation for ReplicatedJobPatch name#3515

Open
pulkit-999 wants to merge 2 commits into
kubeflow:masterfrom
pulkit-999:feat/replicatedjobpatch-name-validation
Open

feat: add validation for ReplicatedJobPatch name#3515
pulkit-999 wants to merge 2 commits into
kubeflow:masterfrom
pulkit-999:feat/replicatedjobpatch-name-validation

Conversation

@pulkit-999
Copy link
Copy Markdown
Contributor

  • Add CEL/XValidation rule for ReplicatedJobPatch.name.
  • Add integration tests for replicated job name validation.

This prevents invalid replicated job identifiers from being accepted into the API and aligns validation behavior with existing Kubernetes CRD validation conventions.

Signed-off-by: Pulkit Agrawal <97938993+pulkit-999@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 15, 2026 18:16
@google-oss-prow google-oss-prow Bot requested a review from akshaychitneni May 15, 2026 18:16
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign electronic-waste for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot requested a review from kuizhiqing May 15, 2026 18:16
@github-actions
Copy link
Copy Markdown

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.
  • Our team will review your PR soon! cc @kubeflow/kubeflow-trainer-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

Copy link
Copy Markdown
Contributor

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

Adds a CEL XValidation rule on ReplicatedJobPatch.name to enforce an RFC 1035-style DNS label pattern, regenerates the CRD manifests, and adds integration tests covering valid and invalid names.

Changes:

  • Add XValidation rule with regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ and message on ReplicatedJobPatch.Name.
  • Regenerate x-kubernetes-validations entries in both base and Helm chart CRDs.
  • Add positive and negative integration test cases for replicated job name validation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/apis/trainer/v1alpha1/trainjob_types.go Adds the CEL XValidation marker to ReplicatedJobPatch.Name.
manifests/base/crds/trainer.kubeflow.org_trainjobs.yaml Generated CRD update reflecting the new validation.
charts/kubeflow-trainer/crds/trainer.kubeflow.org_trainjobs.yaml Generated Helm chart CRD update reflecting the new validation.
test/integration/webhooks/trainjob_test.go Adds integration test entries for invalid/valid replicated job names.

Comment thread pkg/apis/trainer/v1alpha1/trainjob_types.go Outdated
Signed-off-by: Pulkit Agrawal <97938993+pulkit-999@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants