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:
committed by
Alena Prokharchyk
parent
ffa42ab900
commit
38c31b9766
18
pki/util.go
18
pki/util.go
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user