Skip to content

Commit

Permalink
Add connectivity check to cluster when intialising image builder
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Dec 20, 2024
1 parent 766b0ac commit 1dd40b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/cmd/api/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"gorm.io/gorm"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/utils/clock"
Expand Down Expand Up @@ -98,6 +99,11 @@ func initImageBuilder(cfg *config.Config) (webserviceBuilder imagebuilder.ImageB
log.Panicf("%s, unable to initialize image builder", err.Error())
}

_, err = kubeClient.CoreV1().Pods("").List(context.Background(), metav1.ListOptions{})
if err != nil {
log.Panicf("%s, error sending request to kube client at startup to verify connection", err.Error())
}

timeout, err := time.ParseDuration(cfg.ImageBuilderConfig.BuildTimeout)
if err != nil {
log.Panicf("unable to parse image builder timeout to time.Duration %s", cfg.ImageBuilderConfig.BuildTimeout)
Expand Down

0 comments on commit 1dd40b9

Please sign in to comment.