Skip to content

Commit

Permalink
vpa: Pod Monitors for prometheus metrics (#1222)
Browse files Browse the repository at this point in the history
* Pod Monitors for prometheus metrics

* bump version and update docs

* Fix Readme

* Add more docs and new version

* Add more docs and new version

* Update stable/vpa/values.yaml

Co-authored-by: Andrew Suderman <[email protected]>

* Update stable/vpa/values.yaml

Co-authored-by: Andrew Suderman <[email protected]>

* Change format for clarity

* Change format for clarity - lint

* Once more readme update

* Fixes CI checks

---------

Co-authored-by: Andrew Suderman <[email protected]>
  • Loading branch information
digiserg and sudermanjr authored Jun 14, 2023
1 parent b96c157 commit 2edc105
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
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 }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "vpa.fullname" . }}-recommender
{{- 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

0 comments on commit 2edc105

Please sign in to comment.