-
Notifications
You must be signed in to change notification settings - Fork 350
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
fix: many namespace lead to provider stuck #1386
Conversation
This is not correct, because informer is not started, which will not get any objects. |
Codecov Report
@@ Coverage Diff @@
## master #1386 +/- ##
=======================================
Coverage 40.47% 40.47%
=======================================
Files 78 78
Lines 7076 7076
=======================================
Hits 2864 2864
Misses 3897 3897
Partials 315 315 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Sorry for the delay.
I thinking using Labels.Nothing()
is not correct. This will not get the object.
https://pkg.go.dev/k8s.io/apimachinery/pkg/labels#Nothing
switch p.common.Config.Kubernetes.APIVersion { | ||
case config.ApisixV2beta3: | ||
retRoutes, err := p.common.KubeClient.APISIXClient.ApisixV2beta3().ApisixRoutes(ns).List(ctx, opts) | ||
retRoutes, err := p.apisixSharedInformerFactory.Apisix().V2beta3().ApisixRoutes().Lister().ApisixRoutes(ns).List(labels.Nothing()) |
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.
retRoutes, err := p.apisixSharedInformerFactory.Apisix().V2beta3().ApisixRoutes().Lister().ApisixRoutes(ns).List(labels.Nothing()) | |
retRoutes, err := p.apisixSharedInformerFactory.Apisix().V2beta3().ApisixRoutes().Lister().ApisixRoutes(ns).List(labels.Everything()) |
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.
Thanks for reminding, I'll fix it as soon as possible
@@ -93,13 +96,13 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
} | |||
} | |||
case config.ApisixV2: | |||
retRoutes, err := p.common.KubeClient.APISIXClient.ApisixV2().ApisixRoutes(ns).List(ctx, opts) | |||
retRoutes, err := p.apisixSharedInformerFactory.Apisix().V2().ApisixRoutes().Lister().ApisixRoutes(ns).List(labels.Nothing()) |
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.
@@ -138,13 +141,13 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
switch p.common.Config.Kubernetes.APIVersion { | |||
case config.ApisixV2beta3: | |||
// ApisixConsumer | |||
retConsumer, err := p.common.KubeClient.APISIXClient.ApisixV2beta3().ApisixConsumers(ns).List(ctx, opts) | |||
retConsumer, err := p.apisixSharedInformerFactory.Apisix().V2beta3().ApisixConsumers().Lister().ApisixConsumers(ns).List(labels.Nothing()) |
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.
@@ -154,13 +157,13 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
} | |||
} | |||
// ApisixTls | |||
retSSL, err := p.common.KubeClient.APISIXClient.ApisixV2beta3().ApisixTlses(ns).List(ctx, opts) | |||
retSSL, err := p.apisixSharedInformerFactory.Apisix().V2beta3().ApisixTlses().Lister().ApisixTlses(ns).List(labels.Nothing()) |
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.
@@ -171,13 +174,13 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
} | |||
case config.ApisixV2: | |||
// ApisixConsumer | |||
retConsumer, err := p.common.KubeClient.APISIXClient.ApisixV2().ApisixConsumers(ns).List(ctx, opts) | |||
retConsumer, err := p.apisixSharedInformerFactory.Apisix().V2().ApisixConsumers().Lister().ApisixConsumers(ns).List(labels.Nothing()) |
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.
@@ -187,13 +190,13 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
} | |||
} | |||
// ApisixTls | |||
retSSL, err := p.common.KubeClient.APISIXClient.ApisixV2().ApisixTlses(ns).List(ctx, opts) | |||
retSSL, err := p.apisixSharedInformerFactory.Apisix().V2().ApisixTlses().Lister().ApisixTlses(ns).List(labels.Nothing()) |
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.
We have a lot of What do you think? |
@@ -48,23 +48,26 @@ func (p *apisixProvider) Init(ctx context.Context) error { | |||
pluginConfigMapA6 = make(map[string]string) | |||
) | |||
|
|||
p.apisixSharedInformerFactory.Start(ctx.Done()) | |||
p.apisixSharedInformerFactory.WaitForCacheSync(ctx.Done()) |
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.
I think we should check its return value, and log it.
synced := p.apisixSharedInformerFactory.WaitForCacheSync(ctx.Done())
for v, ok := range synced {
if !ok {
// Log it and return
}
}
Sorry, I forgot to reply you. I think so. Meanwhile, I think it can be done in a follow-up PR |
Type of change:
What this PR does / why we need it:
Resolve: #1378
Pre-submission checklist: