-
Notifications
You must be signed in to change notification settings - Fork 136
kernel-native mode support restart #987
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
Conversation
Signed-off-by: lec-bit <glfhmzmy@126.com>
pkg/bpf/ads/sock_ops.go
Outdated
| // pin bpf_link and bpf_tail_call map | ||
| // pin bpf_link, after restart, update prog in bpf_link | ||
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independent | ||
| mapPinPath := filepath.Join(sc.Info.BpfFsPath, "sockops_tail_call_map") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can define the path name as a constant in the constant.go file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
pkg/bpf/utils/bpf_helper.go
Outdated
| func BpfMapDeleteByPinPath(bpfFsPath string) error { | ||
| progMap, err := ebpf.LoadPinnedMap(bpfFsPath, nil) | ||
| if err != nil { | ||
| return fmt.Errorf("loadPinnedProgram failed for %s: %v", bpfFsPath, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoadPinnedProgram or LoadPinnedMap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoadPinnedMap here, a type of ebpf_map of BPF_MAP_TYPE_PROG_ARRAY ,I am wrong in log, will fix
pkg/bpf/utils/bpf_helper.go
Outdated
| func BpfMapDeleteByPinPath(bpfFsPath string) error { | ||
| progMap, err := ebpf.LoadPinnedMap(bpfFsPath, nil) | ||
| if err != nil { | ||
| return fmt.Errorf("loadPinnedProgram failed for %s: %v", bpfFsPath, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps your error message should carry more information, such as the circumstances under which this error occurred.
fmt.Errorf("loadPinnedProgram failed for %s: %v, when kmesh delete by pin path", bpfFsPath, err)
pkg/bpf/ads/trace_point.go
Outdated
| sc.Link = lk | ||
| pinPath := filepath.Join(sc.Info.BpfFsPath, "trace_point_link") | ||
| if restart.GetStartType() == restart.Restart { | ||
| lk, err := link.LoadPinnedLink(pinPath, &ebpf.LoadPinOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| lk, err := link.LoadPinnedLink(pinPath, &ebpf.LoadPinOptions{}) | |
| sc.Link, err := link.LoadPinnedLink(pinPath, &ebpf.LoadPinOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
pkg/bpf/ads/loader_enhanced.go
Outdated
| sc := &BpfAds{} | ||
| sc.TracePoint.NewBpf(cfg) | ||
| if err := sc.TracePoint.NewBpf(cfg); err != nil { | ||
| return sc, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, return nil, err.
pkg/bpf/ads/sock_ops.go
Outdated
| if err != nil { | ||
| // pin bpf_link and bpf_tail_call map | ||
| // pin bpf_link, after restart, update prog in bpf_link | ||
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independent | |
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
Does ads has restart e2e test? |
pkg/constants/constants.go
Outdated
| VersionPath = "/bpf_kmesh/map/" | ||
| WorkloadVersionPath = "/bpf_kmesh_workload/map/" | ||
|
|
||
| Tail_call_map = "tail_call_map" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Tail_call_map = "tail_call_map" | |
| TailCallMap = "tail_call_map" |
In go, everyone uses camel naming by default.
Ads doesn't have E2E tests. |
Signed-off-by: lec-bit <glfhmzmy@126.com>
5a1aee9 to
ac73def
Compare
Signed-off-by: lec-bit <glfhmzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
1add177 to
9e9f682
Compare
|
Adding label Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
8e514ec to
976cdd2
Compare
Signed-off-by: lec-bit <glfhmzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
pkg/bpf/bpf_test.go
Outdated
| t.Run("new start", func(t *testing.T) { | ||
| runTestNormal(t) | ||
| t.Run("new start DualEengine", func(t *testing.T) { | ||
| runTestNormalDualEengine(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| runTestNormalDualEengine(t) | |
| runTestNormalDualEngine(t) |
Spelling mistakes. Check them.
pkg/controller/client.go
Outdated
| NameToLds: *c.AdsController.Processor.Cache.ListenerCache.GetListenerHashPtr(), | ||
| NameToRds: *c.AdsController.Processor.Cache.RouteCache.GetRouteHashPtr(), | ||
| } | ||
| ads.ResetPersistFile() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the hash persistence code in dual-engine mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| func (p *Processor) handleRemovedAddressesDuringRestart() { |
Signed-off-by: lec-bit <glfhzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
pkg/bpf/utils/bpf_helper.go
Outdated
| return sclink, nil | ||
| } | ||
|
|
||
| // func BpfMapDeleteByPinPath(bpfFsPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
|
/lgtm |
Signed-off-by: lec-bit <glfhzmy@126.com>
55b1935 to
5a0e629
Compare
pkg/controller/ads/ads_processor.go
Outdated
| lastNonce *lastNonce | ||
| // the channel used to send domains to dns resolver. key is domain name and value is refreshrate | ||
| DnsResolverChan chan []*config_cluster_v3.Cluster | ||
| once [3]sync.Once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks tricky.
pkg/controller/ads/ads_hash.go
Outdated
| } | ||
|
|
||
| // Should only be used by test | ||
| func ResetPersistFile() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel remove is clearer than reset
| func (l *BpfLoader) Stop() { | ||
| var err error | ||
| if restart.GetExitType() == restart.Restart && l.config.DualEngineEnabled() { | ||
| C.deserial_uninit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove C.deserial_uninit()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deserial logic is updated, and now the default C.deserial_uninit().
Signed-off-by: lec-bit <glfhzmy@126.com>
27eaacd to
f316c05
Compare
pkg/bpf/ads/sock_connection.go
Outdated
| if err != nil { | ||
| // pin bpf_tail_call map | ||
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independently | ||
| mapPinPath := filepath.Join(sc.Info.BpfFsPath, constants.TailCallMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| mapPinPath := filepath.Join(sc.Info.BpfFsPath, constants.TailCallMap) | |
| tailCallMapPinPath := filepath.Join(sc.Info.BpfFsPath, constants.TailCallMap) |
pkg/bpf/ads/sock_ops.go
Outdated
| // pin bpf_link and bpf_tail_call map | ||
| // pin bpf_link, after restart, update prog in bpf_link | ||
| // tail_call map cannot pin in SetMapPinType->LoadAndAssign, we pin them independently | ||
| mapPinPath := filepath.Join(sc.Info.BpfFsPath, constants.TailCallMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: