Skip to content

Commit 8b7502c

Browse files
committed
Merge remote-tracking branch 'upstream/release-4.20' into 4.19-sync-from-4.20-08-06-2025
2 parents e243894 + dca1e7d commit 8b7502c

File tree

126 files changed

+6279
-3288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+6279
-3288
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
merge_group:
55
pull_request:
66
branches: [ master ]
7+
# Only run jobs if at least one non-doc file is changed
8+
paths-ignore:
9+
- '**/*.md'
10+
- 'mkdocs.yml'
711
schedule:
812
- cron: '0 */12 * * *'
913
workflow_dispatch:

contrib/kind-common

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -388,30 +388,7 @@ install_kubevirt() {
388388

389389
local kubevirt_stable_release_url=$(get_kubevirt_release_url "stable")
390390
kubectl -n kubevirt patch kubevirt kubevirt --type=json --patch '[{"op":"add","path":"/spec/configuration/network","value":{}},{"op":"add","path":"/spec/configuration/network/binding","value":{"l2bridge":{"domainAttachmentType":"managedTap","migration":{}}}}]'
391-
392-
if [ ! -d "./bin" ]
393-
then
394-
mkdir -p ./bin
395-
if_error_exit "Failed to create bin dir!"
396-
fi
397-
398-
if [[ "$OSTYPE" == "linux-gnu" ]]; then
399-
OS_TYPE="linux"
400-
elif [[ "$OSTYPE" == "darwin"* ]]; then
401-
OS_TYPE="darwin"
402-
fi
403-
404-
pushd ./bin
405-
if [ ! -f ./virtctl ]; then
406-
kubevirt_stable_release_url=$(get_kubevirt_release_url "stable")
407-
cli_name="virtctl-${kubevirt_stable_release_url##*/}-${OS_TYPE}-${ARCH}"
408-
curl -LO "${kubevirt_stable_release_url}/${cli_name}"
409-
mv ${cli_name} virtctl
410-
if_error_exit "Failed to download virtctl!"
411-
fi
412-
popd
413391

414-
chmod +x ./bin/virtctl
415392
}
416393

