Skip to content

Commit 84f18c6

Browse files
authored
allow untrusted https certificates when joining nodes to the cluster (#284)
1 parent 7d1ad20 commit 84f18c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd/embedded-cluster/join.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"bytes"
55
"context"
6+
"crypto/tls"
67
"encoding/json"
78
"fmt"
89
"io"
@@ -72,14 +73,17 @@ func (j JoinCommandResponse) EmbeddedOverrides() (dig.Mapping, error) {
7273
// getJoinToken issues a request to the kots api to get the actual join command
7374
// based on the short token provided by the user.
7475
func getJoinToken(ctx context.Context, baseURL, shortToken string) (*JoinCommandResponse, error) {
75-
url := fmt.Sprintf("http://%s/api/v1/embedded-cluster/join?token=%s", baseURL, shortToken)
76+
url := fmt.Sprintf("https://%s/api/v1/embedded-cluster/join?token=%s", baseURL, shortToken)
7677
ctx, cancel := context.WithTimeout(ctx, time.Minute)
7778
defer cancel()
7879
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
7980
if err != nil {
8081
return nil, fmt.Errorf("unable to create request: %w", err)
8182
}
82-
resp, err := http.DefaultClient.Do(req)
83+
84+
// this will generally be a self-signed certificate created by kurl-proxy
85+
insecureClient := &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}
86+
resp, err := insecureClient.Do(req)
8387
if err != nil {
8488
return nil, fmt.Errorf("unable to get join token: %w", err)
8589
}

0 commit comments

Comments
 (0)