Skip to content

Commit

Permalink
[Feature] The default ImagePullPolicy should be IfNotPresent (#947)
Browse files Browse the repository at this point in the history
The default ImagePullPolicy should be IfNotPresent
  • Loading branch information
kevin85421 authored Mar 17, 2023
1 parent 480e128 commit 71e260f
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 34 deletions.
4 changes: 2 additions & 2 deletions clients/python-client/examples/use-raw-config_map_with-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"name": "raycluster-getting-started"
},
"spec": {
"rayVersion": "2.2.0",
"rayVersion": "2.3.0",
"headGroupSpec": {
"rayStartParams": {
"dashboard-host": "0.0.0.0",
Expand All @@ -59,7 +59,7 @@
"containers": [
{
"name": "ray-head",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"volumeMounts": [
{
"mountPath": "/opt",
Expand Down
10 changes: 5 additions & 5 deletions clients/python-client/examples/use-raw-with-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"name": "raycluster-mini-raw",
},
"spec": {
"rayVersion": "2.2.0",
"rayVersion": "2.3.0",
"headGroupSpec": {
"rayStartParams": {
"dashboard-host": "0.0.0.0",
Expand All @@ -40,7 +40,7 @@
"containers": [
{
"name": "ray-head",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"resources": {
"limits": {"cpu": 1, "memory": "2Gi"},
"requests": {"cpu": "500m", "memory": "2Gi"},
Expand All @@ -67,7 +67,7 @@
"name": "raycluster-complete-raw",
},
"spec": {
"rayVersion": "2.2.0",
"rayVersion": "2.3.0",
"headGroupSpec": {
"serviceType": "ClusterIP",
"rayStartParams": {"dashboard-host": "0.0.0.0", "block": "true"},
Expand All @@ -77,7 +77,7 @@
"containers": [
{
"name": "ray-head",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"ports": [
{"containerPort": 6379, "name": "gcs"},
{"containerPort": 8265, "name": "dashboard"},
Expand Down Expand Up @@ -113,7 +113,7 @@
"containers": [
{
"name": "ray-worker",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"lifecycle": {
"preStop": {
"exec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ def build_meta(
name: str,
k8s_namespace: str = "default",
labels: dict = None,
ray_version: str = "2.2.0",
ray_version: str = "2.3.0",
):
"""Builds the metadata and ray version of the cluster.
Parameters:
- name (str): The name of the cluster.
- k8s_namespace (str, optional): The namespace in which the Ray cluster exists. Defaults to "default".
- labels (dict, optional): A dictionary of key-value pairs to add as labels to the cluster. Defaults to None.
- ray_version (str, optional): The version of Ray to use for the cluster. Defaults to "2.2.0".
- ray_version (str, optional): The version of Ray to use for the cluster. Defaults to "2.3.0".
"""
self.cluster = self.cluster_utils.populate_meta(
cluster=self.cluster,
Expand All @@ -81,7 +81,7 @@ def build_meta(

def build_head(
self,
ray_image: str = "rayproject/ray:2.2.0",
ray_image: str = "rayproject/ray:2.3.0",
service_type: str = "ClusterIP",
cpu_requests: str = "2",
memory_requests: str = "3G",
Expand All @@ -95,7 +95,7 @@ def build_head(
"""Build head node of the ray cluster.
Parameters:
- ray_image (str): Docker image for the head node. Default value is "rayproject/ray:2.2.0".
- ray_image (str): Docker image for the head node. Default value is "rayproject/ray:2.3.0".
- service_type (str): Service type of the head node. Default value is "ClusterIP".
- cpu_requests (str): CPU requests for the head node. Default value is "2".
- memory_requests (str): Memory requests for the head node. Default value is "3G".
Expand All @@ -119,7 +119,7 @@ def build_head(
def build_worker(
self,
group_name: str,
ray_image: str = "rayproject/ray:2.2.0",
ray_image: str = "rayproject/ray:2.3.0",
ray_command: Any = ["/bin/bash", "-lc"],
init_image: str = "busybox:1.28",
cpu_requests: str = "1",
Expand All @@ -139,7 +139,7 @@ def build_worker(
Parameters:
- group_name (str): name of the worker group.
- ray_image (str, optional): Docker image for the Ray process. Default is "rayproject/ray:2.2.0".
- ray_image (str, optional): Docker image for the Ray process. Default is "rayproject/ray:2.3.0".
- ray_command (Any, optional): Command to run in the Docker container. Default is ["/bin/bash", "-lc"].
- init_image (str, optional): Docker image for the init container. Default is "busybox:1.28".
- cpu_requests (str, optional): CPU requests for the worker pods. Default is "1".
Expand Down
8 changes: 4 additions & 4 deletions clients/python-client/python_client_test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "raycluster-complete-raw",
},
"spec": {
"rayVersion": "2.2.0",
"rayVersion": "2.3.0",
"headGroupSpec": {
"serviceType": "ClusterIP",
"rayStartParams": {"dashboard-host": "0.0.0.0", "block": "true"},
Expand All @@ -24,7 +24,7 @@
"containers": [
{
"name": "ray-head",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"ports": [
{"containerPort": 6379, "name": "gcs"},
{"containerPort": 8265, "name": "dashboard"},
Expand Down Expand Up @@ -60,7 +60,7 @@
"containers": [
{
"name": "ray-worker",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"lifecycle": {
"preStop": {
"exec": {
Expand All @@ -78,7 +78,7 @@
},
{
"name": "side-car",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"resources": {
"limits": {"cpu": "1", "memory": "1G"},
"requests": {"cpu": "500m", "memory": "1G"},
Expand Down
8 changes: 4 additions & 4 deletions clients/python-client/python_client_test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "raycluster-complete-raw",
},
"spec": {
"rayVersion": "2.2.0",
"rayVersion": "2.3.0",
"headGroupSpec": {
"serviceType": "ClusterIP",
"rayStartParams": {"dashboard-host": "0.0.0.0", "block": "true"},
Expand All @@ -23,7 +23,7 @@
"containers": [
{
"name": "ray-head",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"ports": [
{"containerPort": 6379, "name": "gcs"},
{"containerPort": 8265, "name": "dashboard"},
Expand Down Expand Up @@ -59,7 +59,7 @@
"containers": [
{
"name": "ray-worker",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"lifecycle": {
"preStop": {
"exec": {
Expand All @@ -77,7 +77,7 @@
},
{
"name": "side-car",
"image": "rayproject/ray:2.2.0",
"image": "rayproject/ray:2.3.0",
"resources": {
"limits": {"cpu": "1", "memory": "1G"},
"requests": {"cpu": "500m", "memory": "1G"},
Expand Down
6 changes: 5 additions & 1 deletion helm-chart/ray-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

image:
repository: rayproject/ray
tag: 2.0.0
tag: 2.3.0
pullPolicy: IfNotPresent

nameOverride: "kuberay"
Expand All @@ -25,7 +25,11 @@ head:
# The example configuration shown below below represents the DEFAULT values.
# autoscalerOptions:
# upscalingMode: Default
# idleTimeoutSeconds is the number of seconds to wait before scaling down a worker pod which is not using Ray resources.
# idleTimeoutSeconds: 60
# imagePullPolicy optionally overrides the autoscaler container's default image pull policy (IfNotPresent).
# imagePullPolicy: IfNotPresent
# Optionally specify the autoscaler container's securityContext.
# securityContext: {}
# env: []
# envFrom: []
Expand Down
5 changes: 2 additions & 3 deletions ray-operator/config/samples/ray-cluster.autoscaler.large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ spec:
# If instance.spec.rayVersion is at least "2.0.0", the autoscaler will default to the same image as
# the ray container by. For older Ray versions, the autoscaler will default to using the Ray 2.0.0 image.
## image: "my-repo/my-custom-autoscaler-image:tag"
# imagePullPolicy optionally overrides the autoscaler container's image pull policy.
imagePullPolicy: Always
# imagePullPolicy optionally overrides the autoscaler container's default image pull policy (IfNotPresent).
imagePullPolicy: IfNotPresent
# Optionally specify the autoscaler container's securityContext.
securityContext: {}
env: []
Expand Down Expand Up @@ -75,7 +75,6 @@ spec:
# The Ray head container
- name: ray-head
image: rayproject/ray:2.3.0
imagePullPolicy: Always
# Optimal resource allocation will depend on your Kubernetes infrastructure and might
# require some experimentation.
# Setting requests=limits is recommended with Ray. K8s limits are used for Ray-internal
Expand Down
5 changes: 2 additions & 3 deletions ray-operator/config/samples/ray-cluster.autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ spec:
# If instance.spec.rayVersion is at least "2.0.0", the autoscaler will default to the same image as
# the ray container. For older Ray versions, the autoscaler will default to using the Ray 2.0.0 image.
## image: "my-repo/my-custom-autoscaler-image:tag"
# imagePullPolicy optionally overrides the autoscaler container's image pull policy.
imagePullPolicy: Always
# imagePullPolicy optionally overrides the autoscaler container's default image pull policy (IfNotPresent).
imagePullPolicy: IfNotPresent
# Optionally specify the autoscaler container's securityContext.
securityContext: {}
env: []
Expand Down Expand Up @@ -66,7 +66,6 @@ spec:
# The Ray head container
- name: ray-head
image: rayproject/ray:2.3.0
imagePullPolicy: Always
ports:
- containerPort: 6379
name: gcs
Expand Down
2 changes: 0 additions & 2 deletions ray-operator/config/samples/ray_v1alpha1_rayservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ spec:
containers:
- name: ray-head
image: rayproject/ray:2.3.0
imagePullPolicy: Always
resources:
limits:
cpu: 2
Expand Down Expand Up @@ -96,7 +95,6 @@ spec:
containers:
- name: ray-worker # must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc'
image: rayproject/ray:2.3.0
imagePullPolicy: Always
lifecycle:
preStop:
exec:
Expand Down
2 changes: 1 addition & 1 deletion ray-operator/controllers/ray/common/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func BuildAutoscalerContainer(autoscalerImage string) v1.Container {
container := v1.Container{
Name: AutoscalerContainerName,
Image: autoscalerImage,
ImagePullPolicy: v1.PullAlways,
ImagePullPolicy: v1.PullIfNotPresent,
Env: []v1.EnvVar{
{
Name: RAY_CLUSTER_NAME,
Expand Down
2 changes: 1 addition & 1 deletion ray-operator/controllers/ray/common/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var volumeMountsWithAutoscaler = []v1.VolumeMount{
var autoscalerContainer = v1.Container{
Name: "autoscaler",
Image: "repo/image:custom",
ImagePullPolicy: v1.PullAlways,
ImagePullPolicy: v1.PullIfNotPresent,
Env: []v1.EnvVar{
{
Name: RAY_CLUSTER_NAME,
Expand Down
2 changes: 0 additions & 2 deletions tests/config/ray-service.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ spec:
containers:
- name: ray-head
image: $ray_image
imagePullPolicy: Always
ports:
- containerPort: 6379
name: gcs-server
Expand Down Expand Up @@ -104,7 +103,6 @@ spec:
containers:
- name: ray-worker
image: $ray_image
imagePullPolicy: Always
lifecycle:
preStop:
exec:
Expand Down

0 comments on commit 71e260f

Please sign in to comment.