Skip to content
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
3 changes: 2 additions & 1 deletion vertical-pod-autoscaler/e2e/utils/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
e2edeploy "k8s.io/kubernetes/test/e2e/framework/deployment"
e2eendpointslice "k8s.io/kubernetes/test/e2e/framework/endpointslice"
"k8s.io/utils/ptr"
)

Expand Down Expand Up @@ -373,7 +374,7 @@ func DeployWebhookAndService(f *framework.Framework, image string, certContext *
framework.ExpectNoError(err, "creating service %s in namespace %s", WebhookServiceName, namespace)

ginkgo.By("Verifying the service has paired with the endpoint")
err = framework.WaitForServiceEndpointsNum(context.TODO(), client, namespace, WebhookServiceName, 1, 1*time.Second, 30*time.Second)
err = e2eendpointslice.WaitForEndpointCount(context.TODO(), client, namespace, WebhookServiceName, 1)
framework.ExpectNoError(err, "waiting for service %s/%s have %d endpoint", namespace, WebhookServiceName, 1)
}

Expand Down
10 changes: 3 additions & 7 deletions vertical-pod-autoscaler/e2e/v1/autoscaling_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
e2edebug "k8s.io/kubernetes/test/e2e/framework/debug"
e2eendpointslice "k8s.io/kubernetes/test/e2e/framework/endpointslice"
e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl"
e2erc "k8s.io/kubernetes/test/e2e/framework/rc"
"k8s.io/kubernetes/test/e2e/framework/resource"
Expand All @@ -54,11 +55,6 @@ const (
port = 80
targetPort = 8080
timeoutRC = 120 * time.Second
startServiceTimeout = time.Minute
startServiceInterval = 5 * time.Second
rcIsNil = "ERROR: replicationController = nil"
deploymentIsNil = "ERROR: deployment = nil"
rsIsNil = "ERROR: replicaset = nil"
invalidKind = "ERROR: invalid workload kind for resource consumer"
customMetricName = "QPS"
serviceInitializationTimeout = 2 * time.Minute
Expand Down Expand Up @@ -420,8 +416,8 @@ func runServiceAndWorkloadForResourceConsumer(c clientset.Interface, ns, name st
framework.ExpectNoError(e2erc.RunRC(context.TODO(), controllerRcConfig))

// Wait for endpoints to propagate for the controller service.
framework.ExpectNoError(framework.WaitForServiceEndpointsNum(
context.TODO(), c, ns, controllerName, 1, startServiceInterval, startServiceTimeout))
framework.ExpectNoError(e2eendpointslice.WaitForEndpointCount(
context.TODO(), c, ns, controllerName, 1))
}

// runReplicaSet launches (and verifies correctness) of a replicaset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestChangedCAReloader(t *testing.T) {
t.Error(err)
}

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a little strange.
NewSimpleClientset has been deprecated for a while, however, they were tagged incorrectly.
In 1.35 the tagging was fixed (kubernetes/kubernetes@8c139fb)

So any use of NewSimpleClientset is deprecated (according to tooling)

Except for VPA's own NewSimpleClientset.
While it's been generated with 1.34, it won't be tagged correctly for generation, see.

// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
//
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
// via --with-applyconfig).
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
.

But, the replacement function requires someone to run code-gen with --with-applyconfig enabled

I figured I'd leave that for another PR, or, bundle it into the PR that bumps the kubernetes dependencies to 1.35.


selfRegistration(
testClientSet,
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestChangedCAReloader(t *testing.T) {
// t.Error(err)
// }

// testClientSet := fake.NewSimpleClientset()
// testClientSet := fake.NewClientset()

// selfRegistration(
// testClientSet,
Expand Down
16 changes: 8 additions & 8 deletions vertical-pod-autoscaler/pkg/admission-controller/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

func TestSelfRegistrationBase(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestSelfRegistrationBase(t *testing.T) {

func TestSelfRegistrationWithURL(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestSelfRegistrationWithURL(t *testing.T) {

func TestSelfRegistrationWithOutURL(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestSelfRegistrationWithOutURL(t *testing.T) {

func TestSelfRegistrationWithIgnoredNamespaces(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestSelfRegistrationWithIgnoredNamespaces(t *testing.T) {

func TestSelfRegistrationWithSelectedNamespaces(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down Expand Up @@ -194,7 +194,7 @@ func TestSelfRegistrationWithSelectedNamespaces(t *testing.T) {

func TestSelfRegistrationWithFailurePolicy(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand All @@ -221,7 +221,7 @@ func TestSelfRegistrationWithFailurePolicy(t *testing.T) {

func TestSelfRegistrationWithOutFailurePolicy(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand All @@ -248,7 +248,7 @@ func TestSelfRegistrationWithOutFailurePolicy(t *testing.T) {

func TestSelfRegistrationWithInvalidLabels(t *testing.T) {

testClientSet := fake.NewSimpleClientset()
testClientSet := fake.NewClientset()
caCert := []byte("fake")
webHookDelay := 0 * time.Second
namespace := "default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ func TestFilterVPAsIgnoreNamespaces(t *testing.T) {

func TestCanCleanupCheckpoints(t *testing.T) {
_, tctx := ktesting.NewTestContext(t)
client := fake.NewSimpleClientset()
client := fake.NewClientset()
namespace := "testNamespace"

_, err := client.CoreV1().Namespaces().Create(tctx, &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}, metav1.CreateOptions{})
Expand Down
2 changes: 1 addition & 1 deletion vertical-pod-autoscaler/pkg/updater/logic/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func TestRunOnceIgnoreNamespaceMatching(t *testing.T) {
}

func TestNewEventRecorder(t *testing.T) {
fakeClient := fake.NewSimpleClientset()
fakeClient := fake.NewClientset()
er := newEventRecorder(fakeClient)

maxRetries := 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestNewNoopLimitsChecker(t *testing.T) {
}

func TestNoLimitRange(t *testing.T) {
cs := fake.NewSimpleClientset()
cs := fake.NewClientset()
factory := informers.NewSharedInformerFactory(cs, 0)
lc, err := NewLimitsRangeCalculator(factory)

Expand Down Expand Up @@ -133,7 +133,7 @@ func TestGetContainerLimitRangeItem(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
cs := fake.NewSimpleClientset(tc.limitRanges...)
cs := fake.NewClientset(tc.limitRanges...)
factory := informers.NewSharedInformerFactory(cs, 0)
lc, err := NewLimitsRangeCalculator(factory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestUpdateStatus(t *testing.T) {
}
for _, tc := range tests {
t.Run(fmt.Sprintf("test case: %s", tc.name), func(t *testing.T) {
fc := fake.NewSimpleClientset()
fc := fake.NewClientset()
fc.PrependReactor("get", "leases", tc.updateReactor)
fc.PrependReactor("create", "leases", tc.updateReactor)
fc.PrependReactor("update", "leases", tc.updateReactor)
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestGetStatus(t *testing.T) {
}
for _, tc := range tests {
t.Run(fmt.Sprintf("test case: %s", tc.name), func(t *testing.T) {
fc := fake.NewSimpleClientset()
fc := fake.NewClientset()
fc.PrependReactor("get", "leases", tc.getReactor)
client := NewClient(fc, leaseName, leaseNamespace, 10*time.Second, leaseName)
_, err := client.getStatus(context.Background())
Expand Down