Documentation
¶
Overview ¶
Package v1 contains API Schema definitions for the policy v1 API group +kubebuilder:object:generate=true +groupName=policy.open-cluster-management.io
Index ¶
- Constants
- Variables
- type BindingOverrides
- type ComplianceHistory
- type CompliancePerClusterStatus
- type ComplianceState
- type DetailsPerTemplate
- type HubTemplateOptions
- type Placement
- type PlacementBinding
- type PlacementBindingList
- type PlacementBindingStatus
- type PlacementDecision
- type PlacementSubject
- type Policy
- func (in *Policy) DeepCopy() *Policy
- func (in *Policy) DeepCopyInto(out *Policy)
- func (in *Policy) DeepCopyObject() runtime.Object
- func (r *Policy) SetupWebhookWithManager(mgr ctrl.Manager) error
- func (r *Policy) ValidateCreate() (admission.Warnings, error)
- func (r *Policy) ValidateDelete() (admission.Warnings, error)
- func (r *Policy) ValidateUpdate(_ runtime.Object) (admission.Warnings, error)
- type PolicyDependency
- type PolicyList
- type PolicySpec
- type PolicyStatus
- type PolicyTemplate
- type RemediationAction
- type SubFilter
- type Subject
Constants ¶
const Kind = "Policy"
Kind Policy
const PolicySetKind = "PolicySet"
PolicySetKind Policy
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "policy.open-cluster-management.io", Version: "v1"} SchemeGroupVersion = GroupVersion // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
This section is empty.
Types ¶
type BindingOverrides ¶ added in v0.12.0
type BindingOverrides struct { // RemediationAction overrides the policy remediationAction on target clusters. This parameter is // optional. If you set it, you must set it to "enforce". // // +kubebuilder:validation:Optional // +kubebuilder:validation:Enum=Enforce;enforce RemediationAction string `json:"remediationAction,omitempty"` }
BindingOverrides defines the overrides for the subjects.
func (*BindingOverrides) DeepCopy ¶ added in v0.12.0
func (in *BindingOverrides) DeepCopy() *BindingOverrides
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingOverrides.
func (*BindingOverrides) DeepCopyInto ¶ added in v0.12.0
func (in *BindingOverrides) DeepCopyInto(out *BindingOverrides)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ComplianceHistory ¶
type ComplianceHistory struct { // LastTimestamp is the timestamp of the event that reported the message. LastTimestamp metav1.Time `json:"lastTimestamp,omitempty" protobuf:"bytes,7,opt,name=lastTimestamp"` // Message is the compliance message resulting from evaluating the policy resource. Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` // EventName is the name of the event attached to the message. EventName string `json:"eventName,omitempty"` }
ComplianceHistory reports a compliance message from a given time and event.
func (*ComplianceHistory) DeepCopy ¶
func (in *ComplianceHistory) DeepCopy() *ComplianceHistory
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComplianceHistory.
func (*ComplianceHistory) DeepCopyInto ¶
func (in *ComplianceHistory) DeepCopyInto(out *ComplianceHistory)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CompliancePerClusterStatus ¶
type CompliancePerClusterStatus struct { ComplianceState ComplianceState `json:"compliant,omitempty"` ClusterName string `json:"clustername,omitempty"` ClusterNamespace string `json:"clusternamespace,omitempty"` }
CompliancePerClusterStatus reports the name of a managed cluster and its compliance state for this policy.
func (*CompliancePerClusterStatus) DeepCopy ¶
func (in *CompliancePerClusterStatus) DeepCopy() *CompliancePerClusterStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompliancePerClusterStatus.
func (*CompliancePerClusterStatus) DeepCopyInto ¶
func (in *CompliancePerClusterStatus) DeepCopyInto(out *CompliancePerClusterStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ComplianceState ¶
type ComplianceState string
ComplianceState reports the observed status resulting from the definitions of the policy.
+kubebuilder:validation:Enum=Compliant;Pending;NonCompliant
const ( Compliant ComplianceState = "Compliant" NonCompliant ComplianceState = "NonCompliant" Pending ComplianceState = "Pending" )
type DetailsPerTemplate ¶
type DetailsPerTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields TemplateMeta metav1.ObjectMeta `json:"templateMeta,omitempty"` ComplianceState ComplianceState `json:"compliant,omitempty"` History []ComplianceHistory `json:"history,omitempty"` }
DetailsPerTemplate reports the current compliance state and list of recent compliance messages for a given policy template.
func (*DetailsPerTemplate) DeepCopy ¶
func (in *DetailsPerTemplate) DeepCopy() *DetailsPerTemplate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DetailsPerTemplate.
func (*DetailsPerTemplate) DeepCopyInto ¶
func (in *DetailsPerTemplate) DeepCopyInto(out *DetailsPerTemplate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HubTemplateOptions ¶ added in v0.15.0
type HubTemplateOptions struct { // ServiceAccountName is the name of a service account in the same namespace as the policy to use for all hub // template lookups. The service account must have list and watch permissions on any object the hub templates // look up. If not specified, lookups are restricted to namespaced objects in the same namespace as the policy and // to the `ManagedCluster` object associated with the propagated policy. ServiceAccountName string `json:"serviceAccountName,omitempty"` }
func (*HubTemplateOptions) DeepCopy ¶ added in v0.15.0
func (in *HubTemplateOptions) DeepCopy() *HubTemplateOptions
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HubTemplateOptions.
func (*HubTemplateOptions) DeepCopyInto ¶ added in v0.15.0
func (in *HubTemplateOptions) DeepCopyInto(out *HubTemplateOptions)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Placement ¶
type Placement struct { // PlacementBinding is the name of the PlacementBinding resource, from the // policies.open-cluster-management.io API group, that binds the placement resource to the policy. PlacementBinding string `json:"placementBinding,omitempty"` // PlacementRule (deprecated) is the name of the PlacementRule resource, from the // apps.open-cluster-management.io API group, that is bound to the policy. PlacementRule string `json:"placementRule,omitempty"` // Placement is the name of the Placement resource, from the cluster.open-cluster-management.io // API group, that is bound to the policy. Placement string `json:"placement,omitempty"` // Decisions is the list of managed clusters returned by the placement resource for this binding. Decisions []PlacementDecision `json:"decisions,omitempty"` // PolicySet is the name of the policy set containing this policy and bound to the placement. If // specified, then for this placement the policy is being propagated through this policy set // rather than the policy being bound directly to a placement and propagated individually. PolicySet string `json:"policySet,omitempty"` }
Placement reports how and what managed cluster placement resources are attached to the policy.
func (*Placement) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement.
func (*Placement) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PlacementBinding ¶
type PlacementBinding struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` PlacementRef PlacementSubject `json:"placementRef"` // +kubebuilder:validation:MinItems=1 Subjects []Subject `json:"subjects"` // +kubebuilder:validation:Optional BindingOverrides BindingOverrides `json:"bindingOverrides,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:validation:Enum=restricted SubFilter SubFilter `json:"subFilter,omitempty"` Status PlacementBindingStatus `json:"status,omitempty"` }
PlacementBinding is the schema for the placementbindings API. A PlacementBinding resource binds a managed cluster placement resource to a policy or policy set, along with configurable overrides.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:path=placementbindings,scope=Namespaced +kubebuilder:resource:path=placementbindings,shortName=pb
func (*PlacementBinding) DeepCopy ¶
func (in *PlacementBinding) DeepCopy() *PlacementBinding
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementBinding.
func (*PlacementBinding) DeepCopyInto ¶
func (in *PlacementBinding) DeepCopyInto(out *PlacementBinding)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PlacementBinding) DeepCopyObject ¶
func (in *PlacementBinding) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PlacementBindingList ¶
type PlacementBindingList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []PlacementBinding `json:"items"` }
PlacementBindingList contains a list of placement bindings.
+kubebuilder:object:root=true
func (*PlacementBindingList) DeepCopy ¶
func (in *PlacementBindingList) DeepCopy() *PlacementBindingList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementBindingList.
func (*PlacementBindingList) DeepCopyInto ¶
func (in *PlacementBindingList) DeepCopyInto(out *PlacementBindingList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PlacementBindingList) DeepCopyObject ¶
func (in *PlacementBindingList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PlacementBindingStatus ¶
type PlacementBindingStatus struct{}
PlacementBindingStatus defines the observed state of the PlacementBinding resource.
func (*PlacementBindingStatus) DeepCopy ¶
func (in *PlacementBindingStatus) DeepCopy() *PlacementBindingStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementBindingStatus.
func (*PlacementBindingStatus) DeepCopyInto ¶
func (in *PlacementBindingStatus) DeepCopyInto(out *PlacementBindingStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PlacementDecision ¶
type PlacementDecision struct { ClusterName string `json:"clusterName,omitempty"` ClusterNamespace string `json:"clusterNamespace,omitempty"` }
PlacementDecision is the cluster name returned by the placement resource.
func (*PlacementDecision) DeepCopy ¶
func (in *PlacementDecision) DeepCopy() *PlacementDecision
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDecision.
func (*PlacementDecision) DeepCopyInto ¶
func (in *PlacementDecision) DeepCopyInto(out *PlacementDecision)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PlacementSubject ¶
type PlacementSubject struct { // APIGroup is the API group to which the kind belongs. Must be set to // "cluster.open-cluster-management.io" for Placement or "apps.open-cluster-management.io" for // PlacementRule (deprecated). // // +kubebuilder:validation:Enum=apps.open-cluster-management.io;cluster.open-cluster-management.io // +kubebuilder:validation:MinLength=1 APIGroup string `json:"apiGroup"` // Kind is the kind of the placement resource. Must be set to either "Placement" or // "PlacementRule" (deprecated). // // +kubebuilder:validation:Enum=PlacementRule;Placement // +kubebuilder:validation:MinLength=1 Kind string `json:"kind"` // Name is the name of the placement resource being bound. // // +kubebuilder:validation:MinLength=1 Name string `json:"name"` }
PlacementSubject defines the placement resource that is being bound to the subjects defined in the placement binding.
func (*PlacementSubject) DeepCopy ¶
func (in *PlacementSubject) DeepCopy() *PlacementSubject
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSubject.
func (*PlacementSubject) DeepCopyInto ¶
func (in *PlacementSubject) DeepCopyInto(out *PlacementSubject)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Policy ¶
type Policy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` Spec PolicySpec `json:"spec"` Status PolicyStatus `json:"status,omitempty"` }
Policy is the schema for the policies API. Policy wraps other policy engine resources in its "policy-templates" array in order to deliver the resources to managed clusters.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:path=policies,scope=Namespaced +kubebuilder:resource:path=policies,shortName=plc +kubebuilder:printcolumn:name="Remediation action",type="string",JSONPath=".spec.remediationAction" +kubebuilder:printcolumn:name="Compliance state",type="string",JSONPath=".status.compliant" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
func (*Policy) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
func (*Policy) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Policy) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Policy) SetupWebhookWithManager ¶ added in v0.12.0
func (*Policy) ValidateCreate ¶ added in v0.12.0
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (*Policy) ValidateDelete ¶ added in v0.12.0
ValidateDelete implements webhook.Validator so a webhook will be registered for the type
type PolicyDependency ¶ added in v0.10.0
type PolicyDependency struct { metav1.TypeMeta `json:",inline"` // Name is the name of the object that the policy depends on. Name string `json:"name"` // Namespace is the namespace of the object that the policy depends on (optional). Namespace string `json:"namespace,omitempty"` // Compliance is the required ComplianceState of the object that the policy depends on, at the // following path, .status.compliant. Compliance ComplianceState `json:"compliance"` }
Each PolicyDependency defines an object reference which must be in a certain compliance state before the policy should be created.
func (*PolicyDependency) DeepCopy ¶ added in v0.10.0
func (in *PolicyDependency) DeepCopy() *PolicyDependency
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDependency.
func (*PolicyDependency) DeepCopyInto ¶ added in v0.10.0
func (in *PolicyDependency) DeepCopyInto(out *PolicyDependency)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PolicyList ¶
type PolicyList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Policy `json:"items"` }
PolicyList contains a list of policies.
+kubebuilder:object:root=true
func (*PolicyList) DeepCopy ¶
func (in *PolicyList) DeepCopy() *PolicyList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyList.
func (*PolicyList) DeepCopyInto ¶
func (in *PolicyList) DeepCopyInto(out *PolicyList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PolicyList) DeepCopyObject ¶
func (in *PolicyList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PolicySpec ¶
type PolicySpec struct { // Disabled is a boolean parameter you can use to enable and disable the policy. When disabled, // the policy is removed from managed clusters. Disabled bool `json:"disabled"` // CopyPolicyMetadata specifies whether the labels and annotations of a policy should be copied // when replicating the policy to a managed cluster. If set to "true", all of the labels and // annotations of the policy are copied to the replicated policy. If set to "false", only the // policy framework-specific policy labels and annotations are copied to the replicated policy. // This setting is useful if there is tracking for metadata that should only exist on the root // policy. It is recommended to set this to "false" when using Argo CD to deploy the policy // definition since Argo CD uses metadata for tracking that should not be replicated. The default // value is "true". // // +kubebuilder:validation:Optional CopyPolicyMetadata *bool `json:"copyPolicyMetadata,omitempty"` // RemediationAction specifies the remediation of the policy. The parameter values are "enforce" // and "inform". If specified, the value that is defined overrides any remediationAction parameter // defined in the child policies in the "policy-templates" section. Important: Not all policy // engine kinds support the enforce feature. RemediationAction RemediationAction `json:"remediationAction,omitempty"` // PolicyTemplates is a list of definitions of policy engine resources to apply to managed // clusters along with configurations on how it should be applied. PolicyTemplates []*PolicyTemplate `json:"policy-templates"` // PolicyDependencies is a list of dependency objects detailed with extra considerations for // compliance that should be fulfilled before applying the policies to the managed clusters. Dependencies []PolicyDependency `json:"dependencies,omitempty"` // HubTemplateOptions changes the default behavior of hub templates. HubTemplateOptions *HubTemplateOptions `json:"hubTemplateOptions,omitempty"` }
PolicySpec defines the configurations of the policy engine resources to deliver to the managed clusters.
func (*PolicySpec) DeepCopy ¶
func (in *PolicySpec) DeepCopy() *PolicySpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicySpec.
func (*PolicySpec) DeepCopyInto ¶
func (in *PolicySpec) DeepCopyInto(out *PolicySpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PolicyStatus ¶
type PolicyStatus struct { // Placement is a list of managed cluster placement resources bound to the policy. This status // field is only used in the root policy on the hub cluster. Placement []*Placement `json:"placement,omitempty"` // Status is a list of managed clusters and the current compliance state of each one. This // status field is only used in the root policy on the hub cluster. Status []*CompliancePerClusterStatus `json:"status,omitempty"` // ComplianceState reports the observed status resulting from the definitions of this policy. This // status field is only used in the replicated policy in the managed cluster namespace. ComplianceState ComplianceState `json:"compliant,omitempty"` // Details is the list of compliance details for each policy template definition. This status // field is only used in the replicated policy in the managed cluster namespace. Details []*DetailsPerTemplate `json:"details,omitempty"` }
PolicyStatus reports the observed status of the policy resulting from its policy templates.
func (*PolicyStatus) DeepCopy ¶
func (in *PolicyStatus) DeepCopy() *PolicyStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyStatus.
func (*PolicyStatus) DeepCopyInto ¶
func (in *PolicyStatus) DeepCopyInto(out *PolicyStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PolicyTemplate ¶
type PolicyTemplate struct { // A Kubernetes object defining the policy to apply to a managed cluster // // +kubebuilder:pruning:PreserveUnknownFields ObjectDefinition runtime.RawExtension `json:"objectDefinition"` // ExtraDependencies is additional PolicyDependencies that only apply to this policy template. // ExtraDependencies is a list of dependency objects detailed with extra considerations for // compliance that should be fulfilled before applying the policy template to the managed // clusters. ExtraDependencies []PolicyDependency `json:"extraDependencies,omitempty"` // IgnorePending is a boolean parameter to specify whether to ignore the "Pending" status of this // template when calculating the overall policy status. The default value is "false" to not ignore a // "Pending" status. IgnorePending bool `json:"ignorePending,omitempty"` }
PolicyTemplate is the definition of the policy engine resource to apply to the managed cluster, along with configurations on how it should be applied.
func (*PolicyTemplate) DeepCopy ¶
func (in *PolicyTemplate) DeepCopy() *PolicyTemplate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyTemplate.
func (*PolicyTemplate) DeepCopyInto ¶
func (in *PolicyTemplate) DeepCopyInto(out *PolicyTemplate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RemediationAction ¶
type RemediationAction string
RemediationAction specifies the remediation of the policy. The parameter values are "enforce" and "inform".
+kubebuilder:validation:Enum=Inform;inform;Enforce;enforce
const ( Enforce RemediationAction = "Enforce" Inform RemediationAction = "Inform" )
type SubFilter ¶ added in v0.12.0
type SubFilter string
SubFilter provides the ability to apply overrides to a subset of bound clusters when multiple placement bindings are used to bind a policy to placements. When set, only the overrides will be applied to the clusters bound by this placement binding but it will not be considered for placing the policy. This parameter is optional. If you set it, you must set it to "restricted".
const (
Restricted SubFilter = "restricted"
)
type Subject ¶
type Subject struct { // APIGroup is the API group to which the kind belongs. Must be set to // "policy.open-cluster-management.io". // // +kubebuilder:validation:Enum=policy.open-cluster-management.io // +kubebuilder:validation:MinLength=1 APIGroup string `json:"apiGroup"` // Kind is the kind of the object to bind to the placement resource. Must be set to either // "Policy" or "PolicySet". // // +kubebuilder:validation:Enum=Policy;PolicySet // +kubebuilder:validation:MinLength=1 Kind string `json:"kind"` // Name is the name of the policy or policy set to bind to the placement resource. // // +kubebuilder:validation:MinLength=1 Name string `json:"name"` }
Subject defines the resource to bind to the placement resource.
func (*Subject) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subject.
func (*Subject) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.