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 4c6d933
Showing 1 changed file with 3 additions and 2 deletions.
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)
})

Check warning on line 666 in pkg/controller/workload/workload_processor.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/workload/workload_processor.go#L664-L666

Added lines #L664 - L666 were not covered by tests
return nil
Expand Down

0 comments on commit 4c6d933

Please sign in to comment.