controllers

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OwnedByLabel             = "v1.custompodautoscaler.com/owned-by"
	PausedReplicasAnnotation = "v1.custompodautoscaler.com/paused-replicas"
)

Variables

View Source
var PrimaryPred = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		return true
	},
	DeleteFunc: func(e event.DeleteEvent) bool {
		return true
	},
	CreateFunc: func(e event.CreateEvent) bool {
		return true
	},
	GenericFunc: func(e event.GenericEvent) bool {
		return false
	},
}

PrimaryPred is the predicate that filters events for the CustomPodAutoscaler primary resource.

View Source
var SecondaryPred = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		return false
	},
	DeleteFunc: func(e event.DeleteEvent) bool {
		return true
	},
	CreateFunc: func(e event.CreateEvent) bool {
		return false
	},
	GenericFunc: func(e event.GenericEvent) bool {
		return false
	},
}

SecondaryPred is the predicate that filters events for the CustomPodAutoscaler's secondary resources (deployment/service/role/rolebinding).

Functions

func SetupScalingClient added in v1.4.0

func SetupScalingClient() (k8sscale.ScalesGetter, error)

SetupScalingClient sets up a client for the CPA reconciler to use for manually setting the replicas count of a scale target pod while the autoscaler is paused. Functionality is based on the setup for a regular CPA autoscaler in main()

Types

type CustomPodAutoscalerReconciler

type CustomPodAutoscalerReconciler struct {
	client.Client
	Log                          logr.Logger
	Scheme                       *runtime.Scheme
	KubernetesResourceReconciler K8sReconciler
	ScalingClient                k8sscale.ScalesGetter
}

CustomPodAutoscalerReconciler reconciles a CustomPodAutoscaler object.

func (*CustomPodAutoscalerReconciler) Reconcile

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

Reconcile reads that state of the cluster for a CustomPodAutoscaler object and makes changes based on the state read and what is in the CustomPodAutoscaler.Spec The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

func (*CustomPodAutoscalerReconciler) SetupWithManager

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

SetupWithManager sets up the CustomPodAutoscaler controller, setting up watches with the manager provided

type K8sReconciler added in v1.3.0

type K8sReconciler interface {
	Reconcile(
		reqLogger logr.Logger,
		instance *custompodautoscalercomv1.CustomPodAutoscaler,
		obj metav1.Object,
		shouldProvision bool,
		updateable bool,
		kind string,
	) (reconcile.Result, error)
	PodCleanup(reqLogger logr.Logger, instance *custompodautoscalercomv1.CustomPodAutoscaler) error
}

Jump to

Keyboard shortcuts

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