Skip to content

Commit

Permalink
Merge pull request #1190 from kmesh-bot/cherry-pick-1188-to-release-1.0
Browse files Browse the repository at this point in the history
[release-1.0] fix Update mode failed
kmesh-bot authored Jan 15, 2025
2 parents b2ea67a + c868af4 commit 96e1830
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/bpf/bpf.go
Original file line number Diff line number Diff line change
@@ -188,11 +188,14 @@ func (l *BpfLoader) Stop() {

func NewVersionMap(config *options.BpfConfig) *ebpf.Map {
var versionPath string
var kmBpfPath string
var versionMap *ebpf.Map
if config.KernelNativeEnabled() {
versionPath = filepath.Join(config.BpfFsPath, constants.VersionPath)
kmBpfPath = filepath.Join(config.BpfFsPath, constants.KmKernelNativeBpfPath)
} else if config.DualEngineEnabled() {
versionPath = filepath.Join(config.BpfFsPath, constants.WorkloadVersionPath)
kmBpfPath = filepath.Join(config.BpfFsPath, constants.KmDualEngineBpfPath)
}

versionMapPinPath := filepath.Join(versionPath, "kmesh_version")
@@ -214,7 +217,7 @@ func NewVersionMap(config *options.BpfConfig) *ebpf.Map {
}

// Make sure the directory about to use is clean
err = os.RemoveAll(versionPath)
err = os.RemoveAll(kmBpfPath)
if err != nil {
log.Errorf("Clean bpf maps and progs failed, err is:%v", err)
return nil
3 changes: 3 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
@@ -73,6 +73,9 @@ const (
VersionPath = "/bpf_kmesh/map/"
WorkloadVersionPath = "/bpf_kmesh_workload/map/"

KmKernelNativeBpfPath = "/bpf_kmesh"
KmDualEngineBpfPath = "/bpf_kmesh_workload"

TailCallMap = "tail_call_map"
Prog_link = "prog_link"

0 comments on commit 96e1830

Please sign in to comment.