v1beta1

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package v1beta1 contains API Schema definitions for the policy v1beta1 API group +kubebuilder:object:generate=true +groupName=policy.open-cluster-management.io

Index

Constants

View Source
const DefaultPolicyViolationsLimit = 1000

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "policy.open-cluster-management.io", Version: "v1beta1"}

	// 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 AutomationDef

type AutomationDef struct {
	// Type of the automation to invoke
	Type string `json:"type,omitempty"`

	// Name of the Ansible Template to run in Ansible Automation Platform as a job.
	//
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`

	// ExtraVars is passed to the Ansible job at execution time and is a known Ansible entity.
	//
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtraVars *runtime.RawExtension `json:"extra_vars,omitempty"`

	// TowerSecret is the name of the secret that contains the Ansible Automation Platform credential.
	//
	// +kubebuilder:validation:MinLength=1
	TowerSecret string `json:"secret"`

	// JobTTL sets the time to live for the Kubernetes Job object after the Ansible job playbook run
	// has finished.
	JobTTL *int `json:"jobTtl,omitempty"`

	// The maximum number of violating cluster contexts that are provided to the Ansible job as
	// extra variables. When policyViolationsLimit is set to "0", it means no limit. The default value
	// is "1000".
	//
	// +kubebuilder:validation:Minimum=0
	PolicyViolationsLimit *uint16 `json:"policyViolationsLimit,omitempty"`
}

AutomationDef defines the automation to invoke.

func (*AutomationDef) DeepCopy

func (in *AutomationDef) DeepCopy() *AutomationDef

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

func (*AutomationDef) DeepCopyInto

func (in *AutomationDef) DeepCopyInto(out *AutomationDef)

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

type ClusterEvent added in v0.9.0

type ClusterEvent struct {
	// AutomationStartTime is the policy automation start time for everyEvent mode.
	AutomationStartTime string `json:"automationStartTime"`

	// EventTime is the last policy compliance transition event time.
	EventTime string `json:"eventTime"`
}

ClusterEvent shows the PolicyAutomation event on each target cluster.

func (*ClusterEvent) DeepCopy added in v0.10.0

func (in *ClusterEvent) DeepCopy() *ClusterEvent

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

func (*ClusterEvent) DeepCopyInto added in v0.10.0

func (in *ClusterEvent) DeepCopyInto(out *ClusterEvent)

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

type NonEmptyString added in v0.7.0

type NonEmptyString string

+kubebuilder:validation:MinLength=1

type PolicyAutomation

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

	Spec   PolicyAutomationSpec   `json:"spec"`
	Status PolicyAutomationStatus `json:"status,omitempty"`
}

PolicyAutomation is the schema for the policyautomations API. PolicyAutomation configures creation of an AnsibleJob, from the tower.ansible.com API group, to initiate Ansible to run upon noncompliant events of the attached policy, or when you manually initiate the run with the "policy.open-cluster-management.io/rerun=true" annotation.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:path=policyautomations,scope=Namespaced +kubebuilder:resource:path=policyautomations,shortName=plca

func (*PolicyAutomation) DeepCopy

func (in *PolicyAutomation) DeepCopy() *PolicyAutomation

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

func (*PolicyAutomation) DeepCopyInto

func (in *PolicyAutomation) DeepCopyInto(out *PolicyAutomation)

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

func (*PolicyAutomation) DeepCopyObject

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

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

type PolicyAutomationList

type PolicyAutomationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PolicyAutomation `json:"items"`
}

PolicyAutomationList contains a list of policy automations.

+kubebuilder:object:root=true

func (*PolicyAutomationList) DeepCopy

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

func (*PolicyAutomationList) DeepCopyInto

func (in *PolicyAutomationList) DeepCopyInto(out *PolicyAutomationList)

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

func (*PolicyAutomationList) DeepCopyObject

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

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

type PolicyAutomationMode added in v0.9.0

type PolicyAutomationMode string

Mode specifies how often automation is initiated. The supported values are "once", "everyEvent", and "disabled".

+kubebuilder:validation:Enum={once,everyEvent,disabled}

const (
	Once       PolicyAutomationMode = "once"
	EveryEvent PolicyAutomationMode = "everyEvent"
	Disabled   PolicyAutomationMode = "disabled"
)

type PolicyAutomationSpec

type PolicyAutomationSpec struct {
	Automation AutomationDef        `json:"automationDef"`
	Mode       PolicyAutomationMode `json:"mode"`

	// PolicyRef is the name of the policy that this automation resource is bound to.
	PolicyRef string `json:"policyRef"`

	// EventHook specifies the compliance state that initiates automation. This must be set to
	// "noncompliant".
	//
	// +kubebuilder:validation:Enum={noncompliant}
	// +kubebuilder:default=noncompliant
	EventHook string `json:"eventHook,omitempty"`

	// RescanAfter is reserved for future use and should not be set.
	RescanAfter string `json:"rescanAfter,omitempty"`

	// DelayAfterRunSeconds sets the minimum number of seconds before an automation can run again due
	// to a new violation on the same managed cluster. This only applies to the EveryEvent mode. The
	// default value is "0".
	//
	// +kubebuilder:validation:Minimum=0
	DelayAfterRunSeconds uint `json:"delayAfterRunSeconds,omitempty"`
}

PolicyAutomationSpec defines how and when automation is initiated for the referenced policy.

func (*PolicyAutomationSpec) DeepCopy

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

func (*PolicyAutomationSpec) DeepCopyInto

func (in *PolicyAutomationSpec) DeepCopyInto(out *PolicyAutomationSpec)

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

type PolicyAutomationStatus

type PolicyAutomationStatus struct {
	// Cluster name as the key of ClustersWithEvent
	ClustersWithEvent map[string]ClusterEvent `json:"clustersWithEvent,omitempty"`
}

PolicyAutomationStatus defines the observed state of the PolicyAutomation resource.

func (*PolicyAutomationStatus) DeepCopy

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

func (*PolicyAutomationStatus) DeepCopyInto

func (in *PolicyAutomationStatus) DeepCopyInto(out *PolicyAutomationStatus)

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

type PolicySet added in v0.7.0

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

	Spec   PolicySetSpec   `json:"spec"`
	Status PolicySetStatus `json:"status,omitempty"`
}

PolicySet is the schema for the policysets API. A policy set is a logical grouping of policies from the same namespace. The policy set is bound to a placement resource and applies the placement to all policies within the set. The status reports the overall compliance of the set.

+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:path=policysets,scope=Namespaced +kubebuilder:resource:path=policysets,shortName=plcset +kubebuilder:printcolumn:name="Compliance state",type="string",JSONPath=".status.compliant" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

func (*PolicySet) DeepCopy added in v0.7.0

func (in *PolicySet) DeepCopy() *PolicySet

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

func (*PolicySet) DeepCopyInto added in v0.7.0

func (in *PolicySet) DeepCopyInto(out *PolicySet)

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

func (*PolicySet) DeepCopyObject added in v0.7.0

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

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

type PolicySetList added in v0.7.0

type PolicySetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PolicySet `json:"items"`
}

PolicySetList contains a list of policy sets.

+kubebuilder:object:root=true

func (*PolicySetList) DeepCopy added in v0.7.0

func (in *PolicySetList) DeepCopy() *PolicySetList

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

func (*PolicySetList) DeepCopyInto added in v0.7.0

func (in *PolicySetList) DeepCopyInto(out *PolicySetList)

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

func (*PolicySetList) DeepCopyObject added in v0.7.0

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

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

type PolicySetSpec added in v0.7.0

type PolicySetSpec struct {
	// Description is the description of this policy set.
	Description string `json:"description,omitempty"`

	// Policies is a list of policy names that are contained within the policy set.
	Policies []NonEmptyString `json:"policies"`
}

PolicySetSpec defines the group of policies to be included in the policy set.

func (*PolicySetSpec) DeepCopy added in v0.7.0

func (in *PolicySetSpec) DeepCopy() *PolicySetSpec

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

func (*PolicySetSpec) DeepCopyInto added in v0.7.0

func (in *PolicySetSpec) DeepCopyInto(out *PolicySetSpec)

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

type PolicySetStatus added in v0.7.0

type PolicySetStatus struct {
	Placement []PolicySetStatusPlacement `json:"placement,omitempty"`

	// Compliant reports the observed status resulting from the compliance of the policies within.
	Compliant policyv1.ComplianceState `json:"compliant,omitempty"`

	// StatusMessge reports the current state while determining the compliance of the policy set.
	StatusMessage string `json:"statusMessage,omitempty"`
}

PolicySetStatus reports the observed status of the policy set resulting from its policies.

func (*PolicySetStatus) DeepCopy added in v0.7.0

func (in *PolicySetStatus) DeepCopy() *PolicySetStatus

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

func (*PolicySetStatus) DeepCopyInto added in v0.7.0

func (in *PolicySetStatus) DeepCopyInto(out *PolicySetStatus)

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

type PolicySetStatusPlacement added in v0.7.0

type PolicySetStatusPlacement 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
	// set.
	PlacementBinding string `json:"placementBinding,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"`

	// 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"`
}

