Skip to content

Commit 16ef87e

Browse files
authored
Merge pull request kubernetes#128622 from jpbetz/admission-policy-generalize-api-docs
Clean up API docs shared by ValidatingAdmissionPolicy and MutatingAdmissionPolicy
2 parents c608791 + de6a43c commit 16ef87e

File tree

7 files changed

+51
-44
lines changed

7 files changed

+51
-44
lines changed

api/openapi-spec/swagger.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/apis__admissionregistration.k8s.io__v1alpha1_openapi.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/admissionregistration/types.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,20 @@ const (
9292
type FailurePolicyType string
9393

9494
const (
95-
// Ignore means that an error calling the webhook is ignored.
95+
// Ignore means that an error calling the admission webhook or admission policy is ignored.
9696
Ignore FailurePolicyType = "Ignore"
97-
// Fail means that an error calling the webhook causes the admission to fail.
97+
// Fail means that an error calling the admission webhook or admission policy causes resource admission to fail.
9898
Fail FailurePolicyType = "Fail"
9999
)
100100

101101
// MatchPolicyType specifies the type of match policy
102102
type MatchPolicyType string
103103

104104
const (
105-
// Exact means requests should only be sent to the webhook if they exactly match a given rule
105+
// Exact means requests should only be sent to the admission webhook or admission policy if they exactly match a given rule.
106106
Exact MatchPolicyType = "Exact"
107-
// Equivalent means requests should be sent to the webhook if they modify a resource listed in rules via another API group or version.
107+
// Equivalent means requests should be sent to the admission webhook or admission policy if they modify a resource listed
108+
// in rules via another API group or version.
108109
Equivalent MatchPolicyType = "Equivalent"
109110
)
110111

@@ -617,9 +618,9 @@ type MatchResources struct {
617618
// Default to the empty LabelSelector, which matches everything.
618619
// +optional
619620
NamespaceSelector *metav1.LabelSelector
620-
// ObjectSelector decides whether to run the validation based on if the
621+
// ObjectSelector decides whether to run the policy based on if the
621622
// object has matching labels. objectSelector is evaluated against both
622-
// the oldObject and newObject that would be sent to the cel validation, and
623+
// the oldObject and newObject that would be sent to the cel policy, and
623624
// is considered to match if either object matches the selector. A null
624625
// object (oldObject in the case of create, or newObject in the case of
625626
// delete) or an object that cannot have labels (like a
@@ -630,12 +631,14 @@ type MatchResources struct {
630631
// Default to the empty LabelSelector, which matches everything.
631632
// +optional
632633
ObjectSelector *metav1.LabelSelector
633-
// ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches.
634+
// ResourceRules describes what operations on what resources/subresources the policy matches.
634635
// The policy cares about an operation if it matches _any_ Rule.
636+
// +listType=atomic
635637
// +optional
636638
ResourceRules []NamedRuleWithOperations
637-
// ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about.
639+
// ExcludeResourceRules describes what operations on what resources/subresources the policy should not care about.
638640
// The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
641+
// +listType=atomic
639642
// +optional
640643
ExcludeResourceRules []NamedRuleWithOperations
641644
// matchPolicy defines how the "MatchResources" list is used to match incoming requests.
@@ -644,12 +647,12 @@ type MatchResources struct {
644647
// - Exact: match a request only if it exactly matches a specified rule.
645648
// For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
646649
// but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
647-
// a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.
650+
// a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the policy.
648651
//
649652
// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
650653
// For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
651654
// and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
652-
// a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.
655+
// a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the policy.
653656
//
654657
// Defaults to "Equivalent"
655658
// +optional

0 commit comments

Comments
 (0)