v1beta1

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

+kubebuilder:object:generate=true +k8s:deepcopy-gen=package,register +groupName=placement.kubernetes-fleet.io

+kubebuilder:object:generate=true +groupName=placement.kubernetes-fleet.io

Index

Constants

View Source
const (
	// ClusterResourcePlacementCleanupFinalizer is a finalizer added by the CRP controller to all CRPs, to make sure
	// that the CRP controller can react to CRP deletions if necessary.
	ClusterResourcePlacementCleanupFinalizer = fleetPrefix + "crp-cleanup"

	// RevisionHistoryLimitDefaultValue is the default value of RevisionHistoryLimit.
	RevisionHistoryLimitDefaultValue = int32(10)

	// SchedulerCRPCleanupFinalizer is a finalizer addd by the scheduler to CRPs, to make sure
	// that all bindings derived from a CRP can be cleaned up after the CRP is deleted.
	SchedulerCRPCleanupFinalizer = fleetPrefix + "scheduler-cleanup"

	// DefaultMaxUnavailableValue is the default value of MaxUnavailable in the rolling update config.
	DefaultMaxUnavailableValue = "25%"

	// 	DefaultMaxSurgeValue is the default value of MaxSurge in the rolling update config.
	DefaultMaxSurgeValue = "25%"

	// DefaultUnavailablePeriodSeconds is the default period of time we consider a newly applied workload as unavailable.
	DefaultUnavailablePeriodSeconds = 60
)
View Source
const (
	ClusterResourcePlacementKind        = "ClusterResourcePlacement"
	ClusterResourceBindingKind          = "ClusterResourceBinding"
	ClusterResourceSnapshotKind         = "ClusterResourceSnapshot"
	ClusterSchedulingPolicySnapshotKind = "ClusterSchedulingPolicySnapshot"
	WorkKind                            = "Work"
	AppliedWorkKind                     = "AppliedWork"
)
View Source
const (

	// MemberClusterFinalizer is used to make sure that we handle gc of all the member cluster resources on the hub cluster.
	MemberClusterFinalizer = fleetPrefix + "membercluster-finalizer"

	// WorkFinalizer is used by the work generator to make sure that the binding is not deleted until the work objects
	// it generates are all deleted, or used by the work controller to make sure the work has been deleted in the member
	// cluster.
	WorkFinalizer = fleetPrefix + "work-cleanup"

	// CRPTrackingLabel is the label that points to the cluster resource policy that creates a resource binding.
	CRPTrackingLabel = fleetPrefix + "parentCRP"

	// IsLatestSnapshotLabel tells if the snapshot is the latest one.
	IsLatestSnapshotLabel = fleetPrefix + "isLatestSnapshot"

	// FleetResourceLabelKey is that label that indicates the resource is a fleet resource.
	FleetResourceLabelKey = fleetPrefix + "isFleetResource"

	// FirstWorkNameFmt is the format of the name of the first work.
	FirstWorkNameFmt = "%s-work"

	// WorkNameWithSubindexFmt is the format of the name of a work with subindex.
	WorkNameWithSubindexFmt = "%s-%d"

	// ParentResourceSnapshotIndexLabel is the label applied to work that contains the index of the resource snapshot that generates the work.
	ParentResourceSnapshotIndexLabel = fleetPrefix + "parent-resource-snapshot-index"

	// ParentBindingLabel is the label applied to work that contains the name of the binding that generates the work.
	ParentBindingLabel = fleetPrefix + "parent-resource-binding"

	// CRPGenerationAnnotation is the annotation that indicates the generation of the CRP from
	// which an object is derived or last updated.
	CRPGenerationAnnotation = fleetPrefix + "CRPGeneration"
)
View Source
const (
	// PolicyIndexLabel is the label that indicate the policy snapshot index of a cluster policy.
	PolicyIndexLabel = fleetPrefix + "policyIndex"

	// PolicySnapshotNameFmt is clusterPolicySnapshot name format: {CRPName}-{PolicySnapshotIndex}.
	PolicySnapshotNameFmt = "%s-%d"

	// NumberOfClustersAnnotation is the annotation that indicates how many clusters should be selected for selectN placement type.
	NumberOfClustersAnnotation = fleetPrefix + "numberOfClusters"
)
View Source
const (
	// ResourceIndexLabel is the label that indicate the resource snapshot index of a cluster resource snapshot.
	ResourceIndexLabel = fleetPrefix + "resourceIndex"

	// ResourceGroupHashAnnotation is the annotation that contains the value of the sha-256 hash
	// value of all the snapshots belong to the same snapshot index.
	ResourceGroupHashAnnotation = fleetPrefix + "resourceHash"

	// NumberOfResourceSnapshotsAnnotation is the annotation that contains the total number of resource snapshots.
	NumberOfResourceSnapshotsAnnotation = fleetPrefix + "numberOfResourceSnapshots"

	// SubindexOfResourceSnapshotAnnotation is the annotation to store the subindex of resource snapshot in the group.
	SubindexOfResourceSnapshotAnnotation = fleetPrefix + "subindexOfResourceSnapshot"

	// ResourceSnapshotNameFmt is resourcePolicySnapshot name format: {CRPName}-{resourceIndex}-snapshot.
	ResourceSnapshotNameFmt = "%s-%d-snapshot"

	// ResourceSnapshotNameWithSubindexFmt is resourcePolicySnapshot name with subindex format: {CRPName}-{resourceIndex}-{subindex}.
	ResourceSnapshotNameWithSubindexFmt = "%s-%d-%d"
)
View Source
const (
	// ManifestHashAnnotation is the annotation that indicates whether the spec of the object has been changed or not.
	ManifestHashAnnotation = fleetPrefix + "spec-hash"

	// LastAppliedConfigAnnotation is to record the last applied configuration on the object.
	LastAppliedConfigAnnotation = fleetPrefix + "last-applied-configuration"

	// WorkConditionTypeApplied represents workload in Work is applied successfully on the spoke cluster.
	WorkConditionTypeApplied = "Applied"
	// WorkConditionTypeAvailable represents workload in Work exists on the spoke cluster.
	WorkConditionTypeAvailable = "Available"
)

The following definitions are originally declared in the controllers/workv1alpha1/manager.go file.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "placement.kubernetes-fleet.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

func SetDefaultsClusterResourcePlacement added in v0.6.8

func SetDefaultsClusterResourcePlacement(obj *ClusterResourcePlacement)

SetDefaultsClusterResourcePlacement sets the default values for ClusterResourcePlacement.

Types

type Affinity

type Affinity struct {
	// ClusterAffinity contains cluster affinity scheduling rules for the selected resources.
	// +optional
	ClusterAffinity *ClusterAffinity `json:"clusterAffinity,omitempty"`
}

Affinity is a group of cluster affinity scheduling rules. More to be added.

func (*Affinity) DeepCopy

func (in *Affinity) DeepCopy() *Affinity

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

func (*Affinity) DeepCopyInto

