Skip to content

Commit

Permalink
add sync-once func for authz when restart
Browse files Browse the repository at this point in the history
Signed-off-by: superCharge-xsy <[email protected]>
  • Loading branch information
supercharge-xsy committed Sep 6, 2024
1 parent f83283c commit 7eb35a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/bpf/bpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func (l *BpfLoader) StartAdsMode() (err error) {
l.bpfLogLevel = l.obj.SockConn.BpfLogLevel
ret := C.deserial_init()
if ret != 0 {
l.Stop()
return fmt.Errorf("deserial_init failed:%v", ret)
}
return nil
Expand Down
1 change: 0 additions & 1 deletion pkg/bpf/bpf_kmesh_l4_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func (l *BpfLoader) StartWorkloadMode() error {

ret := C.deserial_init()
if ret != 0 {
l.Stop()
return fmt.Errorf("deserial_init failed:%v", ret)
}
l.bpfLogLevel = l.workloadObj.SockConn.BpfLogLevel
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/workload/workload_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ type Processor struct {
WorkloadCache cache.WorkloadCache
ServiceCache cache.ServiceCache

once sync.Once
once sync.Once
authzOnce sync.Once
}

func newProcessor(workloadMap bpf2go.KmeshCgroupSockWorkloadMaps) *Processor {
Expand Down Expand Up @@ -660,7 +661,7 @@ func (p *Processor) handleAuthorizationTypeResponse(rsp *service_discovery_v3.De
log.Debugf("remove authorization policy %s", resourceName)
}

p.once.Do(func() {
p.authzOnce.Do(func() {
p.handleRemovedAuthzPolicyDuringRestart(rbac)
})
return nil
Expand Down

0 comments on commit 7eb35a1

Please sign in to comment.