Skip to content

Commit

Permalink
Add flags for autoscaler recommender
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha committed Dec 25, 2023
1 parent e5780c0 commit eba3c36
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 36 deletions.
27 changes: 27 additions & 0 deletions apis/installer/v1alpha1/kubedb_autoscaler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha1
import (
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"time"
)

const (
Expand Down Expand Up @@ -82,6 +83,8 @@ type KubedbAutoscalerSpec struct {
UpdateInterval string `json:"updateInterval"`
// +optional
StorageAutoscaler StorageAutoscalerSpec `json:"storageAutoscaler"`
// +optional
Recommender Recommender `json:"recommender"`
}

type StorageAutoscalerSpec struct {
Expand All @@ -96,6 +99,30 @@ type PrometheusSpec struct {
CACert string `json:"caCert"`
}

type Recommender struct {
MetricsFetcherInterval time.Duration `json:"metricsFetcherInterval"`
CheckpointsGCInterval time.Duration `json:"checkpointsGCInterval"`
PrometheusJobName string `json:"prometheusJobName"`
Address string `json:"address"`
Storage string `json:"storage"`
HistoryLength string `json:"historyLength"`
HistoryResolution string `json:"history_resolution"`
QueryTimeout string `json:"queryTimeout"`
PodLabelPrefix string `json:"podLabelPrefix"`
PodLabelsMetricName string `json:"podLabelsMetricName"`
PodNamespaceLabel string `json:"podNamespaceLabel"`
PodNameLabel string `json:"podNameLabel"`
CtrNamespaceLabel string `json:"ctrNamespaceLabel"`
CtrPodNameLabel string `json:"ctrPodNameLabel"`
CtrNameLabel string `json:"ctrNameLabel"`
VpaObjectNamespace string `json:"vpaObjectNamespace"`

MemoryAggregationInterval time.Duration `json:"memoryAggregationInterval"`
MemoryAggregationIntervalCount int64 `json:"memoryAggregationIntervalCount"`
MemoryHistogramDecayHalfLife time.Duration `json:"memoryHistogramDecayHalfLife"`
CpuHistogramDecayHalfLife time.Duration `json:"cpuHistogramDecayHalfLife"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// KubedbAutoscalerList is a list of KubedbAutoscalers
Expand Down
17 changes: 17 additions & 0 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 56 additions & 36 deletions charts/kubedb-autoscaler/README.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions charts/kubedb-autoscaler/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ spec:
{{- if .Values.storageAutoscaler.prometheus.bearerToken }}
- --prometheus-token-file=/var/prometheus-data/token.txt
{{- end }}
- --recommender-interval={{ .Values.recommender.metricsFetcherInterval }}
- --checkpoints-gc-interval={{ .Values.recommender.checkpointsGCInterval }}
- --prometheus-cadvisor-job-name={{ .Values.recommender.prometheusJobName }}
- --address={{ .Values.recommender.address }}
- --storage={{ .Values.recommender.storage }}
- --history-length={{ .Values.recommender.historyLength }}
- --history-resolution={{ .Values.recommender.historyResolution }}
- --prometheus-query-timeout={{ .Values.recommender.queryTimeout }}
- --pod-label-prefix={{ .Values.recommender.podLabelPrefix }}
- --metric-for-pod-labels={{ .Values.recommender.podLabelsMetricName }}
- --pod-namespace-label={{ .Values.recommender.podNamespaceLabel }}
- --pod-name-label={{ .Values.recommender.podNameLabel }}
- --container-namespace-label={{ .Values.recommender.ctrNamespaceLabel }}
- --container-pod-name-label={{ .Values.recommender.ctrPodNameLabel }}
- --container-name-label={{ .Values.recommender.ctrNameLabel }}
- --autopilot-object-namespace={{ .Values.recommender.vpaObjectNamespace }}
- --memory-aggregation-interval={{ .Values.recommender.memoryAggregationInterval }}
- --memory-aggregation-interval-count={{ .Values.recommender.memoryAggregationIntervalCount }}
- --memory-histogram-decay-half-life={{ .Values.recommender.memoryHistogramDecayHalfLife }}
- --cpu-histogram-decay-half-life={{ .Values.recommender.cpuHistogramDecayHalfLife }}
{{- if include "appscode.licenseSecretName" . }}
- --license-file=/var/run/secrets/appscode/license/key.txt
{{- end }}
Expand Down
85 changes: 85 additions & 0 deletions charts/kubedb-autoscaler/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,91 @@ properties:
type: string
type: object
type: object
recommender:
properties:
address:
type: string
checkpointsGCInterval:
description: A Duration represents the elapsed time between two instants as
an int64 nanosecond count. The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
cpuHistogramDecayHalfLife:
description: A Duration represents the elapsed time between two instants as
an int64 nanosecond count. The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
ctrNameLabel:
type: string
ctrNamespaceLabel:
type: string
ctrPodNameLabel:
type: string
history_resolution:
type: string
historyLength:
type: string
memoryAggregationInterval:
description: A Duration represents the elapsed time between two instants as
an int64 nanosecond count. The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
memoryAggregationIntervalCount:
format: int64
type: integer
memoryHistogramDecayHalfLife:
description: A Duration represents the elapsed time between two instants as
an int64 nanosecond count. The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
metricsFetcherInterval:
description: A Duration represents the elapsed time between two instants as
an int64 nanosecond count. The representation limits the largest representable
duration to approximately 290 years.
format: int64
type: integer
podLabelPrefix:
type: string
podLabelsMetricName:
type: string
podNameLabel:
type: string
podNamespaceLabel:
type: string
prometheusJobName:
type: string
queryTimeout:
type: string
storage:
type: string
vpaObjectNamespace:
type: string
required:
- address
- checkpointsGCInterval
- cpuHistogramDecayHalfLife
- ctrNameLabel
- ctrNamespaceLabel
- ctrPodNameLabel
- historyLength
- history_resolution
- memoryAggregationInterval
- memoryAggregationIntervalCount
- memoryHistogramDecayHalfLife
- metricsFetcherInterval
- podLabelPrefix
- podLabelsMetricName
- podNameLabel
- podNamespaceLabel
- prometheusJobName
- queryTimeout
- storage
- vpaObjectNamespace
type: object
registryFQDN:
type: string
replicaCount:
Expand Down
23 changes: 23 additions & 0 deletions charts/kubedb-autoscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,26 @@ storageAutoscaler:
bearerToken: ""
# CA cert for prometheus server TLS connections
caCert: ""


recommender:
metricsFetcherInterval: 1m
checkpointsGCInterval: 10m
prometheusJobName: kubernetes-cadvisor
address: ":8942"
storage: ""
historyLength: "8d"
historyResolution: "1h"
queryTimeout: "5m"
podLabelPrefix: "pod_label_"
podLabelsMetricName: "up{job=\"kubernetes-pods\"}"
podNamespaceLabel: "kubernetes_namespace"
podNameLabel: "kubernetes_pod_name"
ctrNamespaceLabel: "namespace"
ctrPodNameLabel: "pod_name"
ctrNameLabel: "name"
vpaObjectNamespace: ""
memoryAggregationInterval: 4m
memoryAggregationIntervalCount: 3
memoryHistogramDecayHalfLife: 5m
cpuHistogramDecayHalfLife: 5m
85 changes: 85 additions & 0 deletions charts/kubedb/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,91 @@ properties:
type: string
type: object
type: object
recommender:
properties:
address:
type: string
checkpointsGCInterval:
description: A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the largest
representable duration to approximately 290 years.
format: int64
type: integer
cpuHistogramDecayHalfLife:
description: A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the largest
representable duration to approximately 290 years.
format: int64
type: integer
ctrNameLabel:
type: string
ctrNamespaceLabel:
type: string
ctrPodNameLabel:
type: string
history_resolution:
type: string
historyLength:
type: string
memoryAggregationInterval:
description: A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the largest
representable duration to approximately 290 years.
format: int64
type: integer
memoryAggregationIntervalCount:
format: int64
type: integer
memoryHistogramDecayHalfLife:
description: A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the largest
representable duration to approximately 290 years.
format: int64
type: integer
metricsFetcherInterval:
description: A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the largest
representable duration to approximately 290 years.
format: int64
type: integer
podLabelPrefix:
type: string
podLabelsMetricName:
type: string
podNameLabel:
type: string
podNamespaceLabel:
type: string
prometheusJobName:
type: string
queryTimeout:
type: string
storage:
type: string
vpaObjectNamespace:
type: string
required:
- address
- checkpointsGCInterval
- cpuHistogramDecayHalfLife
- ctrNameLabel
- ctrNamespaceLabel
- ctrPodNameLabel
- historyLength
- history_resolution
- memoryAggregationInterval
- memoryAggregationIntervalCount
- memoryHistogramDecayHalfLife
- metricsFetcherInterval
- podLabelPrefix
- podLabelsMetricName
- podNameLabel
- podNamespaceLabel
- prometheusJobName
- queryTimeout
- storage
- vpaObjectNamespace
type: object
registryFQDN:
type: string
replicaCount:
Expand Down

0 comments on commit eba3c36

Please sign in to comment.