func (in *Affinity) DeepCopyInto(out *Affinity)

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

type AppliedResourceMeta added in v0.6.9

type AppliedResourceMeta struct {
	WorkResourceIdentifier `json:",inline"`

	// UID is set on successful deletion of the Kubernetes resource by controller. The
	// resource might be still visible on the managed cluster after this field is set.
	// It is not directly settable by a client.
	// +optional
	UID types.UID `json:"uid,omitempty"`
}

AppliedResourceMeta represents the group, version, resource, name and namespace of a resource. Since these resources have been created, they must have valid group, version, resource, namespace, and name.

func (*AppliedResourceMeta) DeepCopy added in v0.6.9

func (in *AppliedResourceMeta) DeepCopy() *AppliedResourceMeta

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

func (*AppliedResourceMeta) DeepCopyInto added in v0.6.9

func (in *AppliedResourceMeta) DeepCopyInto(out *AppliedResourceMeta)

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

type AppliedWork added in v0.6.9

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

	// Spec represents the desired configuration of AppliedWork.
	// +kubebuilder:validation:Required
	// +required
	Spec AppliedWorkSpec `json:"spec"`

	// Status represents the current status of AppliedWork.
	// +optional
	Status AppliedWorkStatus `json:"status,omitempty"`
}

AppliedWork represents an applied work on managed cluster that is placed on a managed cluster. An appliedwork links to a work on a hub recording resources deployed in the managed cluster. When the agent is removed from managed cluster, cluster-admin on managed cluster can delete appliedwork to remove resources deployed by the agent. The name of the appliedwork must be the same as {work name} The namespace of the appliedwork should be the same as the resource applied on the managed cluster.

func (*AppliedWork) DeepCopy added in v0.6.9

func (in *AppliedWork) DeepCopy() *AppliedWork

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

func (*AppliedWork) DeepCopyInto added in v0.6.9

func (in *AppliedWork) DeepCopyInto(out *AppliedWork)

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

func (*AppliedWork) DeepCopyObject added in v0.6.9

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

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

type AppliedWorkList added in v0.6.9

type AppliedWorkList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata.
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	// List of works.
	// +listType=set
	Items []AppliedWork `json:"items"`
}

AppliedWorkList contains a list of AppliedWork.

func (*AppliedWorkList) DeepCopy added in v0.6.9

func (in *AppliedWorkList) DeepCopy() *AppliedWorkList

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

func (*AppliedWorkList) DeepCopyInto added in v0.6.9

func (in *AppliedWorkList) DeepCopyInto(out *AppliedWorkList)

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

func (*AppliedWorkList) DeepCopyObject added in v0.6.9

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

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

type AppliedWorkSpec added in v0.6.9

type AppliedWorkSpec struct {
	// WorkName represents the name of the related work on the hub.
	// +kubebuilder:validation:Required
	// +required
	WorkName string `json:"workName"`

	// WorkNamespace represents the namespace of the related work on the hub.
	// +kubebuilder:validation:Required
	// +required
	WorkNamespace string `json:"workNamespace"`
}

AppliedWorkSpec represents the desired configuration of AppliedWork.

func (*AppliedWorkSpec) DeepCopy added in v0.6.9

func (in *AppliedWorkSpec) DeepCopy() *AppliedWorkSpec

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

func (*AppliedWorkSpec) DeepCopyInto added in v0.6.9

func (in *AppliedWorkSpec) DeepCopyInto(out *AppliedWorkSpec)

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

type AppliedWorkStatus added in v0.6.9

type AppliedWorkStatus struct {
	// AppliedResources represents a list of resources defined within the Work that are applied.
	// Only resources with valid GroupVersionResource, namespace, and name are suitable.
	// An item in this slice is deleted when there is no mapped manifest in Work.Spec or by finalizer.
	// The resource relating to the item will also be removed from managed cluster.
	// The deleted resource may still be present until the finalizers for that resource are finished.
	// However, the resource will not be undeleted, so it can be removed from this list and eventual consistency is preserved.
	// +optional
	AppliedResources []AppliedResourceMeta `json:"appliedResources,omitempty"`
}

AppliedWorkStatus represents the current status of AppliedWork.

func (*AppliedWorkStatus) DeepCopy added in v0.6.9

func (in *AppliedWorkStatus) DeepCopy() *AppliedWorkStatus

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

func (*AppliedWorkStatus) DeepCopyInto added in v0.6.9

func (in *AppliedWorkStatus) DeepCopyInto(out *AppliedWorkStatus)

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

type BindingState

type BindingState string

BindingState is the state of the binding.

const (
	// BindingStateScheduled means the binding is scheduled but need to be bound to the target cluster.
	BindingStateScheduled BindingState = "Scheduled"

	// BindingStateBound means the binding is bound to the target cluster.
	BindingStateBound BindingState = "Bound"

	// BindingStateUnscheduled means the binding is not scheduled on to the target cluster anymore.
	// This is a state that rollout controller cares about.
	// The work generator still treat this as bound until rollout controller deletes the binding.
	BindingStateUnscheduled BindingState = "Unscheduled"
)

type ClusterAffinity

type ClusterAffinity struct {
	// If the affinity requirements specified by this field are not met at
	// scheduling time, the resource will not be scheduled onto the cluster.
	// If the affinity requirements specified by this field cease to be met
	// at some point after the placement (e.g. due to an update), the system
	// may or may not try to eventually remove the resource from the cluster.
	// +optional
	RequiredDuringSchedulingIgnoredDuringExecution *ClusterSelector `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"`

	// The scheduler computes a score for each cluster at schedule time by iterating
	// through the elements of this field and adding "weight" to the sum if the cluster
	// matches the corresponding matchExpression. The scheduler then chooses the first
	// `N` clusters with the highest sum to satisfy the placement.
	// This field is ignored if the placement type is "PickAll".
	// If the cluster score changes at some point after the placement (e.g. due to an update),
	// the system may or may not try to eventually move the resource from a cluster with a lower score
	// to a cluster with higher score.
	// +optional
	PreferredDuringSchedulingIgnoredDuringExecution []PreferredClusterSelector `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"`
}

ClusterAffinity contains cluster affinity scheduling rules for the selected resources.

func (*ClusterAffinity) DeepCopy

func (in *ClusterAffinity) DeepCopy() *ClusterAffinity

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

func (*ClusterAffinity) DeepCopyInto

func (in *ClusterAffinity) DeepCopyInto(out *ClusterAffinity)

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

type ClusterDecision

type ClusterDecision struct {
	// ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all
	// placement decisions for the Placement.
	// +kubebuilder:validation:Required
	// +required
	ClusterName string `json:"clusterName"`

	// Selected indicates if this cluster is selected by the scheduler.
	// +required
	Selected bool `json:"selected"`

	// ClusterScore represents the score of the cluster calculated by the scheduler.
	// +optional
	ClusterScore *ClusterScore `json:"clusterScore"`

	// Reason represents the reason why the cluster is selected or not.
	// +required
	Reason string `json:"reason"`
}

