Skip to content

Commit

Permalink
fix: set kubeconfig for dynamic clients
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Dec 13, 2024
1 parent f4af6b3 commit 09e6bd0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scrapers/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ func scheduleScraperJob(sc api.ScrapeContext) error {
return fmt.Errorf("failed to watch kubernetes resources: %v", err)
}

if config.Kubeconfig != nil {
c, err := sc.WithKubeconfig(*config.Kubeconfig)
if err != nil {
return fmt.Errorf("failed to apply custom kubeconfig: %w", err)
}
sc.Context = *c

}
watchConsumerJob := ConsumeKubernetesWatchJobFunc(sc, config, queue)
if err := watchConsumerJob.AddToScheduler(scrapeJobScheduler); err != nil {
return fmt.Errorf("failed to schedule kubernetes watch consumer job: %v", err)
Expand Down

0 comments on commit 09e6bd0

Please sign in to comment.