Documentation
¶
Overview ¶
Package v1alpha2 is the v1alpha2 version of the API. +k8s:deepcopy-gen=package,register +k8s:openapi-gen=true +groupName=work.karmada.io
Index ¶
- Constants
- Variables
- func Resource(resource string) schema.GroupResource
- type AggregatedStatusItem
- type BindingSnapshot
- type ClusterResourceBinding
- type ClusterResourceBindingList
- type Component
- type ComponentReplicaRequirements
- type GracefulEvictionTask
- type NodeClaim
- type ObjectReference
- type Option
- func WithClustersBeforeFailover(clustersBeforeFailover []string) Option
- func WithGracePeriodSeconds(gracePeriodSeconds *int32) Option
- func WithMessage(message string) Option
- func WithPreservedLabelState(preservedLabelState map[string]string) Option
- func WithProducer(producer string) Option
- func WithPurgeMode(purgeMode policyv1alpha1.PurgeMode) Option
- func WithReason(reason string) Option
- func WithSuppressDeletion(suppressDeletion *bool) Option
- type ReplicaRequirements
- type ResourceBinding
- type ResourceBindingList
- type ResourceBindingSpec
- func (s *ResourceBindingSpec) AssignedReplicasForCluster(targetCluster string) int32
- func (s *ResourceBindingSpec) ClusterInGracefulEvictionTasks(name string) bool
- func (in *ResourceBindingSpec) DeepCopy() *ResourceBindingSpec
- func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec)
- func (s *ResourceBindingSpec) GracefulEvictCluster(name string, options *TaskOptions)
- func (s *ResourceBindingSpec) IsWorkload() bool
- func (s *ResourceBindingSpec) RemoveCluster(name string)
- func (s *ResourceBindingSpec) SchedulePriorityValue() int32
- func (s *ResourceBindingSpec) SchedulingSuspended() bool
- func (s *ResourceBindingSpec) TargetContains(name string) bool
- type ResourceBindingStatus
- type ResourceHealth
- type SchedulePriority
- type Suspension
- type TargetCluster
- type TaskOptions
Constants ¶
const ( // ResourceKindResourceBinding is kind name of ResourceBinding. ResourceKindResourceBinding = "ResourceBinding" // ResourceSingularResourceBinding is singular name of ResourceBinding. ResourceSingularResourceBinding = "resourcebinding" // ResourcePluralResourceBinding is plural name of ResourceBinding. ResourcePluralResourceBinding = "resourcebindings" // ResourceNamespaceScopedResourceBinding indicates if ResourceBinding is NamespaceScoped. ResourceNamespaceScopedResourceBinding = true // ResourceKindClusterResourceBinding is kind name of ClusterResourceBinding. ResourceKindClusterResourceBinding = "ClusterResourceBinding" // ResourceSingularClusterResourceBinding is singular name of ClusterResourceBinding. ResourceSingularClusterResourceBinding = "clusterresourcebinding" // ResourcePluralClusterResourceBinding is kind plural of ClusterResourceBinding. ResourcePluralClusterResourceBinding = "clusterresourcebindings" // ResourceNamespaceScopedClusterResourceBinding indicates if ClusterResourceBinding is NamespaceScoped. ResourceNamespaceScopedClusterResourceBinding = false )
const ( // Scheduled represents the condition that the ResourceBinding or ClusterResourceBinding has been scheduled. Scheduled string = "Scheduled" // FullyApplied represents the condition that the resource referencing by ResourceBinding or ClusterResourceBinding // has been applied to all scheduled clusters. FullyApplied string = "FullyApplied" )
Conditions definition
const ( // BindingReasonSuccess reason in Scheduled condition means that binding has been scheduled successfully. BindingReasonSuccess = "Success" // BindingReasonSchedulerError reason in Scheduled condition means that some internal error happens // during scheduling, for example due to api-server connection error. BindingReasonSchedulerError = "SchedulerError" // BindingReasonNoClusterFit reason in Scheduled condition means that scheduling has finished // due to no fit cluster. BindingReasonNoClusterFit = "NoClusterFit" // BindingReasonUnschedulable reason in Scheduled condition means that the scheduler can't schedule // the binding right now, for example due to insufficient resources in the clusters. BindingReasonUnschedulable = "Unschedulable" // BindingReasonQuotaExceeded reason in Scheduled condition means that the scheduler can't schedule // the binding because the resource requirement exceeds one or more of the FederatedResourceQuotas // defined in the namespace. BindingReasonQuotaExceeded = "QuotaExceeded" )
These are reasons for a binding's transition to a Scheduled condition.
const ( // ResourceBindingPermanentIDLabel is the identifier of a ResourceBinding object. // Karmada generates a unique identifier, such as metadata.UUID, for each ResourceBinding object. // This identifier will be used as a label selector to locate corresponding resources, such as Work. // The reason for generating a new unique identifier instead of simply using metadata.UUID is because: // In backup scenarios, when applying the backup resource manifest in a new cluster, the UUID may change. ResourceBindingPermanentIDLabel = "resourcebinding.karmada.io/permanent-id" // ClusterResourceBindingPermanentIDLabel is the identifier of a ClusterResourceBinding object. // Karmada generates a unique identifier, such as metadata.UUID, for each ClusterResourceBinding object. // This identifier will be used as a label selector to locate corresponding resources, such as Work. // The reason for generating a new unique identifier instead of simply using metadata.UUID is because: // In backup scenarios, when applying the backup resource manifest in a new cluster, the UUID may change. ClusterResourceBindingPermanentIDLabel = "clusterresourcebinding.karmada.io/permanent-id" // WorkPermanentIDLabel is the ID of Work object. WorkPermanentIDLabel = "work.karmada.io/permanent-id" // WorkNamespaceAnnotation is added to objects to specify associated Work's namespace. WorkNamespaceAnnotation = "work.karmada.io/namespace" // WorkNameAnnotation is added to objects to specify associated Work's name. WorkNameAnnotation = "work.karmada.io/name" // ResourceBindingNamespaceAnnotationKey is added to object to describe the associated ResourceBinding's namespace. // It is added to: // - Work object: describes the namespace of ResourceBinding which the Work derived from. // - Manifest in Work object: describes the namespace of ResourceBinding which the manifest derived from. ResourceBindingNamespaceAnnotationKey = "resourcebinding.karmada.io/namespace" // ResourceBindingNameAnnotationKey is added to object to describe the associated ResourceBinding's name. // It is added to: // - Work object: describes the name of ResourceBinding which the Work derived from. // - Manifest in Work object: describes the name of ResourceBinding which the manifest derived from. ResourceBindingNameAnnotationKey = "resourcebinding.karmada.io/name" // ClusterResourceBindingAnnotationKey is added to object to describe associated ClusterResourceBinding's name. // It is added to: // - Work object: describes the name of ClusterResourceBinding which the Work derived from. // - Manifest in Work object: describes the name of ClusterResourceBinding which the manifest derived from. ClusterResourceBindingAnnotationKey = "clusterresourcebinding.karmada.io/name" // BindingManagedByLabel is added to ResourceBinding to represent what kind of resource manages this Binding. BindingManagedByLabel = "binding.karmada.io/managed-by" // ResourceTemplateGenerationAnnotationKey records the generation of resource template in Karmada APIServer, // It will be injected into the resource when propagating to member clusters, to denote the specific version of // the resource template from which the resource is derived. It might be helpful in the following cases: // 1. Facilitating observation from member clusters to ascertain if the most recent resource template has been // completely synced. // 2. The annotation will be synced back to Karmada during the process of syncing resource status, // by leveraging this annotation, Karmada can infer if the most recent resource template has been completely // synced on member clusters, then generates accurate observed generation(like Deployment's .status.observedGeneration) // which might be required by the release system. ResourceTemplateGenerationAnnotationKey = "resourcetemplate.karmada.io/generation" )
const ( // ResourceConflictResolutionAnnotation is added to the resource template to specify how to resolve the conflict // in case of resource already existing in member clusters. // The valid value is: // - overwrite: always overwrite the resource if already exist. The resource will be overwritten with the // configuration from control plane. // - abort: do not resolve the conflict and stop propagating to avoid unexpected overwrites (default value) // Note: Propagation of the resource template without this annotation will fail in case of already exists. ResourceConflictResolutionAnnotation = "work.karmada.io/conflict-resolution" // ResourceConflictResolutionOverwrite is a value of ResourceConflictResolutionAnnotation, indicating the overwrite strategy. ResourceConflictResolutionOverwrite = "overwrite" // ResourceConflictResolutionAbort is a value of ResourceConflictResolutionAnnotation, indicating stop propagating. ResourceConflictResolutionAbort = "abort" )
Define resource conflict resolution
const ( // ResourceTemplateUIDAnnotation is the annotation that is added to the manifest in the Work object. // The annotation is used to identify the resource template which the manifest is derived from. // The annotation can also be used to fire events when syncing Work to member clusters. // For more details about UID, please refer to: // https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids ResourceTemplateUIDAnnotation = "resourcetemplate.karmada.io/uid" // ManagedLabels is the annotation that is added to the manifest in the Work object. // It is used to identify the label keys that are present in the resource template. // With this annotation, Karmada is able to accurately synchronize label changes // against resource template and avoid the problem of accidentally retaining // the deleted labels. // E.g. "resourcetemplate.karmada.io/managed-labels: bar,foo". // Note: the keys will be sorted in alphabetical order. ManagedLabels = "resourcetemplate.karmada.io/managed-labels" // ManagedAnnotation is the annotation that is added to the manifest in the Work object. // It is used to identify the annotation keys that are present in the resource template. // With this annotation, Karmada is able to accurately synchronize annotation changes // against resource template and avoid the problem of accidentally retaining // the deleted annotations. // E.g. "resourcetemplate.karmada.io/managed-annotations: bar,foo". // Note: the keys will be sorted in alphabetical order. ManagedAnnotation = "resourcetemplate.karmada.io/managed-annotations" // DeletionProtectionLabelKey If a user assigns the DeletionProtectionLabelKey label to a specific resource, // and the value of this label is DeletionProtectionAlways, then deletion requests // for this resource will be denied. // In the current design, only the Value set to 'Always' will be protected, // Additional options will be added here in the future. DeletionProtectionLabelKey = "resourcetemplate.karmada.io/deletion-protected" DeletionProtectionAlways = "Always" )
Define annotations that are added to the resource template.
const ( // EvictionReasonTaintUntolerated describes the eviction is triggered // because can not tolerate taint or exceed toleration period of time. EvictionReasonTaintUntolerated = "TaintUntolerated" // EvictionReasonApplicationFailure describes the eviction is triggered // because the application fails and reaches the condition of ApplicationFailoverBehavior. EvictionReasonApplicationFailure = "ApplicationFailure" )
Define eviction reasons.
const (
// EvictionProducerTaintManager represents the name of taint manager.
EvictionProducerTaintManager = "TaintManager"
)
Define eviction producers.
const GroupName = "work.karmada.io"
GroupName specifies the group name used to register the objects.
Variables ¶
var ( // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. SchemeBuilder runtime.SchemeBuilder // Deprecated: use Install instead AddToScheme = localSchemeBuilder.AddToScheme Install = localSchemeBuilder.AddToScheme )
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha2"}
GroupVersion specifies the group and the version used to register the objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
SchemeGroupVersion is group version used to register these objects Deprecated: use GroupVersion instead.
Functions ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource takes an unqualified resource and returns a Group qualified GroupResource
Types ¶
type AggregatedStatusItem ¶
type AggregatedStatusItem struct {
// ClusterName represents the member cluster name which the resource deployed on.
// +required
ClusterName string `json:"clusterName"`
// Status reflects running status of current manifest.
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Status *runtime.RawExtension `json:"status,omitempty"`
// Applied represents if the resource referencing by ResourceBinding or ClusterResourceBinding
// is successfully applied on the cluster.
// +optional
Applied bool `json:"applied,omitempty"`
// AppliedMessage is a human readable message indicating details about the applied status.
// This is usually holds the error message in case of apply failed.
// +optional
AppliedMessage string `json:"appliedMessage,omitempty"`
// Health represents the healthy state of the current resource.
// There maybe different rules for different resources to achieve health status.
// +kubebuilder:validation:Enum=Healthy;Unhealthy;Unknown
// +optional
Health ResourceHealth `json:"health,omitempty"`
}
AggregatedStatusItem represents status of the resource running in a member cluster.
func (*AggregatedStatusItem) DeepCopy ¶
func (in *AggregatedStatusItem) DeepCopy() *AggregatedStatusItem
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AggregatedStatusItem.
func (*AggregatedStatusItem) DeepCopyInto ¶
func (in *AggregatedStatusItem) DeepCopyInto(out *AggregatedStatusItem)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type BindingSnapshot ¶ added in v1.0.0
type BindingSnapshot struct {
// Namespace represents the namespace of the Binding.
// It is required for ResourceBinding.
// If Namespace is not specified, means the referencing is ClusterResourceBinding.
// +optional
Namespace string `json:"namespace,omitempty"`
// Name represents the name of the Binding.
// +required
Name string `json:"name"`
// Clusters represents the scheduled result.
// +optional
Clusters []TargetCluster `json:"clusters,omitempty"`
}
BindingSnapshot is a snapshot of a ResourceBinding or ClusterResourceBinding.
func (*BindingSnapshot) DeepCopy ¶ added in v1.1.0
func (in *BindingSnapshot) DeepCopy() *BindingSnapshot
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingSnapshot.
func (*BindingSnapshot) DeepCopyInto ¶ added in v1.1.0
func (in *BindingSnapshot) DeepCopyInto(out *BindingSnapshot)
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"`
// Spec represents the desired behavior.
Spec ResourceBindingSpec `json:"spec"`
// Status represents the most recently observed status of the ResourceBinding.
// +optional
Status ResourceBindingStatus `json:"status,omitempty"`
}
ClusterResourceBinding represents a binding of a kubernetes resource with a ClusterPropagationPolicy.
func (*ClusterResourceBinding) DeepCopy ¶
func (in *ClusterResourceBinding) DeepCopy() *ClusterResourceBinding
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) Hub ¶ added in v0.10.0
func (*ClusterResourceBinding) Hub()
Hub marks this type as a conversion hub.
type ClusterResourceBindingList ¶
type ClusterResourceBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of ClusterResourceBinding.
Items []ClusterResourceBinding `json:"items"`
}
ClusterResourceBindingList contains a list of ClusterResourceBinding.
func (*ClusterResourceBindingList) DeepCopy ¶
func (in *ClusterResourceBindingList) DeepCopy() *ClusterResourceBindingList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceBindingList.
func (*ClusterResourceBindingList) DeepCopyInto ¶
func (in *ClusterResourceBindingList) DeepCopyInto(out *ClusterResourceBindingList)
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 Component ¶ added in v1.15.0
type Component struct {
// Name of this component.
// It is required when the resource contains multiple components to ensure proper identification,
// and must also be unique within the same resource.
// +kubebuilder:validation:MaxLength=32
// +required
Name string `json:"name"`
// Replicas represents the replica number of the resource's component.
// +required
Replicas int32 `json:"replicas"`
// ReplicaRequirements represents the resource and scheduling requirements for each replica.
// +optional
ReplicaRequirements *ComponentReplicaRequirements `json:"replicaRequirements,omitempty"`
}
Component represents the requirements for a specific component.
func (*Component) DeepCopy ¶ added in v1.15.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Component.
func (*Component) DeepCopyInto ¶ added in v1.15.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ComponentReplicaRequirements ¶ added in v1.15.0
type ComponentReplicaRequirements struct {
// NodeClaim represents the node claim HardNodeAffinity, NodeSelector and Tolerations required by each replica.
// +optional
NodeClaim *NodeClaim `json:"nodeClaim,omitempty"`
// ResourceRequest represents the resources required by each replica.
// +optional
ResourceRequest corev1.ResourceList `json:"resourceRequest,omitempty"`
// PriorityClassName represents the resources priorityClassName
// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
}
ComponentReplicaRequirements represents the resource and scheduling requirements for each replica.
func (*ComponentReplicaRequirements) DeepCopy ¶ added in v1.15.0
func (in *ComponentReplicaRequirements) DeepCopy() *ComponentReplicaRequirements
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentReplicaRequirements.
func (*ComponentReplicaRequirements) DeepCopyInto ¶ added in v1.15.0
func (in *ComponentReplicaRequirements) DeepCopyInto(out *ComponentReplicaRequirements)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type GracefulEvictionTask ¶ added in v1.3.0
type GracefulEvictionTask struct {
// FromCluster which cluster the eviction perform from.
// +required
FromCluster string `json:"fromCluster"`
// PurgeMode represents how to deal with the legacy applications on the
// cluster from which the application is migrated.
// Valid options are "Immediately", "Directly", "Graciously", "Gracefully" and "Never".
// +kubebuilder:validation:Enum=Immediately;Directly;Graciously;Gracefully;Never
// +optional
PurgeMode policyv1alpha1.PurgeMode `json:"purgeMode,omitempty"`
// Replicas indicates the number of replicas should be evicted.
// Should be ignored for resource type that doesn't have replica.
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// Reason contains a programmatic identifier indicating the reason for the eviction.
// Producers may define expected values and meanings for this field,
// and whether the values are considered a guaranteed API.
// The value should be a CamelCase string.
// This field may not be empty.
// +required
// +kubebuilder:validation:MaxLength=32
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
Reason string `json:"reason"`
// Message is a human-readable message indicating details about the eviction.
// This may be an empty string.
// +optional
// +kubebuilder:validation:MaxLength=1024
Message string `json:"message,omitempty"`
// Producer indicates the controller who triggered the eviction.
// +required
Producer string `json:"producer"`
// GracePeriodSeconds is the maximum waiting duration in seconds before the item
// should be deleted. If the application on the new cluster cannot reach a Healthy state,
// Karmada will delete the item after GracePeriodSeconds is reached.
// Value must be positive integer.
// It can not co-exist with SuppressDeletion.
// +optional
GracePeriodSeconds *int32 `json:"gracePeriodSeconds,omitempty"`
// SuppressDeletion represents the grace period will be persistent until
// the tools or human intervention stops it.
// It can not co-exist with GracePeriodSeconds.
// +optional
SuppressDeletion *bool `json:"suppressDeletion,omitempty"`
// PreservedLabelState represents the application state information collected from the original cluster,
// and it will be injected into the new cluster in form of application labels.
// +optional
PreservedLabelState map[string]string `json:"preservedLabelState,omitempty"`
// CreationTimestamp is a timestamp representing the server time when this object was
// created.
// Clients should not set this value to avoid the time inconsistency issue.
// It is represented in RFC3339 form(like '2021-04-25T10:02:10Z') and is in UTC.
//
// Populated by the system. Read-only.
// +optional
CreationTimestamp *metav1.Time `json:"creationTimestamp,omitempty"`
// ClustersBeforeFailover records the clusters where running the application before failover.
ClustersBeforeFailover []string `json:"clustersBeforeFailover,omitempty"`
}
GracefulEvictionTask represents a graceful eviction task.
func (*GracefulEvictionTask) DeepCopy ¶ added in v1.3.0
func (in *GracefulEvictionTask) DeepCopy() *GracefulEvictionTask
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GracefulEvictionTask.
func (*GracefulEvictionTask) DeepCopyInto ¶ added in v1.3.0
func (in *GracefulEvictionTask) DeepCopyInto(out *GracefulEvictionTask)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeClaim ¶
type NodeClaim struct {
// A node selector represents the union of the results of one or more label queries over a set of
// nodes; that is, it represents the OR of the selectors represented by the node selector terms.
// Note that only PodSpec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution
// is included here because it has a hard limit on pod scheduling.
// +optional
HardNodeAffinity *corev1.NodeSelector `json:"hardNodeAffinity,omitempty"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}
NodeClaim represents the node claim HardNodeAffinity, NodeSelector and Tolerations required by each replica.
func (*NodeClaim) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaim.
func (*NodeClaim) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ObjectReference ¶
type ObjectReference struct {
// APIVersion represents the API version of the referent.
APIVersion string `json:"apiVersion"`
// Kind represents the Kind of the referent.
Kind string `json:"kind"`
// Namespace represents the namespace for the referent.
// For non-namespace scoped resources(e.g. 'ClusterRole'),do not need specify Namespace,
// and for namespace scoped resources, Namespace is required.
// If Namespace is not specified, means the resource is non-namespace scoped.
// +optional
Namespace string `json:"namespace,omitempty"`
// Name represents the name of the referent.
Name string `json:"name"`
// UID of the referent.
// +optional
UID types.UID `json:"uid,omitempty"`
// ResourceVersion represents the internal version of the referenced object, that can be used by clients to
// determine when object has changed.
// +optional
ResourceVersion string `json:"resourceVersion,omitempty"`
}
ObjectReference contains enough information to locate the referenced object inside current cluster.
func (*ObjectReference) DeepCopy ¶
func (in *ObjectReference) DeepCopy() *ObjectReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
func (*ObjectReference) DeepCopyInto ¶
func (in *ObjectReference) DeepCopyInto(out *ObjectReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Option ¶ added in v1.6.0
type Option func(*TaskOptions)
Option configures a TaskOptions
func WithClustersBeforeFailover ¶ added in v1.12.0
WithClustersBeforeFailover sets the clustersBeforeFailover for TaskOptions
func WithGracePeriodSeconds ¶ added in v1.6.0
WithGracePeriodSeconds sets the gracePeriodSeconds for TaskOptions
func WithMessage ¶ added in v1.6.0
WithMessage sets the message for TaskOptions
func WithPreservedLabelState ¶ added in v1.12.0
WithPreservedLabelState sets the preservedLabelState for TaskOptions
func WithProducer ¶ added in v1.6.0
WithProducer sets the producer for TaskOptions
func WithPurgeMode ¶ added in v1.12.0
func WithPurgeMode(purgeMode policyv1alpha1.PurgeMode) Option
WithPurgeMode sets the purgeMode for TaskOptions
func WithReason ¶ added in v1.6.0
WithReason sets the reason for TaskOptions
func WithSuppressDeletion ¶ added in v1.6.0
WithSuppressDeletion sets the suppressDeletion for TaskOptions
type ReplicaRequirements ¶
type ReplicaRequirements struct {
// NodeClaim represents the node claim HardNodeAffinity, NodeSelector and Tolerations required by each replica.
// +optional
NodeClaim *NodeClaim `json:"nodeClaim,omitempty"`
// ResourceRequest represents the resources required by each replica.
// +optional
ResourceRequest corev1.ResourceList `json:"resourceRequest,omitempty"`
// Namespace represents the resources namespaces
// +optional
Namespace string `json:"namespace,omitempty"`
// PriorityClassName represents the resources priorityClassName
// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
}
ReplicaRequirements represents the resource and scheduling requirements for each replica.
func (*ReplicaRequirements) DeepCopy ¶
func (in *ReplicaRequirements) DeepCopy() *ReplicaRequirements
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicaRequirements.
func (*ReplicaRequirements) DeepCopyInto ¶
func (in *ReplicaRequirements) DeepCopyInto(out *ReplicaRequirements)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceBinding ¶
type ResourceBinding struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec represents the desired behavior.
Spec ResourceBindingSpec `json:"spec"`
// Status represents the most recently observed status of the ResourceBinding.
// +optional
Status ResourceBindingStatus `json:"status,omitempty"`
}
ResourceBinding represents a binding of a kubernetes resource with a propagation policy.
func (*ResourceBinding) DeepCopy ¶
func (in *ResourceBinding) DeepCopy() *ResourceBinding
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceBinding.
func (*ResourceBinding) DeepCopyInto ¶
func (in *ResourceBinding) DeepCopyInto(out *ResourceBinding)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceBinding) DeepCopyObject ¶
func (in *ResourceBinding) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*ResourceBinding) Hub ¶ added in v0.10.0
func (*ResourceBinding) Hub()
Hub marks this type as a conversion hub.
type ResourceBindingList ¶
type ResourceBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of ResourceBinding.
Items []ResourceBinding `json:"items"`
}
ResourceBindingList contains a list of ResourceBinding.
func (*ResourceBindingList) DeepCopy ¶
func (in *ResourceBindingList) DeepCopy() *ResourceBindingList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceBindingList.
func (*ResourceBindingList) DeepCopyInto ¶
func (in *ResourceBindingList) DeepCopyInto(out *ResourceBindingList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourceBindingList) DeepCopyObject ¶
func (in *ResourceBindingList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ResourceBindingSpec ¶
type ResourceBindingSpec struct {
// Resource represents the Kubernetes resource to be propagated.
Resource ObjectReference `json:"resource"`
// PropagateDeps tells if relevant resources should be propagated automatically.
// It is inherited from PropagationPolicy or ClusterPropagationPolicy.
// default false.
// +optional
PropagateDeps bool `json:"propagateDeps,omitempty"`
// ReplicaRequirements represents the resource and scheduling requirements for each replica.
// +optional
ReplicaRequirements *ReplicaRequirements `json:"replicaRequirements,omitempty"`
// Replicas represents the replica number of the referencing resource.
// +optional
Replicas int32 `json:"replicas,omitempty"`
// Components represents the requirements of multiple pod templates of the referencing resource.
// It is designed to support workloads that consist of multiple pod templates,
// such as distributed training jobs (e.g., PyTorch, TensorFlow) and big data workloads (e.g., FlinkDeployment),
// where each workload is composed of more than one pod template. It is also capable of representing
// single-component workloads, such as Deployment.
//
// Note: This field is intended to replace the legacy ReplicaRequirements and Replicas fields above.
// It is only populated when the MultiplePodTemplatesScheduling feature gate is enabled.
// +optional
Components []Component `json:"components,omitempty"`
// Clusters represents target member clusters where the resource to be deployed.
// +optional
Clusters []TargetCluster `json:"clusters,omitempty"`
// Placement represents the rule for select clusters to propagate resources.
// +optional
Placement *policyv1alpha1.Placement `json:"placement,omitempty"`
// GracefulEvictionTasks holds the eviction tasks that are expected to perform
// the eviction in a graceful way.
// The intended workflow is:
// 1. Once the controller(such as 'taint-manager') decided to evict the resource that
// is referenced by current ResourceBinding or ClusterResourceBinding from a target
// cluster, it removes(or scale down the replicas) the target from Clusters(.spec.Clusters)
// and builds a graceful eviction task.
// 2. The scheduler may perform a re-scheduler and probably select a substitute cluster
// to take over the evicting workload(resource).
// 3. The graceful eviction controller takes care of the graceful eviction tasks and
// performs the final removal after the workload(resource) is available on the substitute
// cluster or exceed the grace termination period(defaults to 10 minutes).
//
// +optional
GracefulEvictionTasks []GracefulEvictionTask `json:"gracefulEvictionTasks,omitempty"`
// RequiredBy represents the list of Bindings that depend on the referencing resource.
// +optional
RequiredBy []BindingSnapshot `json:"requiredBy,omitempty"`
// SchedulerName represents which scheduler to proceed the scheduling.
// It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
// +optional
SchedulerName string `json:"schedulerName,omitempty"`
// Failover indicates how Karmada migrates applications in case of failures.
// It inherits directly from the associated PropagationPolicy(or ClusterPropagationPolicy).
// +optional
Failover *policyv1alpha1.FailoverBehavior `json:"failover,omitempty"`
// ConflictResolution declares how potential conflict should be handled when
// a resource that is being propagated already exists in the target cluster.
//
// It defaults to "Abort" which means stop propagating to avoid unexpected
// overwrites. The "Overwrite" might be useful when migrating legacy cluster
// resources to Karmada, in which case conflict is predictable and can be
// instructed to Karmada take over the resource by overwriting.
//
// +kubebuilder:default="Abort"
// +kubebuilder:validation:Enum=Abort;Overwrite
// +optional
ConflictResolution policyv1alpha1.ConflictResolution `json:"conflictResolution,omitempty"`
// RescheduleTriggeredAt is a timestamp representing when the referenced resource is triggered rescheduling.
// When this field is updated, it means a rescheduling is manually triggered by user, and the expected behavior
// of this action is to do a complete recalculation without referring to last scheduling results.
// It works with the status.lastScheduledTime field, and only when this timestamp is later than timestamp in
// status.lastScheduledTime will the rescheduling actually execute, otherwise, ignored.
//
// It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.
// +optional
RescheduleTriggeredAt *metav1.Time `json:"rescheduleTriggeredAt,omitempty"`
// Suspension declares the policy for suspending different aspects of propagation.
// nil means no suspension. no default values.
// +optional
Suspension *Suspension `json:"suspension,omitempty"`
// PreserveResourcesOnDeletion controls whether resources should be preserved on the
// member clusters when the binding object is deleted.
// If set to true, resources will be preserved on the member clusters.
// Default is false, which means resources will be deleted along with the binding object.
// This setting applies to all Work objects created under this binding object.
// +optional
PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"`
// SchedulePriority represents the scheduling priority assigned to workloads.
// +optional
SchedulePriority *SchedulePriority `json:"schedulePriority,omitempty"`
}
ResourceBindingSpec represents the expectation of ResourceBinding.
func (*ResourceBindingSpec) AssignedReplicasForCluster ¶ added in v1.2.0
func (s *ResourceBindingSpec) AssignedReplicasForCluster(targetCluster string) int32
AssignedReplicasForCluster returns assigned replicas for specific cluster.
func (*ResourceBindingSpec) ClusterInGracefulEvictionTasks ¶ added in v1.6.0
func (s *ResourceBindingSpec) ClusterInGracefulEvictionTasks(name string) bool
ClusterInGracefulEvictionTasks checks if the target cluster is in the GracefulEvictionTasks which means it is in the process of eviction.
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.
func (*ResourceBindingSpec) GracefulEvictCluster ¶ added in v1.3.0
func (s *ResourceBindingSpec) GracefulEvictCluster(name string, options *TaskOptions)
GracefulEvictCluster removes specific cluster from the target list in a graceful way by building a graceful eviction task. This function no-opts if the cluster does not exist.
func (*ResourceBindingSpec) IsWorkload ¶ added in v1.16.0
func (s *ResourceBindingSpec) IsWorkload() bool
IsWorkload return true if the ResourceBinding represents workload which has replicas or replica requirements (e.g., Deployment, StatefulSet) or multi-component workloads (e.g., FlinkDeployment), false otherwise.
func (*ResourceBindingSpec) RemoveCluster ¶ added in v1.3.0
func (s *ResourceBindingSpec) RemoveCluster(name string)
RemoveCluster removes specific cluster from the target list. This function no-opts if cluster not exist.
func (*ResourceBindingSpec) SchedulePriorityValue ¶ added in v1.13.0
func (s *ResourceBindingSpec) SchedulePriorityValue() int32
SchedulePriorityValue returns the scheduling priority declared by '.spec.SchedulePriority.Priority'.
func (*ResourceBindingSpec) SchedulingSuspended ¶ added in v1.13.0
func (s *ResourceBindingSpec) SchedulingSuspended() bool
SchedulingSuspended tells if the scheduling of ResourceBinding or ClusterResourceBinding is suspended.
func (*ResourceBindingSpec) TargetContains ¶ added in v1.2.0
func (s *ResourceBindingSpec) TargetContains(name string) bool
TargetContains checks if specific cluster present on the target list.
type ResourceBindingStatus ¶
type ResourceBindingStatus struct {
// SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler.
// If SchedulerObservedGeneration is less than the generation in metadata means the scheduler hasn't confirmed
// the scheduling result or hasn't done the schedule yet.
// +optional
SchedulerObservedGeneration int64 `json:"schedulerObservedGeneration,omitempty"`
// SchedulerObservedAffinityName is the name of affinity term that is
// the basis of current scheduling.
// +optional
SchedulerObservedAffinityName string `json:"schedulerObservingAffinityName,omitempty"`
// LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.
// It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.
// +optional
LastScheduledTime *metav1.Time `json:"lastScheduledTime,omitempty"`
// Conditions contain the different condition statuses.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
// AggregatedStatus represents status list of the resource running in each member cluster.
// +optional
AggregatedStatus []AggregatedStatusItem `json:"aggregatedStatus,omitempty"`
}
ResourceBindingStatus represents the overall status of the strategy as well as the referenced resources.
func (*ResourceBindingStatus) DeepCopy ¶
func (in *ResourceBindingStatus) DeepCopy() *ResourceBindingStatus
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 ResourceHealth ¶ added in v1.3.0
type ResourceHealth string
ResourceHealth represents that the health status of the reference resource.
const ( // ResourceHealthy represents that the health status of the current resource // that applied on the managed cluster is healthy. ResourceHealthy ResourceHealth = "Healthy" // ResourceUnhealthy represents that the health status of the current resource // that applied on the managed cluster is unhealthy. ResourceUnhealthy ResourceHealth = "Unhealthy" // ResourceUnknown represents that the health status of the current resource // that applied on the managed cluster is unknown. ResourceUnknown ResourceHealth = "Unknown" )
type SchedulePriority ¶ added in v1.13.0
type SchedulePriority struct {
// Priority specifies the scheduling priority for the binding.
// Higher values indicate a higher priority.
// If not explicitly set, the default value is 0.
// +kubebuilder:default=0
// +optional
Priority int32 `json:"priority,omitempty"`
}
SchedulePriority represents the scheduling priority assigned to workloads.
func (*SchedulePriority) DeepCopy ¶ added in v1.13.0
func (in *SchedulePriority) DeepCopy() *SchedulePriority
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulePriority.
func (*SchedulePriority) DeepCopyInto ¶ added in v1.13.0
func (in *SchedulePriority) DeepCopyInto(out *SchedulePriority)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Suspension ¶ added in v1.13.0
type Suspension struct {
policyv1alpha1.Suspension `json:",inline"`
// Scheduling controls whether scheduling should be suspended, the scheduler will pause scheduling and not
// process resource binding when the value is true and resume scheduling when it's false or nil.
// This is designed for third-party systems to temporarily pause the scheduling of applications, which enabling
// manage resource allocation, prioritize critical workloads, etc.
// It is expected that third-party systems use an admission webhook to suspend scheduling at the time of
// ResourceBinding creation. Once a ResourceBinding has been scheduled, it cannot be paused afterward, as it may
// lead to ineffective suspension.
// +optional
Scheduling *bool `json:"scheduling,omitempty"`
}
Suspension defines the policy for suspending dispatching and scheduling.
func (*Suspension) DeepCopy ¶ added in v1.13.0
func (in *Suspension) DeepCopy() *Suspension
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Suspension.
func (*Suspension) DeepCopyInto ¶ added in v1.13.0
func (in *Suspension) DeepCopyInto(out *Suspension)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TargetCluster ¶
type TargetCluster struct {
// Name of target cluster.
Name string `json:"name"`
// Replicas in target cluster
// +optional
Replicas int32 `json:"replicas,omitempty"`
}
TargetCluster represents the identifier of a member cluster.
func (*TargetCluster) DeepCopy ¶
func (in *TargetCluster) DeepCopy() *TargetCluster
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetCluster.
func (*TargetCluster) DeepCopyInto ¶
func (in *TargetCluster) DeepCopyInto(out *TargetCluster)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TaskOptions ¶ added in v1.6.0
type TaskOptions struct {
// contains filtered or unexported fields
}
TaskOptions represents options for GracefulEvictionTasks.
func NewTaskOptions ¶ added in v1.6.0
func NewTaskOptions(opts ...Option) *TaskOptions
NewTaskOptions builds a TaskOptions
func (*TaskOptions) DeepCopy ¶ added in v1.6.0
func (in *TaskOptions) DeepCopy() *TaskOptions
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskOptions.
func (*TaskOptions) DeepCopyInto ¶ added in v1.6.0
func (in *TaskOptions) DeepCopyInto(out *TaskOptions)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.