Documentation ¶
Index ¶
- func NewDefautlEventManager() *defaultEventManager
- func NewProvReqProcessor(client *provreqclient.ProvisioningRequestClient) *provReqProcessor
- func NewProvisioningRequestPodsFilter(e EventManager) pods.PodListProcessor
- type EventManager
- type ProvisioningRequestPodsFilter
- type ProvisioningRequestPodsInjector
- func (p *ProvisioningRequestPodsInjector) CleanUp()
- func (p *ProvisioningRequestPodsInjector) GetCheckCapacityBatch(maxPrs int) ([]ProvisioningRequestWithPods, error)
- func (p *ProvisioningRequestPodsInjector) GetPodsFromNextRequest(isSupportedClass func(*provreqwrapper.ProvisioningRequest) bool) ([]*apiv1.Pod, error)
- func (p *ProvisioningRequestPodsInjector) IsAvailableForProvisioning(pr *provreqwrapper.ProvisioningRequest) bool
- func (p *ProvisioningRequestPodsInjector) LastProvisioningRequestProcessTime() time.Time
- func (p *ProvisioningRequestPodsInjector) MarkAsAccepted(pr *provreqwrapper.ProvisioningRequest) error
- func (p *ProvisioningRequestPodsInjector) MarkAsFailed(pr *provreqwrapper.ProvisioningRequest, reason string, message string)
- func (p *ProvisioningRequestPodsInjector) Process(_ *context.AutoscalingContext, unschedulablePods []*apiv1.Pod) ([]*apiv1.Pod, error)
- func (p *ProvisioningRequestPodsInjector) UpdateLastProcessTime()
- type ProvisioningRequestWithPods
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefautlEventManager ¶
func NewDefautlEventManager() *defaultEventManager
NewDefautlEventManager return basic event manager.
func NewProvReqProcessor ¶
func NewProvReqProcessor(client *provreqclient.ProvisioningRequestClient) *provReqProcessor
NewProvReqProcessor return ProvisioningRequestProcessor.
func NewProvisioningRequestPodsFilter ¶
func NewProvisioningRequestPodsFilter(e EventManager) pods.PodListProcessor
NewProvisioningRequestPodsFilter creates a ProvisioningRequest filter processor.
Types ¶
type EventManager ¶
type EventManager interface { LogIgnoredInScaleUpEvent(context *context.AutoscalingContext, now time.Time, pod *apiv1.Pod, prName string) Reset() }
EventManager is an interface for handling events for provisioning request.
type ProvisioningRequestPodsFilter ¶
type ProvisioningRequestPodsFilter struct {
// contains filtered or unexported fields
}
ProvisioningRequestPodsFilter filter out pods that consumes Provisioning Request
func (*ProvisioningRequestPodsFilter) CleanUp ¶
func (p *ProvisioningRequestPodsFilter) CleanUp()
CleanUp cleans up the processor's internal structures.
func (*ProvisioningRequestPodsFilter) Process ¶
func (p *ProvisioningRequestPodsFilter) Process( context *context.AutoscalingContext, unschedulablePods []*apiv1.Pod, ) ([]*apiv1.Pod, error)
Process filters out all pods that are consuming a Provisioning Request from unschedulable pods list.
type ProvisioningRequestPodsInjector ¶
type ProvisioningRequestPodsInjector struct {
// contains filtered or unexported fields
}
ProvisioningRequestPodsInjector creates in-memory pods from ProvisioningRequest and inject them to unscheduled pods list.
func NewFakePodsInjector ¶
func NewFakePodsInjector(client *provreqclient.ProvisioningRequestClient, clock *testing.FakePassiveClock) *ProvisioningRequestPodsInjector
NewFakePodsInjector creates a new instance of ProvisioningRequestPodsInjector with the given client and clock for testing.
func NewProvisioningRequestPodsInjector ¶
func NewProvisioningRequestPodsInjector(kubeConfig *rest.Config, initialBackoffTime, maxBackoffTime time.Duration, maxCacheSize int, checkCapacityBatchProcessing bool) (*ProvisioningRequestPodsInjector, error)
NewProvisioningRequestPodsInjector creates a ProvisioningRequest filter processor.
func (*ProvisioningRequestPodsInjector) CleanUp ¶
func (p *ProvisioningRequestPodsInjector) CleanUp()
CleanUp cleans up the processor's internal structures.
func (*ProvisioningRequestPodsInjector) GetCheckCapacityBatch ¶
func (p *ProvisioningRequestPodsInjector) GetCheckCapacityBatch(maxPrs int) ([]ProvisioningRequestWithPods, error)
GetCheckCapacityBatch returns up to the requested number of ProvisioningRequestWithPods. We do not mark the PRs as accepted here. If we fail to get the pods for a PR, we mark the PR as failed and issue an update.
func (*ProvisioningRequestPodsInjector) GetPodsFromNextRequest ¶
func (p *ProvisioningRequestPodsInjector) GetPodsFromNextRequest( isSupportedClass func(*provreqwrapper.ProvisioningRequest) bool, ) ([]*apiv1.Pod, error)
GetPodsFromNextRequest picks one ProvisioningRequest meeting the condition passed using isSupportedClass function, marks it as accepted and returns pods from it.
func (*ProvisioningRequestPodsInjector) IsAvailableForProvisioning ¶
func (p *ProvisioningRequestPodsInjector) IsAvailableForProvisioning(pr *provreqwrapper.ProvisioningRequest) bool
IsAvailableForProvisioning checks if the provisioning request is the correct state for processing and provisioning has not been attempted recently.
func (*ProvisioningRequestPodsInjector) LastProvisioningRequestProcessTime ¶
func (p *ProvisioningRequestPodsInjector) LastProvisioningRequestProcessTime() time.Time
LastProvisioningRequestProcessTime returns the time when the last provisioning request was processed.
func (*ProvisioningRequestPodsInjector) MarkAsAccepted ¶
func (p *ProvisioningRequestPodsInjector) MarkAsAccepted(pr *provreqwrapper.ProvisioningRequest) error
MarkAsAccepted marks the ProvisioningRequest as accepted.
func (*ProvisioningRequestPodsInjector) MarkAsFailed ¶
func (p *ProvisioningRequestPodsInjector) MarkAsFailed(pr *provreqwrapper.ProvisioningRequest, reason string, message string)
MarkAsFailed marks the ProvisioningRequest as failed.
func (*ProvisioningRequestPodsInjector) Process ¶
func (p *ProvisioningRequestPodsInjector) Process( _ *context.AutoscalingContext, unschedulablePods []*apiv1.Pod, ) ([]*apiv1.Pod, error)
Process pick one ProvisioningRequest, update Accepted condition and inject pods to unscheduled pods list.
func (*ProvisioningRequestPodsInjector) UpdateLastProcessTime ¶
func (p *ProvisioningRequestPodsInjector) UpdateLastProcessTime()
UpdateLastProcessTime updates the time we last processed a ProvisioningRequest to now. This time is used to skip waiting between loops if a request was processed in the last loop.
type ProvisioningRequestWithPods ¶
type ProvisioningRequestWithPods struct { PrWrapper *provreqwrapper.ProvisioningRequest Pods []*apiv1.Pod }
ProvisioningRequestWithPods contains a ProvisioningRequest Wrapper and its associated pods.