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 d9ebb6c
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 @@ -3,6 +3,7 @@ package main
import (
"context"
"errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net/http"
"time"

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 d9ebb6c

Please sign in to comment.