controllers

package
v0.0.0-...-4384b37 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRetryTimes = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type HPAScalerReconciler

type HPAScalerReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	ScalerManager *ScalerManager
}

HPAScalerReconciler reconciles a HPAScaler object

func (*HPAScalerReconciler) Reconcile

func (r *HPAScalerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the HPAScaler object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile

func (*HPAScalerReconciler) SetupWithManager

func (r *HPAScalerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type NoNeedUpdate

type NoNeedUpdate struct{}

func (NoNeedUpdate) Error

func (n NoNeedUpdate) Error() string

type ScalerExecutor

type ScalerExecutor interface {
	Run()
	Stop()
	AddJob(job ScalerJob) error
	Update(job ScalerJob) error
	RemoveJob(job ScalerJob) error
	FindJob(job ScalerJob) bool
	ListEntries() []*cron.Entry
}

func NewScalerHPAExecutor

func NewScalerHPAExecutor(timezone *time.Location, handler func(job *cron.JobResult)) ScalerExecutor

type ScalerExecutorHPA

type ScalerExecutorHPA struct {
	Engine *cron.Cron
}

func (*ScalerExecutorHPA) AddJob

func (se *ScalerExecutorHPA) AddJob(job ScalerJob) error

func (*ScalerExecutorHPA) FindJob

func (se *ScalerExecutorHPA) FindJob(job ScalerJob) bool

func (*ScalerExecutorHPA) ListEntries

func (se *ScalerExecutorHPA) ListEntries() []*cron.Entry

func (*ScalerExecutorHPA) RemoveJob

func (se *ScalerExecutorHPA) RemoveJob(job ScalerJob) error

func (*ScalerExecutorHPA) Run

func (se *ScalerExecutorHPA) Run()

func (*ScalerExecutorHPA) Stop

func (se *ScalerExecutorHPA) Stop()

func (*ScalerExecutorHPA) Update

func (se *ScalerExecutorHPA) Update(job ScalerJob) error

type ScalerJob

type ScalerJob interface {
	ID() string
	Name() string
	Namespace() string
	SetID(id string)
	Equals(Job ScalerJob) bool
	SchedulePlan() string
	DesiredReplicas() int32
	Run() (string, error)
}

func ScalerJobFactory

func ScalerJobFactory(instance k8sq1comv1.HPAScaler, scaleClient scale.ScalesGetter, client client.Client) ScalerJob

type ScalerJobHPA

type ScalerJobHPA struct {
	// contains filtered or unexported fields
}

func (*ScalerJobHPA) DesiredReplicas

func (sh *ScalerJobHPA) DesiredReplicas() int32

func (*ScalerJobHPA) Equals

func (sh *ScalerJobHPA) Equals(j ScalerJob) bool

func (*ScalerJobHPA) ID

func (sh *ScalerJobHPA) ID() string

func (*ScalerJobHPA) Name

func (sh *ScalerJobHPA) Name() string

func (*ScalerJobHPA) Namespace

func (sh *ScalerJobHPA) Namespace() string

func (*ScalerJobHPA) Run

func (sh *ScalerJobHPA) Run() (msg string, err error)

func (*ScalerJobHPA) Scale

func (sh *ScalerJobHPA) Scale() (msg string, err error)

func (*ScalerJobHPA) SchedulePlan

func (sh *ScalerJobHPA) SchedulePlan() string

func (*ScalerJobHPA) SetID

func (sh *ScalerJobHPA) SetID(id string)

type ScalerManager

type ScalerManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewScalerManager

func NewScalerManager(mgr ctrl.Manager) *ScalerManager

func (*ScalerManager) CreateOrUpdate

func (sm *ScalerManager) CreateOrUpdate(job ScalerJob) error

func (*ScalerManager) FilterItem

func (sm *ScalerManager) FilterItem(item k8sq1comv1.HPAScalerSpec) bool

func (*ScalerManager) GC

func (sm *ScalerManager) GC(namespacedName string)

func (*ScalerManager) Run

func (sm *ScalerManager) Run(stopChan chan struct{})

func (*ScalerManager) Start

func (sm *ScalerManager) Start()

Jump to

Keyboard shortcuts

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