Skip to content

Commit

Permalink
keep timeout to use in NewCluster cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
louiseschmidtgen committed Mar 27, 2024
1 parent 2a1dcc5 commit ffce0a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/k8s/pkg/k8sd/api/cluster_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"time"

apiv1 "github.com/canonical/k8s/api/v1"
"github.com/canonical/k8s/pkg/utils"
Expand Down Expand Up @@ -32,6 +33,12 @@ func postClusterBootstrap(m *microcluster.MicroCluster, s *state.State, r *http.
return response.BadRequest(fmt.Errorf("invalid hostname %q: %w", s.Name(), err))
}

// Set timeout
timeout := 30 * time.Second
if deadline, set := s.Context.Deadline(); set {
timeout = time.Until(deadline)
}

// Check if the cluster is already bootstrapped
_, err = m.Status()
if err == nil {
Expand Down

0 comments on commit ffce0a0

Please sign in to comment.