Skip to content

Commit

Permalink
fix: kubernetes watch resource panic
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 10, 2024
1 parent 180600d commit 79a07fb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions scrapers/kubernetes/events_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ func WatchResources(ctx api.ScrapeContext, config v1.Kubernetes) error {
if err != nil {
return fmt.Errorf("failed to get kubeconfig from env: %w", err)
}

} else {
_, err = kube.DefaultRestConfig()
if err != nil {
return fmt.Errorf("failed to apply default kube config: %w", err)
}
}

for _, watchResource := range lo.Uniq(config.Watch) {
Expand All @@ -87,7 +81,7 @@ func WatchResources(ctx api.ScrapeContext, config v1.Kubernetes) error {
for _, w := range config.Watch {
existingWatches = append(existingWatches, w.ApiVersion+w.Kind)
}
globalSharedInformerManager.stop(ctx, config.Kubeconfig.ValueStatic, existingWatches...)
globalSharedInformerManager.stop(ctx, kubeconfig, existingWatches...)

ctx.Counter("kubernetes_scraper_resource_watcher", "scraper_id", lo.FromPtr(ctx.ScrapeConfig().GetPersistedID()).String()).Add(1)
return nil
Expand Down

0 comments on commit 79a07fb

Please sign in to comment.