common

package
v1.1.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0, BSD-2-Clause, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SharedMemoryVolumeName      = "shared-mem"
	SharedMemoryVolumeMountPath = "/dev/shm"
	RayLogVolumeName            = "ray-logs"
	RayLogVolumeMountPath       = "/tmp/ray"
	AutoscalerContainerName     = "autoscaler"
	RayHeadContainer            = "ray-head"
	ObjectStoreMemoryKey        = "object-store-memory"
	// TODO (davidxia): should be a const in upstream ray-project/ray
	AllowSlowStorageEnvVar = "RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE"
	// If set to true, kuberay auto injects an init container waiting for ray GCS.
	// If false, you will need to inject your own init container to ensure ray GCS is up before the ray workers start.
	EnableInitContainerInjectionEnvKey = "ENABLE_INIT_CONTAINER_INJECTION"
)
View Source
const IngressClassAnnotationKey = "kubernetes.io/ingress.class"

Variables

This section is empty.

Functions

func BuildAutoscalerContainer

func BuildAutoscalerContainer(autoscalerImage string) corev1.Container

BuildAutoscalerContainer builds a Ray autoscaler container which can be appended to the head pod.

func BuildHeadServiceForRayService

func BuildHeadServiceForRayService(ctx context.Context, rayService rayv1.RayService, rayCluster rayv1.RayCluster) (*corev1.Service, error)

BuildHeadServiceForRayService Builds the service for a pod. Currently, there is only one service that allows the worker nodes to connect to the head node. RayService controller updates the service whenever a new RayCluster serves the traffic.

func BuildHeadlessServiceForRayCluster added in v1.1.0

func BuildHeadlessServiceForRayCluster(rayCluster rayv1.RayCluster) (*corev1.Service, error)

BuildHeadlessService builds the headless service for workers in multi-host worker groups to communicate

func BuildIngressForHeadService

func BuildIngressForHeadService(ctx context.Context, cluster rayv1.RayCluster) (*networkingv1.Ingress, error)

BuildIngressForHeadService Builds the ingress for head service dashboard. This is used to expose dashboard for external traffic.

func BuildPod

func BuildPod(ctx context.Context, podTemplateSpec corev1.PodTemplateSpec, rayNodeType rayv1.RayNodeType, rayStartParams map[string]string, headPort string, enableRayAutoscaler *bool, creatorCRDType utils.CRDType, fqdnRayIP string) (aPod corev1.Pod)

BuildPod a pod config

func BuildRole

func BuildRole(cluster *rayv1.RayCluster) (*rbacv1.Role, error)

BuildRole creates a new Role for an RayCluster resource.

func BuildRoleBinding

func BuildRoleBinding(cluster *rayv1.RayCluster) (*rbacv1.RoleBinding, error)

BuildRole

func BuildRouteForHeadService added in v1.0.0

func BuildRouteForHeadService(cluster rayv1.RayCluster) (*routev1.Route, error)

BuildRouteForHeadService Builds the Route (OpenShift) for head service dashboard. This is used to expose dashboard and remote submit service apis or external traffic.

func BuildServeService added in v1.1.0

func BuildServeService(ctx context.Context, rayService rayv1.RayService, rayCluster rayv1.RayCluster, isRayService bool) (*corev1.Service, error)

BuildServeService builds the service for head node and worker nodes who have healthy http proxy to serve traffics.

func BuildServeServiceForRayCluster added in v1.1.0

func BuildServeServiceForRayCluster(ctx context.Context, rayCluster rayv1.RayCluster) (*corev1.Service, error)

BuildServeServiceForRayCluster builds the serve service for Ray cluster.

func BuildServeServiceForRayService

func BuildServeServiceForRayService(ctx context.Context, rayService rayv1.RayService, rayCluster rayv1.RayCluster) (*corev1.Service, error)

BuildServeServiceForRayService builds the serve service for RayService.

func BuildServiceAccount

func BuildServiceAccount(cluster *rayv1.RayCluster) (*corev1.ServiceAccount, error)

BuildServiceAccount creates a new ServiceAccount for a head pod with autoscaler.

func BuildServiceForHeadPod

func BuildServiceForHeadPod(ctx context.Context, cluster rayv1.RayCluster, labels map[string]string, annotations map[string]string) (*corev1.Service, error)

BuildServiceForHeadPod Builds the service for a pod. Currently, there is only one service that allows the worker nodes to connect to the head node.

func CreatedClustersCounterInc

func CreatedClustersCounterInc(namespace string)

func DefaultHeadPodTemplate

func DefaultHeadPodTemplate(ctx context.Context, instance rayv1.RayCluster, headSpec rayv1.HeadGroupSpec, podName string, headPort string) corev1.PodTemplateSpec

