mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
[kubernetes/kubeadm] fix minor nil issues in kudeadm code
This commit is contained in:
parent
0d579bfecf
commit
6df4f62d1c
@ -204,7 +204,7 @@ func getDataFromDisk(cfg *kubeadmapi.InitConfiguration, key []byte) (map[string]
|
||||
secretData := map[string][]byte{}
|
||||
for certName, certPath := range certsToTransfer(cfg) {
|
||||
cert, err := loadAndEncryptCert(certPath, key)
|
||||
if err == nil || (err != nil && os.IsNotExist(err)) {
|
||||
if err == nil || os.IsNotExist(err) {
|
||||
secretData[certOrKeyNameToSecretName(certName)] = cert
|
||||
} else {
|
||||
return nil, err
|
||||
|
@ -480,8 +480,7 @@ func parseCSRPEM(pemCSR []byte) (*x509.CertificateRequest, error) {
|
||||
}
|
||||
|
||||
if block.Type != certutil.CertificateRequestBlockType {
|
||||
var block *pem.Block
|
||||
return nil, errors.Errorf("expected block type %q, but PEM had type %v", certutil.CertificateRequestBlockType, block.Type)
|
||||
return nil, errors.Errorf("expected block type %q, but PEM had type %q", certutil.CertificateRequestBlockType, block.Type)
|
||||
}
|
||||
|
||||
return x509.ParseCertificateRequest(block.Bytes)
|
||||
|
Loading…
Reference in New Issue
Block a user