mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
Ray Kubernetes Operator Part 1: readme, structure, config and CRD realted file (#6332)
* Ray-Operator first PR 1.RayCluster CRD and CR, structure code in golang 2.config file in Kubernetes * Delete go.sum * Ray-Operator first PR 1.add directory structure 2.add guide for submitting RayCluster * Delete ray_v1_raycluster.bk.yaml * Ray-Operator first PR 1.delete file bk 2.add more description about kubernetes and ray-operator features * Ray-Operator first PR: adjust grammar * Ray-Operator first PR: add More Information about proposal * Ray-Operator first PR: 1.add heterogeneous version of CR 2.add reference ot key words, and reference links to the props in yaml 3.file structure to yaml level and function description * Ray-Operator first PR: add ray operator proposal doc * Ray-Operator first PR: add More Information about proposal * Ray-Operator first PR: add command to start * Ray-Operator first PR: add More Information about proposal * Update deploy/ray-operator/README.md Co-Authored-By: Edward Oakes <ed.nmi.oakes@gmail.com> * Update deploy/ray-operator/api/v1/raycluster_types.go Co-Authored-By: Edward Oakes <ed.nmi.oakes@gmail.com> * Update deploy/ray-operator/api/v1/raycluster_types.go Co-Authored-By: Edward Oakes <ed.nmi.oakes@gmail.com> * Ray-Operator first PR: add More Information about proposal * Ray-Operator first PR: remove License * Ray-Operator first PR: rename version from v1 to v1alpha1 * Ray-Operator first PR: use replicas instead of numNodes * Ray-Operator first PR: update replicas in CR yaml file * Ray-Operator first PR: add More Information about proposal
This commit is contained in:
committed by
Edward Oakes
co-authored by
Edward Oakes
parent
b88b8202cc
commit
ed294f4c23
@@ -0,0 +1,20 @@
|
||||
// Package v1alpha1 contains API Schema definitions for the ray v1alpha1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=ray.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
GroupVersion = schema.GroupVersion{Group: "ray.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
@@ -0,0 +1,137 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// 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.
|
||||
|
||||
// RayClusterSpec defines the desired state of RayCluster
|
||||
type RayClusterSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
// ClusterName is unique identifier for RayCluster in one namespace.
|
||||
ClusterName string `json:"clusterName"`
|
||||
// Docker image.
|
||||
Images RayClusterImage `json:"images"`
|
||||
// Image pull policy.
|
||||
// One of Always, Never, IfNotPresent.
|
||||
// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
|
||||
// Cannot be updated.
|
||||
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
|
||||
// Specification of the desired behavior of pod group
|
||||
Extensions []Extension `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
// RayCluster pod type
|
||||
type ReplicaType string
|
||||
|
||||
const (
|
||||
// ReplicaTypeHead means that this pod will be ray cluster head
|
||||
ReplicaTypeHead ReplicaType = "head"
|
||||
// ReplicaTypeWorker means that this pod will be ray cluster worker
|
||||
ReplicaTypeWorker ReplicaType = "worker"
|
||||
)
|
||||
|
||||
// RayClusterStatus defines the observed state of RayCluster
|
||||
type RayClusterStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// RayCluster is the Schema for the RayClusters API
|
||||
type RayCluster struct {
|
||||
// Standard object metadata.
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Specification of the desired behavior of the RayCluster.
|
||||
Spec RayClusterSpec `json:"spec,omitempty"`
|
||||
Status RayClusterStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// RayClusterList contains a list of RayCluster
|
||||
type RayClusterList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []RayCluster `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&RayCluster{}, &RayClusterList{})
|
||||
}
|
||||
|
||||
type RayClusterImage struct {
|
||||
// Default docker image
|
||||
DefaultImage string `json:"defaultImage,omitempty"`
|
||||
}
|
||||
|
||||
type Extension struct {
|
||||
// Number of desired pods in this pod group. This is a pointer to distinguish between explicit
|
||||
// zero and not specified. Defaults to 1.
|
||||
Replicas *int32 `json:"replicas"`
|
||||
|
||||
// The pod type in this group worker/head.
|
||||
Type ReplicaType `json:"type,omitempty"`
|
||||
|
||||
// Pod docker image
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
// Logical groupName for worker in same group, it's used for heterogeneous feature to distinguish different groups.
|
||||
// GroupName is the unique identifier for the pods with the same configuration in one Ray Cluster
|
||||
GroupName string `json:"groupName,omitempty"`
|
||||
|
||||
// Command to start ray
|
||||
Command string `json:"command,omitempty"`
|
||||
|
||||
// Labels for pod, raycluster.component and rayclusters.ray.io/component-name are default labels, do not overwrite them.
|
||||
// Labels are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users,
|
||||
// but do not directly imply semantics to the core system. Labels can be used to organize and to select subsets of objects.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
|
||||
// NodeSelector specifies a map of key-value pairs. For the pod to be eligible
|
||||
// to run on a node, the node must have each of the indicated key-value pairs as
|
||||
// labels. Optional.
|
||||
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
|
||||
|
||||
// Affinity is a group of affinity scheduling rules. Optional.
|
||||
// It allows you to constrain which nodes your pod is eligible to be scheduled on, based on labels on the node.
|
||||
Affinity *v1.Affinity `json:"affinity,omitempty"`
|
||||
|
||||
// ResourceRequirements describes the compute resource requirements.
|
||||
Resources v1.ResourceRequirements `json:"resources,omitempty"`
|
||||
|
||||
// The pod this Toleration is attached to tolerates any taint that matches
|
||||
// the triple <key,value,effect> using the matching operator <operator>. Optional.
|
||||
// Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints.
|
||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||
|
||||
// EnvVar represents an environment variable present in a Container. Optional.
|
||||
// Define environment variables for a container. This can be helpful in defining variables before setting up the container.
|
||||
ContainerEnv []v1.EnvVar `json:"containerEnv,omitempty"`
|
||||
|
||||
// Head service suffix. So head can be accessed by domain name: {namespace}.svc , follows Kubernetes standard.
|
||||
HeadServiceSuffix string `json:"headServiceSuffix,omitempty"`
|
||||
|
||||
// Annotations is an unstructured key value map stored with a resource that may be
|
||||
// set by external tools to store and retrieve arbitrary metadata. They are not
|
||||
// queryable and should be preserved when modifying objects. Optional.
|
||||
// Usage refers to https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
|
||||
// Volume represents a named volume in a pod that may be accessed by any container in the pod. Optional.
|
||||
// At its core, a volume is just a directory, possibly with some data in it, which is accessible to the Containers in a Pod.
|
||||
Volumes []v1.Volume `json:"volumes,omitempty"`
|
||||
|
||||
// VolumeMount describes a mounting of a Volume within a container. Optional.
|
||||
VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Extension) DeepCopyInto(out *Extension) {
|
||||
*out = *in
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.NodeSelector != nil {
|
||||
in, out := &in.NodeSelector, &out.NodeSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Affinity != nil {
|
||||
in, out := &in.Affinity, &out.Affinity
|
||||
*out = new(corev1.Affinity)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.Resources.DeepCopyInto(&out.Resources)
|
||||
if in.Tolerations != nil {
|
||||
in, out := &in.Tolerations, &out.Tolerations
|
||||
*out = make([]corev1.Toleration, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.ContainerEnv != nil {
|
||||
in, out := &in.ContainerEnv, &out.ContainerEnv
|
||||
*out = make([]corev1.EnvVar, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Volumes != nil {
|
||||
in, out := &in.Volumes, &out.Volumes
|
||||
*out = make([]corev1.Volume, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.VolumeMounts != nil {
|
||||
in, out := &in.VolumeMounts, &out.VolumeMounts
|
||||
*out = make([]corev1.VolumeMount, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Extension.
|
||||
func (in *Extension) DeepCopy() *Extension {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Extension)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RayCluster) DeepCopyInto(out *RayCluster) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayCluster.
|
||||
func (in *RayCluster) DeepCopy() *RayCluster {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RayCluster)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RayCluster) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RayClusterImage) DeepCopyInto(out *RayClusterImage) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayClusterImage.
|
||||
func (in *RayClusterImage) DeepCopy() *RayClusterImage {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RayClusterImage)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RayClusterList) DeepCopyInto(out *RayClusterList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]RayCluster, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayClusterList.
|
||||
func (in *RayClusterList) DeepCopy() *RayClusterList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RayClusterList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RayClusterList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RayClusterSpec) DeepCopyInto(out *RayClusterSpec) {
|
||||
*out = *in
|
||||
out.Images = in.Images
|
||||
if in.Extensions != nil {
|
||||
in, out := &in.Extensions, &out.Extensions
|
||||
*out = make([]Extension, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayClusterSpec.
|
||||
func (in *RayClusterSpec) DeepCopy() *RayClusterSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RayClusterSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RayClusterStatus) DeepCopyInto(out *RayClusterStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RayClusterStatus.
|
||||
func (in *RayClusterStatus) DeepCopy() *RayClusterStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RayClusterStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user