Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

policy: remove disable-per-package-lb config #718

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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

Check warning on line 76 in cmd/terway-cli/cni_linux.go

View check run for this annotation

Codecov / codecov/patch

cmd/terway-cli/cni_linux.go#L67-L76

Added lines #L67 - L76 were not covered by tests
}
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 @@
ciliumArgs = append(ciliumArgs, extractArgs(h.CiliumExtraArgs)...)
}

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

Check warning on line 290 in cmd/terway-cli/policy.go

View check run for this annotation

Codecov / codecov/patch

cmd/terway-cli/policy.go#L287-L290

Added lines #L287 - L290 were not covered by tests

// 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

Check warning on line 297 in cmd/terway-cli/policy.go

View check run for this annotation

Codecov / codecov/patch

cmd/terway-cli/policy.go#L293-L297

Added lines #L293 - L297 were not covered by tests
})
return ciliumArgs, nil
}

Expand Down
Loading