diff --git a/cluster/validation.go b/cluster/validation.go index 36658c7f..439624a5 100644 --- a/cluster/validation.go +++ b/cluster/validation.go @@ -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) } } diff --git a/cmd/common.go b/cmd/common.go index 77f17518..6fbc5cb8 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -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 diff --git a/services/etcd.go b/services/etcd.go index 8d525d29..8b98bfcd 100644 --- a/services/etcd.go +++ b/services/etcd.go @@ -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) } }