v2alpha1

package
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

+k8s:deepcopy-gen=package +kubebuilder:object:generate=true +groupName=kyverno.io

Copyright 2022 The Kubernetes authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

+kubebuilder:object:generate=true +groupName=kyverno.io

Index

Constants

This section is empty.

Variables

View Source
var (
	// SchemeBuilder builds the scheme
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

	// AddToScheme adds all types of this clientset into the given scheme
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: kyverno.GroupName, Version: "v2alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func ValidateSchedule

func ValidateSchedule(path *field.Path, schedule string) (errs field.ErrorList)

ValidateSchedule validates whether the schedule specified is in proper cron format or not.

Types

type CleanupPolicy

type CleanupPolicy struct {
	metav1.TypeMeta   `json:",inline,omitempty"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec declares policy behaviors.
	Spec CleanupPolicySpec `json:"spec"`

	// Status contains policy runtime data.
	// +optional
	Status CleanupPolicyStatus `json:"status,omitempty"`
}

CleanupPolicy defines a rule for resource cleanup.

func (*CleanupPolicy) DeepCopy

func (in *CleanupPolicy) DeepCopy() *CleanupPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupPolicy.

func (*CleanupPolicy) DeepCopyInto

func (in *CleanupPolicy) DeepCopyInto(out *CleanupPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CleanupPolicy) DeepCopyObject

func (in *CleanupPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*CleanupPolicy) GetAPIVersion

func (p *CleanupPolicy) GetAPIVersion() string

GetAPIVersion returns the resource kind

func (*CleanupPolicy) GetKind

func (p *CleanupPolicy) GetKind() string

GetKind returns the resource kind

func (*CleanupPolicy) GetSpec

func (p *CleanupPolicy) GetSpec() *CleanupPolicySpec

GetSpec returns the policy spec

func (*CleanupPolicy) GetStatus

func (p *CleanupPolicy) GetStatus() *CleanupPolicyStatus

GetStatus returns the policy status

func (*CleanupPolicy) Validate

func (p *CleanupPolicy) Validate(clusterResources sets.Set[string]) (errs field.ErrorList)

Validate implements programmatic validation

type CleanupPolicyInterface

type CleanupPolicyInterface interface {
	metav1.Object
	GetSpec() *CleanupPolicySpec
	GetStatus() *CleanupPolicyStatus
	Validate(sets.Set[string]) field.ErrorList
	GetKind() string
	GetAPIVersion() string
}

CleanupPolicyInterface abstracts the concrete policy type (Policy vs ClusterPolicy) +kubebuilder:object:generate=false

type CleanupPolicyList

type CleanupPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []CleanupPolicy `json:"items"`
}

CleanupPolicyList is a list of ClusterPolicy instances.

func (*CleanupPolicyList) DeepCopy

func (in *CleanupPolicyList) DeepCopy() *CleanupPolicyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupPolicyList.

func (*CleanupPolicyList) DeepCopyInto

func (in *CleanupPolicyList) DeepCopyInto(out *CleanupPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CleanupPolicyList) DeepCopyObject

func (in *CleanupPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CleanupPolicySpec

type CleanupPolicySpec struct {
	// MatchResources defines when cleanuppolicy should be applied. The match
	// criteria can include resource information (e.g. kind, name, namespace, labels)
	// and admission review request information like the user name or role.
	// At least one kind is required.
	MatchResources kyvernov2beta1.MatchResources `json:"match,omitempty"`

	// ExcludeResources defines when cleanuppolicy should not be applied. The exclude
	// criteria can include resource information (e.g. kind, name, namespace, labels)
	// and admission review request information like the name or role.
	// +optional
	ExcludeResources *kyvernov2beta1.MatchResources `json:"exclude,omitempty"`

	// The schedule in Cron format
	Schedule string `json:"schedule"`

	// Conditions defines the conditions used to select the resources which will be cleaned up.
	// +optional
	Conditions *kyvernov2beta1.AnyAllConditions `json:"conditions,omitempty"`
}

CleanupPolicySpec stores specifications for selecting resources that the user needs to delete and schedule when the matching resources needs deleted.

func (*CleanupPolicySpec) DeepCopy

func (in *CleanupPolicySpec) DeepCopy() *CleanupPolicySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupPolicySpec.

func (*CleanupPolicySpec) DeepCopyInto

func (in *CleanupPolicySpec) DeepCopyInto(out *CleanupPolicySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CleanupPolicySpec) Validate

func (p *CleanupPolicySpec) Validate(path *field.Path, clusterResources sets.Set[string], namespaced bool) (errs field.ErrorList)

Validate implements programmatic validation

func (*CleanupPolicySpec) ValidateMatchExcludeConflict

func (spec *CleanupPolicySpec) ValidateMatchExcludeConflict(path *field.Path) (errs field.ErrorList)

ValidateMatchExcludeConflict checks if the resultant of match and exclude block is not an empty set

type CleanupPolicyStatus

type CleanupPolicyStatus struct {
	Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
}

CleanupPolicyStatus stores the status of the policy.

func (*CleanupPolicyStatus) DeepCopy

func (in *CleanupPolicyStatus) DeepCopy() *CleanupPolicyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupPolicyStatus.

func (*CleanupPolicyStatus) DeepCopyInto

func (in *CleanupPolicyStatus) DeepCopyInto(out *CleanupPolicyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterCleanupPolicy

type ClusterCleanupPolicy struct {
	metav1.TypeMeta   `json:",inline,omitempty"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec declares policy behaviors.
	Spec CleanupPolicySpec `json:"spec"`

	// Status contains policy runtime data.
	// +optional
	Status CleanupPolicyStatus `json:"status,omitempty"`
}

ClusterCleanupPolicy defines rule for resource cleanup.

func (*ClusterCleanupPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCleanupPolicy.

func (*ClusterCleanupPolicy) DeepCopyInto

func (in *ClusterCleanupPolicy) DeepCopyInto(out *ClusterCleanupPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterCleanupPolicy) DeepCopyObject

func (in *ClusterCleanupPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*ClusterCleanupPolicy) GetAPIVersion

func (p *ClusterCleanupPolicy) GetAPIVersion() string

GetAPIVersion returns the resource kind

func (*ClusterCleanupPolicy) GetKind

func (p *ClusterCleanupPolicy) GetKind() string

GetKind returns the resource kind

func (*ClusterCleanupPolicy) GetSpec

GetSpec returns the policy spec

func (*ClusterCleanupPolicy) GetStatus

func (p *ClusterCleanupPolicy) GetStatus() *CleanupPolicyStatus

GetStatus returns the policy status

func (*ClusterCleanupPolicy) Validate

func (p *ClusterCleanupPolicy) Validate(clusterResources sets.Set[string]) (errs field.ErrorList)

Validate implements programmatic validation

type ClusterCleanupPolicyList

type ClusterCleanupPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []ClusterCleanupPolicy `json:"items"`
}

ClusterCleanupPolicyList is a list of ClusterCleanupPolicy instances.

func (*ClusterCleanupPolicyList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCleanupPolicyList.

func (*ClusterCleanupPolicyList) DeepCopyInto

func (in *ClusterCleanupPolicyList) DeepCopyInto(out *ClusterCleanupPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterCleanupPolicyList) DeepCopyObject

func (in *ClusterCleanupPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type Exception

type Exception struct {
	// PolicyName identifies the policy to which the exception is applied.
	// The policy name uses the format <namespace>/<name> unless it
	// references a ClusterPolicy.
	PolicyName string `json:"policyName"`

	// RuleNames identifies the rules to which the exception is applied.
	RuleNames []string `json:"ruleNames"`
}

Exception stores infos about a policy and rules

func (*Exception) Contains

func (p *Exception) Contains(policy string, rule string) bool

Contains returns true if it contains an exception for the given policy/rule pair

func (*Exception) DeepCopy

func (in *Exception) DeepCopy() *Exception

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exception.

func (*Exception) DeepCopyInto

func (in *Exception) DeepCopyInto(out *Exception)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Exception) Validate

func (p *Exception) Validate(path *field.Path) (errs field.ErrorList)

Validate implements programmatic validation

type PolicyException

type PolicyException struct {
	metav1.TypeMeta   `json:",inline,omitempty"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec declares policy exception behaviors.
	Spec PolicyExceptionSpec `json:"spec"`
}

PolicyException declares resources to be excluded from specified policies.

func (*PolicyException) Contains

func (p *PolicyException) Contains(policy string, rule string) bool

Contains returns true if it contains an exception for the given policy/rule pair

func (*PolicyException) DeepCopy

func (in *PolicyException) DeepCopy() *PolicyException

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyException.

func (*PolicyException) DeepCopyInto

func (in *PolicyException) DeepCopyInto(out *PolicyException)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PolicyException) DeepCopyObject

func (in *PolicyException) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*PolicyException) Validate

func (p *PolicyException) Validate() (errs field.ErrorList)

Validate implements programmatic validation

type PolicyExceptionList

type PolicyExceptionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []PolicyException `json:"items"`
}

PolicyExceptionList is a list of Policy Exceptions

func (*PolicyExceptionList) DeepCopy

func (in *PolicyExceptionList) DeepCopy() *PolicyExceptionList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyExceptionList.

func (*PolicyExceptionList) DeepCopyInto

func (in *PolicyExceptionList) DeepCopyInto(out *PolicyExceptionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PolicyExceptionList) DeepCopyObject

func (in *PolicyExceptionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type PolicyExceptionSpec

type PolicyExceptionSpec struct {
	// Match defines match clause used to check if a resource applies to the exception
	Match kyvernov2beta1.MatchResources `json:"match"`

	// Exceptions is a list policy/rules to be excluded
	Exceptions []Exception `json:"exceptions"`
}

PolicyExceptionSpec stores policy exception spec

func (*PolicyExceptionSpec) Contains

func (p *PolicyExceptionSpec) Contains(policy string, rule string) bool

Contains returns true if it contains an exception for the given policy/rule pair

func (*PolicyExceptionSpec) DeepCopy

func (in *PolicyExceptionSpec) DeepCopy() *PolicyExceptionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyExceptionSpec.

func (*PolicyExceptionSpec) DeepCopyInto

func (in *PolicyExceptionSpec) DeepCopyInto(out *PolicyExceptionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PolicyExceptionSpec) Validate

func (p *PolicyExceptionSpec) Validate(path *field.Path) (errs field.ErrorList)

Validate implements programmatic validation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL