Skip to content

Commit 3125e66

Browse files
committed
fix staticcheck: replace deprecated function calls
Signed-off-by: Tim Ramlot <[email protected]>
1 parent c7f61ed commit 3125e66

File tree

32 files changed

+69
-68
lines changed

32 files changed

+69
-68
lines changed

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
issues:
22
exclude-rules:
33
- linters:
4-
- staticcheck
54
- govet
65
- usestdlibvars
76
- misspell

pkg/acme/webhook/apiserver/apiserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (c completedConfig) New() (*ChallengeServer, error) {
162162
}
163163
s.GenericAPIServer.AddPostStartHookOrDie(postStartName,
164164
func(context genericapiserver.PostStartHookContext) error {
165-
return solver.Initialize(c.restConfig, context.StopCh)
165+
return solver.Initialize(c.restConfig, context.Done())
166166
},
167167
)
168168
}

pkg/acme/webhook/cmd/server/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ func (o WebhookServerOptions) RunWebhookServer(ctx context.Context) error {
142142
if err != nil {
143143
return err
144144
}
145-
return server.GenericAPIServer.PrepareRun().Run(ctx.Done())
145+
return server.GenericAPIServer.PrepareRun().RunWithContext(ctx)
146146
}

pkg/controller/acmechallenges/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type controller struct {
6868

6969
// maintain a reference to the workqueue for this controller
7070
// so the handleOwnedResource method can enqueue resources
71-
queue workqueue.RateLimitingInterface
71+
queue workqueue.TypedRateLimitingInterface[any]
7272

7373
// logger to be used by this controller
7474
log logr.Logger
@@ -82,12 +82,12 @@ type controller struct {
8282
objectUpdater
8383
}
8484

85-
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
85+
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.TypedRateLimitingInterface[any], []cache.InformerSynced, error) {
8686
// construct a new named logger to be reused throughout the controller
8787
c.log = logf.FromContext(ctx.RootContext, ControllerName)
8888

8989
// create a queue used to queue up items to be processed
90-
c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(time.Second*5, time.Minute*30), ControllerName)
90+
c.queue = workqueue.NewNamedRateLimitingQueue(workqueue.NewTypedItemExponentialFailureRateLimiter[any](time.Second*5, time.Minute*30), ControllerName)
9191

9292
// obtain references to all the informers used by this controller
9393
challengeInformer := ctx.SharedInformerFactory.Acme().V1().Challenges()

