diff --git a/cmd/restoreSSL.go b/cmd/restoreSSL.go index 1f45d9f24..76ff15b25 100644 --- a/cmd/restoreSSL.go +++ b/cmd/restoreSSL.go @@ -21,7 +21,7 @@ to quickly create a Cobra application.`, fmt.Println("restoreSSL called") err := ssl.RestoreSSL() if err != nil { - fmt.Println("Bucket not found, missing SSL backup, assuming first installation") + fmt.Printf("Bucket not found, missing SSL backup, assuming first installation, error is: %v", err) } }, } diff --git a/internal/aws/aws.go b/internal/aws/aws.go index daa442a89..016e6fa11 100644 --- a/internal/aws/aws.go +++ b/internal/aws/aws.go @@ -4,6 +4,7 @@ package aws import ( "context" + "errors" "fmt" "log" "net" @@ -476,8 +477,7 @@ func DownloadBucket(bucket string, destFolder string) error { }) if err != nil { - log.Printf("Couldn't list bucket contents") - return fmt.Errorf("Couldn't list bucket contents") + return errors.New("couldn't list bucket contents") } for _, object := range listObjsResponse.Contents { diff --git a/internal/ssl/ssl.go b/internal/ssl/ssl.go index c5323d2a4..f199b74b9 100644 --- a/internal/ssl/ssl.go +++ b/internal/ssl/ssl.go @@ -98,7 +98,11 @@ func GetBackupCertificates() (string, error) { for _, cert := range certificates { fullPath := strings.Replace(cert, config.CertsPath, "/certs", 1) log.Println(fullPath) - aws.UploadFile(bucketName, fullPath, cert) + err = aws.UploadFile(bucketName, fullPath, cert) + if err != nil { + log.Println("there is an issue to uploaded your certificate to the S3 bucket") + log.Panic(err) + } } log.Println("getting secrets") @@ -138,7 +142,10 @@ func RestoreSSL() error { } } bucketName := fmt.Sprintf("k1-%s", viper.GetString("aws.hostedzonename")) - aws.DownloadBucket(bucketName, config.CertsPath) + err := aws.DownloadBucket(bucketName, config.CertsPath) + if err != nil { + return err + } //! We need apply secrets firstly than other resources, accordingly with cert-manager docs //pathsRestored := []string{"secrets", "certs", "clusterissuers"} //! At this moment, we dont have the crds certs/clusterissuers installed on cluster