未验证 提交 58a9f260 编写于 作者: Z zhuwenxing 提交者: GitHub

[test]fix k8s client init (#19590)

Signed-off-by: Nzhuwenxing <wenxing.zhu@zilliz.com>
Signed-off-by: Nzhuwenxing <wenxing.zhu@zilliz.com>
上级 ccecd6a7
...@@ -27,7 +27,7 @@ def init_k8s_client_config(): ...@@ -27,7 +27,7 @@ def init_k8s_client_config():
def get_current_namespace(): def get_current_namespace():
config.load_kube_config() init_k8s_client_config()
ns = config.list_kube_config_contexts()[1]["context"]["namespace"] ns = config.list_kube_config_contexts()[1]["context"]["namespace"]
return ns return ns
...@@ -188,7 +188,7 @@ def get_milvus_instance_name(namespace, host="127.0.0.1", port="19530", milvus_s ...@@ -188,7 +188,7 @@ def get_milvus_instance_name(namespace, host="127.0.0.1", port="19530", milvus_s
ip_name_pairs = get_pod_ip_name_pairs(namespace, "app.kubernetes.io/name=milvus") ip_name_pairs = get_pod_ip_name_pairs(namespace, "app.kubernetes.io/name=milvus")
pod_name = ip_name_pairs[query_node_ip] pod_name = ip_name_pairs[query_node_ip]
config.load_kube_config() init_k8s_client_config()
api_instance = client.CoreV1Api() api_instance = client.CoreV1Api()
try: try:
api_response = api_instance.read_namespaced_pod(namespace=namespace, name=pod_name) api_response = api_instance.read_namespaced_pod(namespace=namespace, name=pod_name)
...@@ -214,7 +214,7 @@ def get_milvus_deploy_tool(namespace, milvus_sys): ...@@ -214,7 +214,7 @@ def get_milvus_deploy_tool(namespace, milvus_sys):
query_node_ip = ms.query_nodes[0]["infos"]['hardware_infos']["ip"].split(":")[0] query_node_ip = ms.query_nodes[0]["infos"]['hardware_infos']["ip"].split(":")[0]
ip_name_pairs = get_pod_ip_name_pairs(namespace, "app.kubernetes.io/name=milvus") ip_name_pairs = get_pod_ip_name_pairs(namespace, "app.kubernetes.io/name=milvus")
pod_name = ip_name_pairs[query_node_ip] pod_name = ip_name_pairs[query_node_ip]
config.load_kube_config() init_k8s_client_config()
api_instance = client.CoreV1Api() api_instance = client.CoreV1Api()
try: try:
api_response = api_instance.read_namespaced_pod(namespace=namespace, name=pod_name) api_response = api_instance.read_namespaced_pod(namespace=namespace, name=pod_name)
......
...@@ -10,6 +10,7 @@ import requests ...@@ -10,6 +10,7 @@ import requests
from sklearn import preprocessing from sklearn import preprocessing
from pymilvus import Milvus, DataType from pymilvus import Milvus, DataType
from utils.util_log import test_log as log from utils.util_log import test_log as log
from utils.util_k8s import init_k8s_client_config
port = 19530 port = 19530
epsilon = 0.000001 epsilon = 0.000001
...@@ -857,7 +858,7 @@ def restart_server(helm_release_name): ...@@ -857,7 +858,7 @@ def restart_server(helm_release_name):
client.rest.logger.setLevel(log.WARNING) client.rest.logger.setLevel(log.WARNING)
# service_name = "%s.%s.svc.cluster.local" % (helm_release_name, namespace) # service_name = "%s.%s.svc.cluster.local" % (helm_release_name, namespace)
config.load_kube_config() init_k8s_client_config()
v1 = client.CoreV1Api() v1 = client.CoreV1Api()
pod_name = None pod_name = None
# config_map_names = v1.list_namespaced_config_map(namespace, pretty='true') # config_map_names = v1.list_namespaced_config_map(namespace, pretty='true')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册