Skip to content

Commit 2b99705

Browse files
authored
Merge pull request #49499 from my-git9/np-20142
[zh-cn]sync validating-admission-policy.md
2 parents 2c4aacb + 769bd81 commit 2b99705

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

content/zh-cn/docs/reference/access-authn-authz/validating-admission-policy.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,25 @@ A policy is generally made up of three resources:
5353
- The `ValidatingAdmissionPolicy` describes the abstract logic of a policy
5454
(think: "this policy makes sure a particular label is set to a particular value").
5555
56-
- A `ValidatingAdmissionPolicyBinding` links the above resources together and provides scoping.
57-
If you only want to require an `owner` label to be set for `Pods`, the binding is where you would
58-
specify this restriction.
59-
6056
- A parameter resource provides information to a ValidatingAdmissionPolicy to make it a concrete
6157
statement (think "the `owner` label must be set to something that ends in `.company.com`").
6258
A native type such as ConfigMap or a CRD defines the schema of a parameter resource.
6359
`ValidatingAdmissionPolicy` objects specify what Kind they are expecting for their parameter resource.
60+
61+
- A `ValidatingAdmissionPolicyBinding` links the above resources together and provides scoping.
62+
If you only want to require an `owner` label to be set for `Pods`, the binding is where you would
63+
specify this restriction.
6464
-->
6565
- `ValidatingAdmissionPolicy` 描述策略的抽象逻辑(想想看:“这个策略确保一个特定标签被设置为一个特定值”)。
6666

67-
- 一个 `ValidatingAdmissionPolicyBinding` 将上述资源联系在一起,并提供作用域。
68-
如果你只想为 `Pods` 设置一个 `owner` 标签,你就需要在这个绑定中指定这个限制。
69-
7067
- 参数资源为 `ValidatingAdmissionPolicy` 提供信息,使其成为一个具体的声明
7168
(想想看:“`owner` 标签必须被设置为以 `.company.com` 结尾的形式")。
7269
参数资源的模式(Schema)使用诸如 ConfigMap 或 CRD 这类原生类型定义。
7370
`ValidatingAdmissionPolicy` 对象指定它们期望参数资源所呈现的类型。
7471

72+
- 一个 `ValidatingAdmissionPolicyBinding` 将上述资源联系在一起,并提供作用域。
73+
如果你只想为 `Pods` 设置一个 `owner` 标签,你就需要在这个绑定中指定这个限制。
74+
7575
<!--
7676
At least a `ValidatingAdmissionPolicy` and a corresponding `ValidatingAdmissionPolicyBinding`
7777
must be defined for a policy to have an effect.
@@ -180,6 +180,7 @@ validation failures, use:
180180
```yaml
181181
validationActions: [Warn, Audit]
182182
```
183+
183184
<!--
184185
`Deny` and `Warn` may not be used together since this combination
185186
needlessly duplicates the validation failure both in the
@@ -709,15 +710,15 @@ When an API request is validated with this admission policy, the resulting audit
709710
In this example the annotation will only be included if the `spec.replicas` of the Deployment is more than
710711
50, otherwise the CEL expression evaluates to null and the annotation will not be included.
711712
712-
Note that audit annotation keys are prefixed by the name of the `ValidatingAdmissionWebhook` and a `/`. If
713+
Note that audit annotation keys are prefixed by the name of the `ValidatingAdmissionPolicy` and a `/`. If
713714
another admission controller, such as an admission webhook, uses the exact same audit annotation key, the
714715
value of the first admission controller to include the audit annotation will be included in the audit
715716
event and all other values will be ignored.
716717
-->
717718
在此示例中,只有 Deployment 的 `spec.replicas` 大于 50 时才会包含注解,
718719
否则 CEL 表达式将求值为 null,并且不会包含注解。
719720
720-
请注意,审计注解键以 `ValidatingAdmissionWebhook` 的名称和 `/` 为前缀。
721+
请注意,审计注解键以 `ValidatingAdmissionPolicy` 的名称和 `/` 为前缀。
721722
如果另一个准入控制器(例如准入 Webhook)使用完全相同的审计注解键,
722723
则第一个包括审计注解值的准入控制器将出现在审计事件中,而所有其他值都将被忽略。
723724
@@ -750,7 +751,7 @@ when we try to create a deployment with 5 replicas, we will receive the followin
750751
在创建限制副本为 3 的 Params 对象并设置绑定之后,当我们尝试创建具有 5 个副本的 Deployment
751752
时,我们将收到以下消息:
752753
753-
```
754+
```shell
754755
$ kubectl create deploy --image=nginx nginx --replicas=5
755756
error: failed to create deployment: deployments.apps "nginx" is forbidden: ValidatingAdmissionPolicy 'deploy-replica-policy.example.com' with binding 'demo-binding-test.example.com' denied request: object.spec.replicas must be no greater than 3
756757
```

0 commit comments

Comments
 (0)