Skip to content

Commit 6164822

Browse files
Merge pull request #1508 from janosi/sctp-hostport
Remove the protocol filter from the HostPort management
2 parents b661ad7 + 479dfba commit 6164822

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

pkg/server/sandbox_run.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,6 @@ func toCNIPortMappings(criPortMappings []*runtime.PortMapping) []cni.PortMapping
414414
if mapping.HostPort <= 0 {
415415
continue
416416
}
417-
if mapping.Protocol != runtime.Protocol_TCP && mapping.Protocol != runtime.Protocol_UDP {
418-
continue
419-
}
420417
portMappings = append(portMappings, cni.PortMapping{
421418
HostPort: mapping.HostPort,
422419
ContainerPort: mapping.ContainerPort,

pkg/server/sandbox_run_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ func TestToCNIPortMappings(t *testing.T) {
175175
HostPort: 8765,
176176
HostIp: "126.125.124.123",
177177
},
178+
{
179+
Protocol: runtime.Protocol_SCTP,
180+
ContainerPort: 1234,
181+
HostPort: 5678,
182+
HostIp: "123.124.125.126",
183+
},
178184
},
179185
cniPortMappings: []cni.PortMapping{
180186
{
@@ -189,6 +195,12 @@ func TestToCNIPortMappings(t *testing.T) {
189195
Protocol: "tcp",
190196
HostIP: "126.125.124.123",
191197
},
198+
{
199+
HostPort: 5678,
200+
ContainerPort: 1234,
201+
Protocol: "sctp",
202+
HostIP: "123.124.125.126",
203+
},
192204
},
193205
},
194206
"CRI port mapping without host port should be skipped": {
@@ -216,12 +228,6 @@ func TestToCNIPortMappings(t *testing.T) {
216228
},
217229
"CRI port mapping with unsupported protocol should be skipped": {
218230
criPortMappings: []*runtime.PortMapping{
219-
{
220-
Protocol: runtime.Protocol_SCTP,
221-
ContainerPort: 1234,
222-
HostPort: 5678,
223-
HostIp: "123.124.125.126",
224-
},
225231
{
226232
Protocol: runtime.Protocol_TCP,
227233
ContainerPort: 4321,

0 commit comments

Comments
 (0)