DefaultHeadPodTemplate sets the config values

func DefaultWorkerPodTemplate

func DefaultWorkerPodTemplate(ctx context.Context, instance rayv1.RayCluster, workerSpec rayv1.WorkerGroupSpec, podName string, fqdnRayIP string, headPort string) corev1.PodTemplateSpec

DefaultWorkerPodTemplate sets the config values

func DeletedClustersCounterInc

func DeletedClustersCounterInc(namespace string)

TODO: We don't handle the delete events in new reconciler mode, how to emit deletion metrics?

func FailedClustersCounterInc

func FailedClustersCounterInc(namespace string)

func GetBaseRayJobCommand added in v0.6.0

func GetBaseRayJobCommand(address string) []string

GetBaseRayJobCommand returns the first part of the Ray Job command up to and including the address, e.g. "ray job submit --address http://..."

func GetDefaultSubmitterTemplate added in v0.6.0

func GetDefaultSubmitterTemplate(rayClusterInstance *rayv1.RayCluster) corev1.PodTemplateSpec

GetDefaultSubmitterTemplate creates a default submitter template for the Ray job.

func GetHeadPort

func GetHeadPort(headStartParams map[string]string) string

Get the port required to connect to the Ray cluster by worker nodes and drivers started within the cluster. For Ray >= 1.11.0 this is the GCS server port. For Ray < 1.11.0 it is the Redis port.

func GetK8sJobCommand added in v0.6.0

func GetK8sJobCommand(rayJobInstance *rayv1.RayJob) ([]string, error)

GetK8sJobCommand builds the K8s job command for the Ray job.

func GetMetadataJson added in v0.6.0

func GetMetadataJson(metadata map[string]string, rayVersion string) (string, error)

GetMetadataJson returns the JSON string of the metadata for the Ray job.

func HeadServiceLabels

func HeadServiceLabels(cluster rayv1.RayCluster) map[string]string

HeadServiceLabels returns the default labels for a cluster's head service.

func IsGCSFaultToleranceEnabled added in v1.0.0

func IsGCSFaultToleranceEnabled(instance rayv1.RayCluster) bool

Check if the RayCluster has GCS fault tolerance enabled.

func RayClusterAutoscalerRoleBindingNamespacedName added in v1.1.0

func RayClusterAutoscalerRoleBindingNamespacedName(instance *rayv1.RayCluster) types.NamespacedName

func RayClusterAutoscalerRoleNamespacedName added in v1.1.0

func RayClusterAutoscalerRoleNamespacedName(instance *rayv1.RayCluster) types.NamespacedName

func RayClusterAutoscalerServiceAccountNamespacedName added in v1.1.0

func RayClusterAutoscalerServiceAccountNamespacedName(instance *rayv1.RayCluster) types.NamespacedName

func RayClusterHeadlessServiceListOptions added in v1.1.0

func RayClusterHeadlessServiceListOptions(instance *rayv1.RayCluster) []client.ListOption

func RayClusterServeServiceNamespacedName added in v1.1.0

func RayClusterServeServiceNamespacedName(instance *rayv1.RayCluster) types.NamespacedName

func RayJobK8sJobNamespacedName added in v1.1.0

func RayJobK8sJobNamespacedName(rayJob *rayv1.RayJob) types.NamespacedName

RayJobK8sJobNamespacedName is the only place to associate the RayJob with the submitter Kubernetes Job.

func RayJobRayClusterNamespacedName added in v1.1.0

func RayJobRayClusterNamespacedName(rayJob *rayv1.RayJob) types.NamespacedName

func RayServiceActiveRayClusterNamespacedName added in v1.1.0

func RayServiceActiveRayClusterNamespacedName(rayService *rayv1.RayService) types.NamespacedName

func RayServicePendingRayClusterNamespacedName added in v1.1.0

func RayServicePendingRayClusterNamespacedName(rayService *rayv1.RayService) types.NamespacedName

func RayServiceServeServiceNamespacedName added in v1.1.0

func RayServiceServeServiceNamespacedName(rayService *rayv1.RayService) types.NamespacedName

func SuccessfulClustersCounterInc

func SuccessfulClustersCounterInc(namespace string)

func ValidateHeadRayStartParams

func ValidateHeadRayStartParams(ctx context.Context, rayHeadGroupSpec rayv1.HeadGroupSpec) (isValid bool, err error)

ValidateHeadRayStartParams will validate the head node's RayStartParams. Return a bool indicating the validity of RayStartParams and an err with additional information. If isValid is true, RayStartParams are valid. Any errors will only affect performance. If isValid is false, RayStartParams are invalid will result in an unhealthy or failed Ray cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL