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

feat(vertical-pod-autoscaler): Support recommender only deployment #853

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/vertical-pod-autoscaler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

### Added

- Added `recommenderOnly` to allow for deployment of only the [VPA Recommender](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/recommender/README.md).

## [v1.4.0] - 2023-10-31

### Changed
Expand Down
3 changes: 2 additions & 1 deletion charts/vertical-pod-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ The following table lists the configurable parameters of the _Vertical Pod Autos
| `admissionController.webhook.name` | Name of the admission controller webhook. | `vpa-webhook-config` |
| `admissionController.certManager.enabled` | If `true`, use _Cert Manager_ to create and manage the certificates for the webhook. | `false` |
| `admissionController.certManager.issuerKind` | The type of issuer that `admissionController.certManager.issuerName` refers to. | `Issuer` |
| `admissionController.certManager.issuerName` | If set, the _Cert Manager_ certificate will be configued to use this issuer. | `null` |
| `admissionController.certManager.issuerName` | If set, the _Cert Manager_ certificate will be configured to use this issuer. |
stevehipwell marked this conversation as resolved.
Show resolved Hide resolved
| `recommenderOnly` | If `true`, only deploy the VPA recommender. This is useful if you're only wanting to use VPA for resource recommendations. | `false` |
| `recommender.serviceAccount.create` | If `true`, create a new `ServiceAccount` for the recommender pod. | `true` |
| `recommender.serviceAccount.labels` | Labels to add to the recommender `ServiceAccount`. | `{}` |
| `recommender.serviceAccount.annotations` | Annotations to add to the recommender `ServiceAccount`. | `{}` |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.admissionController.certManager.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.admissionController.certManager.enabled -}}
{{- if not .Values.admissionController.certManager.issuerName }}
apiVersion: cert-manager.io/v1
kind: Issuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.recommenderOnly -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -109,3 +110,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.admissionController.podDisruptionBudget.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.admissionController.podDisruptionBudget.enabled -}}
apiVersion: {{ include "vertical-pod-autoscaler.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.recommenderOnly -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -20,3 +21,4 @@ spec:
targetPort: http-metrics
selector:
{{- include "vertical-pod-autoscaler.admissionController.selectorLabels" . | nindent 4 }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.admissionController.serviceAccount.create -}}
{{- if and (not .Values.recommenderOnly) .Values.admissionController.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.serviceMonitor.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.recommenderOnly -}}
{{- $tls := fromYaml (include "vertical-pod-autoscaler.admissionController.webhookCert" .) -}}
{{- if not .Values.admissionController.certManager.enabled }}
apiVersion: v1
Expand Down Expand Up @@ -46,3 +47,4 @@ webhooks:
apiGroups: ["autoscaling.k8s.io"]
apiVersions: ["*"]
resources: ["verticalpodautoscalers"]
{{- end -}}
12 changes: 12 additions & 0 deletions charts/vertical-pod-autoscaler/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ rules:
- get
- list
- watch
{{ if not .Values.recommenderOnly }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -227,6 +228,7 @@ rules:
- get
- list
- watch
{{ end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -273,9 +275,11 @@ subjects:
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.recommender.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- if not .Values.recommenderOnly }}
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.updater.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down Expand Up @@ -321,12 +325,15 @@ subjects:
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.recommender.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- if not .Values.recommenderOnly }}
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.admissionController.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.updater.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
{{ if not .Values.recommenderOnly }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -342,6 +349,8 @@ subjects:
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.updater.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
{{ if not .Values.recommenderOnly }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -357,6 +366,8 @@ subjects:
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.admissionController.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
{{ if not .Values.recommenderOnly }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -372,4 +383,5 @@ subjects:
- kind: ServiceAccount
name: {{ include "vertical-pod-autoscaler.updater.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.recommenderOnly -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -93,3 +94,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/vertical-pod-autoscaler/templates/updater/pdb.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.updater.podDisruptionBudget.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.updater.podDisruptionBudget.enabled -}}
apiVersion: {{ include "vertical-pod-autoscaler.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.serviceMonitor.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.serviceMonitor.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.updater.serviceAccount.create -}}
{{- if and (not .Values.recommenderOnly) .Values.updater.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.serviceMonitor.enabled -}}
{{- if and (not .Values.recommenderOnly) .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
3 changes: 3 additions & 0 deletions charts/vertical-pod-autoscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ serviceMonitor:

logLevel: 4

# Only deploy the recommender
recommenderOnly: false
stevehipwell marked this conversation as resolved.
Show resolved Hide resolved

admissionController:
image:
repository: registry.k8s.io/autoscaling/vpa-admission-controller
Expand Down