PolicySetStatusPlacement reports how and what managed cluster placement resources are attached to the policy set.

func (*PolicySetStatusPlacement) DeepCopy added in v0.7.0

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

func (*PolicySetStatusPlacement) DeepCopyInto added in v0.7.0

func (in *PolicySetStatusPlacement) DeepCopyInto(out *PolicySetStatusPlacement)

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

type ReplicatedComplianceHistory added in v0.10.0

type ReplicatedComplianceHistory struct {
	LastTimestamp metav1.Time `json:"lastTimestamp,omitempty" protobuf:"bytes,7,opt,name=lastTimestamp"`
	Message       string      `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"`
}

ReplicatedComplianceHistory defines the replicated policy compliance details history.

func (*ReplicatedComplianceHistory) DeepCopy added in v0.12.0

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

func (*ReplicatedComplianceHistory) DeepCopyInto added in v0.12.0

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

type ReplicatedDetailsPerTemplate added in v0.10.0

type ReplicatedDetailsPerTemplate struct {
	ComplianceState policyv1.ComplianceState      `json:"compliant"`
	History         []ReplicatedComplianceHistory `json:"history"`
}

ReplicatedDetailsPerTemplate defines the replicated policy compliance details and history.

func (*ReplicatedDetailsPerTemplate) DeepCopy added in v0.12.0

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

