Skip to content

Commit 0bca3f2

Browse files
committed
fixup! Update pkg/liqo-controller-manager/internal-network/route/k8s.go
1 parent fbb5132 commit 0bca3f2

File tree

5 files changed

+46
-5
lines changed

5 files changed

+46
-5
lines changed

cmd/liqo-controller-manager/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ func main() {
715715
os.Exit(1)
716716
}
717717

718-
719718
wgServerRec := wggatewaycontrollers.NewWgGatewayServerReconciler(
720719
mgr.GetClient(), mgr.GetScheme(), auxmgrExtNetworkPods.GetClient(), wgGatewayServerClusterRoleName)
721720
if err = wgServerRec.SetupWithManager(mgr); err != nil {

pkg/liqo-controller-manager/internal-network/route/k8s.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func forgeRoutePodDeleteFunction(pod *corev1.Pod, routecfg *networkingv1alpha1.R
110110

111111
if existingroute, exists := routeContainsPod(pod, &routecfg.Spec.Table.Rules[0]); exists {
112112
routecfg.Spec.Table.Rules[0].Routes = slices.DeleteFunc(routecfg.Spec.Table.Rules[0].Routes, func(r networkingv1alpha1.Route) bool {
113-
113+
114114
return r.Dst == existingroute.Dst
115115
})
116116
}

pkg/route/routeconfiguration_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (r *RouteConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error
177177
if err != nil {
178178
return err
179179
}
180-
180+
181181
return ctrl.NewControllerManagedBy(mgr).
182182
For(&networkingv1alpha1.RouteConfiguration{}, builder.WithPredicates(filterByLabelsPredicate)).
183183
Complete(r)

pkg/utils/geneve/netlink.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"net"
2020

2121
"github.com/vishvananda/netlink"
22+
23+
"github.com/liqotech/liqo/pkg/utils/kernel"
2224
)
2325

2426
// EnsureGeneveInterfacePresence ensures that a geneve interface exists for the given internal node.
@@ -31,12 +33,16 @@ func EnsureGeneveInterfacePresence(interfaceName, localIP, remoteIP string, id u
3133
}
3234
remoteIPNet = remoteIPsNet[0]
3335
}
34-
return CreateGeneveInterface(interfaceName,
36+
if err := CreateGeneveInterface(interfaceName,
3537
net.ParseIP(localIP),
3638
remoteIPNet,
3739
id,
3840
enableARP,
39-
)
41+
); err != nil {
42+
return err
43+
}
44+
45+
return kernel.EnableProxyARP(interfaceName)
4046
}
4147

4248
// EnsureGeneveInterfaceAbsence ensures that a geneve interface does not exist for the given internal node.

pkg/utils/kernel/proxyarp.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2019-2024 The Liqo Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package kernel
16+
17+
import "os"
18+
19+
func generateARPFileName(ifname string) string {
20+
return "/proc/sys/net/ipv4/conf/" + ifname + "/proxy_arp"
21+
}
22+
23+
// EnableProxyARP enables proxy ARP on the host.
24+
// It writes 1 to /proc/sys/net/ipv4/conf/all/proxy_arp.
25+
func EnableProxyARP(ifname string) error {
26+
file, err := os.OpenFile(generateARPFileName(ifname), os.O_WRONLY, 0o600)
27+
if err != nil {
28+
return err
29+
}
30+
defer file.Close()
31+
32+
if _, err := file.WriteString("1\n"); err != nil {
33+
return err
34+
}
35+
return nil
36+
}

0 commit comments

Comments
 (0)