Skip to content

Commit

Permalink
Merge pull request #36 from Oats87/check-k8s-version
Browse files Browse the repository at this point in the history
Check K8s cluster is healthy before proceeding to watch for remote K8s plans
  • Loading branch information
Oats87 authored Jun 16, 2021
2 parents 58799bb + 5777eca commit 7a0bea5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/k8splan/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func (w *watcher) start(ctx context.Context) {
panic(err)
}

if !clientFactory.IsHealthy(ctx) {
panic(fmt.Errorf("error while connecting to Kubernetes cluster"))
}

cacheFactory := cache.NewSharedCachedFactory(clientFactory, &cache.SharedCacheFactoryOptions{
DefaultNamespace: w.connInfo.Namespace,
DefaultTweakList: func(options *metav1.ListOptions) {
Expand Down

0 comments on commit 7a0bea5

Please sign in to comment.