Skip to content

Commit 215e6e0

Browse files
aledbfkylos101
authored andcommitted
Override network mtu value
1 parent b6f313b commit 215e6e0

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

go.mod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ require (
6161
tags.cncf.io/container-device-interface v1.0.0
6262
)
6363

64+
require github.com/vishvananda/netlink v1.3.1-0.20240922070040-084abd93d350
65+
6466
require (
6567
dario.cat/mergo v1.0.1 // indirect
6668
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
@@ -168,6 +170,7 @@ require (
168170
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect
169171
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
170172
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
173+
github.com/vishvananda/netns v0.0.5 // indirect
171174
github.com/x448/float16 v0.8.4 // indirect
172175
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
173176
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
@@ -205,3 +208,12 @@ require (
205208
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
206209
sigs.k8s.io/yaml v1.4.0 // indirect
207210
)
211+
212+
replace (
213+
// Override for e2e tests
214+
github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7
215+
216+
// v1.2.1-beta.2 is the latest version, override to use v1.1.0 to avoid beta
217+
// https://github.com/vishvananda/netlink/compare/v1.1.0...v1.2.1-beta.2
218+
github.com/vishvananda/netlink => github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
219+
)

go.sum

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,11 @@ github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab h1:H6aJ0yKQ0gF49Q
486486
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc=
487487
github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23envGs=
488488
github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI=
489+
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 h1:+UB2BJA852UkGH42H+Oee69djmxS3ANzl2b/JtT1YiA=
490+
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
491+
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
492+
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
493+
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
489494
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
490495
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
491496
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -587,6 +592,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
587592
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
588593
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
589594
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
595+
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
596+
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
590597
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
591598
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
592599
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

pkg/compose/create.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"github.com/docker/docker/errdefs"
4949
"github.com/docker/go-connections/nat"
5050
"github.com/sirupsen/logrus"
51+
"github.com/vishvananda/netlink"
5152
cdi "tags.cncf.io/container-device-interface/pkg/parser"
5253
)
5354

@@ -1349,6 +1350,18 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, project *ty
13491350
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
13501351
}
13511352

1353+
// override MTU value and set custom MTU one.
1354+
// This is required for gitpod.io due to the veth change
1355+
// https://github.com/gitpod-io/gitpod/pull/8955
1356+
if createOpts.Options == nil {
1357+
createOpts.Options = make(map[string]string)
1358+
}
1359+
1360+
netIface, err := netlink.LinkByName("ceth0")
1361+
if err == nil {
1362+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1363+
}
1364+
13521365
networkEventName := fmt.Sprintf("Network %s", n.Name)
13531366
w := progress.ContextWriter(ctx)
13541367
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)