Documentation ¶
Index ¶
- Constants
- func AddTolerations(placement *policyv1alpha1.Placement, tolerationsToAdd ...*corev1.Toleration)
- func AggregateClusterResourceBindingWorkStatus(c client.Client, binding *workv1alpha2.ClusterResourceBinding, ...) error
- func AggregateResourceBindingWorkStatus(c client.Client, binding *workv1alpha2.ResourceBinding, ...) error
- func ApplyReplica(workload *unstructured.Unstructured, desireReplica int64, field string) error
- func BuildStatusRawExtension(status interface{}) (*runtime.RawExtension, error)
- func ConstructClusterWideKey(resource workv1alpha2.ObjectReference) (keys.ClusterWideKey, error)
- func ConstructObjectReference(rs policyv1alpha1.ResourceSelector) workv1alpha2.ObjectReference
- func ConvertToTypedObject(in, out interface{}) error
- func CreateOrUpdateEndpointSlice(client client.Client, endpointSlice *discoveryv1.EndpointSlice) error
- func CreateOrUpdateWork(client client.Client, workMeta metav1.ObjectMeta, ...) error
- func DeleteEndpointSlice(c client.Client, selector labels.Set) error
- func DeleteWorkByCRBName(c client.Client, name string) error
- func DeleteWorkByRBNamespaceAndName(c client.Client, namespace, name string) error
- func DeleteWorks(c client.Client, namespace, name string) error
- func EmitClusterEvictionEventForClusterResourceBinding(binding *workv1alpha2.ClusterResourceBinding, cluster string, ...)
- func EmitClusterEvictionEventForResourceBinding(binding *workv1alpha2.ResourceBinding, cluster string, ...)
- func FetchResourceTemplate(dynamicClient dynamic.Interface, ...) (*unstructured.Unstructured, error)
- func FindOrphanWorks(c client.Client, bindingNamespace, bindingName string, ...) ([]workv1alpha1.Work, error)
- func GenEventRef(resource *unstructured.Unstructured) (*corev1.ObjectReference, error)
- func GenMergePatch(originalObj interface{}, modifiedObj interface{}) ([]byte, error)
- func GenerateNodeClaimByPodSpec(podSpec *corev1.PodSpec) *workv1alpha2.NodeClaim
- func GeneratePodFromTemplateAndNamespace(template *corev1.PodTemplateSpec, namespace string) *corev1.Pod
- func GenerateReplicaRequirements(podTemplate *corev1.PodTemplateSpec) *workv1alpha2.ReplicaRequirements
- func GenerateResourceSelectorForServiceImport(svcImport policyv1alpha1.ResourceSelector) []policyv1alpha1.ResourceSelector
- func GetAppliedPlacement(annotations map[string]string) (*policyv1alpha1.Placement, error)
- func GetClusterResourceBindings(c client.Client, ls labels.Set) (*workv1alpha2.ClusterResourceBindingList, error)
- func GetCronFederatedHPAFailedHistoryLimits(rule autoscalingv1alpha1.CronFederatedHPARule) int
- func GetCronFederatedHPAKey(cronFHPA *autoscalingv1alpha1.CronFederatedHPA) string
- func GetCronFederatedHPASuccessHistoryLimits(rule autoscalingv1alpha1.CronFederatedHPARule) int
- func GetDependenciesFromPodTemplate(podObj *corev1.Pod) ([]configv1alpha1.DependentObjectReference, error)
- func GetEndpointSlices(c client.Client, ls labels.Set) (*discoveryv1.EndpointSliceList, error)
- func GetFollowedResourceSelectorsWhenMatchServiceImport(resourceSelectors []policyv1alpha1.ResourceSelector) []policyv1alpha1.ResourceSelector
- func GetJobFinishedStatus(jobStatus *batchv1.JobStatus) (bool, batchv1.JobConditionType)
- func GetManifestIndex(manifests []workv1alpha1.Manifest, clusterObj *unstructured.Unstructured) (int, error)
- func GetMatchingTolerations(taints []corev1.Taint, tolerations []corev1.Toleration) (bool, []corev1.Toleration)
- func GetMinTolerationTime(noExecuteTaints []corev1.Taint, usedTolerations []corev1.Toleration) time.Duration
- func GetNoExecuteTaints(taints []corev1.Taint) []corev1.Taint
- func GetObjectFromCache(restMapper meta.RESTMapper, manager genericmanager.MultiClusterInformerManager, ...) (*unstructured.Unstructured, error)
- func GetObjectFromSingleClusterCache(restMapper meta.RESTMapper, ...) (*unstructured.Unstructured, error)
- func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
- func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition
- func GetResourceBindings(c client.Client, ls labels.Set) (*workv1alpha2.ResourceBindingList, error)
- func GetWorksByBindingNamespaceName(c client.Client, bindingNamespace, bindingName string) (*workv1alpha1.WorkList, error)
- func GetWorksByLabelsSet(c client.Client, ls labels.Set) (*workv1alpha1.WorkList, error)
- func HasNoExecuteTaints(taints []corev1.Taint) bool
- func IsAPIEnabled(APIEnablements []clusterv1alpha1.APIEnablement, groupVersion string, ...) bool
- func IsBindingScheduled(status *workv1alpha2.ResourceBindingStatus) bool
- func IsClusterOverridePolicyExist(c client.Client, name string) (bool, error)
- func IsCronFederatedHPARuleSuspend(rule autoscalingv1alpha1.CronFederatedHPARule) bool
- func IsDependentClusterOverridesPresent(c client.Client, policy *policyv1alpha1.ClusterPropagationPolicy) (bool, error)
- func IsDependentOverridesPresent(c client.Client, policy *policyv1alpha1.PropagationPolicy) (bool, error)
- func IsOverridePolicyExist(c client.Client, ns string, name string) (bool, error)
- func IsPodReady(pod *corev1.Pod) bool
- func IsPodReadyConditionTrue(status corev1.PodStatus) bool
- func IsReplicaDynamicDivided(placement *policyv1alpha1.Placement) bool
- func IsResourceApplied(workStatus *workv1alpha1.WorkStatus) bool
- func NewClusterPredicateOnAgent(clusterName string) predicate.Funcs
- func NewExecutionPredicate(mgr controllerruntime.Manager) predicate.Funcs
- func NewExecutionPredicateOnAgent() predicate.Funcs
- func NewNotReadyToleration(tolerationSeconds int64) *corev1.Toleration
- func NewPredicateForServiceExportController(mgr controllerruntime.Manager) predicate.Funcs
- func NewPredicateForServiceExportControllerOnAgent(curClusterName string) predicate.Funcs
- func NewUnreachableToleration(tolerationSeconds int64) *corev1.Toleration
- func NodeReady(node *corev1.Node) bool
- func ObtainBindingSpecExistingClusters(bindingSpec workv1alpha2.ResourceBindingSpec) sets.Set[string]
- func ParsingJobStatus(obj *batchv1.Job, status []workv1alpha2.AggregatedStatusItem) (*batchv1.JobStatus, error)
- func RemoveOrphanWorks(c client.Client, works []workv1alpha1.Work) error
- func SetDefaultGracePeriodSeconds(behavior *policyv1alpha1.ApplicationFailoverBehavior)
- func SetDefaultSpreadConstraints(spreadConstraints []policyv1alpha1.SpreadConstraint)
- func SetReplicaDivisionPreferenceWeighted(placement *policyv1alpha1.Placement)
- func SpreadReplicasByTargetClusters(numReplicas int32, tcs, init []workv1alpha2.TargetCluster) []workv1alpha2.TargetCluster
- func TaintExists(taints []corev1.Taint, taintToFind *corev1.Taint) bool
- func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
- func TolerationExists(tolerations []corev1.Toleration, tolerationToFind *corev1.Toleration) bool
- func UpdateClusterControllerTaint(ctx context.Context, client client.Client, ...) error
- type ClusterWeightInfo
- type ClusterWeightInfoList
- type Dispenser
Constants ¶
const ( // FullyAppliedSuccessReason defines the success reason for the FullyApplied condition. FullyAppliedSuccessReason = "FullyAppliedSuccess" // FullyAppliedFailedReason defines the failure reason for the FullyApplied condition. FullyAppliedFailedReason = "FullyAppliedFailed" // FullyAppliedSuccessMessage defines the success message for the FullyApplied condition. FullyAppliedSuccessMessage = "All works have been successfully applied" // FullyAppliedFailedMessage defines the failure message for the FullyApplied condition. FullyAppliedFailedMessage = "Failed to apply all works, see status.aggregatedStatus for details" )
Variables ¶
This section is empty.
Functions ¶
func AddTolerations ¶ added in v1.3.0
func AddTolerations(placement *policyv1alpha1.Placement, tolerationsToAdd ...*corev1.Toleration)
AddTolerations add some tolerations if not existed.
func AggregateClusterResourceBindingWorkStatus ¶ added in v0.5.0
func AggregateClusterResourceBindingWorkStatus( c client.Client, binding *workv1alpha2.ClusterResourceBinding, resourceTemplate *unstructured.Unstructured, eventRecorder record.EventRecorder, ) error
AggregateClusterResourceBindingWorkStatus will collect all work statuses with current ClusterResourceBinding objects, then aggregate status info to current ClusterResourceBinding status.
func AggregateResourceBindingWorkStatus ¶ added in v0.5.0
func AggregateResourceBindingWorkStatus( c client.Client, binding *workv1alpha2.ResourceBinding, resourceTemplate *unstructured.Unstructured, eventRecorder record.EventRecorder, ) error
AggregateResourceBindingWorkStatus will collect all work statuses with current ResourceBinding objects, then aggregate status info to current ResourceBinding status.
func ApplyReplica ¶ added in v1.0.0
func ApplyReplica(workload *unstructured.Unstructured, desireReplica int64, field string) error
ApplyReplica applies the Replica value for the specific field.
func BuildStatusRawExtension ¶ added in v1.1.0
func BuildStatusRawExtension(status interface{}) (*runtime.RawExtension, error)
BuildStatusRawExtension builds raw JSON by a status map.
func ConstructClusterWideKey ¶ added in v1.4.0
func ConstructClusterWideKey(resource workv1alpha2.ObjectReference) (keys.ClusterWideKey, error)
ConstructClusterWideKey construct resource ClusterWideKey from binding's objectReference.
func ConstructObjectReference ¶ added in v1.7.0
func ConstructObjectReference(rs policyv1alpha1.ResourceSelector) workv1alpha2.ObjectReference
ConstructObjectReference constructs ObjectReference from ResourceSelector.
func ConvertToTypedObject ¶ added in v1.3.0
func ConvertToTypedObject(in, out interface{}) error
ConvertToTypedObject converts an unstructured object to typed.
func CreateOrUpdateEndpointSlice ¶ added in v0.7.0
func CreateOrUpdateEndpointSlice(client client.Client, endpointSlice *discoveryv1.EndpointSlice) error
CreateOrUpdateEndpointSlice creates a EndpointSlice object if not exist, or updates if it already exists.
func CreateOrUpdateWork ¶ added in v0.7.0
func CreateOrUpdateWork(client client.Client, workMeta metav1.ObjectMeta, resource *unstructured.Unstructured) error
CreateOrUpdateWork creates a Work object if not exist, or updates if it already exist.
func DeleteEndpointSlice ¶ added in v0.7.0
DeleteEndpointSlice will delete all EndpointSlice objects by labels.
func DeleteWorkByCRBName ¶ added in v0.10.0
DeleteWorkByCRBName will delete all Work objects by ClusterResourceBinding name.
func DeleteWorkByRBNamespaceAndName ¶ added in v0.10.0
DeleteWorkByRBNamespaceAndName will delete all Work objects by ResourceBinding namespace and name.
func DeleteWorks ¶ added in v0.7.0
DeleteWorks will delete all Work objects by labels.
func EmitClusterEvictionEventForClusterResourceBinding ¶ added in v1.4.0
func EmitClusterEvictionEventForClusterResourceBinding(binding *workv1alpha2.ClusterResourceBinding, cluster string, eventRecorder record.EventRecorder, err error)
EmitClusterEvictionEventForClusterResourceBinding records the eviction event for clusterResourceBinding and its objectReference.
func EmitClusterEvictionEventForResourceBinding ¶ added in v1.4.0
func EmitClusterEvictionEventForResourceBinding(binding *workv1alpha2.ResourceBinding, cluster string, eventRecorder record.EventRecorder, err error)
EmitClusterEvictionEventForResourceBinding records the eviction event for resourceBinding and its objectReference.
func FetchResourceTemplate ¶ added in v1.6.0
func FetchResourceTemplate( dynamicClient dynamic.Interface, informerManager genericmanager.SingleClusterInformerManager, restMapper meta.RESTMapper, resource workv1alpha2.ObjectReference, ) (*unstructured.Unstructured, error)
FetchResourceTemplate fetches the resource template to be propagated.
func FindOrphanWorks ¶
func FindOrphanWorks(c client.Client, bindingNamespace, bindingName string, expectClusters sets.Set[string]) ([]workv1alpha1.Work, error)
FindOrphanWorks retrieves all works that labeled with current binding(ResourceBinding or ClusterResourceBinding) objects, then pick the works that not meet current binding declaration.
func GenEventRef ¶ added in v1.3.0
func GenEventRef(resource *unstructured.Unstructured) (*corev1.ObjectReference, error)
GenEventRef returns the event reference. sets the UID(.spec.uid) that might be missing for fire events. Do nothing if the UID already exist, otherwise set the UID from annotation.
func GenMergePatch ¶ added in v1.3.0
GenMergePatch will return a merge patch document capable of converting the original object to the modified object. The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content.
func GenerateNodeClaimByPodSpec ¶ added in v0.9.0
func GenerateNodeClaimByPodSpec(podSpec *corev1.PodSpec) *workv1alpha2.NodeClaim
GenerateNodeClaimByPodSpec will return a NodeClaim from PodSpec.
func GeneratePodFromTemplateAndNamespace ¶ added in v1.6.0
func GeneratePodFromTemplateAndNamespace(template *corev1.PodTemplateSpec, namespace string) *corev1.Pod
GeneratePodFromTemplateAndNamespace generates a simple pod object from the given podTemplate and namespace, then returns the generated pod.
func GenerateReplicaRequirements ¶ added in v0.10.0
func GenerateReplicaRequirements(podTemplate *corev1.PodTemplateSpec) *workv1alpha2.ReplicaRequirements
GenerateReplicaRequirements generates replica requirements for node and resources.
func GenerateResourceSelectorForServiceImport ¶ added in v0.7.0
func GenerateResourceSelectorForServiceImport(svcImport policyv1alpha1.ResourceSelector) []policyv1alpha1.ResourceSelector
GenerateResourceSelectorForServiceImport generates resource selectors for ServiceImport.
func GetAppliedPlacement ¶ added in v1.3.0
func GetAppliedPlacement(annotations map[string]string) (*policyv1alpha1.Placement, error)
GetAppliedPlacement will get applied placement from annotations.
func GetClusterResourceBindings ¶ added in v0.6.0
func GetClusterResourceBindings(c client.Client, ls labels.Set) (*workv1alpha2.ClusterResourceBindingList, error)
GetClusterResourceBindings returns a ClusterResourceBindingList by labels.
func GetCronFederatedHPAFailedHistoryLimits ¶ added in v1.7.0
func GetCronFederatedHPAFailedHistoryLimits(rule autoscalingv1alpha1.CronFederatedHPARule) int
func GetCronFederatedHPAKey ¶ added in v1.7.0
func GetCronFederatedHPAKey(cronFHPA *autoscalingv1alpha1.CronFederatedHPA) string
func GetCronFederatedHPASuccessHistoryLimits ¶ added in v1.7.0
func GetCronFederatedHPASuccessHistoryLimits(rule autoscalingv1alpha1.CronFederatedHPARule) int
func GetDependenciesFromPodTemplate ¶ added in v1.6.0
func GetDependenciesFromPodTemplate(podObj *corev1.Pod) ([]configv1alpha1.DependentObjectReference, error)
GetDependenciesFromPodTemplate extracts the dependencies from the given pod and returns that. returns DependentObjectReferences according to the pod, including ConfigMap, Secret, ServiceAccount and PersistentVolumeClaim.
func GetEndpointSlices ¶ added in v0.7.0
func GetEndpointSlices(c client.Client, ls labels.Set) (*discoveryv1.EndpointSliceList, error)
GetEndpointSlices returns a EndpointSliceList by labels
func GetFollowedResourceSelectorsWhenMatchServiceImport ¶ added in v0.7.0
func GetFollowedResourceSelectorsWhenMatchServiceImport(resourceSelectors []policyv1alpha1.ResourceSelector) []policyv1alpha1.ResourceSelector
GetFollowedResourceSelectorsWhenMatchServiceImport get followed derived-service and endpointSlices resource selectors when policy's ResourceSelectors contains ResourceSelector, whose kind is ServiceImport.
func GetJobFinishedStatus ¶ added in v1.0.4
func GetJobFinishedStatus(jobStatus *batchv1.JobStatus) (bool, batchv1.JobConditionType)
GetJobFinishedStatus checks whether the given Job has finished execution. It does not discriminate between successful and failed terminations.
func GetManifestIndex ¶ added in v0.5.0
func GetManifestIndex(manifests []workv1alpha1.Manifest, clusterObj *unstructured.Unstructured) (int, error)
GetManifestIndex get the index of clusterObj in manifest list, if not exist return -1.
func GetMatchingTolerations ¶ added in v1.3.0
func GetMatchingTolerations(taints []corev1.Taint, tolerations []corev1.Toleration) (bool, []corev1.Toleration)
GetMatchingTolerations returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise.
func GetMinTolerationTime ¶ added in v1.3.0
func GetMinTolerationTime(noExecuteTaints []corev1.Taint, usedTolerations []corev1.Toleration) time.Duration
GetMinTolerationTime returns minimal toleration time from the given slice, or -1 if it's infinite.
func GetNoExecuteTaints ¶ added in v1.3.0
GetNoExecuteTaints will get all NoExecute taints.
func GetObjectFromCache ¶ added in v0.7.0
func GetObjectFromCache( restMapper meta.RESTMapper, manager genericmanager.MultiClusterInformerManager, fedKey keys.FederatedKey, ) (*unstructured.Unstructured, error)
GetObjectFromCache gets full object information from cache by key in worker queue.
func GetObjectFromSingleClusterCache ¶ added in v1.1.0
func GetObjectFromSingleClusterCache(restMapper meta.RESTMapper, manager genericmanager.SingleClusterInformerManager, cwk *keys.ClusterWideKey) (*unstructured.Unstructured, error)
GetObjectFromSingleClusterCache gets full object information from single cluster cache by key in worker queue.
func GetPodCondition ¶ added in v1.1.0
func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodConditionFromList ¶ added in v1.1.0
func GetPodConditionFromList(conditions []corev1.PodCondition, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)
GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.
func GetPodReadyCondition ¶ added in v1.6.0
func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition
GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func GetResourceBindings ¶ added in v0.6.0
func GetResourceBindings(c client.Client, ls labels.Set) (*workv1alpha2.ResourceBindingList, error)
GetResourceBindings returns a ResourceBindingList by labels
func GetWorksByBindingNamespaceName ¶ added in v1.3.0
func GetWorksByBindingNamespaceName(c client.Client, bindingNamespace, bindingName string) (*workv1alpha1.WorkList, error)
GetWorksByBindingNamespaceName get WorkList by matching same Namespace and same Name.
func GetWorksByLabelsSet ¶ added in v1.2.0
GetWorksByLabelsSet get WorkList by matching labels.Set.
func HasNoExecuteTaints ¶ added in v1.3.0
HasNoExecuteTaints check if NoExecute taints exist.
func IsAPIEnabled ¶ added in v0.7.0
func IsAPIEnabled(APIEnablements []clusterv1alpha1.APIEnablement, groupVersion string, kind string) bool
IsAPIEnabled checks if target API (or CRD) referencing by groupVersion and kind has been installed.
func IsBindingScheduled ¶ added in v1.0.0
func IsBindingScheduled(status *workv1alpha2.ResourceBindingStatus) bool
IsBindingScheduled will check if resourceBinding/clusterResourceBinding is successfully scheduled.
func IsClusterOverridePolicyExist ¶
IsClusterOverridePolicyExist checks if specific ClusterOverridePolicy exist.
func IsCronFederatedHPARuleSuspend ¶ added in v1.7.0
func IsCronFederatedHPARuleSuspend(rule autoscalingv1alpha1.CronFederatedHPARule) bool
func IsDependentClusterOverridesPresent ¶
func IsDependentClusterOverridesPresent(c client.Client, policy *policyv1alpha1.ClusterPropagationPolicy) (bool, error)
IsDependentClusterOverridesPresent checks if a ClusterPropagationPolicy's dependent ClusterOverridePolicy all exist.
func IsDependentOverridesPresent ¶
func IsDependentOverridesPresent(c client.Client, policy *policyv1alpha1.PropagationPolicy) (bool, error)
IsDependentOverridesPresent checks if a PropagationPolicy's dependent OverridePolicy all exist.
func IsOverridePolicyExist ¶
IsOverridePolicyExist checks if specific OverridePolicy exist.
func IsPodReady ¶ added in v1.6.0
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶ added in v1.6.0
IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.
func IsReplicaDynamicDivided ¶ added in v1.1.0
func IsReplicaDynamicDivided(placement *policyv1alpha1.Placement) bool
IsReplicaDynamicDivided checks if a PropagationPolicy schedules replicas as dynamic.
func IsResourceApplied ¶ added in v0.7.0
func IsResourceApplied(workStatus *workv1alpha1.WorkStatus) bool
IsResourceApplied checks whether resource has been dispatched to member cluster or not
func NewClusterPredicateOnAgent ¶ added in v0.7.0
NewClusterPredicateOnAgent generates an event filter function with Cluster for karmada-agent.
func NewExecutionPredicate ¶ added in v0.7.0
func NewExecutionPredicate(mgr controllerruntime.Manager) predicate.Funcs
NewExecutionPredicate generates the event filter function to skip events that the controllers are uninterested. Used by controllers: - execution controller working in karmada-controller-manager - work status controller working in karmada-controller-manager
func NewExecutionPredicateOnAgent ¶ added in v0.7.0
NewExecutionPredicateOnAgent generates the event filter function to skip events that the controllers are uninterested. Used by controllers: - execution controller working in agent - work status controller working in agent
func NewNotReadyToleration ¶ added in v1.3.0
func NewNotReadyToleration(tolerationSeconds int64) *corev1.Toleration
NewNotReadyToleration returns a default not ready toleration.
func NewPredicateForServiceExportController ¶ added in v0.7.0
func NewPredicateForServiceExportController(mgr controllerruntime.Manager) predicate.Funcs
NewPredicateForServiceExportController generates an event filter function for ServiceExport controller running by karmada-controller-manager.
func NewPredicateForServiceExportControllerOnAgent ¶ added in v0.7.0
NewPredicateForServiceExportControllerOnAgent generates an event filter function for ServiceExport controller running by karmada-agent.
func NewUnreachableToleration ¶ added in v1.3.0
func NewUnreachableToleration(tolerationSeconds int64) *corev1.Toleration
NewUnreachableToleration returns a default unreachable toleration.
func ObtainBindingSpecExistingClusters ¶ added in v1.3.0
func ObtainBindingSpecExistingClusters(bindingSpec workv1alpha2.ResourceBindingSpec) sets.Set[string]
ObtainBindingSpecExistingClusters will obtain the cluster slice existing in the binding's spec field.
func ParsingJobStatus ¶ added in v1.0.0
func ParsingJobStatus(obj *batchv1.Job, status []workv1alpha2.AggregatedStatusItem) (*batchv1.JobStatus, error)
ParsingJobStatus generates new status of given 'AggregatedStatusItem'.
func RemoveOrphanWorks ¶
func RemoveOrphanWorks(c client.Client, works []workv1alpha1.Work) error
RemoveOrphanWorks will remove orphan works.
func SetDefaultGracePeriodSeconds ¶ added in v1.6.0
func SetDefaultGracePeriodSeconds(behavior *policyv1alpha1.ApplicationFailoverBehavior)
SetDefaultGracePeriodSeconds sets the default value of GracePeriodSeconds in ApplicationFailoverBehavior
func SetDefaultSpreadConstraints ¶
func SetDefaultSpreadConstraints(spreadConstraints []policyv1alpha1.SpreadConstraint)
SetDefaultSpreadConstraints set default spread constraints if both 'SpreadByField' and 'SpreadByLabel' not set.
func SetReplicaDivisionPreferenceWeighted ¶ added in v1.5.0
func SetReplicaDivisionPreferenceWeighted(placement *policyv1alpha1.Placement)
SetReplicaDivisionPreferenceWeighted sets the default value of ReplicaDivisionPreference to Weighted
func SpreadReplicasByTargetClusters ¶ added in v1.5.0
func SpreadReplicasByTargetClusters(numReplicas int32, tcs, init []workv1alpha2.TargetCluster) []workv1alpha2.TargetCluster
SpreadReplicasByTargetClusters divides replicas by the weight of a target cluster list.
func TaintExists ¶ added in v1.2.0
TaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.
func ToUnstructured ¶ added in v1.0.4
func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
ToUnstructured converts a typed object to an unstructured object.
func TolerationExists ¶ added in v1.3.0
func TolerationExists(tolerations []corev1.Toleration, tolerationToFind *corev1.Toleration) bool
TolerationExists checks if the given toleration exists in list of tolerations. Returns true if exists false otherwise.
Types ¶
type ClusterWeightInfo ¶ added in v0.5.0
ClusterWeightInfo records the weight of a cluster
type ClusterWeightInfoList ¶ added in v0.5.0
type ClusterWeightInfoList []ClusterWeightInfo
ClusterWeightInfoList is a slice of ClusterWeightInfo that implements sort.Interface to sort by Value.
func GetStaticWeightInfoListByTargetClusters ¶ added in v1.5.0
func GetStaticWeightInfoListByTargetClusters(tcs []workv1alpha2.TargetCluster) ClusterWeightInfoList
GetStaticWeightInfoListByTargetClusters constructs a weight list by target cluster slice.
func SortClusterByWeight ¶ added in v0.7.0
func SortClusterByWeight(m map[string]int64) ClusterWeightInfoList
SortClusterByWeight sort clusters by the weight
func (ClusterWeightInfoList) GetWeightSum ¶ added in v1.5.0
func (p ClusterWeightInfoList) GetWeightSum() int64
GetWeightSum returns the sum of the weight info.
func (ClusterWeightInfoList) Len ¶ added in v0.5.0
func (p ClusterWeightInfoList) Len() int
func (ClusterWeightInfoList) Less ¶ added in v0.5.0
func (p ClusterWeightInfoList) Less(i, j int) bool
func (ClusterWeightInfoList) Swap ¶ added in v0.5.0
func (p ClusterWeightInfoList) Swap(i, j int)
type Dispenser ¶ added in v1.5.0
type Dispenser struct { // Target replicas, should be a positive integer. NumReplicas int32 // Final result. Result []workv1alpha2.TargetCluster }
Dispenser aims to divide replicas among clusters by different weights.
func NewDispenser ¶ added in v1.5.0
func NewDispenser(numReplicas int32, init []workv1alpha2.TargetCluster) *Dispenser
NewDispenser will construct a dispenser with target replicas and a prescribed initial result.
func (*Dispenser) TakeByWeight ¶ added in v1.5.0
func (a *Dispenser) TakeByWeight(w ClusterWeightInfoList)
TakeByWeight divide replicas by a weight list and merge the result into previous result.