func (*ReplicatedDetailsPerTemplate) DeepCopyInto added in v0.12.0

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

type ReplicatedPolicyStatus added in v0.10.0

type ReplicatedPolicyStatus struct {
	ComplianceState  policyv1.ComplianceState       `json:"compliant"`         // used by replicated policy
	ViolationMessage string                         `json:"violation_message"` // used by replicated policy
	Details          []ReplicatedDetailsPerTemplate `json:"details"`           // used by replicated policy
}

ReplicatedPolicyStatus defines the replicated policy status.

func (*ReplicatedPolicyStatus) DeepCopy added in v0.12.0

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

func (*ReplicatedPolicyStatus) DeepCopyInto added in v0.12.0

func (in *ReplicatedPolicyStatus) DeepCopyInto(out *ReplicatedPolicyStatus)

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

type ViolationContext added in v0.10.0

type ViolationContext struct {
	TargetClusters   []string                          `json:"targetClusters" ansibleJob:"target_clusters"`
	PolicyName       string                            `json:"policyName" ansibleJob:"policy_name"`
	PolicyNamespace  string                            `json:"policyNamespace" ansibleJob:"policy_namespace"`
	HubCluster       string                            `json:"hubCluster" ansibleJob:"hub_cluster"`
	PolicySets       []string                          `json:"policySets" ansibleJob:"policy_sets"`
	PolicyViolations map[string]ReplicatedPolicyStatus `json:"policyViolations" ansibleJob:"policy_violations"`
}

ViolationContext defines the noncompliant replicated policy information that is sent to the AnsibleJob through the extra_vars parameter.

func (*ViolationContext) DeepCopy added in v0.12.0

func (in *ViolationContext) DeepCopy() *ViolationContext

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

func (*ViolationContext) DeepCopyInto added in v0.12.0

func (in *ViolationContext) DeepCopyInto(out *ViolationContext)

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

Jump to

Keyboard shortcuts

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