ClusterDecision represents a decision from a placement An empty ClusterDecision indicates it is not scheduled yet.

func (*ClusterDecision) DeepCopy

func (in *ClusterDecision) DeepCopy() *ClusterDecision

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

func (*ClusterDecision) DeepCopyInto

func (in *ClusterDecision) DeepCopyInto(out *ClusterDecision)

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

type ClusterResourceBinding

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

	// The desired state of ClusterResourceBinding.
	// +required
	Spec ResourceBindingSpec `json:"spec"`

	// The observed status of ClusterResourceBinding.
	// +optional
	Status ResourceBindingStatus `json:"status,omitempty"`
}

ClusterResourceBinding represents a scheduling decision that binds a group of resources to a cluster. It MUST have a label named `CRPTrackingLabel` that points to the cluster resource policy that creates it.

func (*ClusterResourceBinding) DeepCopy

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

func (*ClusterResourceBinding) DeepCopyInto

func (in *ClusterResourceBinding) DeepCopyInto(out *ClusterResourceBinding)

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

func (*ClusterResourceBinding) DeepCopyObject

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

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

func (*ClusterResourceBinding) GetCondition

func (m *ClusterResourceBinding) GetCondition(conditionType string) *metav1.Condition

GetCondition returns the condition of the given ClusterResourceBinding.

func (*ClusterResourceBinding) SetConditions

func (m *ClusterResourceBinding) SetConditions(conditions ...metav1.Condition)

SetConditions set the given conditions on the ClusterResourceBinding.

type ClusterResourceBindingList

type ClusterResourceBindingList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	// items is the list of ClusterResourceBindings.
	Items []ClusterResourceBinding `json:"items"`
}

ClusterResourceBindingList is a collection of ClusterResourceBinding. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterResourceBindingList) DeepCopy

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

func (*ClusterResourceBindingList) DeepCopyInto

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

func (*ClusterResourceBindingList) DeepCopyObject

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

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

type ClusterResourcePlacement

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

	// The desired state of ClusterResourcePlacement.
	// +required
	Spec ClusterResourcePlacementSpec `json:"spec"`

	// The observed status of ClusterResourcePlacement.
	// +optional
	Status ClusterResourcePlacementStatus `json:"status,omitempty"`
}

ClusterResourcePlacement is used to select cluster scoped resources, including built-in resources and custom resources, and placement them onto selected member clusters in a fleet.

If a namespace is selected, ALL the resources under the namespace are placed to the target clusters. Note that you can't select the following resources:

  • reserved namespaces including: default, kube-* (reserved for Kubernetes system namespaces), fleet-* (reserved for fleet system namespaces).
  • reserved fleet resource types including: MemberCluster, InternalMemberCluster, ClusterResourcePlacement, ClusterSchedulingPolicySnapshot, ClusterResourceSnapshot, ClusterResourceBinding, etc.

`ClusterSchedulingPolicySnapshot` and `ClusterResourceSnapshot` objects are created when there are changes in the system to keep the history of the changes affecting a `ClusterResourcePlacement`.

func (*ClusterResourcePlacement) DeepCopy

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

func (*ClusterResourcePlacement) DeepCopyInto

func (in *ClusterResourcePlacement) DeepCopyInto(out *ClusterResourcePlacement)

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

func (*ClusterResourcePlacement) DeepCopyObject

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

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

func (*ClusterResourcePlacement) GetCondition

func (m *ClusterResourcePlacement) GetCondition(conditionType string) *metav1.Condition

GetCondition returns the condition of the ClusterResourcePlacement objects.

func (*ClusterResourcePlacement) SetConditions

func (m *ClusterResourcePlacement) SetConditions(conditions ...metav1.Condition)

SetConditions sets the conditions of the ClusterResourcePlacement.

type ClusterResourcePlacementConditionType

type ClusterResourcePlacementConditionType string

ClusterResourcePlacementConditionType defines a specific condition of a cluster resource placement. +enum

const (
	// ClusterResourcePlacementScheduledConditionType indicates whether we have successfully scheduled the
	// ClusterResourcePlacement.
	// Its condition status can be one of the following:
	// - "True" means we have successfully scheduled the resources to fully satisfy the placement requirement.
	// - "False" means we didn't fully satisfy the placement requirement. We will fill the Reason field.
	// - "Unknown" means we don't have a scheduling decision yet.
	ClusterResourcePlacementScheduledConditionType ClusterResourcePlacementConditionType = "ClusterResourcePlacementScheduled"

	// ClusterResourcePlacementSynchronizedConditionType indicates whether the selected resources are synchronized under
	// the per-cluster namespaces (i.e., fleet-member-<member-name>) on the hub cluster.
	// Its condition status can be one of the following:
	// - "True" means all the selected resources are successfully synchronized under the per-cluster namespaces
	// (i.e., fleet-member-<member-name>) on the hub cluster.
	// - "False" means all the selected resources have not been synchronized under the per-cluster namespaces
	// (i.e., fleet-member-<member-name>) on the hub cluster yet.
	ClusterResourcePlacementSynchronizedConditionType ClusterResourcePlacementConditionType = "ClusterResourcePlacementSynchronized"

	// ClusterResourcePlacementAppliedConditionType indicates whether all the selected member clusters have applied
	// the selected resources locally.
	// Its condition status can be one of the following:
	// - "True" means all the selected resources are successfully applied to all the target clusters or apply is not needed
	// if there are no cluster(s) selected by the scheduler.
	// - "False" means some of them have failed. We will place some of the detailed failure in the FailedResourcePlacement array.
	// - "Unknown" means we haven't finished the apply yet.
	ClusterResourcePlacementAppliedConditionType ClusterResourcePlacementConditionType = "ClusterResourcePlacementApplied"
)

type ClusterResourcePlacementList

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

ClusterResourcePlacementList contains a list of ClusterResourcePlacement. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterResourcePlacementList) DeepCopy

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

func (*ClusterResourcePlacementList) DeepCopyInto

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

func (*ClusterResourcePlacementList) DeepCopyObject

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

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

type ClusterResourcePlacementSpec

type ClusterResourcePlacementSpec struct {

	// ResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`.
	// You can have 1-100 selectors.
	// +required
	ResourceSelectors []ClusterResourceSelector `json:"resourceSelectors"`

	// Policy defines how to select member clusters to place the selected resources.
	// If unspecified, all the joined member clusters are selected.
	// +optional
	Policy *PlacementPolicy `json:"policy,omitempty"`

	// The rollout strategy to use to replace existing placement with new ones.
	// +optional
	// +patchStrategy=retainKeys
	Strategy RolloutStrategy `json:"strategy,omitempty"`

	// The number of old ClusterSchedulingPolicySnapshot or ClusterResourceSnapshot resources to retain to allow rollback.
	// This is a pointer to distinguish between explicit zero and not specified.
	// Defaults to 10.
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=1000
	// +kubebuilder:default=10
	// +optional
	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
}

