Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vpa: Pod Monitors for prometheus metrics #1222

Merged
merged 13 commits into from
Jun 14, 2023
2 changes: 1 addition & 1 deletion stable/vpa/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: vpa
description: A Helm chart for Kubernetes Vertical Pod Autoscaler
type: application
version: 2.0.1
version: 2.1.0
appVersion: 0.13.0
maintainers:
- name: sudermanjr
Expand Down
2 changes: 2 additions & 0 deletions stable/vpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ recommender:
| recommender.nodeSelector | object | `{}` | |
| recommender.tolerations | list | `[]` | |
| recommender.affinity | object | `{}` | |
| recommender.podMonitor | object | `{"annotations":{},"enabled":false,"labels":{}}` | Enables a prometheus operator podMonitor for the recommender |
| updater.enabled | bool | `true` | If true, the updater component will be deployed |
| updater.extraArgs | object | `{}` | A key-value map of flags to pass to the updater |
| updater.replicaCount | int | `1` | |
Expand All @@ -142,6 +143,7 @@ recommender:
| updater.nodeSelector | object | `{}` | |
| updater.tolerations | list | `[]` | |
| updater.affinity | object | `{}` | |
| updater.podMonitor | object | `{"annotations":{},"enabled":false,"labels":{}}` | Enables a prometheus operator podMonitor for the updater |
| admissionController.enabled | bool | `true` | If true, will install the admission-controller component of vpa |
| admissionController.extraArgs | object | `{}` | A key-value map of flags to pass to the admissionController |
| admissionController.generateCertificate | bool | `true` | If true and admissionController is enabled, a pre-install hook will run to create the certificate for the webhook |
Expand Down
28 changes: 28 additions & 0 deletions stable/vpa/templates/recommender-podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.recommender.podMonitor }}
{{- if and .Values.recommender.enabled .Values.recommender.podMonitor.enabled }}
digiserg marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "vpa.fullname" . }}-recommender
digiserg marked this conversation as resolved.
Show resolved Hide resolved
{{- with .Values.recommender.podMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.recommender.podMonitor.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- interval: 30s
path: /metrics
port: metrics
selector:
matchLabels:
app.kubernetes.io/component: recommender
{{- include "vpa.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions stable/vpa/templates/updater-podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.updater.podMonitor }}
{{- if and .Values.updater.enabled .Values.updater.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "vpa.fullname" . }}-updater
{{- with .Values.updater.podMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.updater.podMonitor.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- interval: 30s
path: /metrics
port: metrics
selector:
matchLabels:
app.kubernetes.io/component: updater
{{- include "vpa.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions stable/vpa/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ recommender:
nodeSelector: {}
tolerations: []
affinity: {}
# -- Enables a prometheus operator podMonitor for the recommender
podMonitor:
enabled: false
annotations: {}
labels: {}

updater:
# updater.enabled -- If true, the updater component will be deployed
Expand Down Expand Up @@ -105,6 +110,11 @@ updater:
nodeSelector: {}
tolerations: []
affinity: {}
# -- Enables a prometheus operator podMonitor for the updater
podMonitor:
enabled: false
annotations: {}
labels: {}

admissionController:
# admissionController.enabled -- If true, will install the admission-controller component of vpa
Expand Down