From 071933c9568944aded3a3d8699a2e0b28b77f18b Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Fri, 30 Jun 2023 00:30:24 +0530 Subject: [PATCH] Following up on review --- functions/onprem/orborus/orborus.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 14cb8dac..af540e93 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -214,21 +214,25 @@ func deployServiceWorkers(image string) { // Get a list of network interfaces interfaces, err := net.Interfaces() + mtu := 1500 // default docker MTU if err != nil { - panic(err) + log.Printf("[ERROR] Failed to get network interfaces: %s", err) } // Check if there is at least one interface if len(interfaces) < 2 { - panic("Insufficient network interfaces") - } + log.Printf("[ERROR] Failed to get enough network interfaces") + } else { + // Get the preferred interface + for _, iface := range interfaces { + if strings.Contains(iface.Name, "eth0") { + targetInterface := iface + mtu = targetInterface.MTU + break + } + } + } - // Get the second interface - targetInterface := interfaces[1] - mtu := targetInterface.MTU - - // Print the interface and MTU information - fmt.Printf("Target Interface: %s, MTU: %d\n", targetInterface.Name, mtu) // Create the network options with the specified MTU options := make(map[string]string) options["com.docker.network.driver.mtu"] = fmt.Sprintf("%d", mtu)