controller

package
v0.0.0-...-2dbac4b Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyRecoWorkflowCtrlName = "RecoWorkflowController"
	RecoQueuedStatusManager    = "RecoQueuedStatusManager"
)
View Source
const (

	//Reason for RecoTaskProgress Condition
	RecoTaskExecutionDone        = "RecoTaskExecutionDone"
	RecoTaskExecutionDoneMessage = "The Recommendation Workflow execution has been completed"

	RecoTaskRecommendationGenerated = "RecoTaskRecommendationGenerated"
	RecommendationGeneratedMessage  = "HPA Recommendation is generated"

	RecoTaskInProgress        = "RecoTaskInProgress"
	RecoTaskInProgressMessage = "Recommendation Workflow execution is in progress"

	RecoTaskErrored        = "RecoTaskErrored"
	EmptyRecoConfigMessage = "Empty recommendation config could be due to lack of utilization data points or non availability of pod ready time"
	EmptyHPAConfigMessage  = "HPA config to be applied is empty"

	//Reason for Initialized Condition
	PolicyRecommendationCreated = "PolicyRecommendationCreated"
	InitializedMessage          = "PolicyRecommendation has been created"

	//Reason for TargetRecoAchieved Condition
	PolicyRecommendationAtTargetReco    = "PolicyRecommendationAtTargetReco"
	PolicyRecommendationNotAtTargetReco = "PolicyRecommendationNotAtTargetReco"
	TargetRecoAchievedSuccessMessage    = "Target Recommendation has been achieved"
	TargetRecoAchievedFailureMessage    = "Target Recommendation has not been achieved yet"
)
View Source
const (
	DeploymentTriggerCtrlName = "DeploymentTriggerController"
)
View Source
const (
	HPAEnforcementCtrlName = "HPAEnforcementController"
)
View Source
const PolicyRecoRegistrarCtrlName = "PolicyRecommendationRegistrar"
View Source
const PolicyWatcherCtrl = "PolicyWatcher"

Variables

View Source
var (
	HPAEnforcedReason             = "ScaledObjectIsCreated"
	HPAEnforcedMessage            = "ScaledObject has been created."
	AutoscalerExistsReason        = "UserCreatedScaledObjectAlreadyExists"
	AutoscalerExistsMessage       = "User managed ScaledObject already exists for this workload."
	InvalidPolicyRecoReason       = "InvalidPolicyRecoConfig"
	InvalidPolicyRecoMessage      = "HPA config in the PolicyRecommendation doesn't qualify for the ScaledObject creation criteria."
	HPAEnforcementDisabledReason  = "HPAEnforcementDisabled"
	HPAEnforcementDisabledMessage = "HPA enforcement disabled for this workload"
)

Functions

func NewPolicyRecommendationCondition

func NewPolicyRecommendationCondition(condType v1alpha1.PolicyRecommendationConditionType, status metav1.ConditionStatus, reason, message string) *metav1.Condition

func SetConditions

func SetConditions(conditions []metav1.Condition, newCondition metav1.Condition) []metav1.Condition

Types

type DeploymentTriggerController

type DeploymentTriggerController struct {
	Client          client.Client
	Scheme          *runtime.Scheme
	ClientsRegistry registry.DeploymentClientRegistry
}

func NewDeploymentTriggerController

func NewDeploymentTriggerController(client client.Client,
	scheme *runtime.Scheme, clientsRegistry registry.DeploymentClientRegistry) *DeploymentTriggerController

func (*DeploymentTriggerController) Reconcile

func (r *DeploymentTriggerController) Reconcile(ctx context.Context,
	request ctrl.Request) (ctrl.Result, error)

func (*DeploymentTriggerController) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type HPAEnforcementController

type HPAEnforcementController struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder

	MaxConcurrentReconciles int

	ExcludedNamespaces  *[]string
	IncludedNamespaces  *[]string
	WhitelistMode       *bool
	MinRequiredReplicas int
	// contains filtered or unexported fields
}

func NewHPAEnforcementController

func NewHPAEnforcementController(client client.Client,
	scheme *runtime.Scheme, clientsRegistry registry.DeploymentClientRegistry, recorder record.EventRecorder,
	maxConcurrentReconciles int, isDryRun *bool, excludedNamespaces *[]string, includedNamespaces *[]string, whitelistMode *bool, minRequiredReplicas int, autoscalerClient autoscaler.AutoscalerClient) (*HPAEnforcementController, error)

func (*HPAEnforcementController) Reconcile

func (*HPAEnforcementController) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type PolicyRecommendationReconciler

type PolicyRecommendationReconciler struct {
	client.Client
	Scheme                  *runtime.Scheme
	Recorder                record.EventRecorder
	MaxConcurrentReconciles int
	PolicyExpiryAge         time.Duration
	RecoWorkflow            reco.RecommendationWorkflow
}

PolicyRecommendationReconciler reconciles a PolicyRecommendation object

func NewPolicyRecommendationReconciler

func NewPolicyRecommendationReconciler(client client.Client,
	scheme *runtime.Scheme, recorder record.EventRecorder,
	maxConcurrentReconciles int, minRequiredReplicas int, recommender reco.Recommender, policyStore policy.Store, policyIterators ...reco.PolicyIterator) (*PolicyRecommendationReconciler, error)

func (*PolicyRecommendationReconciler) Reconcile

func (*PolicyRecommendationReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type PolicyRecommendationRegistrar

type PolicyRecommendationRegistrar struct {
	Client               client.Client
	Scheme               *runtime.Scheme
	MonitorManager       trigger.MonitorManager
	RequeueDelayDuration time.Duration
	PolicyStore          policy.Store
	ClientsRegistry      registry.DeploymentClientRegistry
	ExcludedNamespaces   []string
	IncludedNamespaces   []string
}

PolicyRecommendationRegistrar reconciles a Deployment or ArgoRollout object to ensure a PolicyRecommendation exists.

func NewPolicyRecommendationRegistrar

func NewPolicyRecommendationRegistrar(client client.Client,
	scheme *runtime.Scheme,
	requeueDelayMs int,
	monitorManager trigger.MonitorManager,
	policyStore policy.Store,
	clientsRegistry registry.DeploymentClientRegistry,
	excludedNamespaces []string, includedNamespaces []string) *PolicyRecommendationRegistrar

func (*PolicyRecommendationRegistrar) Reconcile

func (controller *PolicyRecommendationRegistrar) Reconcile(ctx context.Context,
	request ctrl.Request) (ctrl.Result, error)

TODO neerajb Handle the deletion of workloads. We should reregister the monitors.

func (*PolicyRecommendationRegistrar) SetupWithManager

func (controller *PolicyRecommendationRegistrar) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PolicyWatcher

type PolicyWatcher struct {
	Client client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

PolicyWatcher reconciles a Policy object

func NewPolicyWatcher

func NewPolicyWatcher(client client.Client,
	scheme *runtime.Scheme,
	requeueAllFunc func(),
	requeueOneFunc func(types.NamespacedName),
) *PolicyWatcher

func (*PolicyWatcher) Reconcile

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

func (*PolicyWatcher) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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