Skip to content
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

[Feature] Add ManagedBy field #2589

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mszadkow
Copy link

@mszadkow mszadkow commented Nov 29, 2024

Why are these changes needed?

As stated in #2544.
It allows for integration with MultiKueue (multi-cluster Kueue), in specific it provides:

  • simpler installation, otherwise only installation of RayJob CRDs is required
  • support for mixed setup in one cluster - some RayJobs could be run by MultiKueue and some by the default operator

Related issue number

Relates to #2544

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

// the field value is the reserved string 'ray.io/kuberay-operator',
// but delegates reconciling the RayJob with 'kueue.x-k8s.io/multikueue' to the Kueue.
// The field is immutable.
// TBD: Immutability from k8s v1.28 and above, below it won't be - is this acceptable?
Copy link
Author

@mszadkow mszadkow Nov 29, 2024

Choose a reason for hiding this comment

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

@andrewsykim @kevin85421 question to you, as we can enforce immutability with CEL Validation, but only from k8s v1.25 (since it's beta).
E.g kuberay kind version is v1.25.3, so I wonder how much impact it can have

@mszadkow
Copy link
Author

/assign @mimowo

return nil
}

var validManagedBy = sets.NewString(
Copy link

Choose a reason for hiding this comment

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

I would suggest to use New[string] and move the block to the top of the file

Comment on lines +876 to +880
if managedBy != nil {
if !validManagedBy.Has(*managedBy) {
return field.NotSupported(field.NewPath("spec").Child("managedBy"), *managedBy, validManagedBy.List())
}
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
if managedBy != nil {
if !validManagedBy.Has(*managedBy) {
return field.NotSupported(field.NewPath("spec").Child("managedBy"), *managedBy, validManagedBy.List())
}
}
if managedBy != nil && !validManagedBy.Has(*managedBy) {
return field.NotSupported(field.NewPath("spec").Child("managedBy"), *managedBy, validManagedBy.List())
}

Comment on lines +849 to +851
if err := validateManagedBy(rayJob.Spec.ManagedBy); err != nil {
return err
}
Copy link

Choose a reason for hiding this comment

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

Actually, I think this validation could now be moved to CEL. cc @andrewsykim @kevin85421

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