1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 06:56:29 +00:00

Add option to pass custom CA certificate for S3 backend

This commit is contained in:
moelsayed
2019-06-12 00:31:01 +02:00
committed by Alena Prokharchyk
parent ffa42ab900
commit 38c31b9766
5 changed files with 46 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ import (
"time"
"github.com/rancher/rke/hosts"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"k8s.io/client-go/util/cert"
)
@@ -744,3 +744,19 @@ func validateCAIssuer(rkeConfig *v3.RancherKubernetesEngineConfig, certBundle ma
}
return nil
}
func ReadCertToStr(file string) (string, error) {
certStr, err := ioutil.ReadFile(file)
if err != nil {
return "", fmt.Errorf("failed to read certificate [%s]: %v", file, err)
}
return string(certStr), nil
}
func IsValidCertStr(c string) (bool, error) {
_, err := cert.ParseCertsPEM([]byte(c))
if err != nil {
return false, err
}
return true, nil
}