Skip to content

Commit 5a6d749

Browse files
chore(deps): update dependency go to v1.26.0 (master) (#6292)
* chore(deps): update dependency go to v1.26.0 * fix modernize issues Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> --------- Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Mengxin Liu <liumengxinfly@gmail.com>
1 parent 23af563 commit 5a6d749

27 files changed

+65
-88
lines changed

cmd/cni/cni.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func assignAddress(cfg request.IPConfig) (*current.IPConfig, *types.Route) {
215215
ip := &current.IPConfig{
216216
Address: net.IPNet{IP: ipAddr, Mask: cidr.Mask},
217217
Gateway: gwIP,
218-
Interface: current.Int(0),
218+
Interface: new(0),
219219
}
220220

221221
var route *types.Route

dist/images/Dockerfile.base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax = docker/dockerfile:experimental
22
# renovate: datasource=golang-version depName=go
3-
ARG GO_VERSION=1.25.7
3+
ARG GO_VERSION=1.26.0
44

55
FROM ubuntu:24.04 AS openssl-builder
66

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/kubeovn/kube-ovn
22

3-
go 1.25.7
3+
go 1.26.0
44

55
require (
66
github.com/brianvoe/gofakeit/v7 v7.14.0

pkg/controller/init.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"k8s.io/apimachinery/pkg/types"
1717
"k8s.io/client-go/tools/cache"
1818
"k8s.io/klog/v2"
19-
"k8s.io/utils/ptr"
2019
"sigs.k8s.io/controller-runtime/pkg/client"
2120
"sigs.k8s.io/controller-runtime/pkg/client/config"
2221
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
@@ -363,15 +362,15 @@ func (c *Controller) InitIPAM() error {
363362
var mac *string
364363
klog.Infof("Init U2O for subnet %s", subnet.Name)
365364
if subnet.Status.U2OInterconnectionMAC != "" {
366-
mac = ptr.To(subnet.Status.U2OInterconnectionMAC)
365+
mac = new(subnet.Status.U2OInterconnectionMAC)
367366
} else {
368367
lrp, err := c.OVNNbClient.GetLogicalRouterPort(u2oInterconnLrpName, true)
369368
if err != nil {
370369
klog.Errorf("failed to get logical router port %s: %v", u2oInterconnLrpName, err)
371370
return err
372371
}
373372
if lrp != nil {
374-
mac = ptr.To(lrp.MAC)
373+
mac = new(lrp.MAC)
375374
}
376375
}
377376
if _, _, _, err = c.ipam.GetStaticAddress(u2oInterconnName, u2oInterconnLrpName, subnet.Status.U2OInterconnectionIP, mac, subnet.Name, true); err != nil {

pkg/controller/ip.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"k8s.io/apimachinery/pkg/types"
1818
"k8s.io/client-go/tools/cache"
1919
"k8s.io/klog/v2"
20-
"k8s.io/utils/ptr"
2120
"sigs.k8s.io/controller-runtime/pkg/client"
2221
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
2322

@@ -428,7 +427,7 @@ func (c *Controller) createOrUpdateIPCR(ipCRName, podName, ip, mac, subnetName,
428427
Kind: util.KindSubnet,
429428
Name: subnetName,
430429
UID: subnet.UID,
431-
BlockOwnerDeletion: ptr.To(true),
430+
BlockOwnerDeletion: new(true),
432431
}
433432
}
434433
}
@@ -543,7 +542,7 @@ func (c *Controller) ipAcquireAddress(ip *kubeovnv1.IP, subnet *kubeovnv1.Subnet
543542
macPtr = &ip.Spec.MacAddress
544543
}
545544
} else {
546-
macPtr = ptr.To("")
545+
macPtr = new("")
547546
}
548547

549548
if ipStr == "" {

pkg/controller/network_policy_test.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,58 +28,58 @@ func TestParsePolicyFor(t *testing.T) {
2828
},
2929
{
3030
name: "ovn only",
31-
annotation: ptrString("ovn"),
31+
annotation: new("ovn"),
3232
wantProviders: set.New(
3333
util.OvnProvider,
3434
),
3535
},
3636
{
3737
name: "duplicate ovn",
38-
annotation: ptrString("ovn, ovn"),
38+
annotation: new("ovn, ovn"),
3939
wantProviders: set.New(
4040
util.OvnProvider,
4141
),
4242
},
4343
{
4444
name: "secondary only",
45-
annotation: ptrString("ns1/net1"),
45+
annotation: new("ns1/net1"),
4646
wantProviders: set.New(
4747
"net1.ns1." + util.OvnProvider,
4848
),
4949
},
5050
{
5151
name: "ovn and secondary",
52-
annotation: ptrString(" ovn , ns1/net1 "),
52+
annotation: new(" ovn , ns1/net1 "),
5353
wantProviders: set.New(
5454
util.OvnProvider,
5555
"net1.ns1."+util.OvnProvider,
5656
),
5757
},
5858
{
5959
name: "ovn and invalid",
60-
annotation: ptrString("ovn, foo"),
60+
annotation: new("ovn, foo"),
6161
wantProviders: set.New(
6262
util.OvnProvider,
6363
),
6464
},
6565
{
6666
name: "invalid all",
67-
annotation: ptrString("all"),
67+
annotation: new("all"),
6868
wantProviders: set.New[string](),
6969
},
7070
{
7171
name: "invalid default",
72-
annotation: ptrString("default"),
72+
annotation: new("default"),
7373
wantProviders: set.New[string](),
7474
},
7575
{
7676
name: "invalid no entries",
77-
annotation: ptrString(","),
77+
annotation: new(","),
7878
wantProviders: set.New[string](),
7979
},
8080
{
8181
name: "invalid token",
82-
annotation: ptrString("foo"),
82+
annotation: new("foo"),
8383
wantProviders: set.New[string](),
8484
},
8585
}
@@ -116,7 +116,3 @@ func TestNetpolAppliesToProvider(t *testing.T) {
116116
require.True(t, netpolAppliesToProvider("ovn", nil))
117117
require.False(t, netpolAppliesToProvider("ovn", set.New[string]()))
118118
}
119-
120-
func ptrString(s string) *string {
121-
return &s
122-
}

pkg/controller/pod.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"k8s.io/client-go/kubernetes"
2727
"k8s.io/client-go/tools/cache"
2828
"k8s.io/klog/v2"
29-
"k8s.io/utils/ptr"
3029
kubevirtv1 "kubevirt.io/api/core/v1"
3130

3231
kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
@@ -2030,7 +2029,7 @@ func (c *Controller) acquireAddress(pod *v1.Pod, podNet *kubeovnNet) (string, st
20302029
macPointer = &annoMAC
20312030
}
20322031
} else if macPointer == nil {
2033-
macPointer = ptr.To("")
2032+
macPointer = new("")
20342033
}
20352034

20362035
var nsNets []*kubeovnNet

pkg/controller/service_lb.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1818
"k8s.io/apimachinery/pkg/labels"
1919
"k8s.io/klog/v2"
20-
"k8s.io/utils/ptr"
2120

2221
"github.com/kubeovn/kube-ovn/pkg/util"
2322
)
@@ -111,7 +110,7 @@ func (c *Controller) genLbSvcDeployment(svc *corev1.Service, nad *nadv1.NetworkA
111110
Name: name,
112111
},
113112
Spec: v1.DeploymentSpec{
114-
Replicas: ptr.To(int32(1)),
113+
Replicas: new(int32(1)),
115114
Selector: &metav1.LabelSelector{
116115
MatchLabels: labels,
117116
},
@@ -128,14 +127,14 @@ func (c *Controller) genLbSvcDeployment(svc *corev1.Service, nad *nadv1.NetworkA
128127
Command: []string{"sleep", "infinity"},
129128
ImagePullPolicy: corev1.PullIfNotPresent,
130129
SecurityContext: &corev1.SecurityContext{
131-
Privileged: ptr.To(true),
132-
AllowPrivilegeEscalation: ptr.To(true),
130+
Privileged: new(true),
131+
AllowPrivilegeEscalation: new(true),
133132
},
134133
Resources: resources,
135134
},
136135
},
137136
NodeSelector: nodeSelector,
138-
TerminationGracePeriodSeconds: ptr.To(int64(0)),
137+
TerminationGracePeriodSeconds: new(int64(0)),
139138
},
140139
},
141140
Strategy: v1.DeploymentStrategy{

pkg/controller/subnet_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"go.uber.org/mock/gomock"
1010

1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12-
"k8s.io/utils/ptr"
1312

1413
kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
1514
"github.com/kubeovn/kube-ovn/pkg/ovsdb/ovnnb"
@@ -166,7 +165,7 @@ func Test_formatSubnet(t *testing.T) {
166165
ExcludeIps: []string{"192.168.0.1"},
167166
Provider: util.OvnProvider,
168167
GatewayType: kubeovnv1.GWDistributedType,
169-
EnableLb: ptr.To(ctrl.config.EnableLb),
168+
EnableLb: new(ctrl.config.EnableLb),
170169
},
171170
},
172171
},
@@ -183,7 +182,7 @@ func Test_formatSubnet(t *testing.T) {
183182
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
184183
Provider: "ovn.test-provider",
185184
GatewayType: kubeovnv1.GWCentralizedType,
186-
EnableLb: ptr.To(false),
185+
EnableLb: new(false),
187186
},
188187
},
189188
output: &kubeovnv1.Subnet{
@@ -198,7 +197,7 @@ func Test_formatSubnet(t *testing.T) {
198197
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
199198
Provider: "ovn.test-provider",
200199
GatewayType: kubeovnv1.GWCentralizedType,
201-
EnableLb: ptr.To(false),
200+
EnableLb: new(false),
202201
},
203202
},
204203
},
@@ -214,7 +213,7 @@ func Test_formatSubnet(t *testing.T) {
214213
Vpc: "test-vpc",
215214
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
216215
Provider: "ovn.test-provider",
217-
EnableLb: ptr.To(false),
216+
EnableLb: new(false),
218217
},
219218
},
220219
output: &kubeovnv1.Subnet{
@@ -228,7 +227,7 @@ func Test_formatSubnet(t *testing.T) {
228227
Vpc: "test-vpc",
229228
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
230229
Provider: "ovn.test-provider",
231-
EnableLb: ptr.To(false),
230+
EnableLb: new(false),
232231
},
233232
},
234233
},
@@ -243,7 +242,7 @@ func Test_formatSubnet(t *testing.T) {
243242
Gateway: "192.168.0.255",
244243
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
245244
Provider: "test-provider",
246-
EnableLb: ptr.To(false),
245+
EnableLb: new(false),
247246
},
248247
},
249248
output: &kubeovnv1.Subnet{
@@ -256,7 +255,7 @@ func Test_formatSubnet(t *testing.T) {
256255
Gateway: "192.168.0.255",
257256
ExcludeIps: []string{"192.168.0.1", "192.168.0.255"},
258257
Provider: "test-provider",
259-
EnableLb: ptr.To(false),
258+
EnableLb: new(false),
260259
},
261260
},
262261
},

pkg/controller/vpc_dns.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/util/yaml"
2222
"k8s.io/client-go/tools/cache"
2323
"k8s.io/klog/v2"
24-
"k8s.io/utils/ptr"
2524

2625
kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
2726
"github.com/kubeovn/kube-ovn/pkg/request"
@@ -227,7 +226,7 @@ func (c *Controller) createOrUpdateVpcDNSDep(vpcDNS *kubeovnv1.VpcDns) error {
227226
}
228227

229228
if vpcDNS.Spec.Replicas != 0 {
230-
newDp.Spec.Replicas = ptr.To(vpcDNS.Spec.Replicas)
229+
newDp.Spec.Replicas = new(vpcDNS.Spec.Replicas)
231230
}
232231

233232
if deploy == nil {

0 commit comments

Comments
 (0)