From 047243459a1fb5248f3cf74d80e0ba00db71d337 Mon Sep 17 00:00:00 2001 From: Adrian Moisey Date: Thu, 1 Jan 2026 20:51:09 +0200 Subject: [PATCH 1/2] Document how to run e2e tests locally --- vertical-pod-autoscaler/README.md | 5 ++++ .../docs/development-and-testing.md | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 vertical-pod-autoscaler/docs/development-and-testing.md diff --git a/vertical-pod-autoscaler/README.md b/vertical-pod-autoscaler/README.md index d20219c709b7..66f70a172e27 100644 --- a/vertical-pod-autoscaler/README.md +++ b/vertical-pod-autoscaler/README.md @@ -7,6 +7,7 @@ - [Getting started](#getting-started) - [Components and Architecture](#components-and-architecture) - [Features and Known limitations](#features-and-known-limitations) +- [Development and testing](#development-and-testing) - [Related links](#related-links) ## Intro @@ -51,6 +52,10 @@ You can also read about the [features](./docs/features.md) and [known limitation > * When the admission-controller tries to set a container-level limit higher than the pod-level limit, the operation is prohibited, and the pod will not be created. > * When the admission-controller tries to set the newly recommended container-level requests, their total value cannot exceed the pod-level request or limit. For example, if the pod-level memory request is 100Mi, but the newly recommended total of container-level requests is 250Mi, the pod will fail to be created. +## Development and testing + +Have a look at the [Development and testing](./docs/development-and-testing.md) page for more information about developing on the VPA. + ## Related links - [Design proposal](https://github.com/kubernetes/design-proposals-archive/blob/main/autoscaling/vertical-pod-autoscaler.md) diff --git a/vertical-pod-autoscaler/docs/development-and-testing.md b/vertical-pod-autoscaler/docs/development-and-testing.md new file mode 100644 index 000000000000..c1546661e532 --- /dev/null +++ b/vertical-pod-autoscaler/docs/development-and-testing.md @@ -0,0 +1,29 @@ +# Development and testing + +## Contents + +- [Development and testing](#development-and-testing) + - [Introduction](#introduction) + - [Running e2e tests](#running-e2e-tests) + - [Feature gates](#feature-gates) + - [Parallelism](#parallelism) + +## Introduction + +This project contains various scripts and tools to aid in the development of the three VPA components. + +## Running e2e tests + +The VPA contains some e2e tests that test how each component interacts with Pods and VPA resources inside a real Kubernetes cluster. + +They can be run using the `./hack/run-e2e-locally.sh` helper script. Please note that this script will delete any existing [kind](https://kind.sigs.k8s.io) cluster running on the local machine before creating a fresh cluster for executing the tests. + +### Feature gates + +By default, the e2e test suite only runs feature-gated tests for features that are enabled by default (typically beta and GA). Alpha features, which are disabled by default, are not tested. + +Setting the environment variable `ENABLE_ALL_FEATURE_GATES=true` will enable all feature gates and run all feature-gated tests. + +### Parallelism + +By default, the e2e tests create 4 worker processes, each one running its own test. This can be changed by setting the `NUMPROC=` variable. From f9e977083ea7bf518fbcd7e2eb38a961e13baa4b Mon Sep 17 00:00:00 2001 From: Adrian Moisey Date: Sat, 3 Jan 2026 16:05:39 +0200 Subject: [PATCH 2/2] Move most of local-cluster.md into the docs directory --- .../docs/development-and-testing.md | 14 +++++++ vertical-pod-autoscaler/hack/local-cluster.md | 37 ------------------- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/vertical-pod-autoscaler/docs/development-and-testing.md b/vertical-pod-autoscaler/docs/development-and-testing.md index c1546661e532..88cfd2b26552 100644 --- a/vertical-pod-autoscaler/docs/development-and-testing.md +++ b/vertical-pod-autoscaler/docs/development-and-testing.md @@ -7,6 +7,7 @@ - [Running e2e tests](#running-e2e-tests) - [Feature gates](#feature-gates) - [Parallelism](#parallelism) + - [External Metrics Tests](#external-metrics-tests) ## Introduction @@ -27,3 +28,16 @@ Setting the environment variable `ENABLE_ALL_FEATURE_GATES=true` will enable all ### Parallelism By default, the e2e tests create 4 worker processes, each one running its own test. This can be changed by setting the `NUMPROC=` variable. + +### External Metrics Tests + +The external metrics tests (`recommender-externalmetrics`, available in `run-e2e-locally.sh` and `deploy-for-e2e-locally.sh`) +use a stack of 4 additional programs to support testing: + +1. `hack/emit-metrics.py` to generate random CPU and RAM metrics for every pod in the local cluster. +2. Prometheus Pushgateway to accept metrics from `hack/emit-metrics`. +3. Prometheus to store the metrics accepted by the Pushgateway. +4. Prometheus Adapter to provide an External Metrics interface to Prometheus. + +The External Metrics tests run by configuring a `recommender` to use the External Metrics interface +from the Prometheus Adapter. With that configuration, it runs the standard `recommender` test suite. diff --git a/vertical-pod-autoscaler/hack/local-cluster.md b/vertical-pod-autoscaler/hack/local-cluster.md index 6264e68c410a..a6d3bba122a8 100644 --- a/vertical-pod-autoscaler/hack/local-cluster.md +++ b/vertical-pod-autoscaler/hack/local-cluster.md @@ -1,40 +1,3 @@ -# Running Integration Tests locally - -Included in parallel with `run-e2e.sh` and `deploy-for-e2e.sh` are two alternate versions -with `-locally` as part of their names. They use Kubernetes in Docker (`kind`) to run a local -cluster in Docker. Using them will require `docker` and `kind` in your `PATH`. - -## External Metrics Tests - -The external metrics tests (`recommender-externalmetrics`, available on the `-locally` variants) -use a stack of 4 additional programs to support testing: - -1. `hack/emit-metrics.py` to generate random CPU and RAM metrics for every pod in the local cluster. -2. Prometheus Pushgateway to accept metrics from `hack/emit-metrics`. -3. Prometheus to store the metrics accepted by the Pushgateway. -4. Prometheus Adapter to provide an External Metrics interface to Prometheus. - -The External Metrics tests run by configuring a `recommender` to use the External Metrics interface -from the Prometheus Adapter. With that configuration, it runs the standard `recommender` test suite. - -## Non-recommender tests - -The `recommender` and `recommender-externalmetrics` test work locally, but none of the others do; -they require more Makefile work. - -# Configuration Notes - -To support the regular `recommender` tests locally, we've added the stock Kubernetes Metrics Server. -Unfortunately, it doesn't work with TLS turned on. The metrics server is being run in insecure mode -to work around this. This only runs in the local `kind` case, not in a real cluster. - -# RBAC Changes - -The local test cases support running the `recommender` with external metrics. This requires -additional permissions we don't want to automatically enable for all customers via the -configuration given in `deploy/vpa-rbac.yaml`. The scripts use a context diff `hack/e2e/vpa-rbac.diff` -to enable those permission when running locally. - # Quick Integration Tests `run-integration-locally.sh` is a quicker way to integration test compared to `run-e2e-locally.sh`. Only used for simple tests.