@@ -322,19 +322,39 @@ func (r *ClTcProgramReconciler) getExpectedLinks(ctx context.Context, attachInfo
322322 }
323323 } else {
324324 for _ , iface := range interfaces {
325- link := bpfmaniov1alpha1.ClTcAttachInfoState {
326- AttachInfoStateCommon : bpfmaniov1alpha1.AttachInfoStateCommon {
327- ShouldAttach : true ,
328- UUID : uuid .New ().String (),
329- LinkId : nil ,
330- LinkStatus : bpfmaniov1alpha1 .ApAttachNotAttached ,
331- },
332- InterfaceName : iface ,
333- Priority : attachInfo .Priority ,
334- Direction : attachInfo .Direction ,
335- ProceedOn : attachInfo .ProceedOn ,
325+ netnsList := getInterfaceNetNsList (& attachInfo .InterfaceSelector , iface , r .Interfaces )
326+ if len (netnsList ) == 0 {
327+ link := bpfmaniov1alpha1.ClTcAttachInfoState {
328+ AttachInfoStateCommon : bpfmaniov1alpha1.AttachInfoStateCommon {
329+ ShouldAttach : true ,
330+ UUID : uuid .New ().String (),
331+ LinkId : nil ,
332+ LinkStatus : bpfmaniov1alpha1 .ApAttachNotAttached ,
333+ },
334+ InterfaceName : iface ,
335+ Priority : attachInfo .Priority ,
336+ Direction : attachInfo .Direction ,
337+ ProceedOn : attachInfo .ProceedOn ,
338+ }
339+ nodeLinks = append (nodeLinks , link )
340+ } else {
341+ for _ , netns := range netnsList [iface ] {
342+ link := bpfmaniov1alpha1.ClTcAttachInfoState {
343+ AttachInfoStateCommon : bpfmaniov1alpha1.AttachInfoStateCommon {
344+ ShouldAttach : true ,
345+ UUID : uuid .New ().String (),
346+ LinkId : nil ,
347+ LinkStatus : bpfmaniov1alpha1 .ApAttachNotAttached ,
348+ },
349+ InterfaceName : iface ,
350+ Priority : attachInfo .Priority ,
351+ Direction : attachInfo .Direction ,
352+ ProceedOn : attachInfo .ProceedOn ,
353+ NetnsPath : netns ,
354+ }
355+ nodeLinks = append (nodeLinks , link )
356+ }
336357 }
337- nodeLinks = append (nodeLinks , link )
338358 }
339359 }
340360
0 commit comments