pkg/controller/acmeorders/checks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
func handleGenericIssuerFunc(
32-
queue workqueue.RateLimitingInterface,
32+
queue workqueue.TypedRateLimitingInterface[any],
3333
orderLister cmacmelisters.OrderLister,
3434
) func(interface{}) {
3535
return func(obj interface{}) {

pkg/controller/acmeorders/controller.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type controller struct {
6767

6868
// maintain a reference to the workqueue for this controller
6969
// so the handleOwnedResource method can enqueue resources
70-
queue workqueue.RateLimitingInterface
70+
queue workqueue.TypedRateLimitingInterface[any]
7171

7272
// scheduledWorkQueue holds items to be re-queued after a period of time.
7373
scheduledWorkQueue scheduler.ScheduledWorkQueue
@@ -78,12 +78,14 @@ func NewController(
7878
log logr.Logger,
7979
ctx *controllerpkg.Context,
8080
isNamespaced bool,
81-
) (*controller, workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
81+
) (*controller, workqueue.TypedRateLimitingInterface[any], []cache.InformerSynced, error) {
8282

8383
// Create a queue used to queue up Orders to be processed.
84-
queue := workqueue.NewNamedRateLimitingQueue(
85-
workqueue.NewItemExponentialFailureRateLimiter(time.Second*5, time.Minute*30),
86-
ControllerName,
84+
queue := workqueue.NewTypedRateLimitingQueueWithConfig(
85+
workqueue.NewTypedItemExponentialFailureRateLimiter[any](time.Second*5, time.Minute*30),
86+
workqueue.TypedRateLimitingQueueConfig[any]{
87+
Name: ControllerName,
88+
},
8789
)
8890

8991
// Create a scheduledWorkQueue to schedule Orders for re-processing.
@@ -204,7 +206,7 @@ type controllerWrapper struct {
204206
// Register registers a controller, created using the provided context.
205207
// It returns the workqueue to be used to enqueue items, a list of
206208
// InformerSynced functions that must be synced, or an error.
207-
func (c *controllerWrapper) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
209+
func (c *controllerWrapper) Register(ctx *controllerpkg.Context) (workqueue.TypedRateLimitingInterface[any], []cache.InformerSynced, error) {
208210
// Construct a new named logger to be reused throughout the controller.
209211
log := logf.FromContext(ctx.RootContext, ControllerName)
210212

pkg/controller/certificate-shim/gateways/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ type controller struct {
4242
sync shimhelper.SyncFn
4343

4444
// For testing purposes.
45-
queue workqueue.RateLimitingInterface
45+
queue workqueue.TypedRateLimitingInterface[any]
4646
}
4747

48-
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
48+
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.TypedRateLimitingInterface[any], []cache.InformerSynced, error) {
4949
c.gatewayLister = ctx.GWShared.Gateway().V1().Gateways().Lister()
5050
log := logf.FromContext(ctx.RootContext, ControllerName)
5151
c.sync = shimhelper.SyncFnFor(ctx.Recorder, log, ctx.CMClient, ctx.SharedInformerFactory.Certmanager().V1().Certificates().Lister(), ctx.IngressShimOptions, ctx.FieldManager)
@@ -119,7 +119,7 @@ func (c *controller) ProcessItem(ctx context.Context, key string) error {
119119
// name: gateway-1
120120
// blockOwnerDeletion: true
121121
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
122-
func certificateHandler(queue workqueue.RateLimitingInterface) func(obj interface{}) {
122+
func certificateHandler(queue workqueue.TypedRateLimitingInterface[any]) func(obj interface{}) {
123123
return func(obj interface{}) {
124124
crt, ok := obj.(*cmapi.Certificate)
125125
if !ok {

pkg/controller/certificate-shim/gateways/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ type mockWorkqueue struct {
184184
callsToAdd []interface{}
185185
}
186186

187-
var _ workqueue.Interface = &mockWorkqueue{}
187+
var _ workqueue.TypedInterface[any] = &mockWorkqueue{}
188188

189189
func (m *mockWorkqueue) Add(arg0 interface{}) {
190190
m.callsToAdd = append(m.callsToAdd, arg0)

pkg/controller/certificate-shim/ingresses/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type controller struct {
4242
sync shimhelper.SyncFn
4343
}
4444

45-
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {
45+
func (c *controller) Register(ctx *controllerpkg.Context) (workqueue.TypedRateLimitingInterface[any], []cache.InformerSynced, error) {
4646
cmShared := ctx.SharedInformerFactory
4747

4848
ingressInformer := ctx.KubeSharedInformerFactory.Ingresses()
@@ -124,7 +124,7 @@ func (c *controller) ProcessItem(ctx context.Context, key string) error {
124124
// name: ingress-1
125125
// blockOwnerDeletion: true
126126
// uid: 7d3897c2-ce27-4144-883a-e1b5f89bd65a
127-
func certificateHandler(queue workqueue.RateLimitingInterface) func(obj interface{}) {
127+
func certificateHandler(queue workqueue.TypedRateLimitingInterface[any]) func(obj interface{}) {
128128
return func(obj interface{}) {
129129
cert, ok := obj.(*cmapi.Certificate)
130130
if !ok {

pkg/controller/certificaterequests/acme/acme.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func init() {
7474
For(certificaterequests.New(
7575
apiutil.IssuerACME,
7676
NewACME,
77-
func(ctx *controllerpkg.Context, log logr.Logger, queue workqueue.RateLimitingInterface) ([]cache.InformerSynced, error) {
77+
func(ctx *controllerpkg.Context, log logr.Logger, queue workqueue.TypedRateLimitingInterface[any]) ([]cache.InformerSynced, error) {
7878
orderInformer := ctx.SharedInformerFactory.Acme().V1().Orders().Informer()
7979
certificateRequestLister := ctx.SharedInformerFactory.Certmanager().V1().CertificateRequests().Lister()
8080

0 commit comments

Comments
 (0)