ClusterResourcePlacementSpec defines the desired state of ClusterResourcePlacement.

func (*ClusterResourcePlacementSpec) DeepCopy

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

func (*ClusterResourcePlacementSpec) DeepCopyInto

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

type ClusterResourcePlacementStatus

type ClusterResourcePlacementStatus struct {
	// SelectedResources contains a list of resources selected by ResourceSelectors.
	// +optional
	SelectedResources []ResourceIdentifier `json:"selectedResources,omitempty"`

	// PlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy.
	// Each selected cluster according to the latest resource placement is guaranteed to have a corresponding placementStatuses.
	// In the pickN case, there are N placement statuses where N = NumberOfClusters; Or in the pickFixed case, there are
	// N placement statuses where N = ClusterNames.
	// In these cases, some of them may not have assigned clusters when we cannot fill the required number of clusters.
	// TODO, For pickAll type, considering providing unselected clusters info.
	// +optional
	PlacementStatuses []ResourcePlacementStatus `json:"placementStatuses,omitempty"`

	// Conditions is an array of current observed conditions for ClusterResourcePlacement.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ClusterResourcePlacementStatus defines the observed state of the ClusterResourcePlacement object.

func (*ClusterResourcePlacementStatus) DeepCopy

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

func (*ClusterResourcePlacementStatus) DeepCopyInto

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

type ClusterResourceSelector

type ClusterResourceSelector struct {
	// Group name of the cluster-scoped resource.
	// Use an empty string to select resources under the core API group (e.g., namespaces).
	// +required
	Group string `json:"group"`

	// Version of the cluster-scoped resource.
	// +required
	Version string `json:"version"`

	// Kind of the cluster-scoped resource.
	// Note: When `Kind` is `namespace`, ALL the resources under the selected namespaces are selected.
	// +required
	Kind string `json:"kind"`

	// Name of the cluster-scoped resource.
	// +optional
	Name string `json:"name,omitempty"`

	// A label query over all the cluster-scoped resources. Resources matching the query are selected.
	// Note that namespace-scoped resources can't be selected even if they match the query.
	// +optional
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
}

ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. If a namespace is selected, ALL the resources under the namespace are selected automatically. All the fields are `ANDed`. In other words, a resource must match all the fields to be selected.

func (*ClusterResourceSelector) DeepCopy

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

func (*ClusterResourceSelector) DeepCopyInto

func (in *ClusterResourceSelector) DeepCopyInto(out *ClusterResourceSelector)

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

type ClusterResourceSnapshot

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

	// The desired state of ResourceSnapshot.
	// +required
	Spec ResourceSnapshotSpec `json:"spec"`

	// The observed status of ResourceSnapshot.
	// +optional
	Status ResourceSnapshotStatus `json:"status,omitempty"`
}

ClusterResourceSnapshot is used to store a snapshot of selected resources by a resource placement policy. Its spec is immutable. We may need to produce more than one resourceSnapshot for all the resources a ResourcePlacement selected to get around the 1MB size limit of k8s objects. We assign an ever-increasing index for each such group of resourceSnapshots. The naming convention of a clusterResourceSnapshot is {CRPName}-{resourceIndex}-{subindex} where the name of the first snapshot of a group has no subindex part so its name is {CRPName}-{resourceIndex}-snapshot. resourceIndex will begin with 0. Each snapshot MUST have the following labels:

  • `CRPTrackingLabel` which points to its owner CRP.
  • `ResourceIndexLabel` which is the index of the snapshot group.
  • `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one.

All the snapshots within the same index group must have the same ResourceIndexLabel.

The first snapshot of the index group MUST have the following annotations:

  • `NumberOfResourceSnapshotsAnnotation` to store the total number of resource snapshots in the index group.
  • `ResourceGroupHashAnnotation` whose value is the sha-256 hash of all the snapshots belong to the same snapshot index.

Each snapshot (excluding the first snapshot) MUST have the following annotations:

  • `SubindexOfResourceSnapshotAnnotation` to store the subindex of resource snapshot in the group.

func (*ClusterResourceSnapshot) DeepCopy

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

func (*ClusterResourceSnapshot) DeepCopyInto

func (in *ClusterResourceSnapshot) DeepCopyInto(out *ClusterResourceSnapshot)

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

func (*ClusterResourceSnapshot) DeepCopyObject

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

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

func (*ClusterResourceSnapshot) GetCondition

func (m *ClusterResourceSnapshot) GetCondition(conditionType string) *metav1.Condition

GetCondition gets the condition for a ClusterResourceSnapshot.

func (*ClusterResourceSnapshot) SetConditions

func (m *ClusterResourceSnapshot) SetConditions(conditions ...metav1.Condition)

SetConditions sets the conditions for a ClusterResourceSnapshot.

type ClusterResourceSnapshotList

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

ClusterResourceSnapshotList contains a list of ClusterResourceSnapshot. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterResourceSnapshotList) DeepCopy

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

func (*ClusterResourceSnapshotList) DeepCopyInto

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

func (*ClusterResourceSnapshotList) DeepCopyObject

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

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

type ClusterSchedulingPolicySnapshot

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

	// The desired state of SchedulingPolicySnapshot.
	// +required
	Spec SchedulingPolicySnapshotSpec `json:"spec"`

	// The observed status of SchedulingPolicySnapshot.
	// +optional
	Status SchedulingPolicySnapshotStatus `json:"status,omitempty"`
}

ClusterSchedulingPolicySnapshot is used to store a snapshot of cluster placement policy. Its spec is immutable. The naming convention of a ClusterSchedulingPolicySnapshot is {CRPName}-{PolicySnapshotIndex}. PolicySnapshotIndex will begin with 0. Each snapshot must have the following labels:

  • `CRPTrackingLabel` which points to its owner CRP.
  • `PolicyIndexLabel` which is the index of the policy snapshot.
  • `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one.

func (*ClusterSchedulingPolicySnapshot) DeepCopy

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

func (*ClusterSchedulingPolicySnapshot) DeepCopyInto

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

func (*ClusterSchedulingPolicySnapshot) DeepCopyObject

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

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

func (*ClusterSchedulingPolicySnapshot) GetCondition

func (m *ClusterSchedulingPolicySnapshot) GetCondition(conditionType string) *metav1.Condition

GetCondition returns the condition of the given type if exists.

func (*ClusterSchedulingPolicySnapshot) SetConditions

func (m *ClusterSchedulingPolicySnapshot) SetConditions(conditions ...metav1.Condition)

SetConditions sets the given conditions on the ClusterSchedulingPolicySnapshot.

type ClusterSchedulingPolicySnapshotList

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

ClusterSchedulingPolicySnapshotList contains a list of ClusterSchedulingPolicySnapshot. +kubebuilder:resource:scope="Cluster" +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterSchedulingPolicySnapshotList) DeepCopy

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

