From dfa890db9dabd563a06a218611e73c12ce092c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=B4=E5=9F=BA=E9=B1=BC?= Date: Wed, 11 Jun 2025 17:43:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9KubeRay=20Pod=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E4=B8=BA=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E6=98=AF=E5=90=A6ready?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/kuberay/workspace/install.yml | 14 +++++++------- plugins/kuberay/workspace/train.yaml | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/kuberay/workspace/install.yml b/plugins/kuberay/workspace/install.yml index e3bf2fc..82d55d8 100644 --- a/plugins/kuberay/workspace/install.yml +++ b/plugins/kuberay/workspace/install.yml @@ -100,15 +100,15 @@ msg: "Error: KubeRay installation failed" when: head_pod.stdout == "" - - name: Check if Head Pod is running + - name: Check if Head Pod is ready shell: | kubectl get pods -n {{ namespace }} \ --selector=ray.io/node-type=head \ - -o jsonpath='{.items[0].status.phase}' - register: head_pod_status - retries: 20 + -o jsonpath='{.items[0].status.conditions[?(@.type=="Ready")].status}' + register: head_pod_ready + retries: 30 delay: 6 - until: head_pod_status.stdout == "Running" + until: head_pod_ready.stdout == "True" - name: Get Worker Pods info shell: | @@ -117,7 +117,7 @@ -o json register: worker_pods_info - - name: Check if every Worker Pod is running + - name: Check if every Worker Pod is ready shell: | kubectl get pods -n {{ namespace }} \ --selector=ray.io/node-type=worker \ @@ -127,7 +127,7 @@ delay: 6 until: > ( - (worker_pods_status.stdout | from_json | json_query('items[*].status.phase') | select('equalto', 'Running') | list | length) + (worker_pods_status.stdout | from_json | json_query('items[*].status.conditions[?(@.type==`Ready`)].status') | flatten | select('equalto', 'True') | list | length) == (worker_pods_status.stdout | from_json | json_query('items') | length) ) diff --git a/plugins/kuberay/workspace/train.yaml b/plugins/kuberay/workspace/train.yaml index a60cd9c..4274372 100644 --- a/plugins/kuberay/workspace/train.yaml +++ b/plugins/kuberay/workspace/train.yaml @@ -27,15 +27,15 @@ dest: "/tmp/{{ test_picture_name }}" mode: '0744' - - name: Check if Head Pod is running + - name: Check if Head Pod is ready shell: | kubectl get pods -n {{ namespace }} \ --selector=ray.io/node-type=head \ - -o jsonpath='{.items[0].status.phase}' - register: head_pod_status + -o jsonpath='{.items[0].status.conditions[?(@.type=="Ready")].status}' + register: head_pod_ready retries: 10 delay: 5 - until: head_pod_status.stdout == "Running" + until: head_pod_ready.stdout == "True" - name: Get Worker Pods info shell: | @@ -44,7 +44,7 @@ -o json register: worker_pods_info - - name: Check if every Worker Pod is running + - name: Check if every Worker Pod is ready shell: | kubectl get pods -n {{ namespace }} \ --selector=ray.io/node-type=worker \ @@ -54,7 +54,7 @@ delay: 5 until: > ( - (worker_pods_status.stdout | from_json | json_query('items[*].status.phase') | select('equalto', 'Running') | list | length) + (worker_pods_status.stdout | from_json | json_query('items[*].status.conditions[?(@.type==`Ready`)].status') | flatten | select('equalto', 'True') | list | length) == (worker_pods_status.stdout | from_json | json_query('items') | length) ) -- Gitee