Loading
close

命名空间

time 更新时间:2026-08-28 09:21:40

命名空间

列举命名空间

约束条件

cluster_type的取值范围是EOS, EKS, EHOS, PROJECT_ALL, CLOUD_ALL

btype 的取值范围是 SecurityContainer / HybridOrchestration / Normal / User / Controller,默认空,代表所有类型

URI

示例:

product_type_list=[eks, hybrid, security]

GET /api/ecns/${product type}/namespace/clustertype/<cluster_type>/?business_type=<btype>

响应消息

参数 参数类型 描述
namespaces list(namespace)

创建命名空间

URI

示例:product_type_list=[eks, hybrid, security]

POST /api/ecns/${product type}/namespace/

请求消息

参数 参数类型 是否必选 描述
namespace namespace 是

响应消息

参数 参数类型 描述
namespace namespace

namespace Type定义:

参数 参数类型 是否必选 描述
namespace_base namespace_base 是
psp str 否 值范围:Limited和Unlimited
quota quota 否
namespace_status namespace_status 否

namespace_base Type定义:

参数 参数类型 是否必选 描述
name str 是 命名空间名称
cluster_name str 是 所属集群名称
cluster_type str 是 集群类型, 值范围 EHOS(纳管集群) / EKS(业务集群) / EOS (主管集群)
business_type str 否 主管集群创建命名空间时才需要填,值范围:SecurityContainer / HybridOrchestration / Normal
domain str 是 部门名称
project str 是 项目名称
project_id str 是 项目id
role list[str] 否 表示该命名空间可以被授权的角色,值范围:Developer和Visitor中之一或全部
user_ids list[user] 否 表示该命名空间可以被哪些userid访问,若为空,则默认给所有user使用

user Type定义:

参数 参数类型 是否必选 描述
id str 是
name str 否 名称
email str 否 邮箱

namespace_status Type定义:

参数 参数类型 是否必选 描述
status str 是
creation_time str 是

quota Type定义:

参数 参数类型 是否必选 描述
pods int 否 容器组配额
cpu int 否 cpu配额
memory int 否 内存配额
statefulsets int 否 有状态工作负载配额
deployments int 否 无状态工作负载配额
jobs int 否 普通任务配额
cronjobs int 否 定时任务配额
storage int 否 存储容量配额
persistentvolumeclaims int 否 持久卷配额
configmaps int 否 配置配额
services int 否 服务配额
loadbalancers int 否 负载均衡器配额
secrets int 否 密钥配额
ingress int 否 路由配额

批量删除命名空间

URI

示例:product_type_list=[eks, hybrid, security]

DELETE /api/ecns/${product type}/namespace/

请求消息

参数 参数类型 描述 是否必选
namespaces list[namespace_base] 是

删除命名空间

URI

示例:product_type_list=[eks, hybrid, security]

DELETE /api/ecns/${product type}/namespace/cluster/<cluster_name>/ns/<namespace_name>/

设置安全策略

URI

示例:product_type_list=[eks, hybrid, security]

PATCH /api/ecns/${product type}/namespace/cluster/<cluster_name>/ns/<namespace_name>/psp/?cluster_type=<cluster_type>

请求消息

参数 参数类型 是否必选 描述
psp str 是 值范围:Limited和Unlimited

修改可见用户

URI

示例:product_type_list=[eks, hybrid, security]

PATCH /api/ecns/eks/namespace/cluster/<cluster_name>/ns/<namespace_name>/user_ids/?cluster_type=<cluster_type>

请求消息

参数 参数类型 是否必选 描述
user_ids list[user] 是 用户 列表

设置配额

URI

示例:product_type_list=[eks, hybrid, security]

PATCH /api/ecns/${product type}/namespace/cluster//ns//quota/?cluster_type=

请求消息

参数 参数类型 是否必选 描述
quota quota 是

获取配额

URI

示例:product_type_list=[eks, hybrid, security]

GET /api/ecns/${product type}/namespace/cluster/<cluster_name>/ns/<namespace_name>/quota/

响应消息

参数 参数类型 描述
quota quota_status

quota_status Type定义:

参数 参数类型 是否必选 描述
hard quota 是 quota的限制,如果配额项值是 -1 ,则表示无限制
used quota 是 quota的已使用情况

quota Type定义见前文。

切换命名空间

URI

示例:product_type_list=[eks, hybrid, security]

GET /api/ecns/${product type}/namespace/<project_id>/cluster/<cluster_name>/ns/<namespace_name>/

响应消息

参数 参数类型 描述 是否必选
ecns_cluster_addr str 集群apiserver地址
ecns_cluster_type str 集群类型
ecns_project_id str 项目id
ecns_current_ns list(str) 当前namespace
ecns_cluster_name str 集群名称

三级联动全量列举

约束条件

btype 的取值范围是 SecurityContainer / HybridOrchestration / Normal / User / Controller,默认空,代表所有类型

URI

示例:product_type_list=[eks, hybrid, security]

GET /api/ecns/${product type}/namespace/?business_type=<btype>

响应消息

参数 参数类型 描述
list(project_selector)

project_selector Type定义:

参数 参数类型 是否必选 描述
project_name str 是 项目名称
project_id str 是 项目id
clusters list(cluster_selector)

cluster_selector Type定义:

参数 参数类型 是否必选 描述
cluster_name str 是 集群名称
cluster_addr str 是 集群apiserver访问地址
cluster_type str 是 集群类型
namespaces list(str) 是 命名空间列表
此篇文章对你是否有帮助?
没帮助
locked-file

您暂无权限访问该产品