Skip to content

Commit

Permalink
[Bug] KubeRay operator failed to watch endpoint (ray-project#2080)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 authored Apr 17, 2024
1 parent 981c943 commit 791ea37
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rules:
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
1 change: 1 addition & 0 deletions helm-chart/kuberay-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ rules:
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
1 change: 1 addition & 0 deletions ray-operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rules:
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
2 changes: 1 addition & 1 deletion ray-operator/controllers/ray/rayservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewRayServiceReconciler(ctx context.Context, mgr manager.Manager, dashboard
// +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=pods/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=endpoints,verbs=get;list
// +kubebuilder:rbac:groups=core,resources=endpoints,verbs=get;list;watch
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=services/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;create;update
Expand Down
13 changes: 8 additions & 5 deletions tests/framework/prototype.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Configuration test framework for KubeRay"""
import json
import jsonpatch
from typing import Dict, List, Optional
import unittest
import time
import unittest
from typing import Dict, List, Optional
import jsonpatch

from framework.utils import (
create_custom_object,
Expand Down Expand Up @@ -306,17 +306,20 @@ def assert_rule(self, custom_resource, cr_namespace):
name=custom_resource["metadata"]["name"],
namespace=cr_namespace,
path=query.get("path").rstrip("/"),
json=json.dumps(query["json_args"]),
json=json.dumps(query["json_args"])
)

if self.start_in_background:
shell_subprocess_run(f"{cmd} &", hide_output=True)
shell_subprocess_run(f"{cmd} &", hide_output=False)

else:
output = shell_subprocess_check_output(cmd)
logger.info("curl output: %s", output.decode('utf-8'))
if hasattr(query.get("expected_output"), "__iter__"):
assert output.decode('utf-8') in query["expected_output"]
else:
assert output.decode('utf-8') == query["expected_output"]
time.sleep(1)

class AutoscaleRule(Rule):
def __init__(
Expand Down
6 changes: 1 addition & 5 deletions tests/test_sample_rayservice_yamls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
''' Test sample RayService YAML files to catch invalid and outdated ones. '''
from copy import deepcopy
from kubernetes import client
import logging
import pytest
import sys
from tempfile import NamedTemporaryFile
import time
from typing import Any, Dict, List, Optional
from typing import Dict, List, Optional
import yaml

from framework.prototype import (
Expand All @@ -15,10 +14,7 @@
EasyJobRule,
CurlServiceRule,
AutoscaleRule,
get_expected_head_pods,
get_expected_worker_pods,
show_cluster_info,
check_pod_running,
)

from framework.utils import (
Expand Down

0 comments on commit 791ea37

Please sign in to comment.