func (*ClusterSchedulingPolicySnapshotList) DeepCopyInto

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

func (*ClusterSchedulingPolicySnapshotList) DeepCopyObject

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

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

type ClusterScore

type ClusterScore struct {
	// AffinityScore represents the affinity score of the cluster calculated by the last
	// scheduling decision based on the preferred affinity selector.
	// An affinity score may not present if the cluster does not meet the required affinity.
	// +optional
	AffinityScore *int32 `json:"affinityScore,omitempty"`

	// TopologySpreadScore represents the priority score of the cluster calculated by the last
	// scheduling decision based on the topology spread applied to the cluster.
	// A priority score may not present if the cluster does not meet the topology spread.
	// +optional
	TopologySpreadScore *int32 `json:"priorityScore,omitempty"`
}

ClusterScore represents the score of the cluster calculated by the scheduler.

func (*ClusterScore) DeepCopy

func (in *ClusterScore) DeepCopy() *ClusterScore

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

func (*ClusterScore) DeepCopyInto

func (in *ClusterScore) DeepCopyInto(out *ClusterScore)

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

type ClusterSelector

type ClusterSelector struct {
	// +kubebuilder:validation:MaxItems=10
	// ClusterSelectorTerms is a list of cluster selector terms. The terms are `ORed`.
	// +required
	ClusterSelectorTerms []ClusterSelectorTerm `json:"clusterSelectorTerms"`
}

func (*ClusterSelector) DeepCopy

func (in *ClusterSelector) DeepCopy() *ClusterSelector

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

func (*ClusterSelector) DeepCopyInto

func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector)

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

type ClusterSelectorTerm

type ClusterSelectorTerm struct {
	// LabelSelector is a label query over all the joined member clusters. Clusters matching the query are selected.
	// +required
	LabelSelector metav1.LabelSelector `json:"labelSelector"`
}

ClusterSelectorTerm contains the requirements to select clusters.

func (*ClusterSelectorTerm) DeepCopy

func (in *ClusterSelectorTerm) DeepCopy() *ClusterSelectorTerm

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

func (*ClusterSelectorTerm) DeepCopyInto

func (in *ClusterSelectorTerm) DeepCopyInto(out *ClusterSelectorTerm)

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

type FailedResourcePlacement

type FailedResourcePlacement struct {
	// The resource failed to be placed.
	// +required
	ResourceIdentifier `json:",inline"`

	// The failed condition status.
	// +required
	Condition metav1.Condition `json:"condition"`
}

FailedResourcePlacement contains the failure details of a failed resource placement.

func (*FailedResourcePlacement) DeepCopy

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

func (*FailedResourcePlacement) DeepCopyInto

func (in *FailedResourcePlacement) DeepCopyInto(out *FailedResourcePlacement)

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

type Manifest added in v0.6.9

type Manifest struct {
	// +kubebuilder:validation:EmbeddedResource
	// +kubebuilder:pruning:PreserveUnknownFields
	runtime.RawExtension `json:",inline"`
}

Manifest represents a resource to be deployed on spoke cluster.

func (*Manifest) DeepCopy added in v0.6.9

func (in *Manifest) DeepCopy() *Manifest

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

func (*Manifest) DeepCopyInto added in v0.6.9

func (in *Manifest) DeepCopyInto(out *Manifest)

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

type ManifestCondition added in v0.6.9

type ManifestCondition struct {
	// resourceId represents a identity of a resource linking to manifests in spec.
	// +required
	Identifier WorkResourceIdentifier `json:"identifier,omitempty"`

	// Conditions represents the conditions of this resource on spoke cluster
	// +required
	Conditions []metav1.Condition `json:"conditions"`
}

ManifestCondition represents the conditions of the resources deployed on spoke cluster.

func (*ManifestCondition) DeepCopy added in v0.6.9

func (in *ManifestCondition) DeepCopy() *ManifestCondition

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

func (*ManifestCondition) DeepCopyInto added in v0.6.9

func (in *ManifestCondition) DeepCopyInto(out *ManifestCondition)

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

type PlacementPolicy

type PlacementPolicy struct {
	// Type of placement. Can be "PickAll", "PickN" or "PickFixed". Default is PickAll.
	// +kubebuilder:validation:Enum=PickAll;PickN;PickFixed
	// +kubebuilder:default=PickAll
	// +optional
	PlacementType PlacementType `json:"placementType,omitempty"`

	// +kubebuilder:validation:MaxItems=100
	// ClusterNames contains a list of names of MemberCluster to place the selected resources.
	// Only valid if the placement type is "PickFixed"
	// +optional
	ClusterNames []string `json:"clusterNames,omitempty"`

	// NumberOfClusters of placement. Only valid if the placement type is "PickN".
	// +kubebuilder:validation:Minimum=0
	// +optional
	NumberOfClusters *int32 `json:"numberOfClusters,omitempty"`

	// Affinity contains cluster affinity scheduling rules. Defines which member clusters to place the selected resources.
	// Only valid if the placement type is "PickAll" or "PickN".
	// +optional
	Affinity *Affinity `json:"affinity,omitempty"`

	// TopologySpreadConstraints describes how a group of resources ought to spread across multiple topology
	// domains. Scheduler will schedule resources in a way which abides by the constraints.
	// All topologySpreadConstraints are ANDed.
	// Only valid if the placement type is "PickN".
	// +optional
	// +patchMergeKey=topologyKey
	// +patchStrategy=merge
	TopologySpreadConstraints []TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey"`
}

PlacementPolicy contains the rules to select target member clusters to place the selected resources. Note that only clusters that are both joined and satisfying the rules will be selected.

You can only specify at most one of the two fields: ClusterNames and Affinity. If none is specified, all the joined clusters are selected.

func (*PlacementPolicy) DeepCopy

func (in *PlacementPolicy) DeepCopy() *PlacementPolicy

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

func (*PlacementPolicy) DeepCopyInto

func (in *PlacementPolicy) DeepCopyInto(out *PlacementPolicy)

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

type PlacementType

type PlacementType string

PlacementType identifies the type of placement. +enum

const (
	// PickAllPlacementType picks all clusters that satisfy the rules.
	PickAllPlacementType PlacementType = "PickAll"

	// PickNPlacementType picks N clusters that satisfy the rules.
	PickNPlacementType PlacementType = "PickN"

	// PickFixedPlacementType picks a fixed set of clusters.
	PickFixedPlacementType PlacementType = "PickFixed"
)

type PreferredClusterSelector

type PreferredClusterSelector struct {
	// Weight associated with matching the corresponding clusterSelectorTerm, in the range [-100, 100].
	// +required
	// +kubebuilder:validation:Minimum=-100
	// +kubebuilder:validation:Maximum=100
	Weight int32 `json:"weight"`

	// A cluster selector term, associated with the corresponding weight.
	// +required
	Preference ClusterSelectorTerm `json:"preference"`
}

func (*PreferredClusterSelector) DeepCopy

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

