mirror of https://github.com/k3s-io/k3s
Fix boostrap token encoding bug during master init
Currently the boostrap fails when a token is provided by the user on `master init` and works when the token is generated. This is because of a mismatch of how the token string in the kube-discovery secret is encoded.pull/6/head
parent
0a68bb05ea
commit
5862ea6f38
|
@ -18,7 +18,6 @@ package master
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
@ -52,7 +51,7 @@ func encodeKubeDiscoverySecretData(s *kubeadmapi.KubeadmConfig, caCert *x509.Cer
|
||||||
endpointList = append(endpointList, fmt.Sprintf("https://%s:443", addr.String()))
|
endpointList = append(endpointList, fmt.Sprintf("https://%s:443", addr.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenMap[s.Secrets.TokenID] = hex.EncodeToString(s.Secrets.Token)
|
tokenMap[s.Secrets.TokenID] = s.Secrets.BearerToken
|
||||||
|
|
||||||
data["endpoint-list.json"], _ = json.Marshal(endpointList)
|
data["endpoint-list.json"], _ = json.Marshal(endpointList)
|
||||||
data["token-map.json"], _ = json.Marshal(tokenMap)
|
data["token-map.json"], _ = json.Marshal(tokenMap)
|
||||||
|
|
Loading…
Reference in New Issue