Documentation ¶
Overview ¶
Package datadoghq containers all the WatermarkPodAutoscaler controller logic.
Index ¶
- func GetLogAttrsFromWpa(wpa *datadoghqv1alpha1.WatermarkPodAutoscaler) ([]interface{}, error)
- type Options
- type RecommenderClient
- type RecommenderClientImpl
- type ReplicaCalculation
- type ReplicaCalculator
- func (c *ReplicaCalculator) GetExternalMetricReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, ...) (ReplicaCalculation, error)
- func (c *ReplicaCalculator) GetRecommenderReplicas(logger logr.Logger, target *autoscalingv1.Scale, ...) (ReplicaCalculation, error)
- func (c *ReplicaCalculator) GetResourceReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, ...) (ReplicaCalculation, error)
- type ReplicaCalculatorItf
- type ReplicaRecommendationRequest
- type ReplicaRecommendationResponse
- type WatermarkPodAutoscalerReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogAttrsFromWpa ¶
func GetLogAttrsFromWpa(wpa *datadoghqv1alpha1.WatermarkPodAutoscaler) ([]interface{}, error)
GetLogAttrsFromWpa returns a slice of all key/value pairs specified in the WPA log attributes annotation json.
Types ¶
type RecommenderClient ¶
type RecommenderClient interface {
GetReplicaRecommendation(request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error)
}
func NewRecommenderClient ¶
func NewRecommenderClient(client *http.Client) RecommenderClient
NewRecommenderClient returns a new RecommenderClient with the given http.Client.
type RecommenderClientImpl ¶
type RecommenderClientImpl struct {
// contains filtered or unexported fields
}
func (*RecommenderClientImpl) GetReplicaRecommendation ¶
func (r *RecommenderClientImpl) GetReplicaRecommendation(request *ReplicaRecommendationRequest) (*ReplicaRecommendationResponse, error)
GetReplicaRecommendation returns a recommendation for the number of replicas to scale to based on the given ReplicaRecommendationRequest.
Currently, it supports http based recommendation service, but we need to implement grpc services too.
type ReplicaCalculation ¶
type ReplicaCalculation struct {
// contains filtered or unexported fields
}
ReplicaCalculation is used to compute the scaling recommendation.
type ReplicaCalculator ¶
type ReplicaCalculator struct {
// contains filtered or unexported fields
}
ReplicaCalculator is responsible for calculation of the number of replicas It contains all the needed information
func NewReplicaCalculator ¶
func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, recommenderClient RecommenderClient, podLister corelisters.PodLister) *ReplicaCalculator
NewReplicaCalculator returns a ReplicaCalculator object reference
func (*ReplicaCalculator) GetExternalMetricReplicas ¶
func (c *ReplicaCalculator) GetExternalMetricReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (ReplicaCalculation, error)
GetExternalMetricReplicas calculates the desired replica count based on a target metric value (as a milli-value) for the external metric in the given namespace, and the current replica count.
func (*ReplicaCalculator) GetRecommenderReplicas ¶
func (c *ReplicaCalculator) GetRecommenderReplicas(logger logr.Logger, target *autoscalingv1.Scale, wpa *v1alpha1.WatermarkPodAutoscaler) (ReplicaCalculation, error)
GetRecommenderReplicas contacts an external replica recommender to get the desired replica count
func (*ReplicaCalculator) GetResourceReplicas ¶
func (c *ReplicaCalculator) GetResourceReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (ReplicaCalculation, error)
GetResourceReplicas calculates the desired replica count based on a target resource utilization percentage of the given resource for pods matching the given selector in the given namespace, and the current replica count
type ReplicaCalculatorItf ¶
type ReplicaCalculatorItf interface { GetExternalMetricReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (replicaCalculation ReplicaCalculation, err error) GetResourceReplicas(logger logr.Logger, target *autoscalingv1.Scale, metric v1alpha1.MetricSpec, wpa *v1alpha1.WatermarkPodAutoscaler) (replicaCalculation ReplicaCalculation, err error) GetRecommenderReplicas(logger logr.Logger, target *autoscalingv1.Scale, wpa *v1alpha1.WatermarkPodAutoscaler) (replicaCalculation ReplicaCalculation, err error) }
ReplicaCalculatorItf interface for ReplicaCalculator
type ReplicaRecommendationRequest ¶
type ReplicaRecommendationRequest struct { Namespace string TargetRef *v1alpha1.CrossVersionObjectReference Recommender *v1alpha1.RecommenderSpec DesiredReplicas int32 CurrentReplicas int32 CurrentReadyReplicas int32 MinReplicas int32 MaxReplicas int32 }
type WatermarkPodAutoscalerReconciler ¶
type WatermarkPodAutoscalerReconciler struct { // This client, initialized using mgr.Client() above, is a split client // that reads objects from the cache and writes to the apiserver Client client.Client Log logr.Logger Scheme *runtime.Scheme Options Options // contains filtered or unexported fields }
WatermarkPodAutoscalerReconciler reconciles a WatermarkPodAutoscaler object
func (*WatermarkPodAutoscalerReconciler) Reconcile ¶
func (r *WatermarkPodAutoscalerReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error)
Reconcile reads that state of the cluster for a WatermarkPodAutoscaler object and makes changes based on the state read and what is in the WatermarkPodAutoscaler.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 (*WatermarkPodAutoscalerReconciler) SetupWithManager ¶
func (r *WatermarkPodAutoscalerReconciler) SetupWithManager(mgr ctrl.Manager, workers int) error
SetupWithManager creates a new Watermarkpodautoscaler controller