You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/21 06:05:16 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #6646: feat: release 2.13.0

spacewander commented on a change in pull request #6646:
URL: https://github.com/apache/apisix/pull/6646#discussion_r830777846



##########
File path: docs/zh/latest/discovery/kubernetes.md
##########
@@ -93,28 +98,89 @@ discovery:
       #token_file: # enter file path here
 ```
 
-# Kubernetes 服务发现插件的使用
+## Kubernetes 服务发现模块的查询接口
+
+Kubernetes 服务发现模块遵循 [_APISIX Discovery 规范_](https://github.com/apache/apisix/blob/master/docs/zh/latest/discovery.md) 提供查询接口
+
+**函数:**
+ nodes(service_name)
+
+**说明:**
+  service_name 必须满足格式: [namespace]/[name]:[portName]
+
+  + namespace: Endpoints 所在的命名空间
+
+  + name: Endpoints 的资源名
+
+  + portName: Endpoints 定义包含的 portName, 如果 Endpoints 没有定义 portName, 请使用 targetPort,Port 代替
+
+**返回值:**
+  以如下 Endpoints 为例:
 
-Kubernetes 服务发现插件提供与其他服务发现插件相同的查询接口 -> nodes(service_name) \
-service_name 的 pattern 如下:
-> _[namespace]/[name]:[portName]_
+  ```yaml
+  apiVersion: v1
+  kind: Endpoints
+  metadata:
+    name: plat-dev
+    namespace: default
+  subsets:
+    - addresses:
+        - ip: "10.5.10.109"
+        - ip: "10.5.10.110"
+      ports:
+        - port: 3306
+  ```
 
-如果 kubernetes Endpoint 没有定义 portName, Kubernetes 服务发现插件会依次使用 targetPort, port 代替
+  nodes("default/plat-dev:3306") 调用会得到如下的返回值:
 
-# Q&A
+  ```

Review comment:
       I prefer to solve it in the master branch? And would be good to check it in the CI if the mark is required.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org