Skip to content

Commit 4b5de64

Browse files
committed
External-ccm: Migrate from k8s.io/utils/pointer to k8s.io/utils/ptr
Replace usage of the deprecated `pointer` package with the newer `ptr` package from `k8s.io/utils`.
1 parent 0dd7c0b commit 4b5de64

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

pkg/oci/client/networking.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/oracle/oci-cloud-controller-manager/pkg/util"
2424
"github.com/oracle/oci-go-sdk/v65/core"
2525
"github.com/pkg/errors"
26-
"k8s.io/utils/pointer"
26+
"k8s.io/utils/ptr"
2727
)
2828

2929
// NetworkingInterface defines the subset of the OCI compute API utilised by the CCM
@@ -74,7 +74,7 @@ func (c *client) GetVNIC(ctx context.Context, id string) (*core.Vnic, error) {
7474
incRequestCounter(err, getVerb, vnicResource)
7575

7676
if err != nil {
77-
c.logger.With(id).Infof("GetVNIC failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
77+
c.logger.With(id).Infof("GetVNIC failed %s", ptr.Deref(resp.OpcRequestId, ""))
7878
return nil, errors.WithStack(err)
7979
}
8080

@@ -106,7 +106,7 @@ func (c *client) GetSubnet(ctx context.Context, id string) (*core.Subnet, error)
106106
incRequestCounter(err, getVerb, subnetResource)
107107

108108
if err != nil {
109-
c.logger.With(id).Infof("GetSubnet failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
109+
c.logger.With(id).Infof("GetSubnet failed %s", ptr.Deref(resp.OpcRequestId, ""))
110110
return nil, errors.WithStack(err)
111111
}
112112

@@ -187,7 +187,7 @@ func (c *client) GetVcn(ctx context.Context, id string) (*core.Vcn, error) {
187187
incRequestCounter(err, getVerb, vcnResource)
188188

189189
if err != nil {
190-
c.logger.With(id).Infof("GetVcn failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
190+
c.logger.With(id).Infof("GetVcn failed %s", ptr.Deref(resp.OpcRequestId, ""))
191191
return nil, errors.WithStack(err)
192192
}
193193

@@ -248,7 +248,7 @@ func (c *client) GetPrivateIp(ctx context.Context, id string) (*core.PrivateIp,
248248
incRequestCounter(err, getVerb, privateIPResource)
249249

250250
if err != nil {
251-
c.logger.With("mountTargetIpId", id).Infof("GetPrivateIp failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
251+
c.logger.With("mountTargetIpId", id).Infof("GetPrivateIp failed %s", ptr.Deref(resp.OpcRequestId, ""))
252252
return nil, errors.WithStack(err)
253253
}
254254

@@ -267,7 +267,7 @@ func (c *client) GetPublicIpByIpAddress(ctx context.Context, ip string) (*core.P
267267
})
268268
incRequestCounter(err, getVerb, publicReservedIPResource)
269269
if err != nil {
270-
c.logger.With(ip).Infof("GetPublicIpByIpAddress failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
270+
c.logger.With(ip).Infof("GetPublicIpByIpAddress failed %s", ptr.Deref(resp.OpcRequestId, ""))
271271
return nil, errors.WithStack(err)
272272
}
273273

@@ -288,7 +288,7 @@ func (c *client) ListPrivateIps(ctx context.Context, vnicId string) ([]core.Priv
288288
})
289289
incRequestCounter(err, listVerb, privateIPResource)
290290
if err != nil {
291-
c.logger.With(vnicId).Infof("ListPrivateIps failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
291+
c.logger.With(vnicId).Infof("ListPrivateIps failed %s", ptr.Deref(resp.OpcRequestId, ""))
292292
return nil, errors.WithStack(err)
293293
}
294294
privateIps = append(privateIps, resp.Items...)
@@ -313,7 +313,7 @@ func (c *client) CreatePrivateIp(ctx context.Context, vnicId string) (*core.Priv
313313
})
314314
incRequestCounter(err, createVerb, privateIPResource)
315315
if err != nil {
316-
c.logger.With(vnicId).Infof("CreatePrivateIp failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
316+
c.logger.With(vnicId).Infof("CreatePrivateIp failed %s", ptr.Deref(resp.OpcRequestId, ""))
317317
return nil, errors.WithStack(err)
318318
}
319319

@@ -336,7 +336,7 @@ func (c *client) GetIpv6(ctx context.Context, id string) (*core.Ipv6, error) {
336336
incRequestCounter(err, getVerb, ipv6IPResource)
337337

338338
if err != nil {
339-
c.logger.With(id).Infof("GetIpv6 failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
339+
c.logger.With(id).Infof("GetIpv6 failed %s", ptr.Deref(resp.OpcRequestId, ""))
340340
return nil, errors.WithStack(err)
341341
}
342342

@@ -362,7 +362,7 @@ func (c *client) CreateNetworkSecurityGroup(ctx context.Context, compartmentId,
362362

363363
incRequestCounter(err, createVerb, nsgResource)
364364
if err != nil {
365-
c.logger.With(serviceUid).Infof("CreateNetworkSecurityGroup failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
365+
c.logger.With(serviceUid).Infof("CreateNetworkSecurityGroup failed %s", ptr.Deref(resp.OpcRequestId, ""))
366366
return nil, errors.WithStack(err)
367367
}
368368

@@ -381,7 +381,7 @@ func (c *client) GetNetworkSecurityGroup(ctx context.Context, id string) (*core.
381381
incRequestCounter(err, getVerb, nsgResource)
382382

383383
if err != nil {
384-
c.logger.With(id).Infof("GetNetworkSecurityGroup failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
384+
c.logger.With(id).Infof("GetNetworkSecurityGroup failed %s", ptr.Deref(resp.OpcRequestId, ""))
385385
return nil, nil, errors.WithStack(err)
386386
}
387387

@@ -408,7 +408,7 @@ func (c *client) ListNetworkSecurityGroups(ctx context.Context, displayName, com
408408
incRequestCounter(err, listVerb, nsgResource)
409409

410410
if err != nil {
411-
c.logger.With(displayName).Infof("ListNetworkSecurityGroups failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
411+
c.logger.With(displayName).Infof("ListNetworkSecurityGroups failed %s", ptr.Deref(resp.OpcRequestId, ""))
412412
return nil, errors.WithStack(err)
413413
}
414414
nsgList = append(nsgList, resp.Items...)
@@ -436,7 +436,7 @@ func (c *client) UpdateNetworkSecurityGroup(ctx context.Context, id string, etag
436436
incRequestCounter(err, updateVerb, nsgResource)
437437

438438
if err != nil {
439-
c.logger.With(id).Infof("UpdateNetworkSecurityGroup failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
439+
c.logger.With(id).Infof("UpdateNetworkSecurityGroup failed %s", ptr.Deref(resp.OpcRequestId, ""))
440440
return nil, errors.WithStack(err)
441441
}
442442

@@ -457,7 +457,7 @@ func (c *client) DeleteNetworkSecurityGroup(ctx context.Context, id, etag string
457457

458458
incRequestCounter(err, deleteVerb, nsgResource)
459459
if err != nil {
460-
c.logger.With(id).Infof("DeleteNetworkSecurityGroup failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
460+
c.logger.With(id).Infof("DeleteNetworkSecurityGroup failed %s", ptr.Deref(resp.OpcRequestId, ""))
461461
return nil, errors.WithStack(err)
462462
}
463463

@@ -477,7 +477,7 @@ func (c *client) AddNetworkSecurityGroupSecurityRules(ctx context.Context, id st
477477
incRequestCounter(err, createVerb, nsgRuleResource)
478478

479479
if err != nil {
480-
c.logger.With(id).Infof("AddNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
480+
c.logger.With(id).Infof("AddNetworkSecurityGroupSecurityRules failed %s", ptr.Deref(resp.OpcRequestId, ""))
481481
return &resp, errors.WithStack(err)
482482
}
483483
return &resp, nil
@@ -496,7 +496,7 @@ func (c *client) RemoveNetworkSecurityGroupSecurityRules(ctx context.Context, id
496496
incRequestCounter(err, deleteVerb, nsgRuleResource)
497497

498498
if err != nil {
499-
c.logger.With(id).Infof("RemoveNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
499+
c.logger.With(id).Infof("RemoveNetworkSecurityGroupSecurityRules failed %s", ptr.Deref(resp.OpcRequestId, ""))
500500
return &resp, errors.WithStack(err)
501501
}
502502
return &resp, nil
@@ -518,7 +518,7 @@ func (c *client) ListNetworkSecurityGroupSecurityRules(ctx context.Context, id s
518518
incRequestCounter(err, listVerb, nsgRuleResource)
519519

520520
if err != nil {
521-
c.logger.With(id).Infof("ListNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
521+
c.logger.With(id).Infof("ListNetworkSecurityGroupSecurityRules failed %s", ptr.Deref(resp.OpcRequestId, ""))
522522
return []core.SecurityRule{}, errors.WithStack(err)
523523
}
524524
for _, rule := range resp.Items {
@@ -544,7 +544,7 @@ func (c *client) UpdateNetworkSecurityGroupSecurityRules(ctx context.Context, id
544544
incRequestCounter(err, updateVerb, nsgRuleResource)
545545

546546
if err != nil {
547-
c.logger.With(id).Infof("UpdateNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
547+
c.logger.With(id).Infof("UpdateNetworkSecurityGroupSecurityRules failed %s", ptr.Deref(resp.OpcRequestId, ""))
548548
return &resp, errors.WithStack(err)
549549
}
550550
return &resp, nil

test/e2e/framework/deployment_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
v1 "k8s.io/api/core/v1"
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
"k8s.io/apimachinery/pkg/util/wait"
25-
"k8s.io/utils/pointer"
25+
"k8s.io/utils/ptr"
2626
)
2727

2828
func (j *PVCTestJig) createDeploymentOnNodeAndWait(command string, pvcName string, ns string, name string, replicas int32, nodeSelectorLabels map[string]string, isRawBlockVolume bool) string {
@@ -62,7 +62,7 @@ func (j *PVCTestJig) createDeploymentOnNodeAndWait(command string, pvcName strin
6262
Name: name,
6363
},
6464
Spec: appsv1.DeploymentSpec{
65-
Replicas: pointer.Int32Ptr(replicas),
65+
Replicas: ptr.To(replicas),
6666
Selector: &metav1.LabelSelector{
6767
MatchLabels: map[string]string{
6868
"app": name,

0 commit comments

Comments
 (0)