Skip to content

Commit f56f3e1

Browse files
committed
Switch to envtest
Thanks to Github Copilot
1 parent f97b368 commit f56f3e1

File tree

8 files changed

+369
-806
lines changed

8 files changed

+369
-806
lines changed

vertical-pod-autoscaler/go.mod

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,57 @@ require (
1414
golang.org/x/time v0.14.0
1515
k8s.io/api v0.35.0
1616
k8s.io/apimachinery v0.35.0
17+
k8s.io/autoscaler/vertical-pod-autoscaler/e2e v0.0.0-20260102205634-86115b534e59
1718
k8s.io/client-go v0.35.0
1819
k8s.io/code-generator v0.35.0
1920
k8s.io/component-base v0.35.0
2021
k8s.io/klog/v2 v2.130.1
2122
k8s.io/metrics v0.35.0
2223
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
24+
sigs.k8s.io/controller-runtime v0.22.4
25+
)
26+
27+
require (
28+
cel.dev/expr v0.25.1 // indirect
29+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
30+
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
31+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
32+
github.com/distribution/reference v0.6.0 // indirect
33+
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
34+
github.com/felixge/httpsnoop v1.0.4 // indirect
35+
github.com/go-logr/stdr v1.2.2 // indirect
36+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
37+
github.com/google/cel-go v0.26.1 // indirect
38+
github.com/google/pprof v0.0.0-20251213031049-b05bdaca462f // indirect
39+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
40+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
41+
github.com/moby/spdystream v0.5.0 // indirect
42+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
43+
github.com/onsi/ginkgo/v2 v2.27.3 // indirect
44+
github.com/onsi/gomega v1.38.3 // indirect
45+
github.com/opencontainers/go-digest v1.0.0 // indirect
46+
github.com/robfig/cron/v3 v3.0.1 // indirect
47+
github.com/stoewer/go-strcase v1.3.1 // indirect
48+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
49+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 // indirect
50+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
51+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 // indirect
52+
go.opentelemetry.io/otel/metric v1.39.0 // indirect
53+
go.opentelemetry.io/otel/sdk v1.39.0 // indirect
54+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
55+
golang.org/x/exp v0.0.0-20251209150349-8475f28825e9 // indirect
56+
google.golang.org/genproto/googleapis/api v0.0.0-20251213004720-97cd9d5aeac2 // indirect
57+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 // indirect
58+
google.golang.org/grpc v1.77.0 // indirect
59+
k8s.io/apiextensions-apiserver v0.35.0 // indirect
60+
k8s.io/apiserver v0.35.0 // indirect
61+
k8s.io/component-helpers v0.35.0 // indirect
62+
k8s.io/controller-manager v0.35.0 // indirect
63+
k8s.io/kubectl v0.35.0 // indirect
64+
k8s.io/kubelet v0.35.0 // indirect
65+
k8s.io/kubernetes v1.35.0 // indirect
66+
k8s.io/pod-security-admission v0.35.0 // indirect
67+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect
2368
)
2469

2570
exclude (
@@ -70,14 +115,14 @@ require (
70115
go.uber.org/mock v0.6.0
71116
go.yaml.in/yaml/v2 v2.4.3 // indirect
72117
go.yaml.in/yaml/v3 v3.0.4 // indirect
73-
golang.org/x/mod v0.30.0 // indirect
118+
golang.org/x/mod v0.31.0 // indirect
74119
golang.org/x/net v0.48.0 // indirect
75120
golang.org/x/oauth2 v0.34.0 // indirect
76121
golang.org/x/sync v0.19.0 // indirect
77122
golang.org/x/sys v0.39.0 // indirect
78123
golang.org/x/term v0.38.0 // indirect
79124
golang.org/x/text v0.32.0 // indirect
80-
golang.org/x/tools v0.39.0 // indirect
125+
golang.org/x/tools v0.40.0 // indirect
81126
google.golang.org/protobuf v1.36.11 // indirect
82127
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
83128
gopkg.in/inf.v0 v0.9.1 // indirect

vertical-pod-autoscaler/go.sum

Lines changed: 129 additions & 10 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script sets up and runs the VPA integration tests using controller-runtime's envtest.
18+
19+
set -o errexit
20+
set -o nounset
21+
set -o pipefail
22+
23+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24+
VPA_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
25+
INTEGRATION_DIR="${VPA_DIR}/integration"
26+
27+
# Kubernetes version to use for envtest binaries
28+
# This should match the k8s.io/* dependency versions in go.mod
29+
ENVTEST_K8S_VERSION="${ENVTEST_K8S_VERSION:-1.35.x}"
30+
31+
# Directory to store envtest binaries
32+
ENVTEST_ASSETS_DIR="${ENVTEST_ASSETS_DIR:-${HOME}/.local/share/kubebuilder-envtest}"
33+
34+
echo "==> Setting up envtest environment..."
35+
36+
# Check if setup-envtest is installed
37+
if ! command -v setup-envtest &> /dev/null; then
38+
echo "==> Installing setup-envtest..."
39+
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
40+
fi
41+
42+
# Setup envtest binaries and get the path
43+
echo "==> Downloading envtest binaries for Kubernetes ${ENVTEST_K8S_VERSION}..."
44+
KUBEBUILDER_ASSETS="$(setup-envtest use "${ENVTEST_K8S_VERSION}" --bin-dir "${ENVTEST_ASSETS_DIR}" -p path)"
45+
export KUBEBUILDER_ASSETS
46+
47+
echo "==> Using envtest binaries from: ${KUBEBUILDER_ASSETS}"
48+
49+
# Change to integration test directory
50+
cd "${INTEGRATION_DIR}"
51+
52+
# Run the tests
53+
echo "==> Running integration tests..."
54+
go test -v -timeout 300s "$@"
55+
56+
echo "==> Integration tests completed successfully!"

vertical-pod-autoscaler/integration/go.mod

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)