Commit e8c84f52 authored by 黎博's avatar 黎博

update

parent 483c3ef7
...@@ -39,9 +39,9 @@ public class K8sController { ...@@ -39,9 +39,9 @@ public class K8sController {
* 获取namespace列表 * 获取namespace列表
* @return * @return
*/ */
@GetMapping("/namespace") @GetMapping("/namespace/list")
public JsonResult getNamespaceList() { public JsonResult getNamespaceList(String env) {
return JsonResult.buildSuccessResult(k8sService.getNamespaceList()); return JsonResult.buildSuccessResult(k8sService.getNamespaceList(env));
} }
/** /**
......
...@@ -108,11 +108,11 @@ public class K8sService { ...@@ -108,11 +108,11 @@ public class K8sService {
* 获取namespace列表 * 获取namespace列表
* @return * @return
*/ */
public List<Map<String, Object>> getNamespaceList() { public List<Map<String, Object>> getNamespaceList(String env) {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
List<Namespace> namespaceList = kubernetesClient.namespaces().list().getItems(); List<Namespace> namespaceList = kubernetesClient.namespaces().list().getItems();
for (Namespace namespace : namespaceList) { for (Namespace namespace : namespaceList) {
if (namespace.getMetadata().getAnnotations() != null) { if (namespace.getMetadata().getAnnotations() != null && namespace.getMetadata().getAnnotations().get("description").equals(env)) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name", namespace.getMetadata().getName()); map.put("name", namespace.getMetadata().getName());
map.put("description", namespace.getMetadata().getAnnotations().get("description")); map.put("description", namespace.getMetadata().getAnnotations().get("description"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment