@@ -580,11 +580,12 @@ Examples on escaping:
580
580
<!--
581
581
Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
582
582
Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
583
- - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
584
- non-intersecting elements in `Y` are appended, retaining their partial order.
585
- - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
586
- are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
587
- non-intersecting keys are appended, retaining their partial order.
583
+
584
+ - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
585
+ non-intersecting elements in `Y` are appended, retaining their partial order.
586
+ - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
587
+ are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
588
+ non-intersecting keys are appended, retaining their partial order.
588
589
-->
589
590
列表类型为 "set" 或 "map" 的数组上的等价关系比较会忽略元素顺序,即 [ 1, 2] == [ 2, 1] 。
590
591
使用 x-kubernetes-list-type 连接数组时使用列表类型的语义:
@@ -654,7 +655,7 @@ Here is an example illustrating a few different uses for match conditions:
654
655
-->
655
656
以下示例说明了匹配条件的几个不同用法:
656
657
657
- {{< codenew file="access/validating-admission-policy-match-conditions.yaml" > }}
658
+ {{% codenew file="access/validating-admission-policy-match-conditions.yaml" % }}
658
659
659
660
<!--
660
661
Match conditions have access to the same CEL variables as validation expressions.
@@ -664,8 +665,8 @@ the request is determined as follows:
664
665
665
666
1. If **any** match condition evaluated to `false` (regardless of other errors), the API server skips the policy.
666
667
2. Otherwise:
667
- - for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
668
- - for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
668
+ - for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
669
+ - for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
669
670
-->
670
671
这些匹配条件可以访问与验证表达式相同的 CEL 变量。
671
672
@@ -690,13 +691,14 @@ For example, here is an admission policy with an audit annotation:
690
691
691
692
例如,以下是带有审计注解的准入策略:
692
693
693
- {{< codenew file="access/validating-admission-policy-audit-annotation.yaml" > }}
694
+ {{% codenew file="access/validating-admission-policy-audit-annotation.yaml" % }}
694
695
695
696
<!--
696
697
When an API request is validated with this admission policy, the resulting audit event will look like:
697
698
-->
698
699
当使用此准入策略验证 API 请求时,生成的审计事件将如下所示:
699
700
701
+ <!--
700
702
```
701
703
# the audit event recorded
702
704
{
@@ -711,6 +713,21 @@ When an API request is validated with this admission policy, the resulting audit
711
713
...
712
714
}
713
715
```
716
+ -->
717
+ ```
718
+ # 记录的审计事件
719
+ {
720
+ "kind": "Event",
721
+ "apiVersion": "audit.k8s.io/v1",
722
+ "annotations": {
723
+ "demo-policy.example.com/high-replica-count": "Deployment spec.replicas set to 128"
724
+ # 其他注解
725
+ ...
726
+ }
727
+ # 其他字段
728
+ ...
729
+ }
730
+ ```
714
731
715
732
<!--
716
733
In this example the annotation will only be included if the `spec.replicas` of the Deployment is more than
@@ -748,7 +765,7 @@ we can have the following validation:
748
765
749
766
例如,为了在策略引用参数时更好地告知用户拒绝原因,我们可以有以下验证:
750
767
751
- {{< codenew file="access/deployment-replicas-policy.yaml" > }}
768
+ {{% codenew file="access/deployment-replicas-policy.yaml" % }}
752
769
753
770
<!--
754
771
After creating a params object that limits the replicas to 3 and setting up the binding,
@@ -801,6 +818,9 @@ For example, given the following policy definition:
801
818
802
819
例如,给定以下策略定义:
803
820
821
+ <!--
822
+ # should be "object.spec.replicas > 1"
823
+ -->
804
824
``` yaml
805
825
apiVersion : admissionregistration.k8s.io/v1alpha1
806
826
kind : ValidatingAdmissionPolicy
@@ -842,6 +862,9 @@ For example, the following policy definition
842
862
如果在 `spec.matchConstraints` 中匹配了多个资源,则所有匹配的资源都将进行检查。
843
863
例如,以下策略定义:
844
864
865
+ <!--
866
+ # should be "object.spec.replicas > 1"
867
+ -->
845
868
` ` ` yaml
846
869
apiVersion: admissionregistration.k8s.io/v1alpha1
847
870
kind: ValidatingAdmissionPolicy
@@ -892,7 +915,7 @@ Type Checking has the following limitation:
892
915
类型检查具有以下限制:
893
916
894
917
- 没有通配符匹配。
895
- 如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups``、 apiVersions`
918
+ 如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups`、` apiVersions`
896
919
或 `resources` 包含 "\*",则不会检查与 "\*" 匹配的类型。
897
920
- 匹配的类型数量最多为 10 种。这是为了防止手动指定过多类型的策略消耗过多计算资源。
898
921
按升序处理组、版本,然后是资源,忽略第 11 个及其之后的组合。
0 commit comments