v1beta1

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

+kubebuilder:object:generate=true +k8s:deepcopy-gen=package,register +groupName=placement.azure.com

+kubebuilder:object:generate=true +groupName=placement.azure.com

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"
)
View Source
const (

	// 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 (
	MemberClusterKind                = "MemberCluster"
	MemberClusterResource            = "memberclusters"
	InternalMemberClusterKind        = "InternalMemberCluster"
	ClusterResourcePlacementResource = "clusterresourceplacements"
)
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 (
	// WorkFinalizer is used to make sure that the binding is not deleted until the work objects it generates are all deleted.
	WorkFinalizer = fleetPrefix + "work-cleanup"
)

Variables

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

type AgentConditionType string

AgentConditionType identifies a specific condition on the Agent.

const (
	// AgentJoined indicates the join condition of the given member agent.
	// Its condition status can be one of the following:
	// - "True" means the member agent has joined.
	// - "False" means the member agent has left.
	// - "Unknown" means the member agent is joining or leaving or in an unknown status.
	AgentJoined AgentConditionType = "Joined"
	// AgentHealthy indicates the health condition of the given member agent.
	// Its condition status can be one of the following:
	// - "True" means the member agent is healthy.
	// - "False" means the member agent is unhealthy.
	// - "Unknown" means the member agent has an unknown health status.
	AgentHealthy AgentConditionType = "Healthy"
)

type AgentStatus

type AgentStatus struct {
	// Type of the member agent.
	// +required
	Type AgentType `json:"type"`

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

	// Last time we received a heartbeat from the member agent.
	// +optional
	LastReceivedHeartbeat metav1.Time `json:"lastReceivedHeartbeat,omitempty"`
}

AgentStatus defines the observed status of the member agent of the given type.

func (*AgentStatus) DeepCopy

func (in *AgentStatus) DeepCopy() *AgentStatus

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

func (*AgentStatus) DeepCopyInto

func (in *AgentStatus) DeepCopyInto(out *AgentStatus)

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

type AgentType

type AgentType string

AgentType defines a type of agent/binary running in a member cluster.

const (
	// MemberAgent (core) handles member cluster joining/leaving as well as k8s object placement from hub to member clusters.
	MemberAgent AgentType = "MemberAgent"
	// MultiClusterServiceAgent (networking) is responsible for exposing multi-cluster services via L4 load
	// balancer.
	MultiClusterServiceAgent AgentType = "MultiClusterServiceAgent"
	// ServiceExportImportAgent (networking) is responsible for export or import services across multi-clusters.
	ServiceExportImportAgent AgentType = "ServiceExportImportAgent"
)

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"

	// 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.
	// - "False" means some of them have failed. We will place some of the detailed failure in the FailedResourcePlacement array.
	// - "Unknown" means we haven't started 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. Some of them may not have assigned
	// clusters when we cannot fill the required number of clusters.
	// +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 ClusterState

type ClusterState string
const (
	ClusterStateJoin  ClusterState = "Join"
	ClusterStateLeave ClusterState = "Leave"
)

type Conditioned added in v0.6.7

type Conditioned interface {
	SetConditions(...metav1.Condition)
	GetCondition(string) *metav1.Condition
}

A Conditioned may have conditions set or retrieved. Conditions typically indicate the status of both a resource and its reconciliation process. +kubebuilder:object:generate=false

type ConditionedAgentObj added in v0.6.7

type ConditionedAgentObj interface {
	client.Object
	ConditionedWithType
}

A ConditionedAgentObj is for kubernetes resources where multiple agents can set and update conditions within AgentStatus. +kubebuilder:object:generate=false

type ConditionedObj added in v0.6.7

type ConditionedObj interface {
	client.Object
	Conditioned
}

A ConditionedObj is for kubernetes resource with conditions. +kubebuilder:object:generate=false

type ConditionedWithType added in v0.6.7

type ConditionedWithType interface {
	SetConditionsWithType(AgentType, ...metav1.Condition)
	GetConditionWithType(AgentType, string) *metav1.Condition
}

A ConditionedWithType may have conditions set or retrieved based on agent type. Conditions typically indicate the status of both a resource and its reconciliation process. +kubebuilder:object:generate=false

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 InternalMemberCluster

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

	// The desired state of InternalMemberCluster.
	// +required
	Spec InternalMemberClusterSpec `json:"spec"`

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

InternalMemberCluster is used by hub agent to notify the member agents about the member cluster state changes, and is used by the member agents to report their status.

func (*InternalMemberCluster) DeepCopy

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

func (*InternalMemberCluster) DeepCopyInto

