mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Use string bytes for token instead of decoding hex.
This commit is contained in:
parent
b9fd31ff7e
commit
b6d0efb854
@ -77,15 +77,7 @@ func UseGivenTokenIfValid(s *kubeadmapi.KubeadmConfig) (bool, error) {
|
||||
"length of first part is incorrect [%d (given) != %d (expected) ]",
|
||||
len(givenToken[0]), TokenIDLen))
|
||||
}
|
||||
tokenBytes, err := hex.DecodeString(givenToken[1])
|
||||
if err != nil {
|
||||
return false, fmt.Errorf(invalidErr, err)
|
||||
}
|
||||
if len(tokenBytes) != TokenBytes {
|
||||
return false, fmt.Errorf(invalidErr, fmt.Sprintf(
|
||||
"length of second part is incorrect [%d (given) != %d (expected)]",
|
||||
len(tokenBytes), TokenBytes))
|
||||
}
|
||||
tokenBytes := []byte(givenToken[1])
|
||||
s.Secrets.TokenID = givenToken[0]
|
||||
s.Secrets.BearerToken = givenToken[1]
|
||||
s.Secrets.Token = tokenBytes
|
||||
|
Loading…
Reference in New Issue
Block a user