Skip to content

Commit 77124b8

Browse files
committed
[libovsdb/ops] Start adding option constants for ovn.
Only added 4 constants for now that are related to gateway config. Signed-off-by: Nadia Pinaeva <[email protected]>
1 parent 414e296 commit 77124b8

21 files changed

+335
-306
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package ops
2+
3+
// This is a list of options used for OVN operations.
4+
// Started with adding only some of them, feel free to continue extending this list.
5+
// Eventually we expect to have no string options in the code.
6+
const (
7+
// RequestedTnlKey can be used by LogicalSwitch, LogicalSwitchPort, LogicalRouter and LogicalRouterPort
8+
// for distributed switches/routers
9+
RequestedTnlKey = "requested-tnl-key"
10+
// RequestedChassis can be used by LogicalSwitchPort and LogicalRouterPort.
11+
// It specifies the chassis (by name or hostname) that is allowed to bind this port.
12+
RequestedChassis = "requested-chassis"
13+
// RouterPort can be used by LogicalSwitchPort to specify a connection to a logical router.
14+
RouterPort = "router-port"
15+
// GatewayMTU can be used by LogicalRouterPort to specify the MTU for the gateway port.
16+
// If set, logical flows will be added to router pipeline to check packet length.
17+
GatewayMTU = "gateway_mtu"
18+
)