func (in *InternalMemberCluster) DeepCopyInto(out *InternalMemberCluster)

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

func (*InternalMemberCluster) DeepCopyObject

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

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

func (*InternalMemberCluster) GetAgentStatus

func (m *InternalMemberCluster) GetAgentStatus(agentType AgentType) *AgentStatus

GetAgentStatus is used to retrieve agent status from internal member cluster, if it doesn't exist it creates the expected agent status and returns it.

func (*InternalMemberCluster) GetConditionWithType

func (m *InternalMemberCluster) GetConditionWithType(agentType AgentType, conditionType string) *metav1.Condition

GetConditionWithType is used to retrieve the desired condition from AgentStatus for given agentType

func (*InternalMemberCluster) SetConditionsWithType

func (m *InternalMemberCluster) SetConditionsWithType(agentType AgentType, conditions ...metav1.Condition)

SetConditionsWithType is used to add condition to AgentStatus for a given agentType.

type InternalMemberClusterList

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

InternalMemberClusterList contains a list of InternalMemberCluster.

func (*InternalMemberClusterList) DeepCopy

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

func (*InternalMemberClusterList) DeepCopyInto

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

func (*InternalMemberClusterList) DeepCopyObject

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

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

type InternalMemberClusterSpec

type InternalMemberClusterSpec struct {

	// The desired state of the member cluster. Possible values: Join, Leave.
	// +required
	State ClusterState `json:"state"`

	// How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes.
	// +optional
	HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"`
}

InternalMemberClusterSpec defines the desired state of InternalMemberCluster. Set by the hub agent.

func (*InternalMemberClusterSpec) DeepCopy

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

func (*InternalMemberClusterSpec) DeepCopyInto

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

type InternalMemberClusterStatus

type InternalMemberClusterStatus struct {
	// The current observed resource usage of the member cluster. It is populated by the member agent.
	// +optional
	ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"`

	// AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster.
	// +optional
	AgentStatus []AgentStatus `json:"agentStatus,omitempty"`
}

InternalMemberClusterStatus defines the observed state of InternalMemberCluster.

func (*InternalMemberClusterStatus) DeepCopy

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

func (*InternalMemberClusterStatus) DeepCopyInto

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

type MemberCluster

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

	// The desired state of MemberCluster.
	// +required
	Spec MemberClusterSpec `json:"spec"`

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

MemberCluster is a resource created in the hub cluster to represent a member cluster within a fleet.

func (*MemberCluster) DeepCopy

func (in *MemberCluster) DeepCopy() *MemberCluster

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

func (*MemberCluster) DeepCopyInto

func (in *MemberCluster) DeepCopyInto(out *MemberCluster)

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

func (*MemberCluster) DeepCopyObject

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

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

func (*MemberCluster) GetAgentCondition added in v0.6.7

func (m *MemberCluster) GetAgentCondition(agentType AgentType, conditionType AgentConditionType) *metav1.Condition

GetAgentCondition queries the conditions in an agent status for a specific condition type.

func (*MemberCluster) GetAgentStatus added in v0.6.7

func (m *MemberCluster) GetAgentStatus(agentType AgentType) *AgentStatus

GetAgentStatus retrieves the status of a specific member agent from the MemberCluster object.

If the specificed agent does not exist, or it has not updated its status with the hub cluster yet, this function returns nil.

func (*MemberCluster) GetCondition

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

func (*MemberCluster) RemoveCondition

func (m *MemberCluster) RemoveCondition(conditionType string)

func (*MemberCluster) SetConditions

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

type MemberClusterConditionType

type MemberClusterConditionType string

MemberClusterConditionType defines a specific condition of a member cluster.

const (
	// ConditionTypeMemberClusterReadyToJoin indicates the readiness condition of the given member cluster for joining the hub cluster.
	// Its condition status can be one of the following:
	// - "True" means the hub cluster is ready for the member cluster to join.
	// - "False" means the hub cluster is not ready for the member cluster to join.
	// - "Unknown" means it is unknown whether the hub cluster is ready for the member cluster to join.
	ConditionTypeMemberClusterReadyToJoin MemberClusterConditionType = "ReadyToJoin"

	// ConditionTypeMemberClusterJoined indicates the join condition of the given member cluster.
	// Its condition status can be one of the following:
	// - "True" means all the agents on the member cluster have joined.
	// - "False" means all the agents on the member cluster have left.
	// - "Unknown" means not all the agents have joined or left.
	ConditionTypeMemberClusterJoined MemberClusterConditionType = "Joined"

	// ConditionTypeMemberClusterHealthy indicates the health condition of the given member cluster.
	// Its condition status can be one of the following:
	// - "True" means the member cluster is healthy.
	// - "False" means the member cluster is unhealthy.
	// - "Unknown" means the member cluster has an unknown health status.
	// NOTE: This condition type is currently unused.
	ConditionTypeMemberClusterHealthy MemberClusterConditionType = "Healthy"
)

