Skip to content

Commit 416d8be

Browse files
authored
Bump k8s.io/* deps to v1.35 (#476)
Signed-off-by: Rohit Kumar <rohit.1si09ee045@gmail.com>
1 parent 6f31347 commit 416d8be

6 files changed

Lines changed: 69 additions & 88 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: golangci-lint
1818
uses: golangci/golangci-lint-action@v9
1919
with:
20-
version: v2.5
20+
version: v2.11

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
7373

7474
## Tool Versions
7575
ADDLICENSE_VERSION ?= v1.1.1
76-
GOIMPORTS_VERSION ?= v0.34.0
76+
GOIMPORTS_VERSION ?= v0.41.0
7777
MOCKGEN_VERSION ?= v0.6.0
78-
GOLANGCI_LINT_VERSION ?= v2.5
78+
GOLANGCI_LINT_VERSION ?= v2.11
7979

8080
.PHONY: addlicense
8181
addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary.

clientutils/clientutils.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package clientutils
77

88
import (
99
"context"
10+
"encoding/json"
1011
"fmt"
1112
"reflect"
1213

@@ -19,6 +20,7 @@ import (
1920
"k8s.io/apimachinery/pkg/conversion"
2021
"k8s.io/apimachinery/pkg/runtime"
2122
"k8s.io/apimachinery/pkg/runtime/schema"
23+
"k8s.io/apimachinery/pkg/types"
2224
"sigs.k8s.io/controller-runtime/pkg/client"
2325
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
2426
)
@@ -285,15 +287,15 @@ func GetMultiple(ctx context.Context, c client.Client, reqs []GetRequest) error
285287
return nil
286288
}
287289

288-
// apply is a PatchProvider always providing client.Apply.
290+
// apply is a PatchProvider always providing a server-side apply patch.
289291
type apply struct{}
290292

291293
// PatchFor implements PatchProvider.
292294
func (a apply) PatchFor(obj client.Object) client.Patch {
293-
return client.Apply
295+
return applyPatch{}
294296
}
295297

296-
// ApplyAll provides client.Apply for any given object.
298+
// ApplyAll provides a server-side apply patch for any given object.
297299
var ApplyAll = apply{}
298300

299301
// PatchProvider retrieves a patch for any given object.
@@ -307,6 +309,17 @@ type PatchRequest struct {
307309
Patch client.Patch
308310
}
309311

312+
// applyPatch uses server-side apply semantics without relying on the deprecated client.Apply constant.
313+
type applyPatch struct{}
314+
315+
func (applyPatch) Type() types.PatchType {
316+
return types.ApplyPatchType
317+
}
318+
319+
func (applyPatch) Data(obj client.Object) ([]byte, error) {
320+
return json.Marshal(obj)
321+
}
322+
310323
// PatchRequestFromObjectAndProvider is a shorthand to create a PatchRequest using a client.Object and PatchProvider.
311324
func PatchRequestFromObjectAndProvider(obj client.Object, provider PatchProvider) PatchRequest {
312325
return PatchRequest{

clientutils/clientutils_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,19 @@ var _ = Describe("Clientutils", func() {
393393
})
394394

395395
Describe("ApplyAll", func() {
396-
It("should return client.Apply for any object", func() {
397-
Expect(ApplyAll.PatchFor(cm)).To(Equal(client.Apply))
398-
Expect(ApplyAll.PatchFor(secret)).To(Equal(client.Apply))
399-
Expect(ApplyAll.PatchFor(uPod)).To(Equal(client.Apply))
396+
It("should return an apply patch for any object", func() {
397+
Expect(ApplyAll.PatchFor(cm).Type()).To(Equal(types.ApplyPatchType))
398+
Expect(ApplyAll.PatchFor(secret).Type()).To(Equal(types.ApplyPatchType))
399+
Expect(ApplyAll.PatchFor(uPod).Type()).To(Equal(types.ApplyPatchType))
400400
})
401401
})
402402

403403
Describe("PatchRequestFromObjectAndProvider", func() {
404404
It("should create a patch request from the given object and provider", func() {
405-
patchProvider.EXPECT().PatchFor(cm).Return(client.Apply)
405+
patchProvider.EXPECT().PatchFor(cm).Return(ApplyAll.PatchFor(cm))
406406
Expect(PatchRequestFromObjectAndProvider(cm, patchProvider)).To(Equal(PatchRequest{
407407
Object: cm,
408-
Patch: client.Apply,
408+
Patch: ApplyAll.PatchFor(cm),
409409
}))
410410
})
411411
})
@@ -417,19 +417,19 @@ var _ = Describe("Clientutils", func() {
417417

418418
It("should create patch requests from the given objects and provider", func() {
419419
gomock.InOrder(
420-
patchProvider.EXPECT().PatchFor(cm).Return(client.Apply),
421-
patchProvider.EXPECT().PatchFor(secret).Return(client.Apply),
420+
patchProvider.EXPECT().PatchFor(cm).Return(ApplyAll.PatchFor(cm)),
421+
patchProvider.EXPECT().PatchFor(secret).Return(ApplyAll.PatchFor(secret)),
422422
)
423423

424424
Expect(PatchRequestsFromObjectsAndProvider([]client.Object{cm, secret}, patchProvider)).To(Equal(
425425
[]PatchRequest{
426426
{
427427
Object: cm,
428-
Patch: client.Apply,
428+
Patch: ApplyAll.PatchFor(cm),
429429
},
430430
{
431431
Object: secret,
432-
Patch: client.Apply,
432+
Patch: ApplyAll.PatchFor(secret),
433433
},
434434
},
435435
))
@@ -445,11 +445,11 @@ var _ = Describe("Clientutils", func() {
445445
reqs := []PatchRequest{
446446
{
447447
Object: cm,
448-
Patch: client.Apply,
448+
Patch: ApplyAll.PatchFor(cm),
449449
},
450450
{
451451
Object: secret,
452-
Patch: client.Apply,
452+
Patch: ApplyAll.PatchFor(secret),
453453
},
454454
}
455455
Expect(ObjectsFromPatchRequests(reqs)).To(Equal([]client.Object{cm, secret}))
@@ -461,15 +461,15 @@ var _ = Describe("Clientutils", func() {
461461
reqs := []PatchRequest{
462462
{
463463
Object: cm,
464-
Patch: client.Apply,
464+
Patch: ApplyAll.PatchFor(cm),
465465
},
466466
{
467467
Object: secret,
468-
Patch: client.Apply,
468+
Patch: ApplyAll.PatchFor(secret),
469469
},
470470
}
471471
someErr := fmt.Errorf("some error")
472-
c.EXPECT().Patch(ctx, cm, client.Apply).Return(someErr)
472+
c.EXPECT().Patch(ctx, cm, ApplyAll.PatchFor(cm)).Return(someErr)
473473

474474
err := PatchMultiple(ctx, c, reqs)
475475
Expect(err).To(HaveOccurred())
@@ -480,16 +480,16 @@ var _ = Describe("Clientutils", func() {
480480
reqs := []PatchRequest{
481481
{
482482
Object: cm,
483-
Patch: client.Apply,
483+
Patch: ApplyAll.PatchFor(cm),
484484
},
485485
{
486486
Object: secret,
487-
Patch: client.Apply,
487+
Patch: ApplyAll.PatchFor(secret),
488488
},
489489
}
490490
gomock.InOrder(
491-
c.EXPECT().Patch(ctx, cm, client.Apply),
492-
c.EXPECT().Patch(ctx, secret, client.Apply),
491+
c.EXPECT().Patch(ctx, cm, ApplyAll.PatchFor(cm)),
492+
c.EXPECT().Patch(ctx, secret, ApplyAll.PatchFor(secret)),
493493
)
494494
Expect(PatchMultiple(ctx, c, reqs)).To(Succeed())
495495
})
@@ -504,10 +504,10 @@ var _ = Describe("Clientutils", func() {
504504
It("should abort and return any error from patching", func() {
505505
someErr := fmt.Errorf("some error")
506506
gomock.InOrder(
507-
patchProvider.EXPECT().PatchFor(testdata.UnstructuredSecret()).Return(client.Apply),
508-
patchProvider.EXPECT().PatchFor(testdata.UnstructuredConfigMap()).Return(client.Apply),
507+
patchProvider.EXPECT().PatchFor(testdata.UnstructuredSecret()).Return(ApplyAll.PatchFor(testdata.UnstructuredSecret())),
508+
patchProvider.EXPECT().PatchFor(testdata.UnstructuredConfigMap()).Return(ApplyAll.PatchFor(testdata.UnstructuredConfigMap())),
509509

510-
c.EXPECT().Patch(ctx, testdata.UnstructuredSecret(), client.Apply).Return(someErr),
510+
c.EXPECT().Patch(ctx, testdata.UnstructuredSecret(), ApplyAll.PatchFor(testdata.UnstructuredSecret())).Return(someErr),
511511
)
512512

513513
_, err := PatchMultipleFromFile(ctx, c, objectsPath, patchProvider)
@@ -517,11 +517,11 @@ var _ = Describe("Clientutils", func() {
517517

518518
It("should patch multiple objects from file", func() {
519519
gomock.InOrder(
520-
patchProvider.EXPECT().PatchFor(testdata.UnstructuredSecret()).Return(client.Apply),
521-
patchProvider.EXPECT().PatchFor(testdata.UnstructuredConfigMap()).Return(client.Apply),
520+
patchProvider.EXPECT().PatchFor(testdata.UnstructuredSecret()).Return(ApplyAll.PatchFor(testdata.UnstructuredSecret())),
521+
patchProvider.EXPECT().PatchFor(testdata.UnstructuredConfigMap()).Return(ApplyAll.PatchFor(testdata.UnstructuredConfigMap())),
522522

523-
c.EXPECT().Patch(ctx, testdata.UnstructuredSecret(), client.Apply),
524-
c.EXPECT().Patch(ctx, testdata.UnstructuredConfigMap(), client.Apply),
523+
c.EXPECT().Patch(ctx, testdata.UnstructuredSecret(), ApplyAll.PatchFor(testdata.UnstructuredSecret())),
524+
c.EXPECT().Patch(ctx, testdata.UnstructuredConfigMap(), ApplyAll.PatchFor(testdata.UnstructuredConfigMap())),
525525
)
526526

527527
objs, err := PatchMultipleFromFile(ctx, c, objectsPath, patchProvider)

go.mod

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ require (
88
github.com/spf13/pflag v1.0.10
99
github.com/stretchr/testify v1.11.1
1010
go.uber.org/mock v0.6.0
11-
k8s.io/api v0.34.1
12-
k8s.io/apiextensions-apiserver v0.34.1
13-
k8s.io/apimachinery v0.34.1
14-
k8s.io/apiserver v0.34.1
15-
k8s.io/client-go v0.34.1
11+
k8s.io/api v0.35.3
12+
k8s.io/apiextensions-apiserver v0.35.3
13+
k8s.io/apimachinery v0.35.3
14+
k8s.io/apiserver v0.35.3
15+
k8s.io/client-go v0.35.3
1616
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
17-
sigs.k8s.io/controller-runtime v0.22.3
17+
sigs.k8s.io/controller-runtime v0.23.3
1818
sigs.k8s.io/kustomize/api v0.20.1
1919
sigs.k8s.io/kustomize/kyaml v0.20.1
2020
sigs.k8s.io/yaml v1.6.0
@@ -50,7 +50,6 @@ require (
5050
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
5151
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
5252
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
53-
github.com/gogo/protobuf v1.3.2 // indirect
5453
github.com/google/btree v1.1.3 // indirect
5554
github.com/google/gnostic-models v0.7.0 // indirect
5655
github.com/google/go-cmp v0.7.0 // indirect
@@ -98,11 +97,11 @@ require (
9897
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
9998
gopkg.in/inf.v0 v0.9.1 // indirect
10099
gopkg.in/yaml.v3 v3.0.1 // indirect
101-
k8s.io/component-base v0.34.1 // indirect
100+
k8s.io/component-base v0.35.3 // indirect
102101
k8s.io/klog/v2 v2.130.1 // indirect
103102
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
104103
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 // indirect
105104
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
106105
sigs.k8s.io/randfill v1.0.0 // indirect
107-
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
106+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
108107
)

0 commit comments

Comments
 (0)