func (*PreferredClusterSelector) DeepCopyInto

func (in *PreferredClusterSelector) DeepCopyInto(out *PreferredClusterSelector)

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

type ResourceBindingConditionType

type ResourceBindingConditionType string

ResourceBindingConditionType identifies a specific condition of the ClusterResourceBinding.

const (
	// ResourceBindingBound indicates the bound condition of the given resources.
	// Its condition status can be one of the following:
	// - "True" means the corresponding work CR is created in the target cluster's namespace.
	// - "False" means the corresponding work CR is not created yet.
	// - "Unknown" means it is unknown.
	ResourceBindingBound ResourceBindingConditionType = "Bound"

	// ResourceBindingApplied indicates the applied condition of the given resources.
	// Its condition status can be one of the following:
	// - "True" means all the resources are created in the target cluster.
	// - "False" means not all the resources are created in the target cluster yet.
	// - "Unknown" means it is unknown.
	ResourceBindingApplied ResourceBindingConditionType = "Applied"
)

type ResourceBindingSpec

type ResourceBindingSpec struct {
	// The desired state of the binding. Possible values: Scheduled, Bound, Unscheduled.
	// +required
	State BindingState `json:"state"`

	// ResourceSnapshotName is the name of the resource snapshot that this resource binding points to.
	// If the resources are divided into multiple snapshots because of the resource size limit,
	// it points to the name of the leading snapshot of the index group.
	ResourceSnapshotName string `json:"resourceSnapshotName"`

	// SchedulingPolicySnapshotName is the name of the scheduling policy snapshot that this resource binding
	// points to; more specifically, the scheduler creates this bindings in accordance with this
	// scheduling policy snapshot.
	SchedulingPolicySnapshotName string `json:"schedulingPolicySnapshotName"`

	// TargetCluster is the name of the cluster that the scheduler assigns the resources to.
	TargetCluster string `json:"targetCluster"`

	// ClusterDecision explains why the scheduler selected this cluster.
	ClusterDecision ClusterDecision `json:"clusterDecision"`
}

ResourceBindingSpec defines the desired state of ClusterResourceBinding.

func (*ResourceBindingSpec) DeepCopy

func (in *ResourceBindingSpec) DeepCopy() *ResourceBindingSpec

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

func (*ResourceBindingSpec) DeepCopyInto

func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec)

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

type ResourceBindingStatus

type ResourceBindingStatus struct {

	// Conditions is an array of current observed conditions for ClusterResourceBinding.
	// +optional
	Conditions []metav1.Condition `json:"conditions"`
}

ResourceBindingStatus represents the current status of a ClusterResourceBinding.

func (*ResourceBindingStatus) DeepCopy

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

func (*ResourceBindingStatus) DeepCopyInto

func (in *ResourceBindingStatus) DeepCopyInto(out *ResourceBindingStatus)

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

type ResourceContent

type ResourceContent struct {
	// +kubebuilder:validation:EmbeddedResource
	// +kubebuilder:pruning:PreserveUnknownFields
	runtime.RawExtension `json:"-,inline"`
}

ResourceContent contains the content of a resource

func (*ResourceContent) DeepCopy

func (in *ResourceContent) DeepCopy() *ResourceContent

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

func (*ResourceContent) DeepCopyInto

func (in *ResourceContent) DeepCopyInto(out *ResourceContent)

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

type ResourceIdentifier

