opensergo / opensergo-control-plane

Universal cloud-native microservice governance control plane (微服务治理控制面)
Apache License 2.0
35 stars 23 forks source link

[BUG] CRDWatcher does not correctly match AppName when processing CRD resources #35

Closed YunWZ closed 1 year ago

YunWZ commented 1 year ago

Issue Description

Type: bug report Regarding the code below:

//This method requires an AppName as a parameter
func (r *CRDWatcher) HasAnySubscribedOfApp(app string) bool {
    r.updateMux.RLock()
    defer r.updateMux.RUnlock()

    _, exist := r.subscribedApps[app]
    return exist
}

func (r *CRDWatcher) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
        //The actual parameter here is a namespace rather than an AppName
    if r.HasAnySubscribedOfApp(req.Namespace) {
        // Ignore unmatched namespace
        return ctrl.Result{Requeue: false, RequeueAfter: 0}, nil
    }
        //...
}

Describe what happened

Describe what you expected to happen

HasAnySubscribedOfApp should correctly match the App

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

Anything else we need to know?