go-controller/pkg/ovn/base_network_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ func (bnc *BaseNetworkController) syncNodeClusterRouterPort(node *corev1.Node, h
425425
enableGatewayMTU := util.ParseNodeGatewayMTUSupport(node)
426426
if enableGatewayMTU {
427427
lrpOptions = map[string]string{
428-
"gateway_mtu": strconv.Itoa(config.Default.MTU),
428+
libovsdbops.GatewayMTU: strconv.Itoa(config.Default.MTU),
429429
}
430430
}
431431
logicalRouterPort := nbdb.LogicalRouterPort{
@@ -560,7 +560,7 @@ func (bnc *BaseNetworkController) createNodeLogicalSwitch(nodeName string, hostS
560560
Type: "router",
561561
Addresses: []string{"router"},
562562
Options: map[string]string{
563-
"router-port": types.RouterToSwitchPrefix + switchName,
563+
libovsdbops.RouterPort: types.RouterToSwitchPrefix + switchName,
564564
},
565565
}
566566
if bnc.IsDefault() {

go-controller/pkg/ovn/base_network_controller_pods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func (bnc *BaseNetworkController) addLogicalPortToNetwork(pod *corev1.Pod, nadNa
535535
// rescheduled.
536536

537537
if !config.Kubernetes.DisableRequestedChassis {
538-
lsp.Options["requested-chassis"] = pod.Spec.NodeName
538+
lsp.Options[libovsdbops.RequestedChassis] = pod.Spec.NodeName
539539
}
540540

541541
// let's calculate if this network controller's role for this pod

go-controller/pkg/ovn/egressgw_test.go

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
2020
adminpolicybasedrouteapi "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/crd/adminpolicybasedroute/v1"
2121
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/kube"
22+
libovsdbops "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops"
2223
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb"
2324
addressset "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn/address_set"
2425
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn/controller/apbroute"
@@ -133,8 +134,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
133134
},
134135
Name: "namespace1_myPod",
135136
Options: map[string]string{
136-
"iface-id-ver": "myPod",
137-
"requested-chassis": "node1",
137+
"iface-id-ver": "myPod",
138+
libovsdbops.RequestedChassis: "node1",
138139
},
139140
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
140141
},
@@ -169,8 +170,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
169170
},
170171
Name: "namespace1_myPod",
171172
Options: map[string]string{
172-
"iface-id-ver": "myPod",
173-
"requested-chassis": "node1",
173+
"iface-id-ver": "myPod",
174+
libovsdbops.RequestedChassis: "node1",
174175
},
175176
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
176177
},
@@ -273,8 +274,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
273274
},
274275
Name: "namespace1_myPod",
275276
Options: map[string]string{
276-
"iface-id-ver": "myPod",
277-
"requested-chassis": "node1",
277+
"iface-id-ver": "myPod",
278+
libovsdbops.RequestedChassis: "node1",
278279
},
279280
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
280281
},
@@ -309,8 +310,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
309310
},
310311
Name: "namespace1_myPod",
311312
Options: map[string]string{
312-
"iface-id-ver": "myPod",
313-
"requested-chassis": "node1",
313+
"iface-id-ver": "myPod",
314+
libovsdbops.RequestedChassis: "node1",
314315
},
315316
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
316317
},
@@ -417,8 +418,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
417418
},
418419
Name: "namespace1_myPod",
419420
Options: map[string]string{
420-
"iface-id-ver": "myPod",
421-
"requested-chassis": "node1",
421+
"iface-id-ver": "myPod",
422+
libovsdbops.RequestedChassis: "node1",
422423
},
423424
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
424425
},
@@ -463,8 +464,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
463464
},
464465
Name: "namespace1_myPod",
465466
Options: map[string]string{
466-
"iface-id-ver": "myPod",
467-
"requested-chassis": "node1",
467+
"iface-id-ver": "myPod",
468+
libovsdbops.RequestedChassis: "node1",
468469
},
469470
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
470471
},
@@ -895,8 +896,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
895896
},
896897
Name: "namespace1_myPod",
897898
Options: map[string]string{
898-
"iface-id-ver": "myPod",
899-
"requested-chassis": "node1",
899+
"iface-id-ver": "myPod",
900+
libovsdbops.RequestedChassis: "node1",
900901
},
901902
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
902903
},
@@ -966,8 +967,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
966967
},
967968
Name: "namespace1_myPod",
968969
Options: map[string]string{
969-
"iface-id-ver": "myPod",
970-
"requested-chassis": "node1",
970+
"iface-id-ver": "myPod",
971+
libovsdbops.RequestedChassis: "node1",
971972
},
972973
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
973974
},
@@ -1076,8 +1077,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
10761077
},
10771078
Name: "namespace1_myPod",
10781079
Options: map[string]string{
1079-
"iface-id-ver": "myPod",
1080-
"requested-chassis": "node1",
1080+
"iface-id-ver": "myPod",
1081+
libovsdbops.RequestedChassis: "node1",
10811082
},
10821083
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
10831084
},
@@ -1116,8 +1117,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
11161117
},
11171118
Name: "namespace1_myPod",
11181119
Options: map[string]string{
1119-
"iface-id-ver": "myPod",
1120-
"requested-chassis": "node1",
1120+
"iface-id-ver": "myPod",
1121+
libovsdbops.RequestedChassis: "node1",
11211122
},
11221123
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
11231124
},
@@ -1237,8 +1238,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
12371238
},
12381239
Name: "namespace1_myPod",
12391240
Options: map[string]string{
1240-
"iface-id-ver": "myPod",
1241-
"requested-chassis": "node1",
1241+
"iface-id-ver": "myPod",
1242+
libovsdbops.RequestedChassis: "node1",
12421243
},
12431244
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
12441245
},
@@ -1277,8 +1278,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
12771278
},
12781279
Name: "namespace1_myPod",
12791280
Options: map[string]string{
1280-
"iface-id-ver": "myPod",
1281-
"requested-chassis": "node1",
1281+
"iface-id-ver": "myPod",
1282+
libovsdbops.RequestedChassis: "node1",
12821283
},
12831284
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
12841285
},
@@ -1408,8 +1409,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
14081409
},
14091410
Name: "namespace1_myPod",
14101411
Options: map[string]string{
1411-
"iface-id-ver": "myPod",
1412-
"requested-chassis": "node1",
1412+
"iface-id-ver": "myPod",
1413+
libovsdbops.RequestedChassis: "node1",
14131414
},
14141415
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
14151416
},
@@ -1448,8 +1449,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
14481449
},
14491450
Name: "namespace1_myPod",
14501451
Options: map[string]string{
1451-
"iface-id-ver": "myPod",
1452-
"requested-chassis": "node1",
1452+
"iface-id-ver": "myPod",
1453+
libovsdbops.RequestedChassis: "node1",
14531454
},
14541455
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
14551456
},
@@ -1589,8 +1590,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
15891590
},
15901591
Name: "namespace1_myPod",
15911592
Options: map[string]string{
1592-
"iface-id-ver": "myPod",
1593-
"requested-chassis": "node1",
1593+
"iface-id-ver": "myPod",
1594+
libovsdbops.RequestedChassis: "node1",
15941595
},
15951596
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
15961597
},
@@ -1629,8 +1630,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
16291630
},
16301631
Name: "namespace1_myPod",
16311632
Options: map[string]string{
1632-
"iface-id-ver": "myPod",
1633-
"requested-chassis": "node1",
1633+
"iface-id-ver": "myPod",
1634+
libovsdbops.RequestedChassis: "node1",
16341635
},
16351636
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
16361637
},
@@ -1662,8 +1663,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
16621663
},
16631664
Name: "namespace1_myPod",
16641665
Options: map[string]string{
1665-
"iface-id-ver": "myPod",
1666-
"requested-chassis": "node1",
1666+
"iface-id-ver": "myPod",
1667+
libovsdbops.RequestedChassis: "node1",
16671668
},
16681669
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
16691670
},
@@ -1708,8 +1709,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
17081709
},
17091710
Name: "namespace1_myPod",
17101711
Options: map[string]string{
1711-
"iface-id-ver": "myPod",
1712-
"requested-chassis": "node1",
1712+
"iface-id-ver": "myPod",
1713+
libovsdbops.RequestedChassis: "node1",
17131714
},
17141715
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
17151716
},
@@ -1742,8 +1743,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
17421743
},
17431744
Name: "namespace1_myPod",
17441745
Options: map[string]string{
1745-
"iface-id-ver": "myPod",
1746-
"requested-chassis": "node1",
1746+
"iface-id-ver": "myPod",
1747+
libovsdbops.RequestedChassis: "node1",
17471748
},
17481749
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
17491750
},
@@ -1782,8 +1783,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
17821783
},
17831784
Name: "namespace1_myPod",
17841785
Options: map[string]string{
1785-
"iface-id-ver": "myPod",
1786-
"requested-chassis": "node1",
1786+
"iface-id-ver": "myPod",
1787+
libovsdbops.RequestedChassis: "node1",
17871788
},
17881789
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
17891790
},
@@ -1896,8 +1897,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
18961897
},
18971898
Name: "namespace1_myPod",
18981899
Options: map[string]string{
1899-
"iface-id-ver": "myPod",
1900-
"requested-chassis": "node1",
1900+
"iface-id-ver": "myPod",
1901+
libovsdbops.RequestedChassis: "node1",
19011902
},
19021903
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
19031904
},
@@ -2030,8 +2031,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
20302031
},
20312032
Name: "namespace1_myPod",
20322033
Options: map[string]string{
2033-
"iface-id-ver": "myPod",
2034-
"requested-chassis": "node1",
2034+
"iface-id-ver": "myPod",
2035+
libovsdbops.RequestedChassis: "node1",
20352036
},
20362037
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
20372038
},
@@ -2171,8 +2172,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
21712172
},
21722173
Name: "namespace1_myPod",
21732174
Options: map[string]string{
2174-
"iface-id-ver": "myPod",
2175-
"requested-chassis": "node1",
2175+
"iface-id-ver": "myPod",
2176+
libovsdbops.RequestedChassis: "node1",
21762177
},
21772178
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
21782179
},
@@ -2364,8 +2365,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
23642365
},
23652366
Name: "namespace1_myPod",
23662367
Options: map[string]string{
2367-
"requested-chassis": "node1",
2368-
"iface-id-ver": "myPod",
2368+
libovsdbops.RequestedChassis: "node1",
2369+
"iface-id-ver": "myPod",
23692370
},
23702371
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
23712372
},
@@ -2546,8 +2547,8 @@ var _ = ginkgo.Describe("OVN Egress Gateway Operations", func() {
25462547
},
25472548
Name: "namespace1_myPod",
25482549
Options: map[string]string{
2549-
"requested-chassis": "node1",
2550-
"iface-id-ver": "myPod",
2550+
libovsdbops.RequestedChassis: "node1",
2551+
"iface-id-ver": "myPod",
25512552
},
25522553
PortSecurity: []string{"0a:58:0a:80:01:03 10.128.1.3"},
25532554
},

0 commit comments

Comments
 (0)