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

feat: Rename instances of rayiov1alpha1 to rayv1alpha1 #1112

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package schedulerinterface

import (
rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
Expand All @@ -16,11 +16,11 @@ type BatchScheduler interface {

// DoBatchSchedulingOnSubmission handles submitting the RayCluster to the batch scheduler on creation / update
// For most batch schedulers, this results in the creation of a PodGroup.
DoBatchSchedulingOnSubmission(app *rayiov1alpha1.RayCluster) error
DoBatchSchedulingOnSubmission(app *rayv1alpha1.RayCluster) error

// AddMetadataToPod enriches Pod specs with metadata necessary to tie them to the scheduler.
// For example, setting labels for queues / priority, and setting schedulerName.
AddMetadataToPod(app *rayiov1alpha1.RayCluster, pod *v1.Pod)
AddMetadataToPod(app *rayv1alpha1.RayCluster, pod *v1.Pod)
}

// BatchSchedulerFactory handles initial setup of the scheduler plugin by registering the
Expand Down Expand Up @@ -49,11 +49,11 @@ func (d *DefaultBatchScheduler) Name() string {
return GetDefaultPluginName()
}

func (d *DefaultBatchScheduler) DoBatchSchedulingOnSubmission(app *rayiov1alpha1.RayCluster) error {
func (d *DefaultBatchScheduler) DoBatchSchedulingOnSubmission(app *rayv1alpha1.RayCluster) error {
return nil
}

func (d *DefaultBatchScheduler) AddMetadataToPod(app *rayiov1alpha1.RayCluster, pod *v1.Pod) {
func (d *DefaultBatchScheduler) AddMetadataToPod(app *rayv1alpha1.RayCluster, pod *v1.Pod) {
}

func (df *DefaultBatchSchedulerFactory) New(config *rest.Config) (BatchScheduler, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/builder"

rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
schedulerinterface "github.com/ray-project/kuberay/ray-operator/controllers/ray/batchscheduler/interface"
"github.com/ray-project/kuberay/ray-operator/controllers/ray/batchscheduler/volcano"
"github.com/ray-project/kuberay/ray-operator/controllers/ray/common"
Expand Down Expand Up @@ -54,7 +54,7 @@ func NewSchedulerManager(config *rest.Config) *SchedulerManager {
return &manager
}

func (batch *SchedulerManager) GetSchedulerForCluster(app *rayiov1alpha1.RayCluster) (schedulerinterface.BatchScheduler, error) {
func (batch *SchedulerManager) GetSchedulerForCluster(app *rayv1alpha1.RayCluster) (schedulerinterface.BatchScheduler, error) {
if schedulerName, ok := app.ObjectMeta.Labels[common.RaySchedulerName]; ok {
return batch.GetScheduler(schedulerName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/client-go/rest"

"github.com/go-logr/logr"
rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/source"
Expand Down Expand Up @@ -48,7 +48,7 @@ func (v *VolcanoBatchScheduler) Name() string {
return GetPluginName()
}

func (v *VolcanoBatchScheduler) DoBatchSchedulingOnSubmission(app *rayiov1alpha1.RayCluster) error {
func (v *VolcanoBatchScheduler) DoBatchSchedulingOnSubmission(app *rayv1alpha1.RayCluster) error {
var minMember int32
var totalResource corev1.ResourceList
if app.Spec.EnableInTreeAutoscaling == nil || !*app.Spec.EnableInTreeAutoscaling {
Expand All @@ -65,11 +65,11 @@ func (v *VolcanoBatchScheduler) DoBatchSchedulingOnSubmission(app *rayiov1alpha1
return nil
}

func (v *VolcanoBatchScheduler) getAppPodGroupName(app *rayiov1alpha1.RayCluster) string {
func (v *VolcanoBatchScheduler) getAppPodGroupName(app *rayv1alpha1.RayCluster) string {
return fmt.Sprintf("ray-%s-pg", app.Name)
}

func (v *VolcanoBatchScheduler) syncPodGroup(app *rayiov1alpha1.RayCluster, size int32, totalResource corev1.ResourceList) error {
func (v *VolcanoBatchScheduler) syncPodGroup(app *rayv1alpha1.RayCluster, size int32, totalResource corev1.ResourceList) error {
podGroupName := v.getAppPodGroupName(app)
if pg, err := v.volcanoClient.SchedulingV1beta1().PodGroups(app.Namespace).Get(context.TODO(), podGroupName, metav1.GetOptions{}); err != nil {
if !errors.IsNotFound(err) {
Expand Down Expand Up @@ -104,7 +104,7 @@ func (v *VolcanoBatchScheduler) syncPodGroup(app *rayiov1alpha1.RayCluster, size
}

func createPodGroup(
app *rayiov1alpha1.RayCluster,
app *rayv1alpha1.RayCluster,
podGroupName string,
size int32,
totalResource corev1.ResourceList,
Expand All @@ -114,7 +114,7 @@ func createPodGroup(
Namespace: app.Namespace,
Name: podGroupName,
OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(app, rayiov1alpha1.SchemeGroupVersion.WithKind("RayCluster")),
*metav1.NewControllerRef(app, rayv1alpha1.SchemeGroupVersion.WithKind("RayCluster")),
},
},
Spec: v1beta1.PodGroupSpec{
Expand All @@ -137,7 +137,7 @@ func createPodGroup(
return podGroup
}

func (v *VolcanoBatchScheduler) AddMetadataToPod(app *rayiov1alpha1.RayCluster, pod *corev1.Pod) {
func (v *VolcanoBatchScheduler) AddMetadataToPod(app *rayv1alpha1.RayCluster, pod *corev1.Pod) {
pod.Annotations[v1beta1.KubeGroupNameAnnotationKey] = v.getAppPodGroupName(app)
if queue, ok := app.ObjectMeta.Labels[QueueNameLabelKey]; ok {
pod.Labels[QueueNameLabelKey] = queue
Expand Down Expand Up @@ -187,6 +187,6 @@ func (vf *VolcanoBatchSchedulerFactory) ConfigureReconciler(b *builder.Builder)
return b.
Watches(&source.Kind{Type: &v1beta1.PodGroup{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &rayiov1alpha1.RayCluster{},
OwnerType: &rayv1alpha1.RayCluster{},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package volcano
import (
"testing"

rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
"github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -52,19 +52,19 @@ func TestCreatePodGroup(t *testing.T) {
},
}

cluster := rayiov1alpha1.RayCluster{
cluster := rayv1alpha1.RayCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "raycluster-sample",
Namespace: "default",
},
Spec: rayiov1alpha1.RayClusterSpec{
HeadGroupSpec: rayiov1alpha1.HeadGroupSpec{
Spec: rayv1alpha1.RayClusterSpec{
HeadGroupSpec: rayv1alpha1.HeadGroupSpec{
Template: corev1.PodTemplateSpec{
Spec: headSpec,
},
Replicas: pointer.Int32Ptr(1),
},
WorkerGroupSpecs: []rayiov1alpha1.WorkerGroupSpec{
WorkerGroupSpecs: []rayv1alpha1.WorkerGroupSpec{
{
Template: corev1.PodTemplateSpec{
Spec: workerSpec,
Expand Down
10 changes: 5 additions & 5 deletions ray-operator/controllers/ray/common/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"

rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
"github.com/sirupsen/logrus"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -15,10 +15,10 @@ const IngressClassAnnotationKey = "kubernetes.io/ingress.class"

// BuildIngressForHeadService Builds the ingress for head service dashboard.
// This is used to expose dashboard for external traffic.
func BuildIngressForHeadService(cluster rayiov1alpha1.RayCluster) (*networkingv1.Ingress, error) {
func BuildIngressForHeadService(cluster rayv1alpha1.RayCluster) (*networkingv1.Ingress, error) {
labels := map[string]string{
RayClusterLabelKey: cluster.Name,
RayIDLabelKey: utils.GenerateIdentifier(cluster.Name, rayiov1alpha1.HeadNode),
RayIDLabelKey: utils.GenerateIdentifier(cluster.Name, rayv1alpha1.HeadNode),
KubernetesApplicationNameLabelKey: ApplicationName,
KubernetesCreatedByLabelKey: ComponentName,
}
Expand Down Expand Up @@ -94,7 +94,7 @@ func BuildIngressForHeadService(cluster rayiov1alpha1.RayCluster) (*networkingv1
// BuildIngressForRayService Builds the ingress for head service dashboard for RayService.
// This is used to expose dashboard for external traffic.
// RayService controller updates the ingress whenever a new RayCluster serves the traffic.
func BuildIngressForRayService(service rayiov1alpha1.RayService, cluster rayiov1alpha1.RayCluster) (*networkingv1.Ingress, error) {
func BuildIngressForRayService(service rayv1alpha1.RayService, cluster rayv1alpha1.RayCluster) (*networkingv1.Ingress, error) {
ingress, err := BuildIngressForHeadService(cluster)
if err != nil {
return nil, err
Expand All @@ -104,7 +104,7 @@ func BuildIngressForRayService(service rayiov1alpha1.RayService, cluster rayiov1
ingress.ObjectMeta.Namespace = service.Namespace
ingress.ObjectMeta.Labels = map[string]string{
RayServiceLabelKey: service.Name,
RayIDLabelKey: utils.CheckLabel(utils.GenerateIdentifier(service.Name, rayiov1alpha1.HeadNode)),
RayIDLabelKey: utils.CheckLabel(utils.GenerateIdentifier(service.Name, rayv1alpha1.HeadNode)),
}

return ingress, nil
Expand Down
14 changes: 7 additions & 7 deletions ray-operator/controllers/ray/common/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"

rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"

"github.com/stretchr/testify/assert"

Expand All @@ -15,17 +15,17 @@ import (
"k8s.io/utils/pointer"
)

var instanceWithIngressEnabled = &rayiov1alpha1.RayCluster{
var instanceWithIngressEnabled = &rayv1alpha1.RayCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "raycluster-sample",
Namespace: "default",
Annotations: map[string]string{
IngressClassAnnotationKey: "nginx",
},
},
Spec: rayiov1alpha1.RayClusterSpec{
Spec: rayv1alpha1.RayClusterSpec{
RayVersion: "1.0",
HeadGroupSpec: rayiov1alpha1.HeadGroupSpec{
HeadGroupSpec: rayv1alpha1.HeadGroupSpec{
Replicas: pointer.Int32Ptr(1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Expand All @@ -43,14 +43,14 @@ var instanceWithIngressEnabled = &rayiov1alpha1.RayCluster{
},
}

var instanceWithIngressEnabledWithoutIngressClass = &rayiov1alpha1.RayCluster{
var instanceWithIngressEnabledWithoutIngressClass = &rayv1alpha1.RayCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "raycluster-sample",
Namespace: "default",
},
Spec: rayiov1alpha1.RayClusterSpec{
Spec: rayv1alpha1.RayClusterSpec{
RayVersion: "1.0",
HeadGroupSpec: rayiov1alpha1.HeadGroupSpec{
HeadGroupSpec: rayv1alpha1.HeadGroupSpec{
Replicas: pointer.Int32Ptr(1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Expand Down
Loading
Loading