Skip to content

Commit

Permalink
allow untrusted https certificates when joining nodes to the cluster (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya authored Jan 19, 2024
1 parent 7d1ad20 commit 84f18c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/embedded-cluster/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -72,14 +73,17 @@ func (j JoinCommandResponse) EmbeddedOverrides() (dig.Mapping, error) {
// getJoinToken issues a request to the kots api to get the actual join command
// based on the short token provided by the user.
func getJoinToken(ctx context.Context, baseURL, shortToken string) (*JoinCommandResponse, error) {
url := fmt.Sprintf("http://%s/api/v1/embedded-cluster/join?token=%s", baseURL, shortToken)
url := fmt.Sprintf("https://%s/api/v1/embedded-cluster/join?token=%s", baseURL, shortToken)
ctx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, fmt.Errorf("unable to create request: %w", err)
}
resp, err := http.DefaultClient.Do(req)

// this will generally be a self-signed certificate created by kurl-proxy
insecureClient := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}
resp, err := insecureClient.Do(req)
if err != nil {
return nil, fmt.Errorf("unable to get join token: %w", err)
}
Expand Down

0 comments on commit 84f18c6

Please sign in to comment.