Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFixedItemIntervalRateLimiter ¶
func NewFixedItemIntervalRateLimiter(interval time.Duration) workqueue.RateLimiter
NewFixedItemIntervalRateLimiter creates a new instance of a RateLimiter using a fixed interval
Types ¶
type BalancerError ¶
type BalancerError struct {
// contains filtered or unexported fields
}
BalancerError adds phase information to error returned by balancer core.
func (*BalancerError) Error ¶
func (b *BalancerError) Error() string
type BalancerPhase ¶
type BalancerPhase string
BalancerPhase indicates the phase of the balancer reconciliation.
const ( // ScaleSubresourcePolling - phase where the scale subresources af a balancer are get. ScaleSubresourcePolling BalancerPhase = "ScaleSubresourcePolling" // PodListing - phase where pods under balancers target are listed. PodListing BalancerPhase = "PodListing" // PodLabelsChecking - phase where pods labels are checked. PodLabelsChecking BalancerPhase = "PodLabelsChecking" // ApplyingPolicyListing - phase where the balancer policy is applied. ApplyingPolicyListing BalancerPhase = "ApplyingBalancerPolicy" // ReplicaCountSetting - phase where balancer targets are resized. ReplicaCountSetting BalancerPhase = "ReplicaCountSetting" )
type BalancerStatusInfo ¶
type BalancerStatusInfo struct {
// contains filtered or unexported fields
}
BalancerStatusInfo summarizes the balancing operation.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the controller implementation for Balancer resources
func NewController ¶
func NewController( balancerClientSet balancerclientset.Interface, balancerInformer balancerinformers.BalancerInformer, eventinterface typedcorev1.EventInterface, core CoreInterface, resync time.Duration, ) *Controller
NewController returns a new Balancer controller
func (*Controller) Run ¶
func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error
Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shut down the workqueue and wait for workers to finish processing their current work items.
type CoreInterface ¶
type CoreInterface interface { ProcessBalancer(balancer *balancerapi.Balancer, now time.Time) (*BalancerStatusInfo, *BalancerError) IsSynced() bool }
CoreInterface of the balancer controller. Handles individual Balancer reconciliation.
func NewCore ¶
func NewCore(client ScaleClientInterface, informer v1.PodInformer) CoreInterface
NewCore returns an implementation of the CoreInterface.
type FixedItemIntervalRateLimiter ¶
type FixedItemIntervalRateLimiter struct {
// contains filtered or unexported fields
}
FixedItemIntervalRateLimiter limits items to a fixed-rate interval Borrowed from HPA.
func (*FixedItemIntervalRateLimiter) Forget ¶
func (r *FixedItemIntervalRateLimiter) Forget(item interface{})
Forget indicates that an item is finished being retried.
func (*FixedItemIntervalRateLimiter) NumRequeues ¶
func (r *FixedItemIntervalRateLimiter) NumRequeues(item interface{}) int
NumRequeues returns back how many failures the item has had
func (*FixedItemIntervalRateLimiter) When ¶
func (r *FixedItemIntervalRateLimiter) When(item interface{}) time.Duration
When returns the interval of the rate limiter
type ScaleClient ¶
type ScaleClient struct {
// contains filtered or unexported fields
}
ScaleClient implements ScaleClientInterface and issues real queries to K8S apiserver.
func NewScaleClient ¶
func NewScaleClient(context context.Context, scale scaleclient.ScalesGetter, mapper apimeta.RESTMapper) *ScaleClient
NewScaleClient builds scale client.
func (*ScaleClient) GetScale ¶
func (s *ScaleClient) GetScale(namespace string, scaleRef hpa.CrossVersionObjectReference) (*autoscalingv1.Scale, *schema.GroupResource, error)
GetScale gets scale subresource for the given reference. Copied from HPA controller. TODO(mwielgus): Add cache if frequent scale resource lookups become a problem.
func (*ScaleClient) UpdateScale ¶
func (s *ScaleClient) UpdateScale(scale *autoscalingv1.Scale, resource *schema.GroupResource) error
UpdateScale updates the given scale resource.
type ScaleClientInterface ¶
type ScaleClientInterface interface { // GetScale gets scale subresource for the given reference. GetScale(namespace string, scaleRef hpa.CrossVersionObjectReference) (*autoscalingv1.Scale, *schema.GroupResource, error) // UpdateScale updates the given scale resource. UpdateScale(scale *autoscalingv1.Scale, resource *schema.GroupResource) error }
ScaleClientInterface is an interface to interact with Scale subresources.