Documentation
¶
Index ¶
- Constants
- func Dec2float64(d *inf.Dec) (float64, error)
- func RemoveDuplicateResources(slice []v1.ResourceName) []v1.ResourceName
- type AppWrapperReconciler
- type CachedAppWrapper
- type ClusterInfoReconciler
- type Dispatcher
- type PodCounts
- type QueuingDecision
- type QuotaState
- type QuotaTracker
- func (tracker *QuotaTracker) Allocate(namespace string, appWrapperAskWeights *WeightsPair) bool
- func (tracker *QuotaTracker) Init(weightsPairMap map[string]*WeightsPair)
- func (tracker *QuotaTracker) Satisfies(appWrapperAskWeights *WeightsPair, resourceQuota *v1.ResourceQuota) (bool, []v1.ResourceName)
- type Runner
- type Weights
- func (w Weights) Add(r Weights)
- func (w Weights) AddProd(coefficient int32, r Weights)
- func (w Weights) AsResources() v1.ResourceList
- func (w Weights) Clone() Weights
- func (w Weights) Fits(r Weights) (bool, []v1.ResourceName)
- func (w Weights) Max(r Weights)
- func (w Weights) QuotaFits(r Weights) (bool, []v1.ResourceName)
- func (w Weights) QuotaSub(r Weights)
- func (w Weights) Sub(r Weights)
- type WeightsPair
Constants ¶
const DefaultResourceLimitsPrefix = "limits."
Should be defined in api/core/v1/types.go
Variables ¶
This section is empty.
Functions ¶
func Dec2float64 ¶
Dec2float64 converts inf.Dec to float64
func RemoveDuplicateResources ¶
func RemoveDuplicateResources(slice []v1.ResourceName) []v1.ResourceName
Remove duplicate resource names in a slice
Types ¶
type AppWrapperReconciler ¶
type AppWrapperReconciler struct { client.Client Scheme *runtime.Scheme Cache map[types.UID]*CachedAppWrapper // cache AppWrapper updates for write/read consistency MultiClusterMode bool // are we operating in multi-cluster mode ControllerName string // name of the controller }
AppWrapperReconciler is the super type of Dispatcher and Runner reconcilers
type CachedAppWrapper ¶
type CachedAppWrapper struct { // AppWrapper state State mcadv1beta1.AppWrapperState // AppWrapper step Step mcadv1beta1.AppWrapperStep // Number of transitions TransitionCount int32 // First conflict detected between reconciler cache and our cache if not nil Conflict *time.Time }
Cached AppWrapper
type ClusterInfoReconciler ¶
ClusterInfoReconciler reconciles a ClusterInfo object
func (*ClusterInfoReconciler) Reconcile ¶
func (r *ClusterInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile ClusterInfo object
func (*ClusterInfoReconciler) SetupWithManager ¶
func (r *ClusterInfoReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type Dispatcher ¶
type Dispatcher struct { AppWrapperReconciler Decisions map[types.UID]*QueuingDecision // transient log of queuing decisions to enable recording in AppWrapper Status Events chan event.GenericEvent // event channel to trigger dispatch NextLoggedDispatch time.Time // when next to log dispatching decisions }
AppWrapperReconciler responsible for the portion of the lifecycle that happens on the scheduling cluster
func (*Dispatcher) Reconcile ¶
Reconcile one AppWrapper or dispatch queued AppWrappers during the dispatching phases of their lifecycle.
Normal reconciliations "namespace/name" implement all phase transitions except for Queued->Dispatching Queued->Dispatching transitions happen as part of a special "*/*" reconciliation In a "*/*" reconciliation, we iterate over queued AppWrappers in order, dispatching as many as we can
func (*Dispatcher) SetupWithManager ¶
func (r *Dispatcher) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type QueuingDecision ¶
type QueuingDecision struct {
// contains filtered or unexported fields
}
type QuotaState ¶
type QuotaState struct {
// contains filtered or unexported fields
}
State includes total quota, used quota, and currently allocated quota
func NewQuotaStateFromResourceQuota ¶
func NewQuotaStateFromResourceQuota(resourceQuota *v1.ResourceQuota) *QuotaState
Create a QuotaState from a ResourceQuota object
type QuotaTracker ¶
type QuotaTracker struct {
// contains filtered or unexported fields
}
A tracker of allocated quota, mapped by namespace
func (*QuotaTracker) Allocate ¶
func (tracker *QuotaTracker) Allocate(namespace string, appWrapperAskWeights *WeightsPair) bool
Update the QuotaState by the allocated weights of an AppWrapper in a namespace, fails if QuotaState does not exist in the QuotaTracker
func (*QuotaTracker) Init ¶
func (tracker *QuotaTracker) Init(weightsPairMap map[string]*WeightsPair)
Account for all in-flight AppWrappers with their resource demand not yet reflected in the Used status of any ResourceQuota object in their corresponding namespace
func (*QuotaTracker) Satisfies ¶
func (tracker *QuotaTracker) Satisfies(appWrapperAskWeights *WeightsPair, resourceQuota *v1.ResourceQuota) (bool, []v1.ResourceName)
Check if the resource demand of an AppWrapper satisfies a ResourceQuota, without changing the current quota allocation, returning resource names with insufficient quota
type Runner ¶
type Runner struct {
AppWrapperReconciler
}
AppWrapperReconciler responsible for the portion of the lifecycle that happens on the execution cluster
type Weights ¶
type Weights map[v1.ResourceName]*inf.Dec
Weights represent a set of resource requests or available resources Quantities are encoded as *inf.Dec to maintain precision and make arithmetic easy
func NewLimitsWeightsForPod ¶
Converts resource limits of a pod to Weights
func NewWeightsForPod ¶
Converts effective resources of a pod to Weights
func (Weights) AsResources ¶
func (w Weights) AsResources() v1.ResourceList
Converts Weights to a ResourceList
func (Weights) Clone ¶
Creates a (deep) copy of Weights (Easier to add to zero than creating all fields)
func (Weights) Fits ¶
func (w Weights) Fits(r Weights) (bool, []v1.ResourceName)
Compare receiver to argument True if receiver is less than or equal to argument in every dimension
type WeightsPair ¶
type WeightsPair struct {
// contains filtered or unexported fields
}
A pair of Weights used to represent requests and limits for an object
func NewWeightsPair ¶
func NewWeightsPair(requests Weights, limits Weights) *WeightsPair
Creates a new pair of weights
func NewWeightsPairForPod ¶
func NewWeightsPairForPod(pod *v1.Pod) *WeightsPair
Create new WeightsPair for a pod
func (*WeightsPair) Fits ¶
func (w *WeightsPair) Fits(r *WeightsPair) (bool, []v1.ResourceName)
Compare receiver to argument - True if both weights of receiver fit corresponding weights of argument. If False, return list of insufficient resource names
func (*WeightsPair) QuotaSub ¶
func (w *WeightsPair) QuotaSub(r *WeightsPair)
Subtract pair of weights from receiver
func (*WeightsPair) String ¶
func (w *WeightsPair) String() string