From aeb3e3e0835ec5135cfe50340f59853b5b6fc407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Wed, 9 Jan 2019 10:14:02 +0100 Subject: [PATCH] pkg/*: Add option to force path style s3 uploads. This patch adds an option to force path style s3 uploads. This is useful when a third-party s3 endpoint doesn't support the subdomain style uploads that's default in s3. --- CHANGELOG.md | 3 +++ pkg/apis/etcd/v1beta2/backup_types.go | 5 +++++ pkg/apis/etcd/v1beta2/restore_types.go | 5 +++++ pkg/apis/etcd/v1beta2/zz_generated.deepcopy.go | 2 +- pkg/controller/backup-operator/s3_backup.go | 2 +- pkg/controller/restore-operator/http.go | 2 +- pkg/generated/clientset/versioned/clientset.go | 2 +- pkg/generated/clientset/versioned/doc.go | 2 +- .../clientset/versioned/fake/clientset_generated.go | 2 +- pkg/generated/clientset/versioned/fake/doc.go | 2 +- pkg/generated/clientset/versioned/fake/register.go | 2 +- pkg/generated/clientset/versioned/scheme/doc.go | 2 +- pkg/generated/clientset/versioned/scheme/register.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/doc.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/etcd_client.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/etcdbackup.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/etcdcluster.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/etcdrestore.go | 2 +- .../clientset/versioned/typed/etcd/v1beta2/fake/doc.go | 2 +- .../versioned/typed/etcd/v1beta2/fake/fake_etcd_client.go | 2 +- .../versioned/typed/etcd/v1beta2/fake/fake_etcdbackup.go | 2 +- .../versioned/typed/etcd/v1beta2/fake/fake_etcdcluster.go | 2 +- .../versioned/typed/etcd/v1beta2/fake/fake_etcdrestore.go | 2 +- .../versioned/typed/etcd/v1beta2/generated_expansion.go | 2 +- .../informers/externalversions/etcd/interface.go | 2 +- .../informers/externalversions/etcd/v1beta2/etcdbackup.go | 2 +- .../externalversions/etcd/v1beta2/etcdcluster.go | 2 +- .../externalversions/etcd/v1beta2/etcdrestore.go | 2 +- .../informers/externalversions/etcd/v1beta2/interface.go | 2 +- pkg/generated/informers/externalversions/factory.go | 2 +- pkg/generated/informers/externalversions/generic.go | 2 +- .../internalinterfaces/factory_interfaces.go | 2 +- pkg/generated/listers/etcd/v1beta2/etcdbackup.go | 2 +- pkg/generated/listers/etcd/v1beta2/etcdcluster.go | 2 +- pkg/generated/listers/etcd/v1beta2/etcdrestore.go | 2 +- pkg/generated/listers/etcd/v1beta2/expansion_generated.go | 2 +- pkg/util/awsutil/s3factory/client.go | 8 +++++--- pkg/util/awsutil/s3factory/client_test.go | 2 +- test/e2e/e2eutil/spec_util.go | 5 +++-- 39 files changed, 55 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d6a3b32..3d9a7f34a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### Added +- Added `spec.BackupSource.S3.ForcePathStyle` to `EtcdBackup` to force path style s3 uploads. [#2036](https://github.com/coreos/etcd-operator/pull/2036) +- Added `spec.RestoreSource.S3.ForcePathStyle` to `EtcdRestore` to force path style s3 downloads. [#2036](https://github.com/coreos/etcd-operator/pull/2036) + ### Changed ### Removed diff --git a/pkg/apis/etcd/v1beta2/backup_types.go b/pkg/apis/etcd/v1beta2/backup_types.go index 914f34cb5..246ac8c60 100644 --- a/pkg/apis/etcd/v1beta2/backup_types.go +++ b/pkg/apis/etcd/v1beta2/backup_types.go @@ -126,6 +126,11 @@ type S3BackupSource struct { // Endpoint if blank points to aws. If specified, can point to s3 compatible object // stores. Endpoint string `json:"endpoint,omitempty"` + + // ForcePathStyle forces to use path style over the default subdomain style. + // This is useful when you have an s3 compatible endpoint that doesn't support + // subdomain buckets. + ForcePathStyle bool `json:"forcePathStyle"` } // ABSBackupSource provides the spec how to store backups on ABS. diff --git a/pkg/apis/etcd/v1beta2/restore_types.go b/pkg/apis/etcd/v1beta2/restore_types.go index b23ba6dba..997833c19 100644 --- a/pkg/apis/etcd/v1beta2/restore_types.go +++ b/pkg/apis/etcd/v1beta2/restore_types.go @@ -88,6 +88,11 @@ type S3RestoreSource struct { // Endpoint if blank points to aws. If specified, can point to s3 compatible object // stores. Endpoint string `json:"endpoint"` + + // ForcePathStyle forces to use path style over the default subdomain style. + // This is useful when you have an s3 compatible endpoint that doesn't support + // subdomain buckets. + ForcePathStyle bool `json:"forcePathStyle"` } type ABSRestoreSource struct { diff --git a/pkg/apis/etcd/v1beta2/zz_generated.deepcopy.go b/pkg/apis/etcd/v1beta2/zz_generated.deepcopy.go index e5f49a19d..a6b031465 100644 --- a/pkg/apis/etcd/v1beta2/zz_generated.deepcopy.go +++ b/pkg/apis/etcd/v1beta2/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/controller/backup-operator/s3_backup.go b/pkg/controller/backup-operator/s3_backup.go index caf0c18ce..cca3f70be 100644 --- a/pkg/controller/backup-operator/s3_backup.go +++ b/pkg/controller/backup-operator/s3_backup.go @@ -31,7 +31,7 @@ import ( // handleS3 saves etcd cluster's backup to specificed S3 path. func handleS3(ctx context.Context, kubecli kubernetes.Interface, s *api.S3BackupSource, endpoints []string, clientTLSSecret, namespace string) (*api.BackupStatus, error) { // TODO: controls NewClientFromSecret with ctx. This depends on upstream kubernetes to support API calls with ctx. - cli, err := s3factory.NewClientFromSecret(kubecli, namespace, s.Endpoint, s.AWSSecret) + cli, err := s3factory.NewClientFromSecret(kubecli, namespace, s.Endpoint, s.AWSSecret, s.ForcePathStyle) if err != nil { return nil, err } diff --git a/pkg/controller/restore-operator/http.go b/pkg/controller/restore-operator/http.go index a00106762..fa436260a 100644 --- a/pkg/controller/restore-operator/http.go +++ b/pkg/controller/restore-operator/http.go @@ -93,7 +93,7 @@ func (r *Restore) serveBackup(w http.ResponseWriter, req *http.Request) error { return errors.New("invalid s3 restore source field (spec.s3), must specify all required subfields") } - s3Cli, err := s3factory.NewClientFromSecret(r.kubecli, r.namespace, s3RestoreSource.Endpoint, s3RestoreSource.AWSSecret) + s3Cli, err := s3factory.NewClientFromSecret(r.kubecli, r.namespace, s3RestoreSource.Endpoint, s3RestoreSource.AWSSecret, s3RestoreSource.ForcePathStyle) if err != nil { return fmt.Errorf("failed to create S3 client: %v", err) } diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index dc8961a40..e214728f2 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/doc.go b/pkg/generated/clientset/versioned/doc.go index 3ef04b81b..e1edc9927 100644 --- a/pkg/generated/clientset/versioned/doc.go +++ b/pkg/generated/clientset/versioned/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 75791873c..388f98a7e 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go index 16d5871f5..4e0863d5a 100644 --- a/pkg/generated/clientset/versioned/fake/doc.go +++ b/pkg/generated/clientset/versioned/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 7ecefdaad..925a0ea85 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go index d2030dc97..becbf6d26 100644 --- a/pkg/generated/clientset/versioned/scheme/doc.go +++ b/pkg/generated/clientset/versioned/scheme/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index ab9a544a3..897ed5ade 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/doc.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/doc.go index db3564b15..ae465c016 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/doc.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcd_client.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcd_client.go index 48e9c71b2..8931fb343 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcd_client.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcd_client.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdbackup.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdbackup.go index 4267fcf39..6be92f348 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdbackup.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdbackup.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdcluster.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdcluster.go index 3cd3918d6..a3880f22a 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdcluster.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdcluster.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdrestore.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdrestore.go index e5dae4b50..647c7abb8 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdrestore.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/etcdrestore.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/doc.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/doc.go index dc4fe85bd..e143a66b5 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/doc.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcd_client.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcd_client.go index 79f27104d..063204540 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcd_client.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcd_client.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdbackup.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdbackup.go index 4e9027b6c..05d4eddd3 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdbackup.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdbackup.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdcluster.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdcluster.go index 78a91b07c..818d5fa99 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdcluster.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdcluster.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdrestore.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdrestore.go index b45746fe6..7aa929364 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdrestore.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/fake/fake_etcdrestore.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/generated_expansion.go b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/generated_expansion.go index efe619c63..faf0799cc 100644 --- a/pkg/generated/clientset/versioned/typed/etcd/v1beta2/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/etcd/v1beta2/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/etcd/interface.go b/pkg/generated/informers/externalversions/etcd/interface.go index e3c125c54..5e290b3c6 100644 --- a/pkg/generated/informers/externalversions/etcd/interface.go +++ b/pkg/generated/informers/externalversions/etcd/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdbackup.go b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdbackup.go index 7e9207932..05a0d71ee 100644 --- a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdbackup.go +++ b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdbackup.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdcluster.go b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdcluster.go index a27eb939f..d4fdcd3b1 100644 --- a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdcluster.go +++ b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdcluster.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdrestore.go b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdrestore.go index e6a5f9782..944dd5583 100644 --- a/pkg/generated/informers/externalversions/etcd/v1beta2/etcdrestore.go +++ b/pkg/generated/informers/externalversions/etcd/v1beta2/etcdrestore.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/etcd/v1beta2/interface.go b/pkg/generated/informers/externalversions/etcd/v1beta2/interface.go index b19ca9fd7..91f3919ad 100644 --- a/pkg/generated/informers/externalversions/etcd/v1beta2/interface.go +++ b/pkg/generated/informers/externalversions/etcd/v1beta2/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index ee85cb000..dd8e1feef 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 712a0079c..6951a7b44 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index 31b7e8e94..97d813f72 100644 --- a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/etcd/v1beta2/etcdbackup.go b/pkg/generated/listers/etcd/v1beta2/etcdbackup.go index 455ee676d..e78a9b49c 100644 --- a/pkg/generated/listers/etcd/v1beta2/etcdbackup.go +++ b/pkg/generated/listers/etcd/v1beta2/etcdbackup.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/etcd/v1beta2/etcdcluster.go b/pkg/generated/listers/etcd/v1beta2/etcdcluster.go index 4bd608f0e..27f0b3e24 100644 --- a/pkg/generated/listers/etcd/v1beta2/etcdcluster.go +++ b/pkg/generated/listers/etcd/v1beta2/etcdcluster.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/etcd/v1beta2/etcdrestore.go b/pkg/generated/listers/etcd/v1beta2/etcdrestore.go index 7fff4247a..35f32fc38 100644 --- a/pkg/generated/listers/etcd/v1beta2/etcdrestore.go +++ b/pkg/generated/listers/etcd/v1beta2/etcdrestore.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/etcd/v1beta2/expansion_generated.go b/pkg/generated/listers/etcd/v1beta2/expansion_generated.go index 6357f3122..361c893bd 100644 --- a/pkg/generated/listers/etcd/v1beta2/expansion_generated.go +++ b/pkg/generated/listers/etcd/v1beta2/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The etcd-operator Authors +Copyright 2019 The etcd-operator Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/util/awsutil/s3factory/client.go b/pkg/util/awsutil/s3factory/client.go index ed79dd1f7..a3e5bd98d 100644 --- a/pkg/util/awsutil/s3factory/client.go +++ b/pkg/util/awsutil/s3factory/client.go @@ -39,7 +39,7 @@ type S3Client struct { } // NewClientFromSecret returns a S3 client based on given k8s secret containing aws credentials. -func NewClientFromSecret(kubecli kubernetes.Interface, namespace, endpoint, awsSecret string) (w *S3Client, err error) { +func NewClientFromSecret(kubecli kubernetes.Interface, namespace, endpoint, awsSecret string, forcePathStyle bool) (w *S3Client, err error) { defer func() { if err != nil { err = fmt.Errorf("new S3 client failed: %v", err) @@ -50,7 +50,7 @@ func NewClientFromSecret(kubecli kubernetes.Interface, namespace, endpoint, awsS if err != nil { return nil, fmt.Errorf("failed to create aws config dir: (%v)", err) } - so, err := setupAWSConfig(kubecli, namespace, awsSecret, endpoint, w.configDir) + so, err := setupAWSConfig(kubecli, namespace, awsSecret, endpoint, w.configDir, forcePathStyle) if err != nil { return nil, fmt.Errorf("failed to setup aws config: (%v)", err) } @@ -68,13 +68,15 @@ func (w *S3Client) Close() { } // setupAWSConfig setup local AWS config/credential files from Kubernetes aws secret. -func setupAWSConfig(kubecli kubernetes.Interface, ns, secret, endpoint, configDir string) (*session.Options, error) { +func setupAWSConfig(kubecli kubernetes.Interface, ns, secret, endpoint, configDir string, forcePathStyle bool) (*session.Options, error) { options := &session.Options{} options.SharedConfigState = session.SharedConfigEnable // empty string defaults to aws options.Config.Endpoint = &endpoint + options.Config.S3ForcePathStyle = &forcePathStyle + se, err := kubecli.CoreV1().Secrets(ns).Get(secret, metav1.GetOptions{}) if err != nil { return nil, fmt.Errorf("setup AWS config failed: get k8s secret failed: %v", err) diff --git a/pkg/util/awsutil/s3factory/client_test.go b/pkg/util/awsutil/s3factory/client_test.go index aa375cb24..5a74cac83 100644 --- a/pkg/util/awsutil/s3factory/client_test.go +++ b/pkg/util/awsutil/s3factory/client_test.go @@ -29,7 +29,7 @@ func TestSetupAWSConfig(t *testing.T) { client := fake.NewSimpleClientset(sec) e := "example.com" - opts, err := setupAWSConfig(client, "", "", e, "") + opts, err := setupAWSConfig(client, "", "", e, "", false) if err != nil { t.Error(err) } diff --git a/test/e2e/e2eutil/spec_util.go b/test/e2e/e2eutil/spec_util.go index 9b8b33f05..b65f535ad 100644 --- a/test/e2e/e2eutil/spec_util.go +++ b/test/e2e/e2eutil/spec_util.go @@ -51,8 +51,9 @@ func NewS3Backup(endpoints []string, clusterName, path, secret, clientTLSSecret ClientTLSSecret: clientTLSSecret, BackupSource: api.BackupSource{ S3: &api.S3BackupSource{ - Path: path, - AWSSecret: secret, + Path: path, + AWSSecret: secret, + ForcePathStyle: false, }, }, },