1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-01 23:33:39 +00:00

rename EndpointCA

This commit is contained in:
moelsayed 2019-06-25 22:12:17 +02:00 committed by Alena Prokharchyk
parent 0a488ca453
commit 2c907f9f21
3 changed files with 8 additions and 8 deletions

View File

@ -148,8 +148,8 @@ func validateEtcdBackupOptions(c *Cluster) error {
if len(c.Services.Etcd.BackupConfig.S3BackupConfig.BucketName) == 0 {
return fmt.Errorf("etcd s3 backup backend bucketName can't be empty")
}
if len(c.Services.Etcd.BackupConfig.S3BackupConfig.EndpointCA) != 0 {
if isValid, err := pki.IsValidCertStr(c.Services.Etcd.BackupConfig.S3BackupConfig.EndpointCA); !isValid {
if len(c.Services.Etcd.BackupConfig.S3BackupConfig.CustomCA) != 0 {
if isValid, err := pki.IsValidCertStr(c.Services.Etcd.BackupConfig.S3BackupConfig.CustomCA); !isValid {
return fmt.Errorf("invalid S3 endpoint CA certificate: %v", err)
}
}

View File

@ -137,7 +137,7 @@ func setS3OptionsFromCLI(c *cli.Context) *v3.S3BackupConfig {
if err != nil {
logrus.Warnf("Failed to read s3-endpoint-ca [%s]: %v", endpointCA, err)
} else {
s3BackupBackend.EndpointCA = caStr
s3BackupBackend.CustomCA = caStr
}
}
return s3BackupBackend

View File

@ -18,7 +18,7 @@ import (
"github.com/rancher/rke/log"
"github.com/rancher/rke/pki"
"github.com/rancher/rke/util"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
"k8s.io/client-go/util/cert"
@ -367,8 +367,8 @@ func DownloadEtcdSnapshotFromS3(ctx context.Context, etcdHost *hosts.Host, prsMa
},
Image: etcdSnapshotImage,
}
if s3Backend.EndpointCA != "" {
caStr := base64.StdEncoding.EncodeToString([]byte(s3Backend.EndpointCA))
if s3Backend.CustomCA != "" {
caStr := base64.StdEncoding.EncodeToString([]byte(s3Backend.CustomCA))
imageCfg.Cmd = append(imageCfg.Cmd, "--s3-endpoint-ca="+caStr)
}
hostCfg := &container.HostConfig{
@ -556,8 +556,8 @@ func configS3BackupImgCmd(ctx context.Context, imageCfg *container.Config, bc *v
"--s3-bucketName=" + bc.S3BackupConfig.BucketName,
"--s3-region=" + bc.S3BackupConfig.Region,
}...)
if bc.S3BackupConfig.EndpointCA != "" {
caStr := base64.StdEncoding.EncodeToString([]byte(bc.S3BackupConfig.EndpointCA))
if bc.S3BackupConfig.CustomCA != "" {
caStr := base64.StdEncoding.EncodeToString([]byte(bc.S3BackupConfig.CustomCA))
cmd = append(cmd, "--s3-endpoint-ca="+caStr)
}
}