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: Dev RayService CR and Controller logic #287

Merged
merged 21 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from 16 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
3 changes: 2 additions & 1 deletion ray-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ COMMIT_SHA1 := $(shell git rev-parse HEAD )
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:maxDescLen=100,trivialVersions=true,preserveUnknownFields=false,generateEmbeddedObjectMeta=true"
# Golang forbids converting float from Json to struct. Need allowDangerousTypes=true to unblock build.
CRD_OPTIONS ?= "crd:maxDescLen=100,trivialVersions=true,preserveUnknownFields=false,generateEmbeddedObjectMeta=true,allowDangerousTypes=true"
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
68 changes: 66 additions & 2 deletions ray-operator/apis/ray/v1alpha1/rayservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,80 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

type ServiceStatus string

const (
FailToGetOrCreateRayCluster ServiceStatus = "FailToGetOrCreateRayCluster"
WaitForDashboard ServiceStatus = "WaitForDashboard"
FailServeDeploy ServiceStatus = "FailServeDeploy"
FailGetServeDeploymentStatus ServiceStatus = "FailGetServeDeploymentStatus"
Running ServiceStatus = "Running"
Restarting ServiceStatus = "Restarting"
FailDeleteRayCluster ServiceStatus = "FailDeleteRayCluster"
)

// RayServiceSpec defines the desired state of RayService
type RayServiceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
ServeConfigSpecs []ServeConfigSpec `json:"serveConfigs,omitempty"`
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
RayClusterSpec RayClusterSpec `json:"rayClusterConfig,omitempty"`
}

// ServeConfigSpec defines the desired state of RayService
// Reference to https://docs.ray.io/en/latest/ray-core/package-ref.html#ray-remote.
type ServeConfigSpec struct {
Name string `json:"name"`
ImportPath string `json:"importPath"`
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
InitArgs []string `json:"initArgs,omitempty"`
InitKwargs map[string]string `json:"initKwargs,omitempty"`
NumReplicas *int32 `json:"numReplicas,omitempty"`
RoutePrefix string `json:"routePrefix,omitempty"`
MaxConcurrentQueries *int32 `json:"maxConcurrentQueries,omitempty"`
UserConfig map[string]string `json:"userConfig,omitempty"`
AutoscalingConfig map[string]string `json:"autoscalingConfig,omitempty"`
GracefulShutdownWaitLoopS *int32 `json:"gracefulShutdownWaitLoopS,omitempty"`
GracefulShutdownTimeoutS *int32 `json:"gracefulShutdownTimeoutS,omitempty"`
HealthCheckPeriodS *int32 `json:"healthCheckPeriodS,omitempty"`
HealthCheckTimeoutS *int32 `json:"healthCheckTimeoutS,omitempty"`
RayActorOptions RayActorOptionSpec `json:"rayActorOptions,omitempty"`
}

// RayActorOptionSpec defines the desired state of RayActor
type RayActorOptionSpec struct {
RuntimeEnv map[string][]string `json:"runtimeEnv,omitempty"`
NumCpus *float64 `json:"numCpus,omitempty"`
NumGpus *float64 `json:"numGpus,omitempty"`
Memory *int32 `json:"memory,omitempty"`
ObjectStoreMemory *int32 `json:"objectStoreMemory,omitempty"`
Resources map[string]string `json:"resources,omitempty"`
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
AcceleratorType string `json:"acceleratorType,omitempty"`
}

// RayServiceStatus defines the observed state of RayService
type RayServiceStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
ServiceStatus ServiceStatus `json:"serviceStatus,omitempty"`
ServeStatuses []ServeDeploymentStatus `json:"serveDeploymentStatuses,omitempty"`
RayClusterName string `json:"rayClusterName,omitempty"`
RayClusterStatus RayClusterStatus `json:"rayClusterStatus,omitempty"`
}

// ServeDeploymentStatuses defines the current states of all Serve Deployments
type ServeDeploymentStatuses struct {
Statuses []ServeDeploymentStatus `json:"statuses,omitempty"`
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
}

// ServeDeploymentStatus defines the current state of Serve Deployment
type ServeDeploymentStatus struct {
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
// Name, Status, Message are from Ray Dashboard to represent the state of a serve deployment.
Name string `json:"name,omitempty"`
// TODO: change status type to enum
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// Keep track of how long the service is healthy.
// Update when Serve Deployment is healthy or first time convert to unhealthy from healthy.
brucez-anyscale marked this conversation as resolved.
Show resolved Hide resolved
HealthLastUpdateTime metav1.Time `json:"healthLastUpdateTime,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
Loading