417394
install_cert_manager() {

dist/images/Dockerfile.fedora

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ARG OVN_FROM=koji
1414
#############################################
1515
# Stage to get OVN and OVS RPMs from source #
1616
#############################################
17-
FROM quay.io/fedora/fedora:41 AS ovnbuilder
17+
FROM quay.io/fedora/fedora:42 AS ovnbuilder
1818

1919
USER root
2020

@@ -78,8 +78,8 @@ RUN git log -n 1
7878
########################################
7979
# Stage to download OVN RPMs from koji #
8080
########################################
81-
FROM quay.io/fedora/fedora:41 AS kojidownloader
82-
ARG ovnver=ovn-24.09.2-71.fc41
81+
FROM quay.io/fedora/fedora:42 AS kojidownloader
82+
ARG ovnver=ovn-24.09.2-71.fc42
8383

8484
USER root
8585

@@ -99,14 +99,14 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] || [ -z "$TARGETPLATFORM"] ; then k
9999
######################################
100100
# Stage to copy OVN RPMs from source #
101101
######################################
102-
FROM quay.io/fedora/fedora:41 AS source
102+
FROM quay.io/fedora/fedora:42 AS source
103103
COPY --from=ovnbuilder /root/ovn/rpm/rpmbuild/RPMS/x86_64/*.rpm /
104104
COPY --from=ovnbuilder /root/ovs/rpm/rpmbuild/RPMS/x86_64/*.rpm /
105105

106106
####################################
107107
# Stage to copy OVN RPMs from koji #
108108
####################################
109-
FROM quay.io/fedora/fedora:41 AS koji
109+
FROM quay.io/fedora/fedora:42 AS koji
110110

111111
COPY --from=kojidownloader /*.rpm /
112112

dist/images/ovnkube.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,12 @@ ovnkube-controller-with-node() {
20972097
ovn_stateless_netpol_enable_flag="--enable-stateless-netpol"
20982098
fi
20992099

2100+
ovn_disable_requestedchassis_flag=
2101+
if [[ ${ovn_disable_requestedchassis} == "true" ]]; then
2102+
ovn_disable_requestedchassis_flag="--disable-requestedchassis"
2103+
fi
2104+
echo "ovn_disable_requestedchassis_flag=${ovn_disable_requestedchassis_flag}"
2105+
21002106
echo "=============== ovnkube-controller-with-node --init-ovnkube-controller-with-node=========="
21012107
/usr/bin/ovnkube --init-ovnkube-controller ${K8S_NODE} --init-node ${K8S_NODE} \
21022108
${anp_enabled_flag} \
@@ -2150,6 +2156,7 @@ ovnkube-controller-with-node() {
21502156
${ssl_opts} \
21512157
${network_qos_enabled_flag} \
21522158
${ovn_enable_dnsnameresolver_flag} \
2159+
${ovn_disable_requestedchassis_flag} \
21532160
--cluster-subnets ${net_cidr} --k8s-service-cidr=${svc_cidr} \
21542161
--export-ovs-metrics \
21552162
--gateway-mode=${ovn_gateway_mode} ${ovn_gateway_opts} \

dist/templates/ovn-setup.yaml.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ spec:
8989
networkSelectors:
9090
- networkSelectionType: DefaultNetwork
9191
nodeSelector: {}
92-
frrConfigurationSelector: {}
92+
frrConfigurationSelector:
93+
matchLabels:
94+
name: receive-all
9395
advertisements:
9496
- "PodNetwork"
9597
{%- endif %}

go-controller/.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ linters-settings:
6060
# Other frequently used deps
6161
- pkg: github.com/ovn-kubernetes/libovsdb/ovsdb
6262
alias: ""
63+
- pkg: github.com/ovn-org/ovn-kubernetes/go-controller/pkg/node/util
64+
alias: nodeutil
65+
- pkg: github.com/ovn-org/ovn-kubernetes/go-controller/pkg/node/types
66+
alias: nodetypes
6367

6468
revive:
6569
rules:

go-controller/go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/google/uuid v1.6.0
2424
github.com/gorilla/mux v1.8.0
2525
github.com/k8snetworkplumbingwg/govdpa v0.1.5-0.20230926073613-07c1031aea47
26-
github.com/k8snetworkplumbingwg/ipamclaims v0.4.0-alpha
26+
github.com/k8snetworkplumbingwg/ipamclaims v0.5.0-alpha
2727
github.com/k8snetworkplumbingwg/multi-networkpolicy v1.0.1
2828
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.6.0
2929
github.com/k8snetworkplumbingwg/sriovnet v1.2.1-0.20230427090635-4929697df2dc
@@ -57,9 +57,9 @@ require (
5757
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
5858
gopkg.in/gcfg.v1 v1.2.3
5959
gopkg.in/natefinch/lumberjack.v2 v2.2.1
60-
k8s.io/api v0.32.3
61-
k8s.io/apimachinery v0.32.3
62-
k8s.io/client-go v0.32.3
60+
k8s.io/api v0.32.5
61+
k8s.io/apimachinery v0.32.5
62+
k8s.io/client-go v0.32.5
6363
k8s.io/component-helpers v0.32.3
6464
k8s.io/klog/v2 v2.130.1
6565
k8s.io/kubernetes v1.32.6
@@ -125,7 +125,7 @@ require (
125125
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
126126
go.opencensus.io v0.24.0 // indirect
127127
golang.org/x/crypto v0.36.0 // indirect
128-
golang.org/x/oauth2 v0.23.0 // indirect
128+
golang.org/x/oauth2 v0.27.0 // indirect
129129
golang.org/x/term v0.30.0 // indirect
130130
golang.org/x/text v0.23.0 // indirect
131131
golang.org/x/tools v0.26.0 // indirect

go-controller/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2/go.mod h1:kE8gK5X0CIm
494494
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
495495
github.com/k8snetworkplumbingwg/govdpa v0.1.5-0.20230926073613-07c1031aea47 h1:iSncnlC+rtlNOIpPa3fbqQMhpTscGJIlkiWaPl1VcS4=
496496
github.com/k8snetworkplumbingwg/govdpa v0.1.5-0.20230926073613-07c1031aea47/go.mod h1:SPaDIyUmwN03Bgn0u/mhoiE4o/+koeKh11VUsdsUX0U=
497-
github.com/k8snetworkplumbingwg/ipamclaims v0.4.0-alpha h1:ss+EP77GlQmh90hGKpnAG4Q3VVxRlB7GoncemaPtO4g=
498-
github.com/k8snetworkplumbingwg/ipamclaims v0.4.0-alpha/go.mod h1:qlR+sKxQ2OGfwhFCuXSd7rJ/GgC38vQBeHKQ7f2YnpI=
497+
github.com/k8snetworkplumbingwg/ipamclaims v0.5.0-alpha h1:b3iHeks/KTzhG2dNanaUZcFEJwJbYBZY16jxCaVv9i8=
498+
github.com/k8snetworkplumbingwg/ipamclaims v0.5.0-alpha/go.mod h1:MGaMX1tJ7MlHDee4/xmqp3guQh+eDiuCLAauqD9K11Q=
499499
github.com/k8snetworkplumbingwg/multi-networkpolicy v1.0.1 h1:Egj1hEVYNXWFlKpgzAXxe/2o8VNiVcAJLrKzlinILQo=
500500
github.com/k8snetworkplumbingwg/multi-networkpolicy v1.0.1/go.mod h1:kEJ4WM849yNmXekuSXLRwb+LaZ9usC06O8JgoAIq+f4=
501501
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.6.0 h1:BT3ghAY0q7lWib9rz+tVXDFkm27dJV6SLCn7TunZwo4=
@@ -945,8 +945,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ
945945
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
946946
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
947947
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
948-
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
949-
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
948+
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
949+
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
950950
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
951951
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
952952
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1317,26 +1317,26 @@ k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ=
13171317
k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8=
13181318
k8s.io/api v0.22.7/go.mod h1:7hejA1BgBEiSsWljUyRkIjj+AISXO16IwsaDgFjJsQE=
13191319
k8s.io/api v0.23.3/go.mod h1:w258XdGyvCmnBj/vGzQMj6kzdufJZVUwEM1U2fRJwSQ=
1320-
k8s.io/api v0.32.3 h1:Hw7KqxRusq+6QSplE3NYG4MBxZw1BZnq4aP4cJVINls=
1321-
k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k=
1320+
k8s.io/api v0.32.5 h1:uqjjsYo1kTJr5NIcoIaP9F+TgXgADH7nKQx91FDAhtk=
1321+
k8s.io/api v0.32.5/go.mod h1:bXXFU3fGCZ/eFMZvfHZC69PeGbXEL4zzjuPVzOxHF64=
13221322
k8s.io/apiextensions-apiserver v0.32.3 h1:4D8vy+9GWerlErCwVIbcQjsWunF9SUGNu7O7hiQTyPY=
13231323
k8s.io/apiextensions-apiserver v0.32.3/go.mod h1:8YwcvVRMVzw0r1Stc7XfGAzB/SIVLunqApySV5V7Dss=
13241324
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
13251325
k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
13261326
k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc=
13271327
k8s.io/apimachinery v0.22.7/go.mod h1:ZvVLP5iLhwVFg2Yx9Gh5W0um0DUauExbRhe+2Z8I1EU=
13281328
k8s.io/apimachinery v0.23.3/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
1329-
k8s.io/apimachinery v0.32.3 h1:JmDuDarhDmA/Li7j3aPrwhpNBA94Nvk5zLeOge9HH1U=
1330-
k8s.io/apimachinery v0.32.3/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
1329+
k8s.io/apimachinery v0.32.5 h1:6We3aJ6crC0ap8EhsEXcgX3LpI6SEjubpiOMXLROwPM=
1330+
k8s.io/apimachinery v0.32.5/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
13311331
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
13321332
k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM=
13331333
k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q=
13341334
k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y=
13351335
k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k=
13361336
k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0=
13371337
k8s.io/client-go v0.22.7/go.mod h1:pGU/tWSzzvsYT7M3npHhoZ3Jh9qJTTIvFvDtWuW31dw=
1338-
k8s.io/client-go v0.32.3 h1:RKPVltzopkSgHS7aS98QdscAgtgah/+zmpAogooIqVU=
1339-
k8s.io/client-go v0.32.3/go.mod h1:3v0+3k4IcT9bXTc4V2rt+d2ZPPG700Xy6Oi0Gdl2PaY=
1338+
k8s.io/client-go v0.32.5 h1:huFmQMzgWu0z4kbWsuZci+Gt4Fo72I4CcrvhToZ/Qp0=
1339+
k8s.io/client-go v0.32.5/go.mod h1:Qchw6f9WIVrur7DKojAHpRgGLcANT0RLIvF39Jz58xA=
13401340
k8s.io/code-generator v0.22.7/go.mod h1:iOZwYADSgFPNGWfqHFfg1V0TNJnl1t0WyZluQp4baqU=
13411341
k8s.io/code-generator v0.23.3/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
13421342
k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=

go-controller/pkg/clustermanager/routeadvertisements/controller.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,18 @@ func (c *Controller) updateRAStatus(ra *ratypes.RouteAdvertisements, hadUpdates
951951
return nil
952952
}
953953

954+
var updateStatus bool
954955
condition := meta.FindStatusCondition(ra.Status.Conditions, "Accepted")
955-
updateStatus := hadUpdates || condition == nil || condition.ObservedGeneration != ra.Generation
956-
updateStatus = updateStatus || err != nil
957-
956+
switch {
957+
case condition == nil:
958+
fallthrough
959+
case condition.ObservedGeneration != ra.Generation:
960+
fallthrough
961+
case (err == nil) != (condition.Status == metav1.ConditionTrue):
962+
fallthrough
963+
case hadUpdates:
964+
updateStatus = true
965+
}
958966
if !updateStatus {
959967
return nil
960968
}

go-controller/pkg/clustermanager/routeadvertisements/controller_test.go

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type testRA struct {
4747
SelectsDefault bool
4848
AdvertisePods bool
4949
AdvertiseEgressIPs bool
50+
Status *metav1.ConditionStatus
5051
}
5152

5253
func (tra testRA) RouteAdvertisements() *ratypes.RouteAdvertisements {
@@ -92,6 +93,9 @@ func (tra testRA) RouteAdvertisements() *ratypes.RouteAdvertisements {
9293
MatchLabels: tra.FRRConfigurationSelector,
9394
}
9495
}
96+
if tra.Status != nil {
97+
ra.Status.Conditions = []metav1.Condition{{Type: "Accepted", Status: *tra.Status}}
98+
}
9599
return ra
96100
}
97101

@@ -776,6 +780,38 @@ func TestController_reconcile(t *testing.T) {
776780
},
777781
expectNADAnnotations: map[string]map[string]string{"default": {types.OvnRouteAdvertisementsKey: "[\"ra\"]"}, "red": {types.OvnRouteAdvertisementsKey: "[\"ra\"]"}},
778782
},
783+
{
784+
name: "reconciles RouteAdvertisements status even when no other updates are required",
785+
ra: &testRA{Name: "ra", AdvertisePods: true, AdvertiseEgressIPs: true, SelectsDefault: true, Status: ptr.To(metav1.ConditionFalse)},
786+
frrConfigs: []*testFRRConfig{
787+
{
788+
Name: "frrConfig",
789+
Namespace: frrNamespace,
790+
Routers: []*testRouter{
791+
{ASN: 1, Prefixes: []string{"1.1.1.0/24"}, Neighbors: []*testNeighbor{
792+
{ASN: 1, Address: "1.0.0.100"},
793+
}},
794+
},
795+
},
796+
{
797+
Labels: map[string]string{types.OvnRouteAdvertisementsKey: "ra"},
798+
Annotations: map[string]string{types.OvnRouteAdvertisementsKey: "ra/frrConfig/node"},
799+
NodeSelector: map[string]string{"kubernetes.io/hostname": "node"},
800+
Routers: []*testRouter{
801+
{ASN: 1, Prefixes: []string{"1.0.1.1/32", "1.1.0.0/24"}, Neighbors: []*testNeighbor{
802+
{ASN: 1, Address: "1.0.0.100", Advertise: []string{"1.0.1.1/32", "1.1.0.0/24"}, Receive: []string{"1.1.0.0/16/24"}},
803+
}},
804+
},
805+
},
806+
},
807+
nads: []*testNAD{
808+
{Name: "default", Namespace: "ovn-kubernetes", Network: "default", Annotations: map[string]string{types.OvnRouteAdvertisementsKey: "[\"ra\"]"}},
809+
},
810+
nodes: []*testNode{{Name: "node", SubnetsAnnotation: "{\"default\":\"1.1.0.0/24\"}"}},
811+
eips: []*testEIP{{Name: "eip", EIPs: map[string]string{"node": "1.0.1.1"}}},
812+
reconcile: "ra",
813+
expectAcceptedStatus: metav1.ConditionTrue,
814+
},
779815
{
780816
name: "fails to reconcile a secondary network",
781817
ra: &testRA{Name: "ra", AdvertisePods: true, NetworkSelector: map[string]string{"selected": "true"}},
@@ -1005,11 +1041,6 @@ func TestController_reconcile(t *testing.T) {
10051041

10061042
c := NewController(nm.Interface(), wf, fakeClientset)
10071043

1008-
// prime the default network NAD
1009-
if defaultNAD == nil {
1010-
defaultNAD, err = c.getOrCreateDefaultNetworkNAD()
1011-
g.Expect(err).ToNot(gomega.HaveOccurred())
1012-
}
10131044
// prime the default network NAD namespace
10141045
namespace := &corev1.Namespace{
10151046
ObjectMeta: metav1.ObjectMeta{
@@ -1018,11 +1049,15 @@ func TestController_reconcile(t *testing.T) {
10181049
}
10191050
_, err = fakeClientset.KubeClient.CoreV1().Namespaces().Create(context.Background(), namespace, metav1.CreateOptions{})
10201051
g.Expect(err).ToNot(gomega.HaveOccurred())
1021-
1022-
// update it with the annotation that network manager would set
1023-
defaultNAD.Annotations = map[string]string{types.OvnNetworkNameAnnotation: types.DefaultNetworkName}
1024-
_, err = fakeClientset.NetworkAttchDefClient.K8sCniCncfIoV1().NetworkAttachmentDefinitions(defaultNAD.Namespace).Update(context.Background(), defaultNAD, metav1.UpdateOptions{})
1025-
g.Expect(err).ToNot(gomega.HaveOccurred())
1052+
// prime the default network NAD
1053+
if defaultNAD == nil {
1054+
defaultNAD, err = c.getOrCreateDefaultNetworkNAD()
1055+
g.Expect(err).ToNot(gomega.HaveOccurred())
1056+
// update it with the annotation that network manager would set
1057+
defaultNAD.Annotations = map[string]string{types.OvnNetworkNameAnnotation: types.DefaultNetworkName}
1058+
_, err = fakeClientset.NetworkAttchDefClient.K8sCniCncfIoV1().NetworkAttachmentDefinitions(defaultNAD.Namespace).Update(context.Background(), defaultNAD, metav1.UpdateOptions{})
1059+
g.Expect(err).ToNot(gomega.HaveOccurred())
1060+
}
10261061

10271062
err = wf.Start()
10281063
g.Expect(err).ToNot(gomega.HaveOccurred())
@@ -1039,7 +1074,13 @@ func TestController_reconcile(t *testing.T) {
10391074
)
10401075

10411076
err = nm.Start()
1042-
g.Expect(err).ToNot(gomega.HaveOccurred())
1077+
// some test cases start with a bad RA status, avoid asserting
1078+
// initial sync in this case as it will fail
1079+
if tt.ra == nil || tt.ra.Status == nil || *tt.ra.Status == metav1.ConditionTrue {
1080+
g.Expect(err).ToNot(gomega.HaveOccurred())
1081+
} else {
1082+
g.Expect(err).To(gomega.HaveOccurred())
1083+
}
10431084
// we just need the inital sync
10441085
nm.Stop()
10451086

0 commit comments

Comments
 (0)