Skip to content

Commit 6df4f62

Browse files
committed
[kubernetes/kubeadm] fix minor nil issues in kudeadm code
1 parent 0d579bf commit 6df4f62

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

cmd/kubeadm/app/phases/copycerts/copycerts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func getDataFromDisk(cfg *kubeadmapi.InitConfiguration, key []byte) (map[string]
204204
secretData := map[string][]byte{}
205205
for certName, certPath := range certsToTransfer(cfg) {
206206
cert, err := loadAndEncryptCert(certPath, key)
207-
if err == nil || (err != nil && os.IsNotExist(err)) {
207+
if err == nil || os.IsNotExist(err) {
208208
secretData[certOrKeyNameToSecretName(certName)] = cert
209209
} else {
210210
return nil, err

cmd/kubeadm/app/util/pkiutil/pki_helpers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,7 @@ func parseCSRPEM(pemCSR []byte) (*x509.CertificateRequest, error) {
480480
}
481481

482482
if block.Type != certutil.CertificateRequestBlockType {
483-
var block *pem.Block
484-
return nil, errors.Errorf("expected block type %q, but PEM had type %v", certutil.CertificateRequestBlockType, block.Type)
483+
return nil, errors.Errorf("expected block type %q, but PEM had type %q", certutil.CertificateRequestBlockType, block.Type)
485484
}
486485

487486
return x509.ParseCertificateRequest(block.Bytes)

0 commit comments

Comments
 (0)