Skip to content

Commit

Permalink
Merge pull request #718 from l1b0k/fix/lb
Browse files Browse the repository at this point in the history
policy: remove disable-per-package-lb config
  • Loading branch information
BSWANG authored Nov 12, 2024
2 parents 964340a + c79305c commit 20d402f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/terway-cli/cni_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ func allowEBPFNetworkPolicy(require bool) (bool, error) {
func checkKernelVersion(k, major, minor int) bool {
return kernel.CheckKernelVersion(k, major, minor)
}

func isOldNode() (bool, error) {
_, err := netlink.LinkByName("cilium_net")
if err == nil {
fmt.Printf("link cilium_net exist\n")
return true, nil
}
if !errors.As(err, &netlink.LinkNotFoundError{}) {
return false, err
}
return false, nil
}
4 changes: 4 additions & 0 deletions cmd/terway-cli/cni_unsupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ func checkKernelVersion(k, major, minor int) bool {
func allowEBPFNetworkPolicy(enable bool) (bool, error) {
return enable, nil
}

func isOldNode() (bool, error) {
return false, nil
}
12 changes: 12 additions & 0 deletions cmd/terway-cli/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,18 @@ func policyConfig(container *gabs.Container) ([]string, error) {
ciliumArgs = append(ciliumArgs, extractArgs(h.CiliumExtraArgs)...)
}

old, err := isOldNode()
if err != nil {
return nil, err
}

// check the extra args
lo.Filter(ciliumArgs, func(item string, index int) bool {
if strings.Contains(item, "disable-per-package-lb") {
return old
}
return true
})
return ciliumArgs, nil
}

Expand Down

0 comments on commit 20d402f

Please sign in to comment.