Skip to content

Commit

Permalink
[prometheus-blackbox-exporter] Add Vertical Pod Autoscaler to Prometh…
Browse files Browse the repository at this point in the history
…eus Blackbox Exporter (prometheus-community#3578)

* fix: allow minReplicas to be set for VPA

Signed-off-by: t3mi <[email protected]>

* feat: add support for controlledValues

Signed-off-by: t3mi <[email protected]>

* fix: disable vpa by default

Signed-off-by: t3mi <[email protected]>

---------

Signed-off-by: t3mi <[email protected]>
  • Loading branch information
t3mi authored and Matiasmct committed Aug 25, 2023
1 parent a98402b commit f4b0c3f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
description: Prometheus Blackbox Exporter
name: prometheus-blackbox-exporter
version: 8.0.0
version: 8.1.0
appVersion: v0.24.0
home: https://github.com/prometheus/blackbox_exporter
sources:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") (.Values.verticalPodAutoscaler.enabled) }}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ include "prometheus-blackbox-exporter.fullname" . }}
namespace: {{ template "prometheus-blackbox-exporter.namespace" . }}
labels:
{{- include "prometheus-blackbox-exporter.labels" . | nindent 4 }}
spec:
resourcePolicy:
containerPolicies:
- containerName: blackbox-exporter
{{- if .Values.verticalPodAutoscaler.controlledResources }}
controlledResources: {{ .Values.verticalPodAutoscaler.controlledResources }}
{{- end }}
{{- if .Values.verticalPodAutoscaler.controlledValues }}
controlledValues: {{ .Values.verticalPodAutoscaler.controlledValues }}
{{- end }}
{{- if .Values.verticalPodAutoscaler.maxAllowed }}
maxAllowed:
{{ toYaml .Values.verticalPodAutoscaler.maxAllowed | nindent 8 }}
{{- end }}
{{- if .Values.verticalPodAutoscaler.minAllowed }}
minAllowed:
{{ toYaml .Values.verticalPodAutoscaler.minAllowed | nindent 8 }}
{{- end }}
targetRef:
apiVersion: apps/v1
{{- if (eq .Values.kind "DaemonSet") }}
kind: DaemonSet
{{- else }}
kind: Deployment
{{- end }}
name: {{ template "prometheus-blackbox-exporter.fullname" . }}
{{- with .Values.verticalPodAutoscaler.updatePolicy }}
updatePolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions charts/prometheus-blackbox-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,27 @@ extraManifests: []

# global common labels, applied to all ressources
commonLabels: {}

# Enable vertical pod autoscaler support for prometheus-blackbox-exporter
verticalPodAutoscaler:
enabled: false
# List of resources that the vertical pod autoscaler can control. Defaults to cpu and memory
controlledResources: []
# Specifies which resource values should be controlled: RequestsOnly or RequestsAndLimits.
# controlledValues: RequestsAndLimits

# Define the max allowed resources for the pod
maxAllowed: {}
# cpu: 200m
# memory: 100Mi
# Define the min allowed resources for the pod
minAllowed: {}
# cpu: 200m
# memory: 100Mi

updatePolicy:
# Specifies minimal number of replicas which need to be alive for VPA Updater to attempt pod eviction
# minReplicas: 1
# Specifies whether recommended updates are applied when a Pod is started and whether recommended updates
# are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto".
updateMode: Auto

0 comments on commit f4b0c3f

Please sign in to comment.