Documentation ¶
Index ¶
- func GetVPod(key types.NamespacedName, vpods []scheduler.VPod) scheduler.VPod
- func OrdinalFromPodName(podName string) int32
- func PodNameFromOrdinal(name string, ordinal int32) string
- func ToJSONable(ps map[types.NamespacedName]map[string]int32) map[string]map[string]int32
- type State
- func (s *State) Free(ordinal int32) int32
- func (s *State) FreeCapacity() int32
- func (s *State) IsSchedulablePod(ordinal int32) bool
- func (s *State) MarshalJSON() ([]byte, error)
- func (s *State) SetFree(ordinal int32, value int32)
- func (s *State) TotalExpectedVReplicas() int32
- func (s *State) TotalPending() int32
- type StateAccessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OrdinalFromPodName ¶
func PodNameFromOrdinal ¶
func ToJSONable ¶ added in v0.42.4
Types ¶
type State ¶
type State struct { // free tracks the free capacity of each pod. FreeCap []int32 // schedulable pods tracks the pods that aren't being evicted. SchedulablePods []int32 // LastOrdinal is the ordinal index corresponding to the last statefulset replica // with placed vpods. LastOrdinal int32 // Pod capacity. Capacity int32 // Replicas is the (cached) number of statefulset replicas. Replicas int32 StatefulSetName string PodLister corev1.PodNamespaceLister // Stores for each vpod, a map of podname to number of vreplicas placed on that pod currently PodSpread map[types.NamespacedName]map[string]int32 // Pending tracks the number of virtual replicas that haven't been scheduled yet // because there wasn't enough free capacity. Pending map[types.NamespacedName]int32 // ExpectedVReplicaByVPod is the expected virtual replicas for each vpod key ExpectedVReplicaByVPod map[types.NamespacedName]int32 }
state provides information about the current scheduling of all vpods It is used by for the scheduler and the autoscaler
func (*State) FreeCapacity ¶
FreeCapacity returns the number of vreplicas that can be used, up to the last ordinal
func (*State) IsSchedulablePod ¶ added in v0.35.6
func (*State) MarshalJSON ¶ added in v0.35.6
func (*State) TotalExpectedVReplicas ¶ added in v0.38.2
func (*State) TotalPending ¶ added in v0.38.2
type StateAccessor ¶
type StateAccessor interface { // State returns the current state (snapshot) about placed vpods // Take into account reserved vreplicas and update `reserved` to reflect // the current state. State(ctx context.Context) (*State, error) }
func NewStateBuilder ¶
func NewStateBuilder(sfsname string, lister scheduler.VPodLister, podCapacity int32, podlister corev1.PodNamespaceLister, statefulSetCache *scheduler.ScaleCache) StateAccessor
NewStateBuilder returns a StateAccessor recreating the state from scratch each time it is requested
Click to show internal directories.
Click to hide internal directories.