type MemberClusterList

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

MemberClusterList contains a list of MemberCluster.

func (*MemberClusterList) DeepCopy

func (in *MemberClusterList) DeepCopy() *MemberClusterList

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

func (*MemberClusterList) DeepCopyInto

func (in *MemberClusterList) DeepCopyInto(out *MemberClusterList)

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

func (*MemberClusterList) DeepCopyObject

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

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

type MemberClusterSpec

type MemberClusterSpec struct {

	// The desired state of the member cluster. Possible values: Join, Leave.
	// +required
	State ClusterState `json:"state"`

	// The identity used by the member cluster to access the hub cluster.
	// The hub agents deployed on the hub cluster will automatically grant the minimal required permissions to this identity for the member agents deployed on the member cluster to access the hub cluster.
	// +required
	Identity rbacv1.Subject `json:"identity"`

	// How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes.
	// +optional
	HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"`
}

MemberClusterSpec defines the desired state of MemberCluster.

func (*MemberClusterSpec) DeepCopy

func (in *MemberClusterSpec) DeepCopy() *MemberClusterSpec

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

func (*MemberClusterSpec) DeepCopyInto

func (in *MemberClusterSpec) DeepCopyInto(out *MemberClusterSpec)

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

type MemberClusterStatus

type MemberClusterStatus struct {

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

	// The current observed resource usage of the member cluster. It is copied from the corresponding InternalMemberCluster object.
	// +optional
	ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"`

	// AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster.
	// +optional
	AgentStatus []AgentStatus `json:"agentStatus,omitempty"`
}

MemberClusterStatus defines the observed status of MemberCluster.

func (*MemberClusterStatus) DeepCopy

func (in *MemberClusterStatus) DeepCopy() *MemberClusterStatus

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

func (*MemberClusterStatus) DeepCopyInto

func (in *MemberClusterStatus) DeepCopyInto(out *MemberClusterStatus)

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

type PlacementPolicy

type PlacementPolicy struct {
	// +kubebuilder:validation:MaxItems=100
	// ClusterNames contains a list of names of MemberCluster to place the selected resources.
	// If the list is not empty, `PlacementType`, `NumberOfClusters`, `Affinity`, and `TopologySpreadConstraints`
	//  are ignored.
	// +optional
	ClusterNames []string `json:"clusterNames,omitempty"`

	// Type of placement. Can be "PickAll" or "PickN". Default is PickAll.
	// +kubebuilder:validation:Enum=PickAll;PickN
	// +kubebuilder:default=PickAll
	// +optional
	PlacementType PlacementType `json:"placementType,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.
	// +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.
	// +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"
)

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 (
	// ResourceWorkCreatedConditionType indicates whether we have created the corresponding work object under the
	// per-cluster namespaces (i.e., fleet-member-<member-name>).
	// Its condition status can be one of the following:
	// - "True" means we have successfully created the corresponding work resources.
	// - "False" means we have failed to creat the corresponding work resources. We will fill the Reason field.
	// - "Unknown" means we don't have a scheduling decision yet.
	ResourceWorkCreatedConditionType ResourcePlacementConditionType = "WorkCreated"

	// 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 started the apply yet.
	ResourcesAppliedConditionType ResourcePlacementConditionType = "ResourceApplied"

	// 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"
)

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 ResourceUsage

type ResourceUsage struct {
	// Capacity represents the total resource capacity of all the nodes on a member cluster.
	// +optional
	Capacity v1.ResourceList `json:"capacity,omitempty"`

	// Allocatable represents the total resources of all the nodes on a member cluster that are available for scheduling.
	// +optional
	Allocatable v1.ResourceList `json:"allocatable,omitempty"`

	// When the resource usage is observed.
	// +optional
	ObservationTime metav1.Time `json:"observationTime,omitempty"`
}

ResourceUsage contains the observed resource usage of a member cluster.

func (*ResourceUsage) DeepCopy

func (in *ResourceUsage) DeepCopy() *ResourceUsage

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

func (*ResourceUsage) DeepCopyInto

func (in *ResourceUsage) DeepCopyInto(out *ResourceUsage)

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"
)

Jump to

Keyboard shortcuts

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