type ResourceIdentifier struct {
	// Group is the group name of the selected resource.
	// +optional
	Group string `json:"group,omitempty"`

	// Version is the version of the selected resource.
	// +required
	Version string `json:"version"`

	// Kind represents the Kind of the selected resources.
	// +required
	Kind string `json:"kind"`

	// Name of the target resource.
	// +required
	Name string `json:"name"`

	// Namespace is the namespace of the resource. Empty if the resource is cluster scoped.
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

ResourceIdentifier identifies one Kubernetes resource.

func (*ResourceIdentifier) DeepCopy

func (in *ResourceIdentifier) DeepCopy() *ResourceIdentifier

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

func (*ResourceIdentifier) DeepCopyInto

func (in *ResourceIdentifier) DeepCopyInto(out *ResourceIdentifier)

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

type ResourcePlacementConditionType

type ResourcePlacementConditionType string

ResourcePlacementConditionType defines a specific condition of a resource placement. +enum

const (
	// ResourceScheduledConditionType indicates whether we have successfully scheduled the selected resources.
	// Its condition status can be one of the following:
	// - "True" means we have successfully scheduled the resources to satisfy the placement requirement.
	// - "False" means we didn't fully satisfy the placement requirement. We will fill the Message field.
	ResourceScheduledConditionType ResourcePlacementConditionType = "ResourceScheduled"

	// ResourceWorkSynchronizedConditionType indicates whether we have created or updated the corresponding work object(s)
	// under the per-cluster namespaces (i.e., fleet-member-<member-name>) which have the latest resources selected by
	// the placement.
	// Its condition status can be one of the following:
	// - "True" means we have successfully created the latest corresponding work(s) or updated the existing work(s) to
	// the latest.
	// - "False" means we have not created the latest corresponding work(s) or updated the existing work(s) to the latest
	// yet.
	// There are few possibilities:
	// - In the processing state
	// - Rollout controller has decided not to create or update the resources in this cluster for now to honor the
	// rollout strategy configurations specified in the placement.
	// - Work is not created/updated because of the unknown reasons.
	ResourceWorkSynchronizedConditionType ResourcePlacementConditionType = "WorkSynchronized"

	// ResourcesAppliedConditionType indicates whether the selected member cluster has applied the selected resources locally.
	// Its condition status can be one of the following:
	// - "True" means all the selected resources are successfully applied to the target cluster.
	// - "False" means some of them have failed.
	// - "Unknown" means we haven't finished the apply yet.
	ResourcesAppliedConditionType ResourcePlacementConditionType = "ResourceApplied"
)

type ResourcePlacementStatus

type ResourcePlacementStatus struct {
	// ClusterName is the name of the cluster this resource is assigned to.
	// If it is not empty, its value should be unique cross all placement decisions for the Placement.
	// +optional
	ClusterName string `json:"clusterName,omitempty"`

	// FailedResourcePlacements is a list of all the resources failed to be placed to the given cluster.
	// Note that we only include 100 failed resource placements even if there are more than 100.
	// This field is only meaningful if the `ClusterName` is not empty.
	// +optional
	FailedResourcePlacements []FailedResourcePlacement `json:"failedPlacements,omitempty"`

	// Conditions is an array of current observed conditions for ResourcePlacementStatus.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ResourcePlacementStatus represents the placement status of selected resources for one target cluster.

func (*ResourcePlacementStatus) DeepCopy

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

func (*ResourcePlacementStatus) DeepCopyInto

func (in *ResourcePlacementStatus) DeepCopyInto(out *ResourcePlacementStatus)

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

type ResourceSnapshotSpec

type ResourceSnapshotSpec struct {
	// SelectedResources contains a list of resources selected by ResourceSelectors.
	// +required
	SelectedResources []ResourceContent `json:"selectedResources"`
}

ResourceSnapshotSpec defines the desired state of ResourceSnapshot.

func (*ResourceSnapshotSpec) DeepCopy

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

func (*ResourceSnapshotSpec) DeepCopyInto

func (in *ResourceSnapshotSpec) DeepCopyInto(out *ResourceSnapshotSpec)

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

type ResourceSnapshotStatus

type ResourceSnapshotStatus struct {

	// Conditions is an array of current observed conditions for ResourceSnapshot.
	// +optional
	Conditions []metav1.Condition `json:"conditions"`
}

func (*ResourceSnapshotStatus) DeepCopy

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

func (*ResourceSnapshotStatus) DeepCopyInto

func (in *ResourceSnapshotStatus) DeepCopyInto(out *ResourceSnapshotStatus)

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

type RollingUpdateConfig

type RollingUpdateConfig struct {
	// The maximum number of clusters that can be unavailable during the rolling update
	// comparing to the desired number of clusters.
	// The desired number equals to the `NumberOfClusters` field when the placement type is `PickN`.
	// The desired number equals to the number of clusters scheduler selected when the placement type is `PickAll`.
	// Value can be an absolute number (ex: 5) or a percentage of the desired number of clusters (ex: 10%).
	// Absolute number is calculated from percentage by rounding up.
	// We consider a resource unavailable when we either remove it from a cluster or in-place
	// upgrade the resources content on the same cluster.
	// This can not be 0 if MaxSurge is 0.
	// Defaults to 25%.
	// +kubebuilder:default="25%"
	// +kubebuilder:validation:XIntOrString
	// +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$"
	// +optional
	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`

	// The maximum number of clusters that can be scheduled above the desired number of clusters.
	// The desired number equals to the `NumberOfClusters` field when the placement type is `PickN`.
	// The desired number equals to the number of clusters scheduler selected when the placement type is `PickAll`.
	// Value can be an absolute number (ex: 5) or a percentage of desire (ex: 10%).
	// Absolute number is calculated from percentage by rounding up.
	// This does not apply to the case that we do in-place upgrade of resources on the same cluster.
	// This can not be 0 if MaxUnavailable is 0.
	// Defaults to 25%.
	// +kubebuilder:default="25%"
	// +kubebuilder:validation:XIntOrString
	// +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$"
	// +optional
	MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`

	// UnavailablePeriodSeconds is used to config the time to wait between rolling out phases.
	// A resource placement is considered available after `UnavailablePeriodSeconds` seconds
	// has passed after the resources are applied to the target cluster successfully.
	// Default is 60.
	// +kubebuilder:default=60
	// +optional
	UnavailablePeriodSeconds *int `json:"unavailablePeriodSeconds,omitempty"`
}

RollingUpdateConfig contains the config to control the desired behavior of rolling update.

func (*RollingUpdateConfig) DeepCopy

func (in *RollingUpdateConfig) DeepCopy() *RollingUpdateConfig

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

func (*RollingUpdateConfig) DeepCopyInto

func (in *RollingUpdateConfig) DeepCopyInto(out *RollingUpdateConfig)

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

type RolloutStrategy

type RolloutStrategy struct {
	// Type of rollout. The only supported type is "RollingUpdate". Default is "RollingUpdate".
	// +optional
	// +kubebuilder:validation:Enum=RollingUpdate
	// +kubebuilder:default=RollingUpdate
	Type RolloutStrategyType `json:"type,omitempty"`

	// Rolling update config params. Present only if RolloutStrategyType = RollingUpdate.
	// +optional
	RollingUpdate *RollingUpdateConfig `json:"rollingUpdate,omitempty"`
}

RolloutStrategy describes how to roll out a new change in selected resources to target clusters.

func (*RolloutStrategy) DeepCopy

func (in *RolloutStrategy) DeepCopy() *RolloutStrategy

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

func (*RolloutStrategy) DeepCopyInto

func (in *RolloutStrategy) DeepCopyInto(out *RolloutStrategy)

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

type RolloutStrategyType

type RolloutStrategyType string

+enum

const (
	// RollingUpdateRolloutStrategyType replaces the old placed resource using rolling update
	// i.e. gradually create the new one while replace the old ones.
	RollingUpdateRolloutStrategyType RolloutStrategyType = "RollingUpdate"
)

type SchedulingPolicySnapshotConditionType

type SchedulingPolicySnapshotConditionType string

SchedulingPolicySnapshotConditionType identifies a specific condition of the SchedulingPolicySnapshot.

const (
	// 	Scheduled indicates the scheduled condition of the given SchedulingPolicySnapshot.
	// Its condition status can be one of the following:
	// - "True" means we have successfully scheduled corresponding SchedulingPolicySnapshot to fully satisfy the
	// placement requirement.
	// - "False" means we did not fully satisfy the placement requirement of the corresponding SchedulingPolicySnapshot.
	// - "Unknown" means the status of the scheduling is unknown.
	PolicySnapshotScheduled SchedulingPolicySnapshotConditionType = "Scheduled"
)

type SchedulingPolicySnapshotSpec

type SchedulingPolicySnapshotSpec struct {
	// Policy defines how to select member clusters to place the selected resources.
	// If unspecified, all the joined member clusters are selected.
	// +optional
	Policy *PlacementPolicy `json:"policy,omitempty"`

	// PolicyHash is the sha-256 hash value of the Policy field.
	// +required
	PolicyHash []byte `json:"policyHash"`
}

SchedulingPolicySnapshotSpec defines the desired state of SchedulingPolicySnapshot.

func (*SchedulingPolicySnapshotSpec) DeepCopy

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

func (*SchedulingPolicySnapshotSpec) DeepCopyInto

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

type SchedulingPolicySnapshotStatus

type SchedulingPolicySnapshotStatus struct {

	// ObservedCRPGeneration is the generation of the CRP which the scheduler uses to perform
	// the scheduling cycle and prepare the scheduling status.
	// +required
	ObservedCRPGeneration int64 `json:"observedCRPGeneration"`

	// Conditions is an array of current observed conditions for SchedulingPolicySnapshot.
	// +optional
	Conditions []metav1.Condition `json:"conditions"`

	// +kubebuilder:validation:MaxItems=1000
	// ClusterDecisions contains a list of names of member clusters considered by the scheduler.
	// Note that all the selected clusters must present in the list while not all the
	// member clusters are guaranteed to be listed due to the size limit. We will try to
	// add the clusters that can provide the most insight to the list first.
	// +optional
	ClusterDecisions []ClusterDecision `json:"targetClusters,omitempty"`
}

SchedulingPolicySnapshotStatus defines the observed state of SchedulingPolicySnapshot.

func (*SchedulingPolicySnapshotStatus) DeepCopy

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

func (*SchedulingPolicySnapshotStatus) DeepCopyInto

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

type TopologySpreadConstraint

type TopologySpreadConstraint struct {
	// MaxSkew describes the degree to which resources may be unevenly distributed.
	// When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference
	// between the number of resource copies in the target topology and the global minimum.
	// The global minimum is the minimum number of resource copies in a domain.
	// When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence
	// to topologies that satisfy it.
	// It's an optional field. Default value is 1 and 0 is not allowed.
	// +kubebuilder:default=1
	// +kubebuilder:validation:Minimum=1
	// +optional
	MaxSkew *int32 `json:"maxSkew,omitempty"`

	// TopologyKey is the key of cluster labels. Clusters that have a label with this key
	// and identical values are considered to be in the same topology.
	// We consider each <key, value> as a "bucket", and try to put balanced number
	// of replicas of the resource into each bucket honor the `MaxSkew` value.
	// It's a required field.
	// +required
	TopologyKey string `json:"topologyKey"`

	// WhenUnsatisfiable indicates how to deal with the resource if it doesn't satisfy
	// the spread constraint.
	// - DoNotSchedule (default) tells the scheduler not to schedule it.
	// - ScheduleAnyway tells the scheduler to schedule the resource in any cluster,
	//   but giving higher precedence to topologies that would help reduce the skew.
	// It's an optional field.
	// +optional
	WhenUnsatisfiable UnsatisfiableConstraintAction `json:"whenUnsatisfiable,omitempty"`
}

TopologySpreadConstraint specifies how to spread resources among the given cluster topology.

func (*TopologySpreadConstraint) DeepCopy

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

func (*TopologySpreadConstraint) DeepCopyInto

func (in *TopologySpreadConstraint) DeepCopyInto(out *TopologySpreadConstraint)

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

type UnsatisfiableConstraintAction

type UnsatisfiableConstraintAction string

UnsatisfiableConstraintAction defines the type of actions that can be taken if a constraint is not satisfied. +enum

const (
	// DoNotSchedule instructs the scheduler not to schedule the resource
	// onto the cluster when constraints are not satisfied.
	DoNotSchedule UnsatisfiableConstraintAction = "DoNotSchedule"

	// ScheduleAnyway instructs the scheduler to schedule the resource
	// even if constraints are not satisfied.
	ScheduleAnyway UnsatisfiableConstraintAction = "ScheduleAnyway"
)

type Work added in v0.6.9

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

	// spec defines the workload of a work.
	// +optional
	Spec WorkSpec `json:"spec,omitempty"`
	// status defines the status of each applied manifest on the spoke cluster.
	Status WorkStatus `json:"status,omitempty"`
}

Work is the Schema for the works API.

func (*Work) DeepCopy added in v0.6.9

func (in *Work) DeepCopy() *Work

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

func (*Work) DeepCopyInto added in v0.6.9

func (in *Work) DeepCopyInto(out *Work)

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

func (*Work) DeepCopyObject added in v0.6.9

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

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

type WorkList added in v0.6.9

type WorkList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata.
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	// List of works.
	// +listType=set
	Items []Work `json:"items"`
}

