From 2640f801280ed7fa427107f9150996f5de31d06d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 25 May 2022 18:25:02 +0800 Subject: [PATCH] [zh] sync 1.24 ref-k8s-api authorization-resources/role-v1.md --- .../authorization-resources/role-v1.md | 690 ++++++++++++++++++ 1 file changed, 690 insertions(+) create mode 100644 content/zh/docs/reference/kubernetes-api/authorization-resources/role-v1.md diff --git a/content/zh/docs/reference/kubernetes-api/authorization-resources/role-v1.md b/content/zh/docs/reference/kubernetes-api/authorization-resources/role-v1.md new file mode 100644 index 0000000000..8b6f136299 --- /dev/null +++ b/content/zh/docs/reference/kubernetes-api/authorization-resources/role-v1.md @@ -0,0 +1,690 @@ +--- +api_metadata: + apiVersion: "rbac.authorization.k8s.io/v1" + import: "k8s.io/api/rbac/v1" + kind: "Role" +content_type: "api_reference" +description: "Role 是一个按命名空间划分的 PolicyRule 逻辑分组,可以被 RoleBinding 作为一个单元引用。" +title: "Role" +weight: 7 +auto_generated: false +--- + + +`apiVersion: rbac.authorization.k8s.io/v1` + +`import "k8s.io/api/rbac/v1"` + +## Role {#Role} + +Role 是一个按命名空间划分的 PolicyRule 逻辑分组,可以被 RoleBinding 作为一个单元引用。 + +
+ +- **apiVersion**: rbac.authorization.k8s.io/v1 + +- **kind**: Role + +- **metadata** (}}">ObjectMeta) + + 标准的对象元数据。 + +- **rules** ([]PolicyRule) + + rules 包含了这个 Role 的所有 PolicyRule。 + + + **PolicyRule 包含描述一个策略规则的信息,但不包含该规则适用于哪个主体或适用于哪个命名空间的信息。** + + - **rules.apiGroups** ([]string) + + apiGroups 是包含资源的 apiGroup 的名称。 + 如果指定了多个 API 组,则允许对任何 API 组中的其中一个枚举资源来请求任何操作。 + + - **rules.resources** ([]string) + + resources 是此规则所适用的资源的列表。 + “*” 表示所有资源。 + + - **rules.verbs** ([]string),必需 + + verbs 是适用于此规则中所包含的所有 ResourceKinds 的动作。 + “*” 表示所有动作。 + + - **rules.resourceNames** ([]string) + + resourceNames 是此规则所适用的资源名称白名单,可选。 + 空集合意味着允许所有资源。 + + - **rules.nonResourceURLs** ([]string) + + nonResourceURLs 是用户应有权访问的一组部分 URL。 + 允许使用 “*”,但仅能作为路径中最后一段且必须用于完整的一段, + 因为非资源 URL 没有划分命名空间。 + 此字段仅适用于从 ClusterRoleBinding 引用的 ClusterRole。 + rules 可以应用到 API 资源(如 “pod” 或 “secret”)或非资源 URL 路径(如 “/api”), + 但不能同时应用于两者。 + +## RoleList {#RoleList} + +RoleList 是 Role 的集合。 + +
+ +- **apiVersion**: rbac.authorization.k8s.io/v1 + +- **kind**: RoleList + +- **metadata** (}}">ListMeta) + + 标准的对象元数据。 + +- **items** ([]}}">Role),必需 + + items 是 Role 的列表。 + +## 操作 {#Operations} + +
+ +### `get` 读取指定的 Role + +#### HTTP 请求 + +GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name} + +#### 参数 + +- **name** (**路径参数**): string,必需 + + Role 的名称 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **pretty** (**查询参数**): string + + }}">pretty + +#### 响应 + +200 (}}">Role): OK + +401: Unauthorized + +### `list` 列出或观测类别为 Role 的对象 + +#### HTTP 请求 + +GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles + +#### 参数 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **allowWatchBookmarks** (**查询参数**): boolean + + }}">allowWatchBookmarks + +- **continue** (**查询参数**): string + + }}">continue + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + +- **limit** (**查询参数**): integer + + }}">limit + +- **pretty** (**查询参数**): string + + }}">pretty + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + +- **watch** (**查询参数**): boolean + + }}">watch + +#### 响应 + +200 (}}">RoleList): OK + +401: Unauthorized + +### `list` 列出或观测类别为 Role 的对象 + +#### HTTP 请求 + +GET /apis/rbac.authorization.k8s.io/v1/roles + +#### 参数 + +- **allowWatchBookmarks** (**查询参数**): boolean + + }}">allowWatchBookmarks + +- **continue** (**查询参数**): string + + }}">continue + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + +- **limit** (**查询参数**): integer + + }}">limit + +- **pretty** (**查询参数**): string + + }}">pretty + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + +- **watch** (**查询参数**): boolean + + }}">watch + +#### 响应 + +200 (}}">RoleList): OK + +401: Unauthorized + +### `create` 创建 Role + +#### HTTP 请求 + +POST /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles + +#### 参数 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **body**: }}">Role,必需 + +- **dryRun** (**查询参数**): string + + }}">dryRun + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + +- **pretty** (**查询参数**): string + + }}">pretty + +#### 响应 + +200 (}}">Role): OK + +201 (}}">Role): Created + +202 (}}">Role): Accepted + +401: Unauthorized + +### `update` 替换指定的 Role + +#### HTTP 请求 + +PUT /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name} + +#### 参数 + +- **name** (**路径参数**): string,必需 + + Role 的名称 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **body**: }}">Role,必需 + +- **dryRun** (**查询参数**): string + + }}">dryRun + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + +- **pretty** (**查询参数**): string + + }}">pretty + +#### 响应 + +200 (}}">Role): OK + +201 (}}">Role): Created + +401: Unauthorized + +### `patch` 部分更新指定的 Role + +#### HTTP 请求 + +PATCH /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name} + +#### 参数 + +- **name** (**路径参数**): string,必需 + + Role 的名称 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **body**: }}">Patch,必需 + +- **dryRun** (**查询参数**): string + + }}">dryRun + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + +- **force** (**查询参数**): boolean + + }}">force + +- **pretty** (**查询参数**): string + + }}">pretty + +#### 响应 + +200 (}}">Role): OK + +201 (}}">Role): Created + +401: Unauthorized + +### `delete` 删除 Role + +#### HTTP 请求 + +DELETE /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name} + +#### 参数 + +- **name** (**路径参数**): string,必需 + + Role 的名称 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **body**: }}">DeleteOptions + +- **dryRun** (**查询参数**): string + + }}">dryRun + +- **gracePeriodSeconds** (**查询参数**): integer + + }}">gracePeriodSeconds + +- **pretty** (**查询参数**): string + + }}">pretty + +- **propagationPolicy** (**查询参数**): string + + }}">propagationPolicy + +#### 响应 + +200 (}}">Status): OK + +202 (}}">Status): Accepted + +401: Unauthorized + +### `deletecollection` 删除 Role 的集合 + +#### HTTP 请求 + +DELETE /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles + +#### 参数 + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + +- **body**: }}">DeleteOptions + +- **continue** (**查询参数**): string + + }}">continue + +- **dryRun** (**查询参数**): string + + }}">dryRun + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + +- **gracePeriodSeconds** (**查询参数**): integer + + }}">gracePeriodSeconds + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + +- **limit** (**查询参数**): integer + + }}">limit + +- **pretty** (**查询参数**): string + + }}">pretty + +- **propagationPolicy** (**查询参数**): string + + }}">propagationPolicy + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + +#### 响应 + +200 (}}">Status): OK + +401: Unauthorized