diff --git a/Gopkg.lock b/Gopkg.lock index df895a8cb..cd5313362 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,51 +2,66 @@ [[projects]] + digest = "1:94ffc0947c337d618b6ff5ed9abaddc1217b090c1b3a1ae4739b35b7b25851d5" name = "github.com/container-storage-interface/spec" packages = ["lib/go/csi"] + pruneopts = "NUT" revision = "ed0bb0e1557548aa028307f48728767cfe8f6345" version = "v1.0.0" [[projects]] + digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39" name = "github.com/davecgh/go-spew" packages = ["spew"] + pruneopts = "NUT" revision = "346938d642f2ec3594ed81d874461961cd0faa76" version = "v1.1.0" [[projects]] + digest = "1:32598368f409bbee79deb9d43569fcd92b9fb27f39155f5e166b3371217f051f" name = "github.com/evanphx/json-patch" packages = ["."] + pruneopts = "NUT" revision = "72bf35d0ff611848c1dc9df0f976c81192392fa5" version = "v4.1.0" [[projects]] + digest = "1:1b3dd24f14a5280710fc7a3aa2480b6e4d20fdfc905841de9a3aa2aa2f1d4ee9" name = "github.com/gogo/protobuf" packages = [ "proto", - "sortkeys" + "sortkeys", ] + pruneopts = "NUT" revision = "1adfc126b41513cc696b209667c8656ea7aac67c" version = "v1.0.0" [[projects]] branch = "master" + digest = "1:e2b86e41f3d669fc36b50d31d32d22c8ac656c75aa5ea89717ce7177e134ff2a" name = "github.com/golang/glog" packages = ["."] + pruneopts = "NUT" revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" [[projects]] branch = "master" + digest = "1:3fb07f8e222402962fa190eb060608b34eddfb64562a18e2167df2de0ece85d8" name = "github.com/golang/groupcache" packages = ["lru"] + pruneopts = "NUT" revision = "66deaeb636dff1ac7d938ce666d090556056a4b0" [[projects]] + digest = "1:bc38c7c481812e178d85160472e231c5e1c9a7f5845d67e23ee4e706933c10d8" name = "github.com/golang/mock" packages = ["gomock"] + pruneopts = "NUT" revision = "c34cdb4725f4c3844d095133c6e40e448b86589b" version = "v1.1.1" [[projects]] + digest = "1:3b583d3cd8cec5a31ca9f928ddedd17770987daafa8f326b678c54e8e9798430" name = "github.com/golang/protobuf" packages = [ "descriptor", @@ -56,125 +71,148 @@ "ptypes/any", "ptypes/duration", "ptypes/timestamp", - "ptypes/wrappers" + "ptypes/wrappers", ] + pruneopts = "NUT" revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" version = "v1.1.0" [[projects]] branch = "master" + digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107" name = "github.com/google/btree" packages = ["."] + pruneopts = "NUT" revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306" [[projects]] branch = "master" + digest = "1:52c5834e2bebac9030c97cc0798ac11c3aa8a39f098aeb419f142533da6cd3cc" name = "github.com/google/gofuzz" packages = ["."] + pruneopts = "NUT" revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" [[projects]] + digest = "1:3d7c1446fc5c710351b246c0dc6700fae843ca27f5294d0bd9f68bab2a810c44" name = "github.com/googleapis/gnostic" packages = [ "OpenAPIv2", "compiler", - "extensions" + "extensions", ] + pruneopts = "NUT" revision = "ee43cbb60db7bd22502942cccbc39059117352ab" version = "v0.1.0" [[projects]] branch = "master" + digest = "1:7fdf3223c7372d1ced0b98bf53457c5e89d89aecbad9a77ba9fcc6e01f9e5621" name = "github.com/gregjones/httpcache" packages = [ ".", - "diskcache" + "diskcache", ] + pruneopts = "NUT" revision = "9cad4c3443a7200dd6400aef47183728de563a38" [[projects]] branch = "master" + digest = "1:13e2fa5735a82a5fb044f290cfd0dba633d1c5e516b27da0509e0dbb3515a18e" name = "github.com/hashicorp/golang-lru" packages = [ ".", - "simplelru" + "simplelru", ] + pruneopts = "NUT" revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" [[projects]] + digest = "1:cf327083982a19eae01f70be6663a935a02bac3a2dc79efbc19668c8378bfbb3" name = "github.com/imdario/mergo" packages = ["."] + pruneopts = "NUT" revision = "163f41321a19dd09362d4c63cc2489db2015f1f4" version = "0.3.2" [[projects]] + digest = "1:8e36686e8b139f8fe240c1d5cf3a145bc675c22ff8e707857cdd3ae17b00d728" name = "github.com/json-iterator/go" packages = ["."] + pruneopts = "NUT" revision = "1624edc4454b8682399def8740d46db5e4362ba4" version = "v1.1.5" [[projects]] + digest = "1:610f50d23ee3e0fa37d77fc23bf2c3b6897d2dc1c934739f13cdf551e9fc57d9" name = "github.com/kubernetes-csi/csi-lib-utils" packages = ["protosanitizer"] + pruneopts = "NUT" revision = "1628ab5351eafa4fc89a96862a08a891e601e03a" version = "v0.1.0" [[projects]] + digest = "1:cab5d1fe86e273b35887f707dbec779d77d87613d9f2f14ea23002912197ce81" name = "github.com/kubernetes-csi/csi-test" packages = [ "driver", - "utils" + "utils", ] + pruneopts = "NUT" revision = "42947e04c4a0d2087448841a1dc3ccb20fb903b1" version = "v1.0.0-rc2" [[projects]] - branch = "master" - name = "github.com/kubernetes-csi/kubernetes-csi-migration-library" - packages = [ - ".", - "plugins" - ] - revision = "edcf4b4169dcecadd06e071c4801e0373f14d7a2" - -[[projects]] + digest = "1:bdca59c6bbfc61fea8b66d564f54a0be4364728b1ee94a004eee21ae2c01582d" name = "github.com/modern-go/concurrent" packages = ["."] + pruneopts = "NUT" revision = "938152ca6a933f501bb238954eebd3cbcbf489ff" version = "1.0.2" [[projects]] + digest = "1:c6aca19413b13dc59c220ad7430329e2ec454cc310bc6d8de2c7e2b93c18a0f6" name = "github.com/modern-go/reflect2" packages = ["."] + pruneopts = "NUT" revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" version = "1.0.1" [[projects]] branch = "master" + digest = "1:3bf17a6e6eaa6ad24152148a631d18662f7212e21637c2699bff3369b7f00fa2" name = "github.com/petar/GoLLRB" packages = ["llrb"] + pruneopts = "NUT" revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" [[projects]] + digest = "1:6c6d91dc326ed6778783cff869c49fb2f61303cdd2ebbcf90abe53505793f3b6" name = "github.com/peterbourgon/diskv" packages = ["."] + pruneopts = "NUT" revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" version = "v2.0.1" [[projects]] + digest = "1:3ab855aa584d08db6541ce99dad60c12bd6a328ecb8a7358363887f85c976347" name = "github.com/spf13/pflag" packages = ["."] + pruneopts = "NUT" revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66" version = "v1.0.0" [[projects]] branch = "master" + digest = "1:38cb27d3525635c34e84e2dbc2207c37d10832776997665bf0ddaeae2c861f1f" name = "golang.org/x/crypto" packages = ["ssh/terminal"] + pruneopts = "NUT" revision = "91a49db82a88618983a78a06c1cbd4e00ab749ab" [[projects]] branch = "master" + digest = "1:6fcbdc6eb8e1611ad2d66550d1ff9e57d7d0dacec977bb374a7651f329c2837d" name = "golang.org/x/net" packages = [ "context", @@ -184,29 +222,35 @@ "idna", "internal/timeseries", "lex/httplex", - "trace" + "trace", ] + pruneopts = "NUT" revision = "22ae77b79946ea320088417e4d50825671d82d57" [[projects]] branch = "master" + digest = "1:db0ef10bef8ec68d343f7371d5d6006c1086b5882654e10e7cc9335bfb551b8d" name = "golang.org/x/oauth2" packages = [ ".", - "internal" + "internal", ] + pruneopts = "NUT" revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9" [[projects]] branch = "master" + digest = "1:a327d9e240ec95484861abeee08aadeb6ac1262fa8148c5e676674c0ca00e81b" name = "golang.org/x/sys" packages = [ "unix", - "windows" + "windows", ] + pruneopts = "NUT" revision = "dd2ff4accc098aceecb86b36eaa7829b2a17b1c9" [[projects]] + digest = "1:e7071ed636b5422cc51c0e3a6cebc229d6c9fffc528814b519a980641422d619" name = "golang.org/x/text" packages = [ "collate", @@ -222,18 +266,22 @@ "unicode/bidi", "unicode/cldr", "unicode/norm", - "unicode/rangetable" + "unicode/rangetable", ] + pruneopts = "NUT" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" version = "v0.3.0" [[projects]] branch = "master" + digest = "1:51a479a09b7ed06b7be5a854e27fcc328718ae0e5ad159f9ddeef12d0326c2e7" name = "golang.org/x/time" packages = ["rate"] + pruneopts = "NUT" revision = "26559e0f760e39c24d730d3224364aef164ee23f" [[projects]] + digest = "1:af71cb57ffcbc389c2f8af1e6a763c0d2e6f08d2ceb64140c0fd4c57fdbc2898" name = "google.golang.org/appengine" packages = [ "internal", @@ -242,18 +290,22 @@ "internal/log", "internal/remote_api", "internal/urlfetch", - "urlfetch" + "urlfetch", ] + pruneopts = "NUT" revision = "b1f26356af11148e710935ed1ac8a7f5702c7612" version = "v1.1.0" [[projects]] branch = "master" + digest = "1:cd018653a358d4b743a9d3bee89e825521f2ab2f2ec0770164bf7632d8d73ab7" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] + pruneopts = "NUT" revision = "2c5e7ac708aaa719366570dd82bda44541ca2a63" [[projects]] + digest = "1:d6978aa19fad4f8b3485d7a56e847542dc821d8dd2845bf2d2f8fdccf2d5e655" name = "google.golang.org/grpc" packages = [ ".", @@ -280,25 +332,30 @@ "stats", "status", "tap", - "transport" + "transport", ] + pruneopts = "NUT" revision = "8e4536a86ab602859c20df5ebfd0bd4228d08655" version = "v1.10.0" [[projects]] + digest = "1:ef72505cf098abdd34efeea032103377bec06abb61d8a06f002d5d296a4b1185" name = "gopkg.in/inf.v0" packages = ["."] + pruneopts = "NUT" revision = "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" version = "v0.9.0" [[projects]] + digest = "1:b92c04db63b4a79baff7afe06e0ee1076383a16834f8b8a90dc04644651f5315" name = "gopkg.in/yaml.v2" packages = ["."] + pruneopts = "NUT" revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5" version = "v2.1.1" [[projects]] - branch = "release-1.13" + digest = "1:c453ddc26bdab1e4267683a588ad9046e48d803a73f124fe2927adbab6ff02a5" name = "k8s.io/api" packages = [ "admissionregistration/v1alpha1", @@ -332,12 +389,14 @@ "settings/v1alpha1", "storage/v1", "storage/v1alpha1", - "storage/v1beta1" + "storage/v1beta1", ] - revision = "a61488babbd64b32da2ed985e2e70fe7b4ffc05a" + pruneopts = "NUT" + revision = "67edc246be36579e46a89e29a2f165d47e012109" + version = "kubernetes-1.13.2" [[projects]] - branch = "release-1.13" + digest = "1:3fced44d17545e2555cb982382c3b77829565d64d74cd497caa82fa55bda7fe1" name = "k8s.io/apimachinery" packages = [ "pkg/api/equality", @@ -382,12 +441,14 @@ "pkg/version", "pkg/watch", "third_party/forked/golang/json", - "third_party/forked/golang/reflect" + "third_party/forked/golang/reflect", ] - revision = "a6dc8e30bd0d613be6277952802c814768ed60c9" + pruneopts = "NUT" + revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd" + version = "kubernetes-1.13.2" [[projects]] - branch = "release-10.0" + digest = "1:34e65233e1d8f54d9db0f2233ff6c7e816107e57dcae5524892a7191ea43b1d7" name = "k8s.io/client-go" packages = [ "discovery", @@ -561,12 +622,14 @@ "util/homedir", "util/integer", "util/retry", - "util/workqueue" + "util/workqueue", ] - revision = "a47917edff34c2c3f7be36398e3ebad6011ce05c" + pruneopts = "NUT" + revision = "6bf63545bd0257ed9e701ad95307ffa51b4407c0" + version = "kubernetes-1.13.2" [[projects]] - branch = "release-1.13" + digest = "1:40f07150a9aab41f1bc0f52cc404d9d2b4c3bf0c45da19e36f9e73bff399508d" name = "k8s.io/csi-api" packages = [ "pkg/apis/csi/v1alpha1", @@ -579,31 +642,95 @@ "pkg/client/informers/externalversions/csi", "pkg/client/informers/externalversions/csi/v1alpha1", "pkg/client/informers/externalversions/internalinterfaces", - "pkg/client/listers/csi/v1alpha1" + "pkg/client/listers/csi/v1alpha1", ] - revision = "474e2246bd086c1441ac6dcf9cdd6267aea7e141" + pruneopts = "NUT" + revision = "6e3455e34a969d391180dce8c419d7219279b1f4" + version = "kubernetes-1.13.2" [[projects]] + branch = "master" + digest = "1:f1fd4a61afe71730223e6ca647049b87c69fbfb85c09e58904cdfecbac2dfd97" + name = "k8s.io/csi-translation-lib" + packages = [ + ".", + "plugins", + ] + pruneopts = "NUT" + revision = "c8c21cd117f4c0eef153178c8244e4cc9a609070" + +[[projects]] + digest = "1:9cc257b3c9ff6a0158c9c661ab6eebda1fe8a4a4453cd5c4044dc9a2ebfb992b" name = "k8s.io/klog" packages = ["."] + pruneopts = "NUT" revision = "a5bc97fbc634d635061f3146511332c7e313a55a" version = "v0.1.0" [[projects]] branch = "master" + digest = "1:e0d6dcb28c42a53c7243bb6380badd17f92fbd8488a075a07e984f91a07c0d23" name = "k8s.io/kube-openapi" packages = ["pkg/util/proto"] + pruneopts = "NUT" revision = "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf" [[projects]] + digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" name = "sigs.k8s.io/yaml" packages = ["."] + pruneopts = "NUT" revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" version = "v1.1.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "f4ac87732a46be1f9a45b1869c3a50f32e912112df9c700b3f8693d33e05d824" + input-imports = [ + "github.com/container-storage-interface/spec/lib/go/csi", + "github.com/davecgh/go-spew/spew", + "github.com/golang/glog", + "github.com/golang/mock/gomock", + "github.com/golang/protobuf/proto", + "github.com/kubernetes-csi/csi-lib-utils/protosanitizer", + "github.com/kubernetes-csi/csi-test/driver", + "google.golang.org/grpc", + "google.golang.org/grpc/codes", + "google.golang.org/grpc/connectivity", + "google.golang.org/grpc/status", + "k8s.io/api/core/v1", + "k8s.io/api/storage/v1", + "k8s.io/api/storage/v1beta1", + "k8s.io/apimachinery/pkg/api/equality", + "k8s.io/apimachinery/pkg/api/errors", + "k8s.io/apimachinery/pkg/apis/meta/v1", + "k8s.io/apimachinery/pkg/labels", + "k8s.io/apimachinery/pkg/runtime", + "k8s.io/apimachinery/pkg/runtime/schema", + "k8s.io/apimachinery/pkg/util/wait", + "k8s.io/client-go/informers", + "k8s.io/client-go/informers/core/v1", + "k8s.io/client-go/informers/storage/v1beta1", + "k8s.io/client-go/kubernetes", + "k8s.io/client-go/kubernetes/fake", + "k8s.io/client-go/kubernetes/scheme", + "k8s.io/client-go/kubernetes/typed/core/v1", + "k8s.io/client-go/listers/core/v1", + "k8s.io/client-go/listers/storage/v1beta1", + "k8s.io/client-go/rest", + "k8s.io/client-go/testing", + "k8s.io/client-go/tools/cache", + "k8s.io/client-go/tools/clientcmd", + "k8s.io/client-go/tools/leaderelection", + "k8s.io/client-go/tools/leaderelection/resourcelock", + "k8s.io/client-go/tools/record", + "k8s.io/client-go/util/workqueue", + "k8s.io/csi-api/pkg/apis/csi/v1alpha1", + "k8s.io/csi-api/pkg/client/clientset/versioned", + "k8s.io/csi-api/pkg/client/clientset/versioned/fake", + "k8s.io/csi-api/pkg/client/informers/externalversions", + "k8s.io/csi-api/pkg/client/listers/csi/v1alpha1", + "k8s.io/csi-translation-lib", + ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 0d4c1cb86..49d020915 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -24,23 +24,26 @@ name = "github.com/json-iterator/go" version = "1.1.4" -# TODO: use [[constraint]] when kubernetes-csi/kubernetes-csi-migration-library uses 1.13 code -[[override]] +[[constraint]] name = "k8s.io/api" - version = "kubernetes-1.13.0-beta.2" + version = "kubernetes-1.13.2" -[[override]] +[[constraint]] + name = "k8s.io/csi-translation-lib" + branch = "master" + +[[constraint]] name = "k8s.io/apimachinery" - version = "kubernetes-1.13.0-beta.2" + version = "kubernetes-1.13.2" -[[override]] +[[constraint]] name = "k8s.io/client-go" - version = "kubernetes-1.13.0-beta.2" + version = "kubernetes-1.13.2" -[[override]] +[[constraint]] name = "k8s.io/csi-api" - version = "kubernetes-1.13.0-beta.2" + version = "kubernetes-1.13.2" [[constraint]] name = "github.com/kubernetes-csi/csi-lib-utils" diff --git a/pkg/controller/csi_handler.go b/pkg/controller/csi_handler.go index 337a9a916..433e07e0e 100644 --- a/pkg/controller/csi_handler.go +++ b/pkg/controller/csi_handler.go @@ -25,7 +25,6 @@ import ( "github.com/kubernetes-csi/external-attacher/pkg/connection" - csiMigration "github.com/kubernetes-csi/kubernetes-csi-migration-library" "k8s.io/api/core/v1" storage "k8s.io/api/storage/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,6 +35,7 @@ import ( "k8s.io/client-go/util/workqueue" csiclient "k8s.io/csi-api/pkg/client/clientset/versioned" csilisters "k8s.io/csi-api/pkg/client/listers/csi/v1alpha1" + csitranslationlib "k8s.io/csi-translation-lib" ) // csiHandler is a handler that calls CSI to attach/detach volume. @@ -245,8 +245,8 @@ func getCSISource(pv *v1.PersistentVolume) (*v1.CSIPersistentVolumeSource, error } if pv.Spec.CSI != nil { return pv.Spec.CSI, nil - } else if csiMigration.IsPVMigrated(pv) { - csiPV, err := csiMigration.TranslateInTreePVToCSI(pv) + } else if csitranslationlib.IsPVMigratable(pv) { + csiPV, err := csitranslationlib.TranslateInTreePVToCSI(pv) if err != nil { return nil, fmt.Errorf("failed to translate in tree pv to CSI: %v", err) } diff --git a/vendor/k8s.io/client-go/rest/config.go b/vendor/k8s.io/client-go/rest/config.go index 438eb3bed..072e7392b 100644 --- a/vendor/k8s.io/client-go/rest/config.go +++ b/vendor/k8s.io/client-go/rest/config.go @@ -70,6 +70,11 @@ type Config struct { // TODO: demonstrate an OAuth2 compatible client. BearerToken string + // Path to a file containing a BearerToken. + // If set, the contents are periodically read. + // The last successfully read value takes precedence over BearerToken. + BearerTokenFile string + // Impersonate is the configuration that RESTClient will use for impersonation. Impersonate ImpersonationConfig @@ -322,9 +327,8 @@ func InClusterConfig() (*Config, error) { return nil, ErrNotInCluster } - ts := NewCachedFileTokenSource(tokenFile) - - if _, err := ts.Token(); err != nil { + token, err := ioutil.ReadFile(tokenFile) + if err != nil { return nil, err } @@ -340,7 +344,8 @@ func InClusterConfig() (*Config, error) { // TODO: switch to using cluster DNS. Host: "https://" + net.JoinHostPort(host, port), TLSClientConfig: tlsClientConfig, - WrapTransport: TokenSourceWrapTransport(ts), + BearerToken: string(token), + BearerTokenFile: tokenFile, }, nil } @@ -430,12 +435,13 @@ func AnonymousClientConfig(config *Config) *Config { // CopyConfig returns a copy of the given config func CopyConfig(config *Config) *Config { return &Config{ - Host: config.Host, - APIPath: config.APIPath, - ContentConfig: config.ContentConfig, - Username: config.Username, - Password: config.Password, - BearerToken: config.BearerToken, + Host: config.Host, + APIPath: config.APIPath, + ContentConfig: config.ContentConfig, + Username: config.Username, + Password: config.Password, + BearerToken: config.BearerToken, + BearerTokenFile: config.BearerTokenFile, Impersonate: ImpersonationConfig{ Groups: config.Impersonate.Groups, Extra: config.Impersonate.Extra, diff --git a/vendor/k8s.io/client-go/tools/clientcmd/client_config.go b/vendor/k8s.io/client-go/tools/clientcmd/client_config.go index dea229c91..a7b8c1c6e 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/client_config.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/client_config.go @@ -229,11 +229,12 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI if len(configAuthInfo.Token) > 0 { mergedConfig.BearerToken = configAuthInfo.Token } else if len(configAuthInfo.TokenFile) > 0 { - ts := restclient.NewCachedFileTokenSource(configAuthInfo.TokenFile) - if _, err := ts.Token(); err != nil { + tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile) + if err != nil { return nil, err } - mergedConfig.WrapTransport = restclient.TokenSourceWrapTransport(ts) + mergedConfig.BearerToken = string(tokenBytes) + mergedConfig.BearerTokenFile = configAuthInfo.TokenFile } if len(configAuthInfo.Impersonate) > 0 { mergedConfig.Impersonate = restclient.ImpersonationConfig{ diff --git a/vendor/k8s.io/client-go/transport/config.go b/vendor/k8s.io/client-go/transport/config.go index 4081c23e7..acb126d8b 100644 --- a/vendor/k8s.io/client-go/transport/config.go +++ b/vendor/k8s.io/client-go/transport/config.go @@ -39,6 +39,11 @@ type Config struct { // Bearer token for authentication BearerToken string + // Path to a file containing a BearerToken. + // If set, the contents are periodically read. + // The last successfully read value takes precedence over BearerToken. + BearerTokenFile string + // Impersonate is the config that this Config will impersonate using Impersonate ImpersonationConfig @@ -80,7 +85,7 @@ func (c *Config) HasBasicAuth() bool { // HasTokenAuth returns whether the configuration has token authentication or not. func (c *Config) HasTokenAuth() bool { - return len(c.BearerToken) != 0 + return len(c.BearerToken) != 0 || len(c.BearerTokenFile) != 0 } // HasCertAuth returns whether the configuration has certificate authentication or not. diff --git a/vendor/k8s.io/client-go/transport/round_trippers.go b/vendor/k8s.io/client-go/transport/round_trippers.go index da417cf96..117a9c8c4 100644 --- a/vendor/k8s.io/client-go/transport/round_trippers.go +++ b/vendor/k8s.io/client-go/transport/round_trippers.go @@ -22,6 +22,7 @@ import ( "strings" "time" + "golang.org/x/oauth2" "k8s.io/klog" utilnet "k8s.io/apimachinery/pkg/util/net" @@ -44,7 +45,11 @@ func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTrip case config.HasBasicAuth() && config.HasTokenAuth(): return nil, fmt.Errorf("username/password or bearer token may be set, but not both") case config.HasTokenAuth(): - rt = NewBearerAuthRoundTripper(config.BearerToken, rt) + var err error + rt, err = NewBearerAuthWithRefreshRoundTripper(config.BearerToken, config.BearerTokenFile, rt) + if err != nil { + return nil, err + } case config.HasBasicAuth(): rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt) } @@ -265,13 +270,35 @@ func (rt *impersonatingRoundTripper) WrappedRoundTripper() http.RoundTripper { r type bearerAuthRoundTripper struct { bearer string + source oauth2.TokenSource rt http.RoundTripper } // NewBearerAuthRoundTripper adds the provided bearer token to a request // unless the authorization header has already been set. func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper { - return &bearerAuthRoundTripper{bearer, rt} + return &bearerAuthRoundTripper{bearer, nil, rt} +} + +// NewBearerAuthRoundTripper adds the provided bearer token to a request +// unless the authorization header has already been set. +// If tokenFile is non-empty, it is periodically read, +// and the last successfully read content is used as the bearer token. +// If tokenFile is non-empty and bearer is empty, the tokenFile is read +// immediately to populate the initial bearer token. +func NewBearerAuthWithRefreshRoundTripper(bearer string, tokenFile string, rt http.RoundTripper) (http.RoundTripper, error) { + if len(tokenFile) == 0 { + return &bearerAuthRoundTripper{bearer, nil, rt}, nil + } + source := NewCachedFileTokenSource(tokenFile) + if len(bearer) == 0 { + token, err := source.Token() + if err != nil { + return nil, err + } + bearer = token.AccessToken + } + return &bearerAuthRoundTripper{bearer, source, rt}, nil } func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { @@ -280,7 +307,13 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, } req = utilnet.CloneRequest(req) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", rt.bearer)) + token := rt.bearer + if rt.source != nil { + if refreshedToken, err := rt.source.Token(); err == nil { + token = refreshedToken.AccessToken + } + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) return rt.rt.RoundTrip(req) } diff --git a/vendor/k8s.io/client-go/rest/token_source.go b/vendor/k8s.io/client-go/transport/token_source.go similarity index 87% rename from vendor/k8s.io/client-go/rest/token_source.go rename to vendor/k8s.io/client-go/transport/token_source.go index c251b5eb0..8595df271 100644 --- a/vendor/k8s.io/client-go/rest/token_source.go +++ b/vendor/k8s.io/client-go/transport/token_source.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package rest +package transport import ( "fmt" @@ -47,14 +47,14 @@ func TokenSourceWrapTransport(ts oauth2.TokenSource) func(http.RoundTripper) htt func NewCachedFileTokenSource(path string) oauth2.TokenSource { return &cachingTokenSource{ now: time.Now, - leeway: 1 * time.Minute, + leeway: 10 * time.Second, base: &fileTokenSource{ path: path, - // This period was picked because it is half of the minimum validity - // duration for a token provisioned by they TokenRequest API. This is - // unsophisticated and should induce rotation at a frequency that should - // work with the token volume source. - period: 5 * time.Minute, + // This period was picked because it is half of the duration between when the kubelet + // refreshes a projected service account token and when the original token expires. + // Default token lifetime is 10 minutes, and the kubelet starts refreshing at 80% of lifetime. + // This should induce re-reading at a frequency that works with the token volume source. + period: time.Minute, }, } } diff --git a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/LICENSE b/vendor/k8s.io/csi-translation-lib/LICENSE similarity index 100% rename from vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/LICENSE rename to vendor/k8s.io/csi-translation-lib/LICENSE diff --git a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/aws_ebs.go b/vendor/k8s.io/csi-translation-lib/plugins/aws_ebs.go similarity index 59% rename from vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/aws_ebs.go rename to vendor/k8s.io/csi-translation-lib/plugins/aws_ebs.go index 1b48b57aa..eda70843f 100644 --- a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/aws_ebs.go +++ b/vendor/k8s.io/csi-translation-lib/plugins/aws_ebs.go @@ -1,10 +1,12 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,16 +24,25 @@ import ( ) const ( - AWSEBSDriverName = "com.amazon.aws.csi.ebs" + // AWSEBSDriverName is the name of the CSI driver for EBS + AWSEBSDriverName = "ebs.csi.aws.com" + // AWSEBSInTreePluginName is the name of the intree plugin for EBS AWSEBSInTreePluginName = "kubernetes.io/aws-ebs" ) -type AWSEBS struct{} +var _ InTreePlugin = &awsElasticBlockStoreCSITranslator{} + +// awsElasticBlockStoreTranslator handles translation of PV spec from In-tree EBS to CSI EBS and vice versa +type awsElasticBlockStoreCSITranslator struct{} + +// NewAWSElasticBlockStoreCSITranslator returns a new instance of awsElasticBlockStoreTranslator +func NewAWSElasticBlockStoreCSITranslator() InTreePlugin { + return &awsElasticBlockStoreCSITranslator{} +} -// TranslateToCSI takes a volume.Spec and will translate it to a -// CSIPersistentVolumeSource if the translation logic for that -// specific in-tree volume spec has been implemented -func (t *AWSEBS) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { +// TranslateInTreePVToCSI takes a PV with AWSElasticBlockStore set from in-tree +// and converts the AWSElasticBlockStore source to a CSIPersistentVolumeSource +func (t *awsElasticBlockStoreCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { if pv == nil || pv.Spec.AWSElasticBlockStore == nil { return nil, fmt.Errorf("pv is nil or AWS EBS not defined on pv") } @@ -53,10 +64,9 @@ func (t *AWSEBS) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.Persistent return pv, nil } -// TranslateToIntree takes a CSIPersistentVolumeSource and will translate -// it to a volume.Spec for the specific in-tree volume specified by -//`inTreePlugin`, if that translation logic has been implemented -func (t *AWSEBS) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { +// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and +// translates the EBS CSI source to a AWSElasticBlockStore source. +func (t *awsElasticBlockStoreCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { if pv == nil || pv.Spec.CSI == nil { return nil, fmt.Errorf("pv is nil or CSI source not defined on pv") } @@ -85,10 +95,11 @@ func (t *AWSEBS) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.Persistent // CanSupport tests whether the plugin supports a given volume // specification from the API. The spec pointer should be considered // const. -func (t *AWSEBS) CanSupport(pv *v1.PersistentVolume) bool { +func (t *awsElasticBlockStoreCSITranslator) CanSupport(pv *v1.PersistentVolume) bool { return pv != nil && pv.Spec.AWSElasticBlockStore != nil } -func (t *AWSEBS) GetInTreePluginName() string { +// GetInTreePluginName returns the name of the intree plugin driver +func (t *awsElasticBlockStoreCSITranslator) GetInTreePluginName() string { return AWSEBSInTreePluginName } diff --git a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/gce_pd.go b/vendor/k8s.io/csi-translation-lib/plugins/gce_pd.go similarity index 70% rename from vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/gce_pd.go rename to vendor/k8s.io/csi-translation-lib/plugins/gce_pd.go index dcbee9135..740e54f5f 100644 --- a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/gce_pd.go +++ b/vendor/k8s.io/csi-translation-lib/plugins/gce_pd.go @@ -1,10 +1,12 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,11 +26,11 @@ import ( ) const ( - // GCE PD CSI driver constants - GCEPDDriverName = "com.google.csi.gcepd" + // GCEPDDriverName is the name of the CSI driver for GCE PD + GCEPDDriverName = "pd.csi.storage.gke.io" + // GCEPDInTreePluginName is the name of the intree plugin for GCE PD GCEPDInTreePluginName = "kubernetes.io/gce-pd" - UnspecifiedValue = "UNSPECIFIED" // Volume ID Expected Format // "projects/{projectName}/zones/{zoneName}/disks/{diskName}" volIDZonalFmt = "projects/%s/zones/%s/disks/%s" @@ -37,17 +39,28 @@ const ( volIDDiskNameValue = 5 volIDTotalElements = 6 - // Kubernetes label constants - LabelZoneFailureDomain = "failure-domain.beta.kubernetes.io/zone" + // LabelZoneFailureDomain is the label on PVs indicating the zone they are provisioned in + LabelZoneFailureDomain = "failure-domain.beta.kubernetes.io/zone" + // LabelMultiZoneDelimiter separates zones for RePD volumes LabelMultiZoneDelimiter = "__" + // UnspecifiedValue is used for an unknown zone string + UnspecifiedValue = "UNSPECIFIED" ) -type GCEPD struct{} +var _ InTreePlugin = &gcePersistentDiskCSITranslator{} + +// gcePersistentDiskCSITranslator handles translation of PV spec from In-tree +// GCE PD to CSI GCE PD and vice versa +type gcePersistentDiskCSITranslator struct{} + +// NewGCEPersistentDiskCSITranslator returns a new instance of gcePersistentDiskTranslator +func NewGCEPersistentDiskCSITranslator() InTreePlugin { + return &gcePersistentDiskCSITranslator{} +} -// TranslateToCSI takes a volume.Spec and will translate it to a -// CSIPersistentVolumeSource if the translation logic for that -// specific in-tree volume spec has been implemented -func (g *GCEPD) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { +// TranslateInTreePVToCSI takes a PV with GCEPersistentDisk set from in-tree +// and converts the GCEPersistentDisk source to a CSIPersistentVolumeSource +func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { var volID string if pv == nil || pv.Spec.GCEPersistentDisk == nil { @@ -88,10 +101,9 @@ func (g *GCEPD) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentV return pv, nil } -// TranslateToIntree takes a CSIPersistentVolumeSource and will translate -// it to a volume.Spec for the specific in-tree volume specified by -//`inTreePlugin`, if that translation logic has been implemented -func (g *GCEPD) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { +// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and +// translates the GCE PD CSI source to a GCEPersistentDisk source. +func (g *gcePersistentDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { if pv == nil || pv.Spec.CSI == nil { return nil, fmt.Errorf("pv is nil or CSI source not defined on pv") } @@ -126,20 +138,21 @@ func (g *GCEPD) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentV // CanSupport tests whether the plugin supports a given volume // specification from the API. The spec pointer should be considered // const. -func (g *GCEPD) CanSupport(pv *v1.PersistentVolume) bool { +func (g *gcePersistentDiskCSITranslator) CanSupport(pv *v1.PersistentVolume) bool { return pv != nil && pv.Spec.GCEPersistentDisk != nil } -func (g *GCEPD) GetInTreePluginName() string { +// GetInTreePluginName returns the name of the intree plugin driver +func (g *gcePersistentDiskCSITranslator) GetInTreePluginName() string { return GCEPDInTreePluginName } func pdNameFromVolumeID(id string) (string, error) { - splitId := strings.Split(id, "/") - if len(splitId) != volIDTotalElements { + splitID := strings.Split(id, "/") + if len(splitID) != volIDTotalElements { return "", fmt.Errorf("failed to get id components. Expected projects/{project}/zones/{zone}/disks/{name}. Got: %s", id) } - return splitId[volIDDiskNameValue], nil + return splitID[volIDDiskNameValue], nil } // TODO: Replace this with the imported one from GCE PD CSI Driver when diff --git a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/in_tree_volume.go b/vendor/k8s.io/csi-translation-lib/plugins/in_tree_volume.go similarity index 81% rename from vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/in_tree_volume.go rename to vendor/k8s.io/csi-translation-lib/plugins/in_tree_volume.go index 28882d230..e2eb16e49 100644 --- a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins/in_tree_volume.go +++ b/vendor/k8s.io/csi-translation-lib/plugins/in_tree_volume.go @@ -1,10 +1,12 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,12 +18,13 @@ package plugins import "k8s.io/api/core/v1" +// InTreePlugin handles translations between CSI and in-tree sources in a PV type InTreePlugin interface { - // TranslateToCSI takes a persistent volume and will translate + // TranslateInTreePVToCSI takes a persistent volume and will translate // the in-tree source to a CSI Source. The input persistent volume can be modified TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) - // TranslateToIntree takes a PV with a CSI PersistentVolume Source and will translate + // TranslateCSIPVToInTree takes a PV with a CSI PersistentVolume Source and will translate // it to a in-tree Persistent Volume Source for the in-tree volume // by the `Driver` field in the CSI Source. The input PV object can be modified TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) diff --git a/vendor/k8s.io/csi-translation-lib/plugins/openstack_cinder.go b/vendor/k8s.io/csi-translation-lib/plugins/openstack_cinder.go new file mode 100644 index 000000000..7694845aa --- /dev/null +++ b/vendor/k8s.io/csi-translation-lib/plugins/openstack_cinder.go @@ -0,0 +1,93 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package plugins + +import ( + "fmt" + "k8s.io/api/core/v1" +) + +const ( + // CinderDriverName is the name of the CSI driver for Cinder + CinderDriverName = "cinder.csi.openstack.org" + // CinderInTreePluginName is the name of the intree plugin for Cinder + CinderInTreePluginName = "kubernetes.io/cinder" +) + +var _ InTreePlugin = (*osCinderCSITranslator)(nil) + +// osCinderCSITranslator handles translation of PV spec from In-tree Cinder to CSI Cinder and vice versa +type osCinderCSITranslator struct{} + +// NewOpenStackCinderCSITranslator returns a new instance of osCinderCSITranslator +func NewOpenStackCinderCSITranslator() InTreePlugin { + return &osCinderCSITranslator{} +} + +// TranslateInTreePVToCSI takes a PV with Cinder set from in-tree +// and converts the Cinder source to a CSIPersistentVolumeSource +func (t *osCinderCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { + if pv == nil || pv.Spec.Cinder == nil { + return nil, fmt.Errorf("pv is nil or Cinder not defined on pv") + } + + cinderSource := pv.Spec.Cinder + + csiSource := &v1.CSIPersistentVolumeSource{ + Driver: CinderDriverName, + VolumeHandle: cinderSource.VolumeID, + ReadOnly: cinderSource.ReadOnly, + FSType: cinderSource.FSType, + VolumeAttributes: map[string]string{}, + } + + pv.Spec.Cinder = nil + pv.Spec.CSI = csiSource + return pv, nil +} + +// TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and +// translates the Cinder CSI source to a Cinder In-tree source. +func (t *osCinderCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { + if pv == nil || pv.Spec.CSI == nil { + return nil, fmt.Errorf("pv is nil or CSI source not defined on pv") + } + + csiSource := pv.Spec.CSI + + cinderSource := &v1.CinderPersistentVolumeSource{ + VolumeID: csiSource.VolumeHandle, + FSType: csiSource.FSType, + ReadOnly: csiSource.ReadOnly, + } + + pv.Spec.CSI = nil + pv.Spec.Cinder = cinderSource + return pv, nil +} + +// CanSupport tests whether the plugin supports a given volume +// specification from the API. The spec pointer should be considered +// const. +func (t *osCinderCSITranslator) CanSupport(pv *v1.PersistentVolume) bool { + return pv != nil && pv.Spec.Cinder != nil +} + +// GetInTreePluginName returns the name of the intree plugin driver +func (t *osCinderCSITranslator) GetInTreePluginName() string { + return CinderInTreePluginName +} diff --git a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/translate.go b/vendor/k8s.io/csi-translation-lib/translate.go similarity index 71% rename from vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/translate.go rename to vendor/k8s.io/csi-translation-lib/translate.go index 90de606cd..754cab9e0 100644 --- a/vendor/github.com/kubernetes-csi/kubernetes-csi-migration-library/translate.go +++ b/vendor/k8s.io/csi-translation-lib/translate.go @@ -1,10 +1,12 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -12,23 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -package translate +package csitranslation import ( "fmt" - "github.com/kubernetes-csi/kubernetes-csi-migration-library/plugins" "k8s.io/api/core/v1" + "k8s.io/csi-translation-lib/plugins" ) var ( inTreePlugins = map[string]plugins.InTreePlugin{ - plugins.GCEPDDriverName: &plugins.GCEPD{}, - plugins.AWSEBSDriverName: &plugins.AWSEBS{}, + plugins.GCEPDDriverName: plugins.NewGCEPersistentDiskCSITranslator(), + plugins.AWSEBSDriverName: plugins.NewAWSElasticBlockStoreCSITranslator(), + plugins.CinderDriverName: plugins.NewOpenStackCinderCSITranslator(), } ) -// TranslateToCSI takes a persistent volume and will translate +// TranslateInTreePVToCSI takes a persistent volume and will translate // the in-tree source to a CSI Source if the translation logic // has been implemented. The input persistent volume will not // be modified @@ -45,7 +48,7 @@ func TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, erro return nil, fmt.Errorf("could not find in-tree plugin translation logic for %#v", copiedPV.Name) } -// TranslateToIntree takes a PV with a CSI PersistentVolume Source and will translate +// TranslateCSIPVToInTree takes a PV with a CSI PersistentVolume Source and will translate // it to a in-tree Persistent Volume Source for the specific in-tree volume specified // by the `Driver` field in the CSI Source. The input PV object will not be modified. func TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { @@ -61,9 +64,9 @@ func TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, erro return nil, fmt.Errorf("could not find in-tree plugin translation logic for %s", copiedPV.Spec.CSI.Driver) } -// IsMigratedByName tests whether there is Migration logic for the in-tree plugin +// IsMigratableByName tests whether there is Migration logic for the in-tree plugin // for the given `pluginName` -func IsMigratedByName(pluginName string) bool { +func IsMigratableByName(pluginName string) bool { for _, curPlugin := range inTreePlugins { if curPlugin.GetInTreePluginName() == pluginName { return true @@ -72,6 +75,7 @@ func IsMigratedByName(pluginName string) bool { return false } +// GetCSINameFromIntreeName maps the name of a CSI driver to its in-tree version func GetCSINameFromIntreeName(pluginName string) (string, error) { for csiDriverName, curPlugin := range inTreePlugins { if curPlugin.GetInTreePluginName() == pluginName { @@ -81,8 +85,8 @@ func GetCSINameFromIntreeName(pluginName string) (string, error) { return "", fmt.Errorf("Could not find CSI Driver name for plugin %v", pluginName) } -// IsPVMigrated tests whether there is Migration logic for the given Persistent Volume -func IsPVMigrated(pv *v1.PersistentVolume) bool { +// IsPVMigratable tests whether there is Migration logic for the given Persistent Volume +func IsPVMigratable(pv *v1.PersistentVolume) bool { for _, curPlugin := range inTreePlugins { if curPlugin.CanSupport(pv) { return true @@ -91,7 +95,7 @@ func IsPVMigrated(pv *v1.PersistentVolume) bool { return false } -// IsInlineMigrated tests whether there is Migration logic for the given Inline Volume -func IsInlineMigrated(vol *v1.Volume) bool { +// IsInlineMigratable tests whether there is Migration logic for the given Inline Volume +func IsInlineMigratable(vol *v1.Volume) bool { return false }