WorkList contains a list of Work.

func (*WorkList) DeepCopy added in v0.6.9

func (in *WorkList) DeepCopy() *WorkList

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

func (*WorkList) DeepCopyInto added in v0.6.9

func (in *WorkList) DeepCopyInto(out *WorkList)

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

func (*WorkList) DeepCopyObject added in v0.6.9

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

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

type WorkResourceIdentifier added in v0.6.9

type WorkResourceIdentifier struct {
	// Ordinal represents an index in manifests list, so the condition can still be linked
	// to a manifest even thougth manifest cannot be parsed successfully.
	Ordinal int `json:"ordinal"`

	// Group is the group of the resource.
	Group string `json:"group,omitempty"`

	// Version is the version of the resource.
	Version string `json:"version,omitempty"`

	// Kind is the kind of the resource.
	Kind string `json:"kind,omitempty"`

	// Resource is the resource type of the resource
	Resource string `json:"resource,omitempty"`

	// Namespace is the namespace of the resource, the resource is cluster scoped if the value
	// is empty
	Namespace string `json:"namespace,omitempty"`

	// Name is the name of the resource
	Name string `json:"name,omitempty"`
}

WorkResourceIdentifier provides the identifiers needed to interact with any arbitrary object. Renamed original "ResourceIdentifier" so that it won't conflict with ResourceIdentifier defined in the clusterresourceplacement_types.go.

func (*WorkResourceIdentifier) DeepCopy added in v0.6.9

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

func (*WorkResourceIdentifier) DeepCopyInto added in v0.6.9

func (in *WorkResourceIdentifier) DeepCopyInto(out *WorkResourceIdentifier)

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

type WorkSpec added in v0.6.9

type WorkSpec struct {
	// Workload represents the manifest workload to be deployed on spoke cluster
	Workload WorkloadTemplate `json:"workload,omitempty"`
}

WorkSpec defines the desired state of Work.

func (*WorkSpec) DeepCopy added in v0.6.9

func (in *WorkSpec) DeepCopy() *WorkSpec

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

func (*WorkSpec) DeepCopyInto added in v0.6.9

func (in *WorkSpec) DeepCopyInto(out *WorkSpec)

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

type WorkStatus added in v0.6.9

type WorkStatus struct {
	// Conditions contains the different condition statuses for this work.
	// Valid condition types are:
	// 1. Applied represents workload in Work is applied successfully on the spoke cluster.
	// 2. Progressing represents workload in Work in the trasitioning from one state to another the on the spoke cluster.
	// 3. Available represents workload in Work exists on the spoke cluster.
	// 4. Degraded represents the current state of workload does not match the desired
	// state for a certain period.
	Conditions []metav1.Condition `json:"conditions"`

	// ManifestConditions represents the conditions of each resource in work deployed on
	// spoke cluster.
	// +optional
	ManifestConditions []ManifestCondition `json:"manifestConditions,omitempty"`
}

WorkStatus defines the observed state of Work.

func (*WorkStatus) DeepCopy added in v0.6.9

func (in *WorkStatus) DeepCopy() *WorkStatus

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

func (*WorkStatus) DeepCopyInto added in v0.6.9

func (in *WorkStatus) DeepCopyInto(out *WorkStatus)

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

type WorkloadTemplate added in v0.6.9

type WorkloadTemplate struct {
	// Manifests represents a list of kuberenetes resources to be deployed on the spoke cluster.
	// +optional
	Manifests []Manifest `json:"manifests,omitempty"`
}

WorkloadTemplate represents the manifest workload to be deployed on spoke cluster

func (*WorkloadTemplate) DeepCopy added in v0.6.9

func (in *WorkloadTemplate) DeepCopy() *WorkloadTemplate

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

func (*WorkloadTemplate) DeepCopyInto added in v0.6.9

func (in *WorkloadTemplate) DeepCopyInto(out *WorkloadTemplate)

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