Skip to content

Commit

Permalink
[autoscaler] Better defaults and config options (ray-project#414)
Browse files Browse the repository at this point in the history
This PR wraps up autoscaler-related work for the Ray 2.0.0 release.
  • Loading branch information
DmitriGekhtman authored Jul 26, 2022
1 parent 35f7839 commit 068edd4
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 40 deletions.
19 changes: 12 additions & 7 deletions ray-operator/apis/ray/v1alpha1/raycluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,28 @@ type ScaleStrategy struct {

// AutoscalerOptions specifies optional configuration for the Ray autoscaler.
type AutoscalerOptions struct {
// Resources specifies resource requests and limits for the autoscaler container.
// Default values: 256m CPU request, 512m CPU limit, 256Mi memory request, 512Mi memory limit.
// Resources specifies optional resource request and limit overrides for the autoscaler container.
// Default values: 500m CPU request and limit. 512Mi memory request and limit.
Resources *v1.ResourceRequirements `json:"resources,omitempty"`
// Image optionally overrides the autoscaler's container image. This override is for provided for autoscaler testing and development.
Image *string `json:"image,omitempty"`
// ImagePullPolicy optionally overrides the autoscaler container's image pull policy. This override is for provided for autoscaler testing and development.
ImagePullPolicy *v1.PullPolicy `json:"imagePullPolicy,omitempty"`
// Optional list of environment variables to set in the autoscaler container.
Env []v1.EnvVar `json:"env,omitempty"`
// Optional list of sources to populate environment variables in the autoscaler container.
EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty"`
// IdleTimeoutSeconds is the number of seconds to wait before scaling down a worker pod which is not using Ray resources.
// Defaults to 300 (five minutes).
// Defaults to 60 (one minute).
IdleTimeoutSeconds *int32 `json:"idleTimeoutSeconds,omitempty"`
// UpscalingMode is "Default" or "Aggressive."
// Default: Upscaling is rate-limited; the number of pending worker pods is at most the size of the Ray cluster.
// Aggressive: Upscaling is not rate-limited.
// UpscalingMode is "Conservative", "Default", or "Aggressive."
// Conservative: Upscaling is rate-limited; the number of pending worker pods is at most the size of the Ray cluster.
// Default: Upscaling is not rate-limited.
// Aggressive: An alias for Default; upscaling is not rate-limited.
UpscalingMode *UpscalingMode `json:"upscalingMode,omitempty"`
}

// +kubebuilder:validation:Enum=Default;Aggressive
// +kubebuilder:validation:Enum=Default;Aggressive;Conservative
type UpscalingMode string

// The overall state of the Ray cluster.
Expand Down
14 changes: 14 additions & 0 deletions ray-operator/apis/ray/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 133 additions & 3 deletions ray-operator/config/crd/bases/ray.io_rayclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,135 @@ spec:
description: AutoscalerOptions specifies optional configuration for
the Ray autoscaler.
properties:
env:
description: Optional list of environment variables to set in
the autoscaler container.
items:
description: EnvVar represents an environment variable present
in a Container.
properties:
name:
description: Name of the environment variable. Must be a
C_IDENTIFIER.
type: string
value:
description: Variable references $(VAR_NAME) are expanded
using the previously defined environment variables in
t
type: string
valueFrom:
description: Source for the environment variable's value.
Cannot be used if value is not empty.
properties:
configMapKeyRef:
description: Selects a key of a ConfigMap.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.'
type: string
optional:
description: Specify whether the ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
fieldRef:
description: 'Selects a field of the pod: supports metadata.name,
metadata.namespace, `metadata.'
properties:
apiVersion:
description: Version of the schema the FieldPath
is written in terms of, defaults to "v1".
type: string
fieldPath:
description: Path of the field to select in the
specified API version.
type: string
required:
- fieldPath
type: object
resourceFieldRef:
description: 'Selects a resource of the container: only
resources limits and requests (limits.cpu, limits.'
properties:
containerName:
description: 'Container name: required for volumes,
optional for env vars'
type: string
divisor:
anyOf:
- type: integer
- type: string
description: Specifies the output format of the
exposed resources, defaults to "1"
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
resource:
description: 'Required: resource to select'
type: string
required:
- resource
type: object
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.'
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
type: object
required:
- name
type: object
type: array
envFrom:
description: Optional list of sources to populate environment
variables in the autoscaler container.
items:
description: EnvFromSource represents the source of a set of
ConfigMaps
properties:
configMapRef:
description: The ConfigMap to select from
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.'
type: string
optional:
description: Specify whether the ConfigMap must be defined
type: boolean
type: object
prefix:
description: An optional identifier to prepend to each key
in the ConfigMap. Must be a C_IDENTIFIER.
type: string
secretRef:
description: The Secret to select from
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.'
type: string
optional:
description: Specify whether the Secret must be defined
type: boolean
type: object
type: object
type: array
idleTimeoutSeconds:
description: IdleTimeoutSeconds is the number of seconds to wait
before scaling down a worker pod which is not us
Expand All @@ -52,8 +181,8 @@ spec:
container's image pull policy.
type: string
resources:
description: Resources specifies resource requests and limits
for the autoscaler container.
description: Resources specifies optional resource request and
limit overrides for the autoscaler container.
properties:
limits:
additionalProperties:
Expand All @@ -77,10 +206,11 @@ spec:
type: object
type: object
upscalingMode:
description: UpscalingMode is "Default" or "Aggressive.
description: UpscalingMode is "Conservative", "Default", or "Aggressive.
enum:
- Default
- Aggressive
- Conservative
type: string
type: object
enableInTreeAutoscaling:
Expand Down
Loading

0 comments on commit 068edd4

Please sign in to comment.