cronfederatedhpa

package
v1.9.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
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

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

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL