Merge pull request #112024 from cndoit18/remove-redundant-judgment
style: remove redundant judgment
This commit is contained in:
@@ -240,11 +240,7 @@ func runPreflightChecks(client clientset.Interface, ignorePreflightErrors sets.S
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = upgrade.RunCoreDNSMigrationCheck(client, ignorePreflightErrors)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return upgrade.RunCoreDNSMigrationCheck(client, ignorePreflightErrors)
|
||||
}
|
||||
|
||||
// getClient gets a real or fake client depending on whether the user is dry-running or not
|
||||
|
@@ -471,11 +471,7 @@ func createKeyAndCSR(kubeadmConfig *kubeadmapi.InitConfiguration, cert *KubeadmC
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = pkiutil.WriteCSR(certDir, name, csr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return pkiutil.WriteCSR(certDir, name, csr)
|
||||
}
|
||||
|
||||
// CreateDefaultKeysAndCSRFiles is used in ExternalCA mode to create key files
|
||||
|
@@ -486,10 +486,7 @@ func validateSignedCertWithCA(l certKeyLocation, caCert *x509.Certificate) error
|
||||
func validatePrivatePublicKey(l certKeyLocation) error {
|
||||
// Try to load key
|
||||
_, _, err := pkiutil.TryLoadPrivatePublicKeyFromDisk(l.pkiDir, l.baseName)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failure loading key for %s", l.uxName)
|
||||
}
|
||||
return nil
|
||||
return errors.Wrapf(err, "failure loading key for %s", l.uxName)
|
||||
}
|
||||
|
||||
// validateCertificateWithConfig makes sure that a given certificate is valid at
|
||||
|
@@ -281,10 +281,7 @@ func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmda
|
||||
}
|
||||
fmt.Printf("[kubeconfig] Writing %q kubeconfig file\n", filename)
|
||||
err = kubeconfigutil.WriteToDisk(kubeConfigFilePath, config)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to save kubeconfig file %q on disk", kubeConfigFilePath)
|
||||
}
|
||||
return nil
|
||||
return errors.Wrapf(err, "failed to save kubeconfig file %q on disk", kubeConfigFilePath)
|
||||
}
|
||||
// kubeadm doesn't validate the existing kubeconfig file more than this (kubeadm trusts the client certs to be valid)
|
||||
// Basically, if we find a kubeconfig file with the same path; the same CA cert and the same server URL;
|
||||
|
@@ -110,8 +110,5 @@ func checkMigration(client clientset.Interface) error {
|
||||
|
||||
currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v")
|
||||
_, err = migration.Migrate(currentInstalledCoreDNSversion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile, false)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "CoreDNS will not be upgraded")
|
||||
}
|
||||
return nil
|
||||
return errors.Wrap(err, "CoreDNS will not be upgraded")
|
||||
}
|
||||
|
@@ -249,10 +249,7 @@ func (w *KubeWaiter) WaitForStaticPodHashChange(nodeName, component, previousHas
|
||||
if lastErr != nil {
|
||||
return lastErr
|
||||
}
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "static Pod hash for component %s on Node %s did not change after %v", component, nodeName, w.timeout)
|
||||
}
|
||||
return nil
|
||||
return errors.Wrapf(err, "static Pod hash for component %s on Node %s did not change after %v", component, nodeName, w.timeout)
|
||||
}
|
||||
|
||||
// getStaticPodSingleHash computes hashes for a single Static Pod resource
|
||||
|
@@ -23,9 +23,5 @@ import (
|
||||
// CopyDir copies the content of a folder
|
||||
func CopyDir(src string, dst string) error {
|
||||
cmd := exec.Command("cp", "-r", src, dst)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return cmd.Run()
|
||||
}
|
||||
|
Reference in New Issue
Block a user