Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support of background-only mode for policies #14

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/kyverno/v1/spec_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ type Spec struct {
// ValidationFailureAction defines if a validation policy rule violation should block
// the admission review request (enforce), or allow (audit) the admission review request
// and report an error in a policy report. Optional.
// Allowed values are audit or enforce. The default value is "audit".
// Allowed values are audit or enforce.
// The default value is "" which means policy will be executed in background-only mode.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we add another value say background or background-only instead of an empty string?

Copy link
Author

@sandeshlmore sandeshlmore Oct 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ApsTomar @samkulkarni20 can you suggest what would be better value for ValidationFailureAction to introduce background only mode?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i confirm this with chipzoller. please check upstream issue thread.

// +optional
// +kubebuilder:validation:Enum=audit;enforce
// +kubebuilder:default=audit
// +kubebuilder:validation:Enum=audit;enforce;""
ValidationFailureAction ValidationFailureAction `json:"validationFailureAction,omitempty" yaml:"validationFailureAction,omitempty"`

// ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction
Expand Down
6 changes: 3 additions & 3 deletions api/kyverno/v2beta1/spec_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ type Spec struct {
// ValidationFailureAction defines if a validation policy rule violation should block
// the admission review request (enforce), or allow (audit) the admission review request
// and report an error in a policy report. Optional.
// Allowed values are audit or enforce. The default value is "audit".
// Allowed values are audit or enforce.
// The default value is "" which means policy will be executed in background-only mode.
// +optional
// +kubebuilder:validation:Enum=audit;enforce
// +kubebuilder:default=audit
// +kubebuilder:validation:Enum=audit;enforce;""
ValidationFailureAction kyvernov1.ValidationFailureAction `json:"validationFailureAction,omitempty" yaml:"validationFailureAction,omitempty"`

// ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction
Expand Down
16 changes: 8 additions & 8 deletions charts/kyverno/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2811,11 +2811,11 @@ spec:
description: SchemaValidation skips policy validation checks. Optional. The default value is set to "true", it must be set to "false" to disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "audit".
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "" which means policy will be executed in background-only mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
Expand Down Expand Up @@ -6294,11 +6294,11 @@ spec:
description: SchemaValidation skips policy validation checks. Optional. The default value is set to "true", it must be set to "false" to disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "audit".
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "" which means policy will be executed in background-only mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
Expand Down Expand Up @@ -10401,11 +10401,11 @@ spec:
description: SchemaValidation skips policy validation checks. Optional. The default value is set to "true", it must be set to "false" to disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "audit".
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "" which means policy will be executed in background-only mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
Expand Down Expand Up @@ -13884,11 +13884,11 @@ spec:
description: SchemaValidation skips policy validation checks. Optional. The default value is set to "true", it must be set to "false" to disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "audit".
description: ValidationFailureAction defines if a validation policy rule violation should block the admission review request (enforce), or allow (audit) the admission review request and report an error in a policy report. Optional. Allowed values are audit or enforce. The default value is "" which means policy will be executed in background-only mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy attribute that specifies ValidationFailureAction namespace-wise. It overrides ValidationFailureAction for the specified namespaces.
Expand Down
10 changes: 6 additions & 4 deletions config/crds/kyverno.io_clusterpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2867,15 +2867,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -8449,15 +8450,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down
10 changes: 6 additions & 4 deletions config/crds/kyverno.io_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2868,15 +2868,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -8452,15 +8453,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down
20 changes: 12 additions & 8 deletions config/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4189,15 +4189,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -9771,15 +9772,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -16210,15 +16212,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -21794,15 +21797,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down
20 changes: 12 additions & 8 deletions config/install_debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4183,15 +4183,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -9765,15 +9766,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -16201,15 +16203,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down Expand Up @@ -21785,15 +21788,16 @@ spec:
disable the validation checks.
type: boolean
validationFailureAction:
default: audit
description: ValidationFailureAction defines if a validation policy
rule violation should block the admission review request (enforce),
or allow (audit) the admission review request and report an error
in a policy report. Optional. Allowed values are audit or enforce.
The default value is "audit".
The default value is "" which means policy will be executed in background-only
mode.
enum:
- audit
- enforce
- ""
type: string
validationFailureActionOverrides:
description: ValidationFailureActionOverrides is a Cluster Policy
Expand Down
Loading