Documentation ¶
Index ¶
- Constants
- func RunCronFederatedHPARule(c *ScalingJob)
- type CronFHPAController
- type CronHandler
- func (c *CronHandler) AddCronExecutorIfNotExist(cronFHPAKey string)
- func (c *CronHandler) CreateCronJobForExecutor(cronFHPA *autoscalingv1alpha1.CronFederatedHPA, ...) error
- func (c *CronHandler) CronFHPAScaleTargetRefUpdates(cronFHPAKey string, scaleTarget autoscalingv2.CrossVersionObjectReference) bool
- func (c *CronHandler) GetRuleNextExecuteTime(cronFHPA *autoscalingv1alpha1.CronFederatedHPA, ruleName string) (time.Time, error)
- func (c *CronHandler) RuleCronExecutorExists(cronFHPAKey string, ruleName string) (autoscalingv1alpha1.CronFederatedHPARule, bool)
- func (c *CronHandler) StopCronFHPAExecutor(cronFHPAKey string)
- func (c *CronHandler) StopRuleExecutor(cronFHPAKey string, ruleName string)
- type RuleCron
- type ScalingJob
Constants ¶
const (
// ControllerName is the controller name that will be used when reporting events.
ControllerName = "cronfederatedhpa-controller"
)
Variables ¶
This section is empty.
Functions ¶
func RunCronFederatedHPARule ¶
func RunCronFederatedHPARule(c *ScalingJob)
RunCronFederatedHPARule runs the job to handle CronFederatedHPA.
Types ¶
type CronFHPAController ¶
type CronFHPAController struct { client.Client // used to operate Cron resources. EventRecorder record.EventRecorder RateLimiterOptions ratelimiterflag.Options CronHandler *CronHandler }
CronFHPAController is used to operate CronFederatedHPA.
func (*CronFHPAController) Reconcile ¶
func (c *CronFHPAController) Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error)
Reconcile performs a full reconciliation for the object referred to by the Request. The Controller will requeue the Request to be processed again if an error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
func (*CronFHPAController) SetupWithManager ¶
func (c *CronFHPAController) SetupWithManager(mgr controllerruntime.Manager) error
SetupWithManager creates a controller and register to controller manager.
type CronHandler ¶
type CronHandler struct {
// contains filtered or unexported fields
}
CronHandler is the handler for CronFederatedHPA
func NewCronHandler ¶
func NewCronHandler(client client.Client, eventRecorder record.EventRecorder) *CronHandler
NewCronHandler creates new cron handler
func (*CronHandler) AddCronExecutorIfNotExist ¶
func (c *CronHandler) AddCronExecutorIfNotExist(cronFHPAKey string)
AddCronExecutorIfNotExist creates the executor for CronFederatedHPA if not exist
func (*CronHandler) CreateCronJobForExecutor ¶
func (c *CronHandler) CreateCronJobForExecutor(cronFHPA *autoscalingv1alpha1.CronFederatedHPA, rule autoscalingv1alpha1.CronFederatedHPARule) error
CreateCronJobForExecutor creates the executor for a rule of CronFederatedHPA
func (*CronHandler) CronFHPAScaleTargetRefUpdates ¶
func (c *CronHandler) CronFHPAScaleTargetRefUpdates(cronFHPAKey string, scaleTarget autoscalingv2.CrossVersionObjectReference) bool
CronFHPAScaleTargetRefUpdates checks if the scale target changed
func (*CronHandler) GetRuleNextExecuteTime ¶
func (c *CronHandler) GetRuleNextExecuteTime(cronFHPA *autoscalingv1alpha1.CronFederatedHPA, ruleName string) (time.Time, error)
GetRuleNextExecuteTime returns the next execute time of a rule of CronFederatedHPA
func (*CronHandler) RuleCronExecutorExists ¶
func (c *CronHandler) RuleCronExecutorExists(cronFHPAKey string, ruleName string) (autoscalingv1alpha1.CronFederatedHPARule, bool)
RuleCronExecutorExists checks if the executor for specific CronFederatedHPA rule exists
func (*CronHandler) StopCronFHPAExecutor ¶
func (c *CronHandler) StopCronFHPAExecutor(cronFHPAKey string)
StopCronFHPAExecutor stops the executor for specific CronFederatedHPA
func (*CronHandler) StopRuleExecutor ¶
func (c *CronHandler) StopRuleExecutor(cronFHPAKey string, ruleName string)
StopRuleExecutor stops the executor for specific CronFederatedHPA rule
type RuleCron ¶
type RuleCron struct { *gocron.Scheduler autoscalingv1alpha1.CronFederatedHPARule }
RuleCron is the wrapper of gocron.Scheduler and CronFederatedHPARule
type ScalingJob ¶ added in v1.9.0
type ScalingJob struct {
// contains filtered or unexported fields
}
ScalingJob is a job to handle CronFederatedHPA.
func NewCronFederatedHPAJob ¶
func NewCronFederatedHPAJob(client client.Client, eventRecorder record.EventRecorder, scheduler *gocron.Scheduler, cronFHPA *autoscalingv1alpha1.CronFederatedHPA, rule autoscalingv1alpha1.CronFederatedHPARule) *ScalingJob
NewCronFederatedHPAJob creates a new CronFederatedHPAJob.
func (*ScalingJob) ScaleFHPA ¶ added in v1.9.0
func (c *ScalingJob) ScaleFHPA(cronFHPA *autoscalingv1alpha1.CronFederatedHPA) error
ScaleFHPA scales FederatedHPA's minReplicas and maxReplicas
func (*ScalingJob) ScaleWorkloads ¶ added in v1.9.0
func (c *ScalingJob) ScaleWorkloads(cronFHPA *autoscalingv1alpha1.CronFederatedHPA) error
ScaleWorkloads scales workload's replicas directly