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

[rayservice] Add support for getting multi-app status #1136

Merged
merged 7 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
40 changes: 26 additions & 14 deletions apiserver/pkg/model/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,10 @@ func PopulateServeConfig(serveConfigSpecs []v1alpha1.ServeConfigSpec) []*api.Ser

func PoplulateRayServiceStatus(serviceName string, serviceStatus v1alpha1.RayServiceStatuses, events []v1.Event) *api.RayServiceStatus {
status := &api.RayServiceStatus{
ApplicationStatus: serviceStatus.ActiveServiceStatus.ApplicationStatus.Status,
ApplicationMessage: serviceStatus.ActiveServiceStatus.ApplicationStatus.Message,
ServeDeploymentStatus: PopulateServeDeploymentStatus(serviceStatus.ActiveServiceStatus.ServeStatuses),
RayServiceEvents: PopulateRayServiceEvent(serviceName, events),
RayClusterName: serviceStatus.ActiveServiceStatus.RayClusterName,
RayClusterState: string(serviceStatus.ActiveServiceStatus.RayClusterStatus.State),
RayServiceEvents: PopulateRayServiceEvent(serviceName, events),
RayClusterName: serviceStatus.ActiveServiceStatus.RayClusterName,
RayClusterState: string(serviceStatus.ActiveServiceStatus.RayClusterStatus.State),
ServeApplicationStatus: PopulateServeApplicationStatus(serviceStatus.ActiveServiceStatus.Applications),
}
status.ServiceEndpoint = map[string]string{}
for name, port := range serviceStatus.ActiveServiceStatus.RayClusterStatus.Endpoints {
Expand All @@ -382,17 +380,31 @@ func PoplulateRayServiceStatus(serviceName string, serviceStatus v1alpha1.RaySer
return status
}

func PopulateServeDeploymentStatus(serveDeploymentStatuses []v1alpha1.ServeDeploymentStatus) []*api.ServeDeploymentStatus {
deploymentStatus := make([]*api.ServeDeploymentStatus, 0)
for _, serveDeploymentStatus := range serveDeploymentStatuses {
func PopulateServeApplicationStatus(serveApplicationStatuses map[string]v1alpha1.AppStatus) []*api.ServeApplicationStatus {
appStatuses := make([]*api.ServeApplicationStatus, 0)
for appName, appStatus := range serveApplicationStatuses {
ds := &api.ServeApplicationStatus{
Name: appName,
Status: appStatus.Status,
Message: appStatus.Message,
ServeDeploymentStatus: PopulateServeDeploymentStatus(appStatus.Deployments),
}
appStatuses = append(appStatuses, ds)
}
return appStatuses
}

func PopulateServeDeploymentStatus(serveDeploymentStatuses map[string]v1alpha1.ServeDeploymentStatus) []*api.ServeDeploymentStatus {
deploymentStatuses := make([]*api.ServeDeploymentStatus, 0)
for deploymentName, deploymentStatus := range serveDeploymentStatuses {
ds := &api.ServeDeploymentStatus{
DeploymentName: serveDeploymentStatus.Name,
Status: serveDeploymentStatus.Status,
Message: serveDeploymentStatus.Message,
DeploymentName: deploymentName,
Status: deploymentStatus.Status,
Message: deploymentStatus.Message,
}
deploymentStatus = append(deploymentStatus, ds)
deploymentStatuses = append(deploymentStatuses, ds)
}
return deploymentStatus
return deploymentStatuses
}

func PopulateRayServiceEvent(serviceName string, events []v1.Event) []*api.RayServiceEvent {
Expand Down
140 changes: 71 additions & 69 deletions helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12144,6 +12144,8 @@ spec:
required:
- importPath
type: object
serveConfigV2:
type: object
serviceUnhealthySecondThreshold:
format: int32
type: integer
Expand All @@ -12153,21 +12155,44 @@ spec:
properties:
activeServiceStatus:
properties:
appStatus:
applicationStatuses:
additionalProperties:
properties:
healthLastUpdateTime:
description: Keep track of how long the service is healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
serveDeploymentStatuses:
additionalProperties:
description: ServeDeploymentStatus defines the current
state of a Serve deployment
properties:
healthLastUpdateTime:
description: Keep track of how long the service is
healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
status:
description: Name, Status, Message are from Ray Dashboard
and represent a Serve deployment's state.
type: string
type: object
type: object
status:
type: string
type: object
description: 'Important: Run "make" to regenerate code after modifying
this file'
properties:
healthLastUpdateTime:
description: Keep track of how long the service is healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
status:
type: string
type: object
dashboardStatus:
description: DashboardStatus defines the current states of Ray
Expand Down Expand Up @@ -12241,10 +12266,18 @@ spec:
state of cluster Important: Run "make" to regenerat'
type: string
type: object
serveDeploymentStatuses:
items:
description: ServeDeploymentStatus defines the current state
of a Serve deployment
type: object
observedGeneration:
description: observedGeneration is the most recent generation observed
for this RayService.
format: int64
type: integer
pendingServiceStatus:
description: Pending Service Status indicates a RayCluster will be
created or is being created.
properties:
applicationStatuses:
additionalProperties:
properties:
healthLastUpdateTime:
description: Keep track of how long the service is healthy.
Expand All @@ -12255,40 +12288,32 @@ spec:
type: string
message:
type: string
name:
description: Name, Status, Message are from Ray Dashboard
and represent a Serve deployment's state.
type: string
serveDeploymentStatuses:
additionalProperties:
description: ServeDeploymentStatus defines the current
state of a Serve deployment
properties:
healthLastUpdateTime:
description: Keep track of how long the service is
healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
status:
description: Name, Status, Message are from Ray Dashboard
and represent a Serve deployment's state.
type: string
type: object
type: object
status:
description: 'TODO: change status type to enum'
type: string
type: object
type: array
type: object
observedGeneration:
description: observedGeneration is the most recent generation observed
for this RayService.
format: int64
type: integer
pendingServiceStatus:
description: Pending Service Status indicates a RayCluster will be
created or is being created.
properties:
appStatus:
description: 'Important: Run "make" to regenerate code after modifying
this file'
properties:
healthLastUpdateTime:
description: Keep track of how long the service is healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
status:
type: string
type: object
dashboardStatus:
description: DashboardStatus defines the current states of Ray
Expand Down Expand Up @@ -12362,29 +12387,6 @@ spec:
state of cluster Important: Run "make" to regenerat'
type: string
type: object
serveDeploymentStatuses:
items:
description: ServeDeploymentStatus defines the current state
of a Serve deployment
properties:
healthLastUpdateTime:
description: Keep track of how long the service is healthy.
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
name:
description: Name, Status, Message are from Ray Dashboard
and represent a Serve deployment's state.
type: string
status:
description: 'TODO: change status type to enum'
type: string
type: object
type: array
type: object
serviceStatus:
description: ServiceStatus indicates the current RayService status.
Expand Down
Loading