mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
fix: missing elements in v2beta1 api (#4654)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
42a2df56c1
commit
47b3704848
8 changed files with 4609 additions and 20 deletions
|
@ -15,10 +15,10 @@ import (
|
|||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:path=clusterpolicies,scope="Cluster",shortName=cpol
|
||||
// +kubebuilder:printcolumn:name="Background",type="string",JSONPath=".spec.background"
|
||||
// +kubebuilder:printcolumn:name="Action",type="string",JSONPath=".spec.validationFailureAction"
|
||||
// +kubebuilder:printcolumn:name="Failure Policy",type="string",JSONPath=".spec.failurePolicy",priority=1
|
||||
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.ready`
|
||||
// +kubebuilder:printcolumn:name="Background",type=boolean,JSONPath=".spec.background"
|
||||
// +kubebuilder:printcolumn:name="Validate Action",type=string,JSONPath=".spec.validationFailureAction"
|
||||
// +kubebuilder:printcolumn:name="Failure Policy",type=string,JSONPath=".spec.failurePolicy",priority=1
|
||||
// +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready`
|
||||
|
||||
// ClusterPolicy declares validation, mutation, and generation behaviors for matching resources.
|
||||
type ClusterPolicy struct {
|
||||
|
|
|
@ -13,10 +13,10 @@ import (
|
|||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="Background",type="string",JSONPath=".spec.background"
|
||||
// +kubebuilder:printcolumn:name="Action",type="string",JSONPath=".spec.validationFailureAction"
|
||||
// +kubebuilder:printcolumn:name="Failure Policy",type="string",JSONPath=".spec.failurePolicy",priority=1
|
||||
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.ready`
|
||||
// +kubebuilder:printcolumn:name="Background",type=boolean,JSONPath=".spec.background"
|
||||
// +kubebuilder:printcolumn:name="Validate Action",type=string,JSONPath=".spec.validationFailureAction"
|
||||
// +kubebuilder:printcolumn:name="Failure Policy",type=string,JSONPath=".spec.failurePolicy",priority=1
|
||||
// +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready`
|
||||
// +kubebuilder:resource:shortName=pol
|
||||
|
||||
// Policy declares validation, mutation, and generation behaviors for matching resources.
|
||||
|
@ -27,6 +27,10 @@ type Policy struct {
|
|||
|
||||
// Spec defines policy behaviors and contains one or more rules.
|
||||
Spec Spec `json:"spec" yaml:"spec"`
|
||||
|
||||
// Status contains policy runtime data.
|
||||
// +optional
|
||||
Status kyvernov1.PolicyStatus `json:"status,omitempty" yaml:"status,omitempty"`
|
||||
}
|
||||
|
||||
// HasAutoGenAnnotation checks if a policy has auto-gen annotation
|
||||
|
@ -84,6 +88,11 @@ func (p *Policy) IsNamespaced() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// IsReady indicates if the policy is ready to serve the admission request
|
||||
func (p *Policy) IsReady() bool {
|
||||
return p.Status.IsReady()
|
||||
}
|
||||
|
||||
// Validate implements programmatic validation.
|
||||
// namespaced means that the policy is bound to a namespace and therefore
|
||||
// should not filter/generate cluster wide resources.
|
||||
|
|
|
@ -44,6 +44,7 @@ type Spec struct {
|
|||
// Optional. Default value is "true". The value must be set to "false" if the policy rule
|
||||
// uses variables that are only available in the admission review request (e.g. user name).
|
||||
// +optional
|
||||
// +kubebuilder:default=true
|
||||
Background *bool `json:"background,omitempty" yaml:"background,omitempty"`
|
||||
|
||||
// SchemaValidation skips policy validation checks.
|
||||
|
|
|
@ -230,6 +230,7 @@ func (in *Policy) DeepCopyInto(out *Policy) {
|
|||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5643,9 +5643,9 @@ spec:
|
|||
- additionalPrinterColumns:
|
||||
- jsonPath: .spec.background
|
||||
name: Background
|
||||
type: string
|
||||
type: boolean
|
||||
- jsonPath: .spec.validationFailureAction
|
||||
name: Action
|
||||
name: Validate Action
|
||||
type: string
|
||||
- jsonPath: .spec.failurePolicy
|
||||
name: Failure Policy
|
||||
|
@ -5653,7 +5653,7 @@ spec:
|
|||
type: string
|
||||
- jsonPath: .status.ready
|
||||
name: Ready
|
||||
type: string
|
||||
type: boolean
|
||||
name: v2beta1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
|
@ -5686,6 +5686,7 @@ spec:
|
|||
- One
|
||||
type: string
|
||||
background:
|
||||
default: true
|
||||
description: Background controls if rules are applied to existing
|
||||
resources during a background scan. Optional. Default value is "true".
|
||||
The value must be set to "false" if the policy rule uses variables
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -444,6 +444,18 @@ Defaults to “false” if not specified.</p>
|
|||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>status</code><br/>
|
||||
<em>
|
||||
github.com/kyverno/kyverno/api/kyverno/v1.PolicyStatus
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Status contains policy runtime data.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
|
|
Loading…
Add table
Reference in a new issue