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

Refactor UpgradeStrategy to UpgradeSpec.Type #2678

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

ryanaoleary
Copy link
Contributor

Why are these changes needed?

This PR changes UpgradeStrategy to a field Type in a new UpgradeSpec field under RayServiceSpec . This will make it easier to add other upgrade related fields to the RayService CR in the future.

Related issue number

Checks

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

@ryanaoleary
Copy link
Contributor Author

cc: @kevin85421 @andrewsykim

// UpgradeStrategy represents the strategy used when upgrading the RayService. Currently supports `NewCluster` and `None`
UpgradeStrategy *RayServiceUpgradeStrategy `json:"upgradeStrategy,omitempty"`
// UpgradeSpec defines the scaling policy used when upgrading the RayService.
UpgradeSpec *RayServiceUpgradeSpec `json:"upgradeSpec,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

spec.upgradeStrategy.type instead of spec.upgradeSpec.type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure that sounds more clear, RayServiceUpgradeStrategy was already in use to define the string constant, but I went ahead and changed that field to RayServiceUpgradeType instead. 97816e8

Signed-off-by: ryanaoleary <[email protected]>
@kevin85421
Copy link
Member

@ryanaoleary can you fix the CI failure? Thanks!

Signed-off-by: ryanaoleary <[email protected]>
@ryanaoleary
Copy link
Contributor Author

[2a0cf6e](/ray-project/kuberay/pull/2678/commits/2a0cf6e1b2e63fa97f309e049686aea16445a30b)

Done in 2a0cf6e.

if upgradeStrategy := rayService.Spec.UpgradeStrategy; upgradeStrategy != nil {
if *upgradeStrategy != rayv1.NewCluster && *upgradeStrategy != rayv1.None {
return fmt.Errorf("spec.UpgradeStrategy value %s is invalid, valid options are %s or %s", *upgradeStrategy, rayv1.NewCluster, rayv1.None)
if rayService.Spec.UpgradeStrategy == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can we merge these two if statements into one? The current control flow can easily skip some checks we might add in the future. For example, if UpgradeStrategy is nil, the "check others" step will be skipped.

if rayService.Spec.UpgradeStrategy == nil {
  return nil
}

// check upgradeType
// check others

Copy link
Member

Choose a reason for hiding this comment

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

maybe leave this as a good first issue for new contributors.

@kevin85421 kevin85421 merged commit f0ff2c1 into ray-project:master Jan 3, 2025
24 checks passed
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.

3 participants