From 1add6b0cfa30a534e7d13cc92cdb93805ca7ea4d Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 10:36:31 +0800 Subject: [PATCH 1/8] migrate to k8s.io/utils/keymutex --- pkg/volume/azure_dd/BUILD | 2 +- pkg/volume/azure_dd/attacher.go | 2 +- pkg/volume/cinder/BUILD | 2 +- pkg/volume/cinder/cinder.go | 2 +- pkg/volume/iscsi/BUILD | 2 +- pkg/volume/iscsi/attacher.go | 2 +- pkg/volume/iscsi/iscsi.go | 2 +- pkg/volume/local/BUILD | 2 +- pkg/volume/local/local.go | 2 +- pkg/volume/scaleio/BUILD | 2 +- pkg/volume/scaleio/sio_plugin.go | 2 +- pkg/volume/vsphere_volume/BUILD | 2 +- pkg/volume/vsphere_volume/attacher.go | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/volume/azure_dd/BUILD b/pkg/volume/azure_dd/BUILD index fd28f977d79..3fe9b993bdf 100644 --- a/pkg/volume/azure_dd/BUILD +++ b/pkg/volume/azure_dd/BUILD @@ -25,7 +25,6 @@ go_library( "//pkg/cloudprovider/providers/azure:go_default_library", "//pkg/features:go_default_library", "//pkg/kubelet/apis:go_default_library", - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -42,6 +41,7 @@ go_library( "//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-10-01/compute:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index 0a99b4a91c6..e4b5e797700 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -33,10 +33,10 @@ import ( "k8s.io/apimachinery/pkg/util/wait" cloudprovider "k8s.io/cloud-provider" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/keymutex" ) type azureDiskDetacher struct { diff --git a/pkg/volume/cinder/BUILD b/pkg/volume/cinder/BUILD index 9435be1ec42..f04049f859e 100644 --- a/pkg/volume/cinder/BUILD +++ b/pkg/volume/cinder/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/cloudprovider/providers/openstack:go_default_library", "//pkg/features:go_default_library", "//pkg/kubelet/apis:go_default_library", - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -37,6 +36,7 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index fa3b43c87e9..a609f0f43ce 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -31,11 +31,11 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack" "k8s.io/kubernetes/pkg/features" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/keymutex" ) const ( diff --git a/pkg/volume/iscsi/BUILD b/pkg/volume/iscsi/BUILD index 1143c892e86..f9632a1e86d 100644 --- a/pkg/volume/iscsi/BUILD +++ b/pkg/volume/iscsi/BUILD @@ -18,7 +18,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/iscsi", deps = [ "//pkg/features:go_default_library", - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -29,6 +28,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/iscsi/attacher.go b/pkg/volume/iscsi/attacher.go index 922bc31de6c..2a59a3047e9 100644 --- a/pkg/volume/iscsi/attacher.go +++ b/pkg/volume/iscsi/attacher.go @@ -26,10 +26,10 @@ import ( utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog" "k8s.io/kubernetes/pkg/features" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/keymutex" ) type iscsiAttacher struct { diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index dba3acf2f2f..aebf15c390a 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -27,12 +27,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" ioutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + "k8s.io/utils/keymutex" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/local/BUILD b/pkg/volume/local/BUILD index a17a11a58bc..b078bf37b16 100644 --- a/pkg/volume/local/BUILD +++ b/pkg/volume/local/BUILD @@ -10,7 +10,6 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/kubelet/events:go_default_library", - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -21,6 +20,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index 7d12819929c..29e8f645059 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -30,12 +30,12 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/kubernetes/pkg/kubelet/events" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" stringsutil "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/validation" + "k8s.io/utils/keymutex" ) const ( diff --git a/pkg/volume/scaleio/BUILD b/pkg/volume/scaleio/BUILD index 526fcbe582b..4e8fb802429 100644 --- a/pkg/volume/scaleio/BUILD +++ b/pkg/volume/scaleio/BUILD @@ -40,7 +40,6 @@ go_library( ], importpath = "k8s.io/kubernetes/pkg/volume/scaleio", deps = [ - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -53,6 +52,7 @@ go_library( "//vendor/github.com/codedellemc/goscaleio:go_default_library", "//vendor/github.com/codedellemc/goscaleio/types/v1:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/scaleio/sio_plugin.go b/pkg/volume/scaleio/sio_plugin.go index 775d9315b7b..7b045376dd5 100644 --- a/pkg/volume/scaleio/sio_plugin.go +++ b/pkg/volume/scaleio/sio_plugin.go @@ -22,8 +22,8 @@ import ( api "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/keymutex" ) const ( diff --git a/pkg/volume/vsphere_volume/BUILD b/pkg/volume/vsphere_volume/BUILD index 89892c7621d..2c948b74465 100644 --- a/pkg/volume/vsphere_volume/BUILD +++ b/pkg/volume/vsphere_volume/BUILD @@ -19,7 +19,6 @@ go_library( "//pkg/cloudprovider/providers/vsphere:go_default_library", "//pkg/cloudprovider/providers/vsphere/vclib:go_default_library", "//pkg/features:go_default_library", - "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -32,6 +31,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/keymutex:go_default_library", ], ) diff --git a/pkg/volume/vsphere_volume/attacher.go b/pkg/volume/vsphere_volume/attacher.go index ed7688f91eb..1551d981d54 100644 --- a/pkg/volume/vsphere_volume/attacher.go +++ b/pkg/volume/vsphere_volume/attacher.go @@ -26,10 +26,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" - "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/keymutex" ) type vsphereVMDKAttacher struct { From df7e4f3d497e0bb21a048de60f4ed007dc9d9a16 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 10:58:18 +0800 Subject: [PATCH 2/8] clean pkg/util/keymutex --- pkg/util/BUILD | 1 - pkg/util/keymutex/BUILD | 36 ---------- pkg/util/keymutex/hashed.go | 64 ------------------ pkg/util/keymutex/keymutex.go | 27 -------- pkg/util/keymutex/keymutex_test.go | 105 ----------------------------- test/test_owners.csv | 1 - 6 files changed, 234 deletions(-) delete mode 100644 pkg/util/keymutex/BUILD delete mode 100644 pkg/util/keymutex/hashed.go delete mode 100644 pkg/util/keymutex/keymutex.go delete mode 100644 pkg/util/keymutex/keymutex_test.go diff --git a/pkg/util/BUILD b/pkg/util/BUILD index b2620448b6b..c3b25deb69c 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -32,7 +32,6 @@ filegroup( "//pkg/util/ipset:all-srcs", "//pkg/util/iptables:all-srcs", "//pkg/util/ipvs:all-srcs", - "//pkg/util/keymutex:all-srcs", "//pkg/util/labels:all-srcs", "//pkg/util/maps:all-srcs", "//pkg/util/metrics:all-srcs", diff --git a/pkg/util/keymutex/BUILD b/pkg/util/keymutex/BUILD deleted file mode 100644 index 267a4b1f633..00000000000 --- a/pkg/util/keymutex/BUILD +++ /dev/null @@ -1,36 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "hashed.go", - "keymutex.go", - ], - importpath = "k8s.io/kubernetes/pkg/util/keymutex", - deps = ["//vendor/k8s.io/klog:go_default_library"], -) - -go_test( - name = "go_default_test", - srcs = ["keymutex_test.go"], - embed = [":go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/keymutex/hashed.go b/pkg/util/keymutex/hashed.go deleted file mode 100644 index 5176ae916c2..00000000000 --- a/pkg/util/keymutex/hashed.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2018 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 keymutex - -import ( - "hash/fnv" - "runtime" - "sync" - - "k8s.io/klog" -) - -// NewHashed returns a new instance of KeyMutex which hashes arbitrary keys to -// a fixed set of locks. `n` specifies number of locks, if n <= 0, we use -// number of cpus. -// Note that because it uses fixed set of locks, different keys may share same -// lock, so it's possible to wait on same lock. -func NewHashed(n int) KeyMutex { - if n <= 0 { - n = runtime.NumCPU() - } - return &hashedKeyMutex{ - mutexes: make([]sync.Mutex, n), - } -} - -type hashedKeyMutex struct { - mutexes []sync.Mutex -} - -// Acquires a lock associated with the specified ID. -func (km *hashedKeyMutex) LockKey(id string) { - klog.V(5).Infof("hashedKeyMutex.LockKey(...) called for id %q\r\n", id) - km.mutexes[km.hash(id)%len(km.mutexes)].Lock() - klog.V(5).Infof("hashedKeyMutex.LockKey(...) for id %q completed.\r\n", id) -} - -// Releases the lock associated with the specified ID. -func (km *hashedKeyMutex) UnlockKey(id string) error { - klog.V(5).Infof("hashedKeyMutex.UnlockKey(...) called for id %q\r\n", id) - km.mutexes[km.hash(id)%len(km.mutexes)].Unlock() - klog.V(5).Infof("hashedKeyMutex.UnlockKey(...) for id %q completed.\r\n", id) - return nil -} - -func (km *hashedKeyMutex) hash(id string) int { - h := fnv.New32a() - h.Write([]byte(id)) - return int(h.Sum32()) -} diff --git a/pkg/util/keymutex/keymutex.go b/pkg/util/keymutex/keymutex.go deleted file mode 100644 index 89dc022397c..00000000000 --- a/pkg/util/keymutex/keymutex.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2015 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 keymutex - -// KeyMutex is a thread-safe interface for acquiring locks on arbitrary strings. -type KeyMutex interface { - // Acquires a lock associated with the specified ID, creates the lock if one doesn't already exist. - LockKey(id string) - - // Releases the lock associated with the specified ID. - // Returns an error if the specified ID doesn't exist. - UnlockKey(id string) error -} diff --git a/pkg/util/keymutex/keymutex_test.go b/pkg/util/keymutex/keymutex_test.go deleted file mode 100644 index ce2f567bb2d..00000000000 --- a/pkg/util/keymutex/keymutex_test.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright 2015 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 keymutex - -import ( - "testing" - "time" -) - -const ( - callbackTimeout = 1 * time.Second -) - -func newKeyMutexes() []KeyMutex { - return []KeyMutex{ - NewHashed(0), - NewHashed(1), - NewHashed(2), - NewHashed(4), - } -} - -func Test_SingleLock_NoUnlock(t *testing.T) { - for _, km := range newKeyMutexes() { - // Arrange - key := "fakeid" - callbackCh := make(chan interface{}) - - // Act - go lockAndCallback(km, key, callbackCh) - - // Assert - verifyCallbackHappens(t, callbackCh) - } -} - -func Test_SingleLock_SingleUnlock(t *testing.T) { - for _, km := range newKeyMutexes() { - // Arrange - key := "fakeid" - callbackCh := make(chan interface{}) - - // Act & Assert - go lockAndCallback(km, key, callbackCh) - verifyCallbackHappens(t, callbackCh) - km.UnlockKey(key) - } -} - -func Test_DoubleLock_DoubleUnlock(t *testing.T) { - for _, km := range newKeyMutexes() { - // Arrange - key := "fakeid" - callbackCh1stLock := make(chan interface{}) - callbackCh2ndLock := make(chan interface{}) - - // Act & Assert - go lockAndCallback(km, key, callbackCh1stLock) - verifyCallbackHappens(t, callbackCh1stLock) - go lockAndCallback(km, key, callbackCh2ndLock) - verifyCallbackDoesntHappens(t, callbackCh2ndLock) - km.UnlockKey(key) - verifyCallbackHappens(t, callbackCh2ndLock) - km.UnlockKey(key) - } -} - -func lockAndCallback(km KeyMutex, id string, callbackCh chan<- interface{}) { - km.LockKey(id) - callbackCh <- true -} - -func verifyCallbackHappens(t *testing.T, callbackCh <-chan interface{}) bool { - select { - case <-callbackCh: - return true - case <-time.After(callbackTimeout): - t.Fatalf("Timed out waiting for callback.") - return false - } -} - -func verifyCallbackDoesntHappens(t *testing.T, callbackCh <-chan interface{}) bool { - select { - case <-callbackCh: - t.Fatalf("Unexpected callback.") - return false - case <-time.After(callbackTimeout): - return true - } -} diff --git a/test/test_owners.csv b/test/test_owners.csv index 16ba34c28db..26cdfa575d6 100644 --- a/test/test_owners.csv +++ b/test/test_owners.csv @@ -793,7 +793,6 @@ k8s.io/kubernetes/pkg/util/hash,timothysc,1, k8s.io/kubernetes/pkg/util/i18n,brendandburns,0, k8s.io/kubernetes/pkg/util/io,mtaufen,1, k8s.io/kubernetes/pkg/util/iptables,rrati,0, -k8s.io/kubernetes/pkg/util/keymutex,saad-ali,0, k8s.io/kubernetes/pkg/util/labels,rmmh,1, k8s.io/kubernetes/pkg/util/limitwriter,deads2k,1, k8s.io/kubernetes/pkg/util/mount,xiang90,1, From 093328e57f6aa4ff77b9e9c731d1da10fbdcd725 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 17:50:53 +0800 Subject: [PATCH 3/8] migrate to k8s.io/utils/strings --- pkg/controller/.import-restrictions | 4 ++-- .../volume/attachdetach/reconciler/BUILD | 2 +- .../reconciler/reconciler_test.go | 4 ++-- pkg/kubelet/mountpod/BUILD | 2 +- pkg/kubelet/mountpod/mount_pod.go | 4 ++-- pkg/kubelet/volumemanager/reconciler/BUILD | 2 +- .../volumemanager/reconciler/reconciler.go | 4 ++-- pkg/volume/awsebs/BUILD | 2 +- pkg/volume/awsebs/aws_ebs.go | 4 ++-- pkg/volume/awsebs/aws_ebs_block.go | 4 ++-- pkg/volume/azure_dd/BUILD | 2 +- pkg/volume/azure_dd/azure_common.go | 4 ++-- pkg/volume/azure_dd/azure_dd_block.go | 4 ++-- pkg/volume/azure_file/BUILD | 2 +- pkg/volume/azure_file/azure_file.go | 4 ++-- pkg/volume/azure_file/azure_provision.go | 4 ++-- pkg/volume/cephfs/BUILD | 2 +- pkg/volume/cephfs/cephfs.go | 6 +++--- pkg/volume/cinder/BUILD | 2 +- pkg/volume/cinder/cinder.go | 4 ++-- pkg/volume/cinder/cinder_block.go | 4 ++-- pkg/volume/configmap/BUILD | 2 +- pkg/volume/configmap/configmap.go | 6 +++--- pkg/volume/csi/BUILD | 2 +- pkg/volume/csi/csi_block.go | 8 ++++---- pkg/volume/csi/csi_mounter.go | 6 +++--- pkg/volume/csi/csi_util.go | 9 +++++---- pkg/volume/downwardapi/BUILD | 2 +- pkg/volume/downwardapi/downwardapi.go | 9 ++++----- pkg/volume/emptydir/BUILD | 2 +- pkg/volume/emptydir/empty_dir.go | 6 +++--- pkg/volume/fc/BUILD | 2 +- pkg/volume/fc/fc.go | 6 +++--- pkg/volume/flexvolume/BUILD | 2 +- pkg/volume/flexvolume/plugin.go | 11 +++++------ pkg/volume/flexvolume/probe.go | 17 +++++++---------- pkg/volume/flexvolume/volume.go | 4 ++-- pkg/volume/flocker/BUILD | 2 +- pkg/volume/flocker/flocker.go | 4 ++-- pkg/volume/gcepd/BUILD | 2 +- pkg/volume/gcepd/gce_pd.go | 4 ++-- pkg/volume/gcepd/gce_pd_block.go | 4 ++-- pkg/volume/git_repo/BUILD | 2 +- pkg/volume/git_repo/git_repo.go | 6 +++--- pkg/volume/glusterfs/BUILD | 2 +- pkg/volume/glusterfs/glusterfs.go | 10 +++++----- pkg/volume/iscsi/BUILD | 2 +- pkg/volume/iscsi/iscsi.go | 8 ++++---- pkg/volume/local/BUILD | 2 +- pkg/volume/local/local.go | 10 +++++----- pkg/volume/nfs/BUILD | 2 +- pkg/volume/nfs/nfs.go | 4 ++-- pkg/volume/photon_pd/BUILD | 2 +- pkg/volume/photon_pd/photon_pd.go | 4 ++-- pkg/volume/portworx/BUILD | 2 +- pkg/volume/portworx/portworx.go | 4 ++-- pkg/volume/projected/BUILD | 2 +- pkg/volume/projected/projected.go | 7 +++---- pkg/volume/quobyte/BUILD | 2 +- pkg/volume/quobyte/quobyte.go | 8 ++++---- pkg/volume/rbd/BUILD | 2 +- pkg/volume/rbd/rbd.go | 6 +++--- pkg/volume/scaleio/BUILD | 2 +- pkg/volume/scaleio/sio_volume.go | 4 ++-- pkg/volume/secret/BUILD | 2 +- pkg/volume/secret/secret.go | 4 ++-- pkg/volume/storageos/BUILD | 2 +- pkg/volume/storageos/storageos.go | 13 ++++++------- pkg/volume/testing/BUILD | 2 +- pkg/volume/testing/testing.go | 8 ++++---- pkg/volume/util/BUILD | 2 +- pkg/volume/util/util.go | 19 ++++++++----------- pkg/volume/vsphere_volume/BUILD | 2 +- pkg/volume/vsphere_volume/vsphere_volume.go | 6 +++--- .../vsphere_volume/vsphere_volume_block.go | 4 ++-- 75 files changed, 164 insertions(+), 173 deletions(-) diff --git a/pkg/controller/.import-restrictions b/pkg/controller/.import-restrictions index bb88f40d2ed..9749301c119 100644 --- a/pkg/controller/.import-restrictions +++ b/pkg/controller/.import-restrictions @@ -286,7 +286,6 @@ "k8s.io/kubernetes/pkg/util/node", "k8s.io/kubernetes/pkg/util/reflector/prometheus", "k8s.io/kubernetes/pkg/util/slice", - "k8s.io/kubernetes/pkg/util/strings", "k8s.io/kubernetes/pkg/util/system", "k8s.io/kubernetes/pkg/util/taints", "k8s.io/kubernetes/pkg/util/workqueue/prometheus", @@ -341,7 +340,8 @@ "k8s.io/utils/integer", "k8s.io/utils/io", "k8s.io/utils/pointer", - "k8s.io/utils/exec" + "k8s.io/utils/exec", + "k8s.io/utils/strings" ] }, { diff --git a/pkg/controller/volume/attachdetach/reconciler/BUILD b/pkg/controller/volume/attachdetach/reconciler/BUILD index b09344c04fd..cb047fc9366 100644 --- a/pkg/controller/volume/attachdetach/reconciler/BUILD +++ b/pkg/controller/volume/attachdetach/reconciler/BUILD @@ -35,7 +35,6 @@ go_test( "//pkg/controller/volume/attachdetach/cache:go_default_library", "//pkg/controller/volume/attachdetach/statusupdater:go_default_library", "//pkg/controller/volume/attachdetach/testing:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume/testing:go_default_library", "//pkg/volume/util/operationexecutor:go_default_library", "//pkg/volume/util/types:go_default_library", @@ -44,6 +43,7 @@ go_test( "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/client-go/informers:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go index a16a7af8595..8c83f77d0e8 100644 --- a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go +++ b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go @@ -29,10 +29,10 @@ import ( "k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache" "k8s.io/kubernetes/pkg/controller/volume/attachdetach/statusupdater" controllervolumetesting "k8s.io/kubernetes/pkg/controller/volume/attachdetach/testing" - stringutil "k8s.io/kubernetes/pkg/util/strings" volumetesting "k8s.io/kubernetes/pkg/volume/testing" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" "k8s.io/kubernetes/pkg/volume/util/types" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -738,7 +738,7 @@ func Test_ReportMultiAttachError(t *testing.T) { volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) volumeSpec.PersistentVolume.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} uid := string(n.name) + "-" + podName // unique UID - namespace, name := stringutil.SplitQualifiedName(podName) + namespace, name := utilsstrings.SplitQualifiedName(podName) pod := controllervolumetesting.NewPod(uid, name) pod.Namespace = namespace _, err := dsw.AddPod(types.UniquePodName(uid), pod, volumeSpec, n.name) diff --git a/pkg/kubelet/mountpod/BUILD b/pkg/kubelet/mountpod/BUILD index 411da640f20..bcb1961dd77 100644 --- a/pkg/kubelet/mountpod/BUILD +++ b/pkg/kubelet/mountpod/BUILD @@ -8,8 +8,8 @@ go_library( deps = [ "//pkg/kubelet/config:go_default_library", "//pkg/kubelet/pod:go_default_library", - "//pkg/util/strings:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/kubelet/mountpod/mount_pod.go b/pkg/kubelet/mountpod/mount_pod.go index 6c7afda4810..cf0e97ba4cf 100644 --- a/pkg/kubelet/mountpod/mount_pod.go +++ b/pkg/kubelet/mountpod/mount_pod.go @@ -26,7 +26,7 @@ import ( "k8s.io/api/core/v1" "k8s.io/kubernetes/pkg/kubelet/config" kubepod "k8s.io/kubernetes/pkg/kubelet/pod" - "k8s.io/kubernetes/pkg/util/strings" + "k8s.io/utils/strings" ) // Manager is an interface that tracks pods with mount utilities for individual @@ -68,7 +68,7 @@ func NewManager(rootDirectory string, podManager kubepod.Manager) (Manager, erro func (m *basicManager) getVolumePluginRegistrationPath(pluginName string) string { // sanitize plugin name so it does not escape directory - safePluginName := strings.EscapePluginName(pluginName) + ".json" + safePluginName := strings.EscapeQualifiedName(pluginName) + ".json" return path.Join(m.registrationDirectory, safePluginName) } diff --git a/pkg/kubelet/volumemanager/reconciler/BUILD b/pkg/kubelet/volumemanager/reconciler/BUILD index ca88d62d7b9..46865145d4f 100644 --- a/pkg/kubelet/volumemanager/reconciler/BUILD +++ b/pkg/kubelet/volumemanager/reconciler/BUILD @@ -17,7 +17,6 @@ go_library( "//pkg/util/file:go_default_library", "//pkg/util/goroutinemap/exponentialbackoff:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/nestedpendingoperations:go_default_library", @@ -30,6 +29,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index a28517d887f..c02c9e0d5f7 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -39,12 +39,12 @@ import ( utilfile "k8s.io/kubernetes/pkg/util/file" "k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" volumepkg "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" volumetypes "k8s.io/kubernetes/pkg/volume/util/types" + utilsstrings "k8s.io/utils/strings" ) // Reconciler runs a periodic loop to reconcile the desired state of the world @@ -678,7 +678,7 @@ func getVolumesFromPodDir(podDir string) ([]podVolume, error) { klog.Errorf("Could not read volume plugin directory %q: %v", volumePluginPath, err) continue } - unescapePluginName := utilstrings.UnescapeQualifiedNameForDisk(pluginName) + unescapePluginName := utilsstrings.UnescapeQualifiedName(pluginName) for _, volumeName := range volumePluginDirs { mountPath := path.Join(volumePluginPath, volumeName) klog.V(5).Infof("podName: %v, mount path from volume plugin directory: %v, ", podName, mountPath) diff --git a/pkg/volume/awsebs/BUILD b/pkg/volume/awsebs/BUILD index 27213a3b622..92bd082e7a9 100644 --- a/pkg/volume/awsebs/BUILD +++ b/pkg/volume/awsebs/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/cloudprovider/providers/aws:go_default_library", "//pkg/features:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -32,6 +31,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/awsebs/aws_ebs.go b/pkg/volume/awsebs/aws_ebs.go index d94f63e0f80..ab922073a85 100644 --- a/pkg/volume/awsebs/aws_ebs.go +++ b/pkg/volume/awsebs/aws_ebs.go @@ -35,9 +35,9 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -60,7 +60,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(awsElasticBlockStorePluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) } func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/awsebs/aws_ebs_block.go b/pkg/volume/awsebs/aws_ebs_block.go index a6d64b5c495..d23e29756ff 100644 --- a/pkg/volume/awsebs/aws_ebs_block.go +++ b/pkg/volume/awsebs/aws_ebs_block.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{} @@ -172,5 +172,5 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er // path: pods/{podUid}/volumeDevices/kubernetes.io~aws func (ebs *awsElasticBlockStore) GetPodDeviceMapPath() (string, string) { name := awsElasticBlockStorePluginName - return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, kstrings.EscapeQualifiedNameForDisk(name)), ebs.volName + return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilsstrings.EscapeQualifiedName(name)), ebs.volName } diff --git a/pkg/volume/azure_dd/BUILD b/pkg/volume/azure_dd/BUILD index 3fe9b993bdf..74dd5b980ae 100644 --- a/pkg/volume/azure_dd/BUILD +++ b/pkg/volume/azure_dd/BUILD @@ -26,7 +26,6 @@ go_library( "//pkg/features:go_default_library", "//pkg/kubelet/apis:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -42,6 +41,7 @@ go_library( "//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/azure_dd/azure_common.go b/pkg/volume/azure_dd/azure_common.go index 174510c5d1b..451b4048cb5 100644 --- a/pkg/volume/azure_dd/azure_common.go +++ b/pkg/volume/azure_dd/azure_common.go @@ -33,8 +33,8 @@ import ( api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/strings" ) const ( @@ -66,7 +66,7 @@ var ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(azureDataDiskPluginName), volName) + return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(azureDataDiskPluginName), volName) } // creates a unique path for disks (even if they share the same *.vhd name) diff --git a/pkg/volume/azure_dd/azure_dd_block.go b/pkg/volume/azure_dd/azure_dd_block.go index 70430499463..c5b6adbde9e 100644 --- a/pkg/volume/azure_dd/azure_dd_block.go +++ b/pkg/volume/azure_dd/azure_dd_block.go @@ -25,10 +25,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &azureDataDiskPlugin{} @@ -157,5 +157,5 @@ func (disk *dataDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) { // path: pods/{podUid}/volumeDevices/kubernetes.io~azure func (disk *dataDisk) GetPodDeviceMapPath() (string, string) { name := azureDataDiskPluginName - return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, kstrings.EscapeQualifiedNameForDisk(name)), disk.volumeName + return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilsstrings.EscapeQualifiedName(name)), disk.volumeName } diff --git a/pkg/volume/azure_file/BUILD b/pkg/volume/azure_file/BUILD index b4fa68effea..bfa63a9b61b 100644 --- a/pkg/volume/azure_file/BUILD +++ b/pkg/volume/azure_file/BUILD @@ -18,7 +18,6 @@ go_library( deps = [ "//pkg/cloudprovider/providers/azure:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -29,6 +28,7 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2018-07-01/storage:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/azure_file/azure_file.go b/pkg/volume/azure_file/azure_file.go index 97b29bc1a84..07b25e81e60 100644 --- a/pkg/volume/azure_file/azure_file.go +++ b/pkg/volume/azure_file/azure_file.go @@ -30,9 +30,9 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary endpoint for volume plugins @@ -53,7 +53,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(azureFilePluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(azureFilePluginName), volName) } func (plugin *azureFilePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/azure_file/azure_provision.go b/pkg/volume/azure_file/azure_provision.go index 60466cedab6..06637ee248f 100644 --- a/pkg/volume/azure_file/azure_provision.go +++ b/pkg/volume/azure_file/azure_provision.go @@ -28,9 +28,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" cloudprovider "k8s.io/cloud-provider" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) var _ volume.DeletableVolumePlugin = &azureFilePlugin{} @@ -116,7 +116,7 @@ var _ volume.Deleter = &azureFileDeleter{} func (f *azureFileDeleter) GetPath() string { name := azureFilePluginName - return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedNameForDisk(name), f.volName) + return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) } func (f *azureFileDeleter) Delete() error { diff --git a/pkg/volume/cephfs/BUILD b/pkg/volume/cephfs/BUILD index eeb4ee0dce5..993481194dc 100644 --- a/pkg/volume/cephfs/BUILD +++ b/pkg/volume/cephfs/BUILD @@ -15,13 +15,13 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/cephfs", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/cephfs/cephfs.go b/pkg/volume/cephfs/cephfs.go index ec571c6d90e..0f7e9e6a157 100644 --- a/pkg/volume/cephfs/cephfs.go +++ b/pkg/volume/cephfs/cephfs.go @@ -29,9 +29,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -289,13 +289,13 @@ func (cephfsVolume *cephfsUnmounter) TearDownAt(dir string) error { // GetPath creates global mount path func (cephfsVolume *cephfs) GetPath() string { name := cephfsPluginName - return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedNameForDisk(name), cephfsVolume.volName) + return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) } // GetKeyringPath creates cephfuse keyring path func (cephfsVolume *cephfs) GetKeyringPath() string { name := cephfsPluginName - volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedNameForDisk(name), cephfsVolume.volName) + volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) volumeKeyringDir := volumeDir + "~keyring" return volumeKeyringDir } diff --git a/pkg/volume/cinder/BUILD b/pkg/volume/cinder/BUILD index f04049f859e..8b99eb6451c 100644 --- a/pkg/volume/cinder/BUILD +++ b/pkg/volume/cinder/BUILD @@ -21,7 +21,6 @@ go_library( "//pkg/features:go_default_library", "//pkg/kubelet/apis:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -37,6 +36,7 @@ go_library( "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index a609f0f43ce..81f19349001 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -32,10 +32,10 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/keymutex" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -82,7 +82,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(cinderVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(cinderVolumePluginName), volName) } func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/cinder/cinder_block.go b/pkg/volume/cinder/cinder_block.go index 90e2056e049..4e355307074 100644 --- a/pkg/volume/cinder/cinder_block.go +++ b/pkg/volume/cinder/cinder_block.go @@ -24,10 +24,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &cinderPlugin{} @@ -163,5 +163,5 @@ func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { // path: pods/{podUid}/volumeDevices/kubernetes.io~cinder func (cd *cinderVolume) GetPodDeviceMapPath() (string, string) { name := cinderVolumePluginName - return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, kstrings.EscapeQualifiedNameForDisk(name)), cd.volName + return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, utilsstrings.EscapeQualifiedName(name)), cd.volName } diff --git a/pkg/volume/configmap/BUILD b/pkg/volume/configmap/BUILD index 1047a1b090f..a8329fa8b07 100644 --- a/pkg/volume/configmap/BUILD +++ b/pkg/volume/configmap/BUILD @@ -15,7 +15,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/configmap", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -23,6 +22,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/configmap/configmap.go b/pkg/volume/configmap/configmap.go index 5711b959241..610f7870e3d 100644 --- a/pkg/volume/configmap/configmap.go +++ b/pkg/volume/configmap/configmap.go @@ -25,9 +25,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -48,7 +48,7 @@ type configMapPlugin struct { var _ volume.VolumePlugin = &configMapPlugin{} func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(configMapPluginName), volName) + return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(configMapPluginName), volName) } func (plugin *configMapPlugin) Init(host volume.VolumeHost) error { @@ -142,7 +142,7 @@ type configMapVolume struct { var _ volume.Volume = &configMapVolume{} func (sv *configMapVolume) GetPath() string { - return sv.plugin.host.GetPodVolumeDir(sv.podUID, strings.EscapeQualifiedNameForDisk(configMapPluginName), sv.volName) + return sv.plugin.host.GetPodVolumeDir(sv.podUID, strings.EscapeQualifiedName(configMapPluginName), sv.volName) } // configMapVolumeMounter handles retrieving secrets from the API server diff --git a/pkg/volume/csi/BUILD b/pkg/volume/csi/BUILD index a4ac6145d40..d2e218ef380 100644 --- a/pkg/volume/csi/BUILD +++ b/pkg/volume/csi/BUILD @@ -14,7 +14,6 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/features:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/csi/csiv0:go_default_library", "//pkg/volume/csi/nodeinfomanager:go_default_library", @@ -35,6 +34,7 @@ go_library( "//vendor/github.com/container-storage-interface/spec/lib/go/csi:go_default_library", "//vendor/google.golang.org/grpc:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/csi/csi_block.go b/pkg/volume/csi/csi_block.go index 3a80352c580..6e5024c9ed7 100644 --- a/pkg/volume/csi/csi_block.go +++ b/pkg/volume/csi/csi_block.go @@ -31,9 +31,9 @@ import ( meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" ioutil "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) type csiBlockMapper struct { @@ -62,21 +62,21 @@ func (m *csiBlockMapper) GetGlobalMapPath(spec *volume.Spec) (string, error) { // getStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume // Example: plugins/kubernetes.io/csi/volumeDevices/staging/{pvname} func (m *csiBlockMapper) getStagingPath() string { - sanitizedSpecVolID := kstrings.EscapeQualifiedNameForDisk(m.specName) + sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "staging", sanitizedSpecVolID) } // getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{pvname} func (m *csiBlockMapper) getPublishPath() string { - sanitizedSpecVolID := kstrings.EscapeQualifiedNameForDisk(m.specName) + sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "publish", sanitizedSpecVolID) } // GetPodDeviceMapPath returns pod's device file which will be mapped to a volume // returns: pods/{podUid}/volumeDevices/kubernetes.io~csi, {pvname} func (m *csiBlockMapper) GetPodDeviceMapPath() (string, string) { - path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, kstrings.EscapeQualifiedNameForDisk(csiPluginName)) + path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, utilsstrings.EscapeQualifiedName(csiPluginName)) specName := m.specName klog.V(4).Infof(log("blockMapper.GetPodDeviceMapPath [path=%s; name=%s]", path, specName)) return path, specName diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index b46c89f1ef1..3f408303079 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -31,8 +31,8 @@ import ( utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/pkg/features" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + utilsstrings "k8s.io/utils/strings" ) //TODO (vladimirvivien) move this in a central loc later @@ -79,8 +79,8 @@ func (c *csiMountMgr) GetPath() string { } func getTargetPath(uid types.UID, specVolumeID string, host volume.VolumeHost) string { - specVolID := kstrings.EscapeQualifiedNameForDisk(specVolumeID) - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(csiPluginName), specVolID) + specVolID := utilsstrings.EscapeQualifiedName(specVolumeID) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(csiPluginName), specVolID) } // volume.Mounter methods diff --git a/pkg/volume/csi/csi_util.go b/pkg/volume/csi/csi_util.go index 3fe103584c4..85aafeec5b6 100644 --- a/pkg/volume/csi/csi_util.go +++ b/pkg/volume/csi/csi_util.go @@ -22,13 +22,14 @@ import ( "os" "path" + "time" + api "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/klog" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" - "time" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -116,7 +117,7 @@ func log(msg string, parts ...interface{}) string { // symlink for a block device associated with a given specVolumeID. // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/dev func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { - sanitizedSpecVolID := kstrings.EscapeQualifiedNameForDisk(specVolID) + sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "dev") } @@ -124,7 +125,7 @@ func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { // volume data for a block device associated with a given specVolumeID. // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/data func getVolumeDeviceDataDir(specVolID string, host volume.VolumeHost) string { - sanitizedSpecVolID := kstrings.EscapeQualifiedNameForDisk(specVolID) + sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "data") } diff --git a/pkg/volume/downwardapi/BUILD b/pkg/volume/downwardapi/BUILD index d223844116f..cece3c521e2 100644 --- a/pkg/volume/downwardapi/BUILD +++ b/pkg/volume/downwardapi/BUILD @@ -13,13 +13,13 @@ go_library( deps = [ "//pkg/api/v1/resource:go_default_library", "//pkg/fieldpath:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/downwardapi/downwardapi.go b/pkg/volume/downwardapi/downwardapi.go index d6239fdf04c..49700b7e486 100644 --- a/pkg/volume/downwardapi/downwardapi.go +++ b/pkg/volume/downwardapi/downwardapi.go @@ -23,13 +23,12 @@ import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/klog" "k8s.io/kubernetes/pkg/api/v1/resource" "k8s.io/kubernetes/pkg/fieldpath" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" - - "k8s.io/klog" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -49,7 +48,7 @@ type downwardAPIPlugin struct { var _ volume.VolumePlugin = &downwardAPIPlugin{} func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), volName) } func wrappedVolumeSpec() volume.Spec { @@ -289,7 +288,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu } func (d *downwardAPIVolume) GetPath() string { - return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName), d.volName) + return d.plugin.host.GetPodVolumeDir(d.podUID, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), d.volName) } // downwardAPIVolumeCleaner handles cleaning up downwardAPI volumes diff --git a/pkg/volume/emptydir/BUILD b/pkg/volume/emptydir/BUILD index fd4eaff0332..08c2bc334fc 100644 --- a/pkg/volume/emptydir/BUILD +++ b/pkg/volume/emptydir/BUILD @@ -18,7 +18,6 @@ go_library( deps = [ "//pkg/apis/core/v1/helper:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -26,6 +25,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ] + select({ "@io_bazel_rules_go//go/platform:linux": [ "//vendor/golang.org/x/sys/unix:go_default_library", diff --git a/pkg/volume/emptydir/empty_dir.go b/pkg/volume/emptydir/empty_dir.go index b3474bbe5d5..2fae1a9c787 100644 --- a/pkg/volume/emptydir/empty_dir.go +++ b/pkg/volume/emptydir/empty_dir.go @@ -28,9 +28,9 @@ import ( "k8s.io/klog" v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper" "k8s.io/kubernetes/pkg/util/mount" - stringsutil "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // TODO: in the near future, this will be changed to be more restrictive @@ -59,7 +59,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, stringsutil.EscapeQualifiedNameForDisk(emptyDirPluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(emptyDirPluginName), volName) } func (plugin *emptyDirPlugin) Init(host volume.VolumeHost) error { @@ -420,7 +420,7 @@ func (ed *emptyDir) teardownTmpfsOrHugetlbfs(dir string) error { } func (ed *emptyDir) getMetaDir() string { - return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, stringsutil.EscapeQualifiedNameForDisk(emptyDirPluginName)), ed.volName) + return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, utilsstrings.EscapeQualifiedName(emptyDirPluginName)), ed.volName) } func getVolumeSource(spec *volume.Spec) (*v1.EmptyDirVolumeSource, bool) { diff --git a/pkg/volume/fc/BUILD b/pkg/volume/fc/BUILD index 8c7328601db..bec107d7dc7 100644 --- a/pkg/volume/fc/BUILD +++ b/pkg/volume/fc/BUILD @@ -19,7 +19,6 @@ go_library( deps = [ "//pkg/features:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -28,6 +27,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index 5997a9756cd..e78d2c9d6fc 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -29,10 +29,10 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -360,7 +360,7 @@ type fcDisk struct { func (fc *fcDisk) GetPath() string { // safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up - return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilstrings.EscapeQualifiedNameForDisk(fcPluginName), fc.volName) + return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName), fc.volName) } func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { @@ -373,7 +373,7 @@ func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { } func (fc *fcDisk) fcPodDeviceMapPath() (string, string) { - return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilstrings.EscapeQualifiedNameForDisk(fcPluginName)), fc.volName + return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName)), fc.volName } type fcDiskMounter struct { diff --git a/pkg/volume/flexvolume/BUILD b/pkg/volume/flexvolume/BUILD index f337fc42bb3..6af91d59242 100644 --- a/pkg/volume/flexvolume/BUILD +++ b/pkg/volume/flexvolume/BUILD @@ -31,7 +31,6 @@ go_library( deps = [ "//pkg/util/filesystem:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -41,6 +40,7 @@ go_library( "//vendor/github.com/fsnotify/fsnotify:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/flexvolume/plugin.go b/pkg/volume/flexvolume/plugin.go index 4721d78bd3f..f0afd834eb3 100644 --- a/pkg/volume/flexvolume/plugin.go +++ b/pkg/volume/flexvolume/plugin.go @@ -23,15 +23,14 @@ import ( "strings" "sync" - "k8s.io/klog" - api "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/exec" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -72,7 +71,7 @@ type pluginFactory struct{} func (pluginFactory) NewFlexVolumePlugin(pluginDir, name string, runner exec.Interface) (volume.VolumePlugin, error) { execPath := path.Join(pluginDir, name) - driverName := utilstrings.UnescapePluginName(name) + driverName := utilsstrings.UnescapeQualifiedName(name) flexPlugin := &flexVolumePlugin{ driverName: driverName, @@ -186,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P var metricsProvider volume.MetricsProvider if plugin.capabilities.SupportsMetrics { metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( - pod.UID, utilstrings.EscapeQualifiedNameForDisk(sourceDriver), spec.Name())) + pod.UID, utilsstrings.EscapeQualifiedName(sourceDriver), spec.Name())) } else { metricsProvider = &volume.MetricsNil{} } @@ -220,7 +219,7 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type var metricsProvider volume.MetricsProvider if plugin.capabilities.SupportsMetrics { metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( - podUID, utilstrings.EscapeQualifiedNameForDisk(plugin.driverName), volName)) + podUID, utilsstrings.EscapeQualifiedName(plugin.driverName), volName)) } else { metricsProvider = &volume.MetricsNil{} } diff --git a/pkg/volume/flexvolume/probe.go b/pkg/volume/flexvolume/probe.go index 7a929e5ce99..bc6e3b30cb8 100644 --- a/pkg/volume/flexvolume/probe.go +++ b/pkg/volume/flexvolume/probe.go @@ -17,22 +17,19 @@ limitations under the License. package flexvolume import ( - "k8s.io/klog" - "k8s.io/kubernetes/pkg/volume" - "k8s.io/utils/exec" - - "os" - "fmt" + "os" "path/filepath" - "sync" - "strings" + "sync" "github.com/fsnotify/fsnotify" "k8s.io/apimachinery/pkg/util/errors" + "k8s.io/klog" utilfs "k8s.io/kubernetes/pkg/util/filesystem" - utilstrings "k8s.io/kubernetes/pkg/util/strings" + "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" + utilsstrings "k8s.io/utils/strings" ) type flexVolumeProber struct { @@ -142,7 +139,7 @@ func (prober *flexVolumeProber) newProbeEvent(driverDirName string, op volume.Pr probeEvent.Plugin = plugin probeEvent.PluginName = plugin.GetPluginName() } else if op == volume.ProbeRemove { - driverName := utilstrings.UnescapePluginName(driverDirName) + driverName := utilsstrings.UnescapeQualifiedName(driverDirName) probeEvent.PluginName = flexVolumePluginNamePrefix + driverName } else { diff --git a/pkg/volume/flexvolume/volume.go b/pkg/volume/flexvolume/volume.go index f4988d839e6..d9922d64409 100644 --- a/pkg/volume/flexvolume/volume.go +++ b/pkg/volume/flexvolume/volume.go @@ -19,8 +19,8 @@ package flexvolume import ( "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + utilsstrings "k8s.io/utils/strings" ) type flexVolume struct { @@ -51,5 +51,5 @@ type flexVolume struct { func (f *flexVolume) GetPath() string { name := f.driverName - return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedNameForDisk(name), f.volName) + return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) } diff --git a/pkg/volume/flocker/BUILD b/pkg/volume/flocker/BUILD index 0067622c19d..d58059aa58b 100644 --- a/pkg/volume/flocker/BUILD +++ b/pkg/volume/flocker/BUILD @@ -18,7 +18,6 @@ go_library( deps = [ "//pkg/util/env:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -28,6 +27,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/rand:go_default_library", "//vendor/github.com/clusterhq/flocker-go:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/flocker/flocker.go b/pkg/volume/flocker/flocker.go index e9c1623aee6..02a81f7f536 100644 --- a/pkg/volume/flocker/flocker.go +++ b/pkg/volume/flocker/flocker.go @@ -27,8 +27,8 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/util/env" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/strings" flockerapi "github.com/clusterhq/flocker-go" ) @@ -77,7 +77,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(flockerPluginName), volName) + return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(flockerPluginName), volName) } func makeGlobalFlockerPath(datasetUUID string) string { diff --git a/pkg/volume/gcepd/BUILD b/pkg/volume/gcepd/BUILD index 938b5757330..ed00e269c04 100644 --- a/pkg/volume/gcepd/BUILD +++ b/pkg/volume/gcepd/BUILD @@ -22,7 +22,6 @@ go_library( "//pkg/kubelet/apis:go_default_library", "//pkg/util/file:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -35,6 +34,7 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/gcepd/gce_pd.go b/pkg/volume/gcepd/gce_pd.go index c4f3c4551e2..0c2a5cb4c6d 100644 --- a/pkg/volume/gcepd/gce_pd.go +++ b/pkg/volume/gcepd/gce_pd.go @@ -34,9 +34,9 @@ import ( "k8s.io/kubernetes/pkg/features" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -72,7 +72,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(gcePersistentDiskPluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(gcePersistentDiskPluginName), volName) } func (plugin *gcePersistentDiskPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/gcepd/gce_pd_block.go b/pkg/volume/gcepd/gce_pd_block.go index f4e7e2c7252..d72a41cd549 100644 --- a/pkg/volume/gcepd/gce_pd_block.go +++ b/pkg/volume/gcepd/gce_pd_block.go @@ -26,10 +26,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &gcePersistentDiskPlugin{} @@ -170,5 +170,5 @@ func (pd *gcePersistentDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) // path: pods/{podUid}/volumeDevices/kubernetes.io~aws func (pd *gcePersistentDisk) GetPodDeviceMapPath() (string, string) { name := gcePersistentDiskPluginName - return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, kstrings.EscapeQualifiedNameForDisk(name)), pd.volName + return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, utilsstrings.EscapeQualifiedName(name)), pd.volName } diff --git a/pkg/volume/git_repo/BUILD b/pkg/volume/git_repo/BUILD index 48cfa4308dd..57a9e29bdf2 100644 --- a/pkg/volume/git_repo/BUILD +++ b/pkg/volume/git_repo/BUILD @@ -14,12 +14,12 @@ go_library( ], importpath = "k8s.io/kubernetes/pkg/volume/git_repo", deps = [ - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/git_repo/git_repo.go b/pkg/volume/git_repo/git_repo.go index bba6c719e0e..24c71bacec5 100644 --- a/pkg/volume/git_repo/git_repo.go +++ b/pkg/volume/git_repo/git_repo.go @@ -25,10 +25,10 @@ import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/exec" + utilsstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -147,7 +147,7 @@ var _ volume.Volume = &gitRepoVolume{} func (gr *gitRepoVolume) GetPath() string { name := gitRepoPluginName - return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilstrings.EscapeQualifiedNameForDisk(name), gr.volName) + return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilsstrings.EscapeQualifiedName(name), gr.volName) } // gitRepoVolumeMounter builds git repo volumes. @@ -248,7 +248,7 @@ func (b *gitRepoVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { } func (b *gitRepoVolumeMounter) getMetaDir() string { - return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedNameForDisk(gitRepoPluginName)), b.volName) + return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilsstrings.EscapeQualifiedName(gitRepoPluginName)), b.volName) } func (b *gitRepoVolumeMounter) execCommand(command string, args []string, dir string) ([]byte, error) { diff --git a/pkg/volume/glusterfs/BUILD b/pkg/volume/glusterfs/BUILD index 52e33003414..bc684f32846 100644 --- a/pkg/volume/glusterfs/BUILD +++ b/pkg/volume/glusterfs/BUILD @@ -18,7 +18,6 @@ go_library( deps = [ "//pkg/apis/core/v1/helper:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -33,6 +32,7 @@ go_library( "//vendor/github.com/heketi/heketi/client/api/go-client:go_default_library", "//vendor/github.com/heketi/heketi/pkg/glusterfs/api:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index cf04da68e83..b15497602d1 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -40,9 +40,9 @@ import ( "k8s.io/klog" v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -200,7 +200,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp mounter: mounter, pod: pod, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, strings.EscapeQualifiedNameForDisk(glusterfsPluginName), spec.Name())), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, strings.EscapeQualifiedName(glusterfsPluginName), spec.Name())), }, hosts: ep, path: volPath, @@ -219,7 +219,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types mounter: mounter, pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: podUID}}, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, strings.EscapeQualifiedNameForDisk(glusterfsPluginName), volName)), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, strings.EscapeQualifiedName(glusterfsPluginName), volName)), }}, nil } @@ -301,7 +301,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error { func (glusterfsVolume *glusterfs) GetPath() string { name := glusterfsPluginName - return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, strings.EscapeQualifiedNameForDisk(name), glusterfsVolume.volName) + return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, strings.EscapeQualifiedName(name), glusterfsVolume.volName) } type glusterfsUnmounter struct { @@ -542,7 +542,7 @@ type glusterfsVolumeDeleter struct { func (d *glusterfsVolumeDeleter) GetPath() string { name := glusterfsPluginName - return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, strings.EscapeQualifiedNameForDisk(name), d.glusterfsMounter.glusterfs.volName) + return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, strings.EscapeQualifiedName(name), d.glusterfsMounter.glusterfs.volName) } // Traverse the PVs, fetching all the GIDs from those diff --git a/pkg/volume/iscsi/BUILD b/pkg/volume/iscsi/BUILD index f9632a1e86d..d076457c168 100644 --- a/pkg/volume/iscsi/BUILD +++ b/pkg/volume/iscsi/BUILD @@ -19,7 +19,6 @@ go_library( deps = [ "//pkg/features:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -29,6 +28,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index aebf15c390a..334df9ee573 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -28,11 +28,11 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" ioutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" "k8s.io/utils/keymutex" + utilsstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -181,7 +181,7 @@ func (plugin *iscsiPlugin) newUnmounterInternal(volName string, podUID types.UID VolName: volName, manager: manager, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedNameForDisk(iscsiPluginName), volName)), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(iscsiPluginName), volName)), }, mounter: mounter, exec: exec, @@ -285,7 +285,7 @@ type iscsiDisk struct { func (iscsi *iscsiDisk) GetPath() string { name := iscsiPluginName // safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up - return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilstrings.EscapeQualifiedNameForDisk(name), iscsi.VolName) + return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name), iscsi.VolName) } func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { @@ -299,7 +299,7 @@ func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { func (iscsi *iscsiDisk) iscsiPodDeviceMapPath() (string, string) { name := iscsiPluginName - return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilstrings.EscapeQualifiedNameForDisk(name)), iscsi.VolName + return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name)), iscsi.VolName } type iscsiDiskMounter struct { diff --git a/pkg/volume/local/BUILD b/pkg/volume/local/BUILD index b078bf37b16..63f2323d7a4 100644 --- a/pkg/volume/local/BUILD +++ b/pkg/volume/local/BUILD @@ -11,7 +11,6 @@ go_library( deps = [ "//pkg/kubelet/events:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/validation:go_default_library", @@ -21,6 +20,7 @@ go_library( "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index 29e8f645059..ecad69301b4 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -31,11 +31,11 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/util/mount" - stringsutil "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/validation" "k8s.io/utils/keymutex" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -132,7 +132,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo mounter: plugin.host.GetMounter(plugin.GetPluginName()), plugin: plugin, globalPath: globalLocalPath, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, stringsutil.EscapeQualifiedNameForDisk(localVolumePluginName), spec.Name())), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilsstrings.EscapeQualifiedName(localVolumePluginName), spec.Name())), }, mountOptions: util.MountOptionFromSpec(spec), readOnly: readOnly, @@ -392,7 +392,7 @@ type localVolume struct { } func (l *localVolume) GetPath() string { - return l.plugin.host.GetPodVolumeDir(l.podUID, stringsutil.EscapeQualifiedNameForDisk(localVolumePluginName), l.volName) + return l.plugin.host.GetPodVolumeDir(l.podUID, utilsstrings.EscapeQualifiedName(localVolumePluginName), l.volName) } type localVolumeMounter struct { @@ -584,7 +584,7 @@ func (u *localVolumeUnmapper) TearDownDevice(mapPath, _ string) error { // GetGlobalMapPath returns global map path and error. // path: plugins/kubernetes.io/kubernetes.io/local-volume/volumeDevices/{volumeName} func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { - return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(stringsutil.EscapeQualifiedNameForDisk(localVolumePluginName)), + return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName), nil } @@ -593,5 +593,5 @@ func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { // volName: local-pv-ff0d6d4 func (lv *localVolume) GetPodDeviceMapPath() (string, string) { return lv.plugin.host.GetPodVolumeDeviceDir(lv.podUID, - stringsutil.EscapeQualifiedNameForDisk(localVolumePluginName)), lv.volName + utilsstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName } diff --git a/pkg/volume/nfs/BUILD b/pkg/volume/nfs/BUILD index 28885d7fb4f..42baf1177e3 100644 --- a/pkg/volume/nfs/BUILD +++ b/pkg/volume/nfs/BUILD @@ -15,7 +15,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/nfs", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/recyclerclient:go_default_library", @@ -23,6 +22,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index 20c2c5a283b..e55446d3a45 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -26,10 +26,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/recyclerclient" + "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -189,7 +189,7 @@ type nfs struct { func (nfsVolume *nfs) GetPath() string { name := nfsPluginName - return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, strings.EscapeQualifiedNameForDisk(name), nfsVolume.volName) + return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, strings.EscapeQualifiedName(name), nfsVolume.volName) } // Checks prior to mount operations to verify that the required components (binaries, etc.) diff --git a/pkg/volume/photon_pd/BUILD b/pkg/volume/photon_pd/BUILD index 61d5467e4df..97ee8e7fd96 100644 --- a/pkg/volume/photon_pd/BUILD +++ b/pkg/volume/photon_pd/BUILD @@ -17,7 +17,6 @@ go_library( deps = [ "//pkg/cloudprovider/providers/photon:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -26,6 +25,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/photon_pd/photon_pd.go b/pkg/volume/photon_pd/photon_pd.go index f965398e402..c482782a6ed 100644 --- a/pkg/volume/photon_pd/photon_pd.go +++ b/pkg/volume/photon_pd/photon_pd.go @@ -27,9 +27,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -290,7 +290,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { func (ppd *photonPersistentDisk) GetPath() string { name := photonPersistentDiskPluginName - return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilstrings.EscapeQualifiedNameForDisk(name), ppd.volName) + return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilsstrings.EscapeQualifiedName(name), ppd.volName) } // TODO: supporting more access mode for PhotonController persistent disk diff --git a/pkg/volume/portworx/BUILD b/pkg/volume/portworx/BUILD index e43ba8d037f..63053513b77 100644 --- a/pkg/volume/portworx/BUILD +++ b/pkg/volume/portworx/BUILD @@ -32,7 +32,6 @@ go_library( deps = [ "//pkg/apis/core:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -45,6 +44,7 @@ go_library( "//vendor/github.com/libopenstorage/openstorage/api/spec:go_default_library", "//vendor/github.com/libopenstorage/openstorage/volume:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index 6083f69416d..76de9e6479e 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -27,9 +27,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -58,7 +58,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(portworxVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(portworxVolumePluginName), volName) } func (plugin *portworxVolumePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/projected/BUILD b/pkg/volume/projected/BUILD index 65883f906b3..d3685747bf5 100644 --- a/pkg/volume/projected/BUILD +++ b/pkg/volume/projected/BUILD @@ -36,7 +36,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/projected", deps = [ "//pkg/features:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/configmap:go_default_library", "//pkg/volume/downwardapi:go_default_library", @@ -50,6 +49,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/projected/projected.go b/pkg/volume/projected/projected.go index 6b18ca31750..c8d51bb2507 100644 --- a/pkg/volume/projected/projected.go +++ b/pkg/volume/projected/projected.go @@ -26,15 +26,14 @@ import ( "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" utilfeature "k8s.io/apiserver/pkg/util/feature" + "k8s.io/klog" "k8s.io/kubernetes/pkg/features" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/configmap" "k8s.io/kubernetes/pkg/volume/downwardapi" "k8s.io/kubernetes/pkg/volume/secret" volumeutil "k8s.io/kubernetes/pkg/volume/util" - - "k8s.io/klog" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -67,7 +66,7 @@ func wrappedVolumeSpec() volume.Spec { } func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedNameForDisk(projectedPluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(projectedPluginName), volName) } func (plugin *projectedPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/quobyte/BUILD b/pkg/volume/quobyte/BUILD index 1142f5f633a..fe0c047f720 100644 --- a/pkg/volume/quobyte/BUILD +++ b/pkg/volume/quobyte/BUILD @@ -16,7 +16,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/quobyte", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -26,6 +25,7 @@ go_library( "//vendor/github.com/pborman/uuid:go_default_library", "//vendor/github.com/quobyte/api:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/quobyte/quobyte.go b/pkg/volume/quobyte/quobyte.go index a0c85c5b770..136e72e392e 100644 --- a/pkg/volume/quobyte/quobyte.go +++ b/pkg/volume/quobyte/quobyte.go @@ -29,9 +29,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool { // If Quobyte is already mounted we don't need to check if the binary is installed if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter(plugin.GetPluginName())); err == nil { qm, _ := mounter.(*quobyteMounter) - pluginDir := plugin.host.GetPluginDir(strings.EscapeQualifiedNameForDisk(quobytePluginName)) + pluginDir := plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) if mounted, err := qm.pluginDirIsMounted(pluginDir); mounted && err == nil { klog.V(4).Infof("quobyte: can support") return true @@ -238,7 +238,7 @@ func (mounter *quobyteMounter) CanMount() error { // SetUp attaches the disk and bind mounts to the volume path. func (mounter *quobyteMounter) SetUp(fsGroup *int64) error { - pluginDir := mounter.plugin.host.GetPluginDir(strings.EscapeQualifiedNameForDisk(quobytePluginName)) + pluginDir := mounter.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) return mounter.SetUpAt(pluginDir, fsGroup) } @@ -284,7 +284,7 @@ func (quobyteVolume *quobyte) GetPath() string { // Quobyte has only one mount in the PluginDir where all Volumes are mounted // The Quobyte client does a fixed-user mapping - pluginDir := quobyteVolume.plugin.host.GetPluginDir(strings.EscapeQualifiedNameForDisk(quobytePluginName)) + pluginDir := quobyteVolume.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) return path.Join(pluginDir, fmt.Sprintf("%s#%s@%s", user, group, quobyteVolume.volume)) } diff --git a/pkg/volume/rbd/BUILD b/pkg/volume/rbd/BUILD index ccd413eefec..0a5ca33c552 100644 --- a/pkg/volume/rbd/BUILD +++ b/pkg/volume/rbd/BUILD @@ -21,7 +21,6 @@ go_library( "//pkg/util/file:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/node:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -36,6 +35,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index d806b964a42..0945baa1458 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -34,10 +34,10 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + "k8s.io/utils/strings" ) var ( @@ -75,7 +75,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(rbdPluginName), volName) + return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(rbdPluginName), volName) } func (plugin *rbdPlugin) Init(host volume.VolumeHost) error { @@ -930,7 +930,7 @@ func (rbd *rbd) rbdGlobalMapPath(spec *volume.Spec) (string, error) { func (rbd *rbd) rbdPodDeviceMapPath() (string, string) { name := rbdPluginName - return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, strings.EscapeQualifiedNameForDisk(name)), rbd.volName + return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, strings.EscapeQualifiedName(name)), rbd.volName } type rbdDiskUnmapper struct { diff --git a/pkg/volume/scaleio/BUILD b/pkg/volume/scaleio/BUILD index 4e8fb802429..a5c98810a21 100644 --- a/pkg/volume/scaleio/BUILD +++ b/pkg/volume/scaleio/BUILD @@ -41,7 +41,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/scaleio", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -53,6 +52,7 @@ go_library( "//vendor/github.com/codedellemc/goscaleio/types/v1:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/scaleio/sio_volume.go b/pkg/volume/scaleio/sio_volume.go index c73e16ae96c..7d07b4a9640 100644 --- a/pkg/volume/scaleio/sio_volume.go +++ b/pkg/volume/scaleio/sio_volume.go @@ -30,9 +30,9 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) type sioVolume struct { @@ -61,7 +61,7 @@ var _ volume.Volume = &sioVolume{} func (v *sioVolume) GetPath() string { return v.plugin.host.GetPodVolumeDir( v.podUID, - kstrings.EscapeQualifiedNameForDisk(sioPluginName), + utilsstrings.EscapeQualifiedName(sioPluginName), v.volSpecName) } diff --git a/pkg/volume/secret/BUILD b/pkg/volume/secret/BUILD index d44d59dd614..288808826ff 100644 --- a/pkg/volume/secret/BUILD +++ b/pkg/volume/secret/BUILD @@ -15,7 +15,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/secret", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -23,6 +22,7 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/secret/secret.go b/pkg/volume/secret/secret.go index f58b9b92628..0536dfc23ad 100644 --- a/pkg/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -25,9 +25,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -54,7 +54,7 @@ func wrappedVolumeSpec() volume.Spec { } func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(secretPluginName), volName) + return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(secretPluginName), volName) } func (plugin *secretPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/storageos/BUILD b/pkg/volume/storageos/BUILD index c89c5fee55f..ebfc86e0b3d 100644 --- a/pkg/volume/storageos/BUILD +++ b/pkg/volume/storageos/BUILD @@ -16,7 +16,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/storageos", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", @@ -27,6 +26,7 @@ go_library( "//vendor/github.com/storageos/go-api:go_default_library", "//vendor/github.com/storageos/go-api/types:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/storageos/storageos.go b/pkg/volume/storageos/storageos.go index e65cdc5204f..9c3b0f80de3 100644 --- a/pkg/volume/storageos/storageos.go +++ b/pkg/volume/storageos/storageos.go @@ -24,17 +24,16 @@ import ( "path/filepath" "strings" - "k8s.io/klog" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" clientset "k8s.io/client-go/kubernetes" + "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -64,9 +63,9 @@ const ( func getPath(uid types.UID, volNamespace string, volName string, pvName string, host volume.VolumeHost) string { if len(volNamespace) != 0 && len(volName) != 0 && strings.Count(volName, ".") == 0 { - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(storageosPluginName), pvName+"."+volNamespace+"."+volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName+"."+volNamespace+"."+volName) } - return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(storageosPluginName), pvName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName) } func (plugin *storageosPlugin) Init(host volume.VolumeHost) error { @@ -432,7 +431,7 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error { } func makeGlobalPDName(host volume.VolumeHost, pvName, volNamespace, volName string) string { - return path.Join(host.GetPluginDir(kstrings.EscapeQualifiedNameForDisk(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) + return path.Join(host.GetPluginDir(utilsstrings.EscapeQualifiedName(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) } // Given the pod id and PV name, finds the volume's namespace and name from the @@ -444,7 +443,7 @@ func getVolumeInfo(pvName string, podUID types.UID, host volume.VolumeHost) (str return volNamespace, volName, nil } - volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, kstrings.EscapeQualifiedNameForDisk(storageosPluginName), pvName)) + volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName)) files, err := ioutil.ReadDir(volumeDir) if err != nil { return "", "", fmt.Errorf("Could not read mounts from pod volume dir: %s", err) diff --git a/pkg/volume/testing/BUILD b/pkg/volume/testing/BUILD index 16d3406a92f..f477a3996b4 100644 --- a/pkg/volume/testing/BUILD +++ b/pkg/volume/testing/BUILD @@ -14,7 +14,6 @@ go_library( importpath = "k8s.io/kubernetes/pkg/volume/testing", deps = [ "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/recyclerclient:go_default_library", @@ -31,6 +30,7 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library", "//vendor/github.com/stretchr/testify/mock:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/testing/testing.go b/pkg/volume/testing/testing.go index 129b8de73c6..07c19b62154 100644 --- a/pkg/volume/testing/testing.go +++ b/pkg/volume/testing/testing.go @@ -39,11 +39,11 @@ import ( cloudprovider "k8s.io/cloud-provider" csiclientset "k8s.io/csi-api/pkg/client/clientset/versioned" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" . "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/recyclerclient" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -765,7 +765,7 @@ func (fv *FakeVolume) GetPath() string { } func (fv *FakeVolume) getPath() string { - return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilstrings.EscapeQualifiedNameForDisk(fv.Plugin.PluginName), fv.VolName)) + return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName), fv.VolName)) } func (fv *FakeVolume) TearDown() error { @@ -810,7 +810,7 @@ func (fv *FakeVolume) GetGlobalMapPath(spec *Spec) (string, error) { // Block volume support func (fv *FakeVolume) getGlobalMapPath() (string, error) { - return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilstrings.EscapeQualifiedNameForDisk(fv.Plugin.PluginName)), "pluginDependentPath"), nil + return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName)), "pluginDependentPath"), nil } // Block volume support @@ -830,7 +830,7 @@ func (fv *FakeVolume) GetPodDeviceMapPath() (string, string) { // Block volume support func (fv *FakeVolume) getPodDeviceMapPath() (string, string) { - return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilstrings.EscapeQualifiedNameForDisk(fv.Plugin.PluginName))), fv.VolName + return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName))), fv.VolName } // Block volume support diff --git a/pkg/volume/util/BUILD b/pkg/volume/util/BUILD index d2bcab775ee..d325599af33 100644 --- a/pkg/volume/util/BUILD +++ b/pkg/volume/util/BUILD @@ -26,7 +26,6 @@ go_library( "//pkg/kubelet/apis:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/resizefs:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util/types:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -43,6 +42,7 @@ go_library( "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//vendor/github.com/prometheus/client_golang/prometheus:go_default_library", "//vendor/k8s.io/klog:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/util/util.go b/pkg/volume/util/util.go index 8de0469f50e..f2de07e2b52 100644 --- a/pkg/volume/util/util.go +++ b/pkg/volume/util/util.go @@ -18,17 +18,23 @@ package util import ( "fmt" + "hash/fnv" "io/ioutil" + "math/rand" "os" "path" "path/filepath" + "reflect" + "strconv" "strings" v1 "k8s.io/api/core/v1" storage "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + utypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" utilfeature "k8s.io/apiserver/pkg/util/feature" clientset "k8s.io/client-go/kubernetes" @@ -38,19 +44,10 @@ import ( "k8s.io/kubernetes/pkg/features" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" - - "reflect" - - "hash/fnv" - "math/rand" - "strconv" - - "k8s.io/apimachinery/pkg/api/resource" - utypes "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/volume/util/types" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) const ( @@ -823,7 +820,7 @@ func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.Per // GetPersistentVolumeClaimQualifiedName returns a qualified name for pvc. func GetPersistentVolumeClaimQualifiedName(claim *v1.PersistentVolumeClaim) string { - return utilstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) + return utilsstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) } // CheckVolumeModeFilesystem checks VolumeMode. diff --git a/pkg/volume/vsphere_volume/BUILD b/pkg/volume/vsphere_volume/BUILD index 2c948b74465..bbdbdd4e471 100644 --- a/pkg/volume/vsphere_volume/BUILD +++ b/pkg/volume/vsphere_volume/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/cloudprovider/providers/vsphere/vclib:go_default_library", "//pkg/features:go_default_library", "//pkg/util/mount:go_default_library", - "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//pkg/volume/util/volumepathhandler:go_default_library", @@ -32,6 +31,7 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/keymutex:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/vsphere_volume/vsphere_volume.go b/pkg/volume/vsphere_volume/vsphere_volume.go index 29cb1d0e237..eca25233143 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume.go +++ b/pkg/volume/vsphere_volume/vsphere_volume.go @@ -30,9 +30,9 @@ import ( "k8s.io/klog" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/util/mount" - utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + utilsstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -54,7 +54,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedNameForDisk(vsphereVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName), volName) } // vSphere Volume Plugin @@ -298,7 +298,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { func (vv *vsphereVolume) GetPath() string { name := vsphereVolumePluginName - return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilstrings.EscapeQualifiedNameForDisk(name), vv.volName) + return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilsstrings.EscapeQualifiedName(name), vv.volName) } // vSphere Persistent Volume Plugin diff --git a/pkg/volume/vsphere_volume/vsphere_volume_block.go b/pkg/volume/vsphere_volume/vsphere_volume_block.go index 40342b8aacd..806002b6f0b 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume_block.go +++ b/pkg/volume/vsphere_volume/vsphere_volume_block.go @@ -26,10 +26,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/mount" - kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" + utilsstrings "k8s.io/utils/strings" ) var _ volume.BlockVolumePlugin = &vsphereVolumePlugin{} @@ -157,5 +157,5 @@ func (v *vsphereVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { } func (v *vsphereVolume) GetPodDeviceMapPath() (string, string) { - return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, kstrings.EscapeQualifiedNameForDisk(vsphereVolumePluginName)), v.volName + return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName)), v.volName } From 65356896804f96478d3ba534a029fa0e4a8c0649 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 17:52:34 +0800 Subject: [PATCH 4/8] clean pkg/util/strings --- pkg/util/BUILD | 1 - pkg/util/strings/BUILD | 40 ---------- pkg/util/strings/escape.go | 49 ------------- pkg/util/strings/escape_test.go | 63 ---------------- pkg/util/strings/line_delimiter.go | 64 ---------------- pkg/util/strings/line_delimiter_test.go | 40 ---------- pkg/util/strings/strings.go | 58 --------------- pkg/util/strings/strings_test.go | 97 ------------------------- test/test_owners.csv | 1 - 9 files changed, 413 deletions(-) delete mode 100644 pkg/util/strings/BUILD delete mode 100644 pkg/util/strings/escape.go delete mode 100644 pkg/util/strings/escape_test.go delete mode 100644 pkg/util/strings/line_delimiter.go delete mode 100644 pkg/util/strings/line_delimiter_test.go delete mode 100644 pkg/util/strings/strings.go delete mode 100644 pkg/util/strings/strings_test.go diff --git a/pkg/util/BUILD b/pkg/util/BUILD index c3b25deb69c..35e298f15bf 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -52,7 +52,6 @@ filegroup( "//pkg/util/rlimit:all-srcs", "//pkg/util/selinux:all-srcs", "//pkg/util/slice:all-srcs", - "//pkg/util/strings:all-srcs", "//pkg/util/sysctl:all-srcs", "//pkg/util/system:all-srcs", "//pkg/util/tail:all-srcs", diff --git a/pkg/util/strings/BUILD b/pkg/util/strings/BUILD deleted file mode 100644 index a7cd124f7cc..00000000000 --- a/pkg/util/strings/BUILD +++ /dev/null @@ -1,40 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "escape.go", - "line_delimiter.go", - "strings.go", - ], - importpath = "k8s.io/kubernetes/pkg/util/strings", -) - -go_test( - name = "go_default_test", - srcs = [ - "escape_test.go", - "line_delimiter_test.go", - "strings_test.go", - ], - embed = [":go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/strings/escape.go b/pkg/util/strings/escape.go deleted file mode 100644 index b82a0f23fb8..00000000000 --- a/pkg/util/strings/escape.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2014 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 strings - -import ( - "strings" -) - -// EscapePluginName converts a plugin name in the format -// vendor/pluginname into a proper ondisk vendor~pluginname plugin directory -// format. -func EscapePluginName(in string) string { - return strings.Replace(in, "/", "~", -1) -} - -// UnescapePluginName converts a plugin directory name in the format -// vendor~pluginname into a proper vendor/pluginname. -func UnescapePluginName(in string) string { - return strings.Replace(in, "~", "/", -1) -} - -// EscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a -// string that is safe to use on-disk. This assumes that the input has already -// been validates as a qualified name. we use "~" rather than ":" here in case -// we ever use a filesystem that doesn't allow ":". -func EscapeQualifiedNameForDisk(in string) string { - return strings.Replace(in, "/", "~", -1) -} - -// UnescapeQualifiedNameForDisk converts an escaped plugin name (as per EscapeQualifiedNameForDisk) -// back to its normal form. This assumes that the input has already been -// validates as a qualified name. -func UnescapeQualifiedNameForDisk(in string) string { - return strings.Replace(in, "~", "/", -1) -} diff --git a/pkg/util/strings/escape_test.go b/pkg/util/strings/escape_test.go deleted file mode 100644 index 4c92f638a46..00000000000 --- a/pkg/util/strings/escape_test.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2016 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 strings - -import ( - "testing" -) - -func TestEscapePluginName(t *testing.T) { - testCases := []struct { - input string - output string - }{ - {"kubernetes.io/blah", "kubernetes.io~blah"}, - {"blah/blerg/borg", "blah~blerg~borg"}, - {"kubernetes.io", "kubernetes.io"}, - } - for i, tc := range testCases { - escapee := EscapePluginName(tc.input) - if escapee != tc.output { - t.Errorf("case[%d]: expected (%q), got (%q)", i, tc.output, escapee) - } - original := UnescapePluginName(escapee) - if original != tc.input { - t.Errorf("case[%d]: expected (%q), got (%q)", i, tc.input, original) - } - } -} - -func TestEscapeQualifiedNameForDisk(t *testing.T) { - testCases := []struct { - input string - output string - }{ - {"kubernetes.io/blah", "kubernetes.io~blah"}, - {"blah/blerg/borg", "blah~blerg~borg"}, - {"kubernetes.io", "kubernetes.io"}, - } - for i, tc := range testCases { - escapee := EscapeQualifiedNameForDisk(tc.input) - if escapee != tc.output { - t.Errorf("case[%d]: expected (%q), got (%q)", i, tc.output, escapee) - } - original := UnescapeQualifiedNameForDisk(escapee) - if original != tc.input { - t.Errorf("case[%d]: expected (%q), got (%q)", i, tc.input, original) - } - } -} diff --git a/pkg/util/strings/line_delimiter.go b/pkg/util/strings/line_delimiter.go deleted file mode 100644 index 8907869c9e7..00000000000 --- a/pkg/util/strings/line_delimiter.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2015 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 strings - -import ( - "bytes" - "io" - "strings" -) - -// LineDelimiter is a filter that will split input on lines -// and bracket each line with the delimiter string. -type LineDelimiter struct { - output io.Writer - delimiter []byte - buf bytes.Buffer -} - -// NewLineDelimiter allocates a new io.Writer that will split input on lines -// and bracket each line with the delimiter string. This can be useful in -// output tests where it is difficult to see and test trailing whitespace. -func NewLineDelimiter(output io.Writer, delimiter string) *LineDelimiter { - return &LineDelimiter{output: output, delimiter: []byte(delimiter)} -} - -// Write writes buf to the LineDelimiter ld. The only errors returned are ones -// encountered while writing to the underlying output stream. -func (ld *LineDelimiter) Write(buf []byte) (n int, err error) { - return ld.buf.Write(buf) -} - -// Flush all lines up until now. This will assume insert a linebreak at the current point of the stream. -func (ld *LineDelimiter) Flush() (err error) { - lines := strings.Split(ld.buf.String(), "\n") - for _, line := range lines { - if _, err = ld.output.Write(ld.delimiter); err != nil { - return - } - if _, err = ld.output.Write([]byte(line)); err != nil { - return - } - if _, err = ld.output.Write(ld.delimiter); err != nil { - return - } - if _, err = ld.output.Write([]byte("\n")); err != nil { - return - } - } - return -} diff --git a/pkg/util/strings/line_delimiter_test.go b/pkg/util/strings/line_delimiter_test.go deleted file mode 100644 index 15bee165b59..00000000000 --- a/pkg/util/strings/line_delimiter_test.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2015 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 strings - -import ( - "fmt" - "os" -) - -func Example_trailingNewline() { - ld := NewLineDelimiter(os.Stdout, "|") - defer ld.Flush() - fmt.Fprint(ld, " Hello \n World \n") - // Output: - // | Hello | - // | World | - // || -} -func Example_noTrailingNewline() { - ld := NewLineDelimiter(os.Stdout, "|") - defer ld.Flush() - fmt.Fprint(ld, " Hello \n World ") - // Output: - // | Hello | - // | World | -} diff --git a/pkg/util/strings/strings.go b/pkg/util/strings/strings.go deleted file mode 100644 index 29be3170a25..00000000000 --- a/pkg/util/strings/strings.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2014 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 strings - -import ( - "path" - "strings" - "unicode" -) - -// SplitQualifiedName splits a fully qualified name and returns its namespace and name. -// Assumes that the input 'str' has been validated. -func SplitQualifiedName(str string) (string, string) { - parts := strings.Split(str, "/") - if len(parts) < 2 { - return "", str - } - return parts[0], parts[1] -} - -// JoinQualifiedName joins 'namespace' and 'name' and returns a fully qualified name -// Assumes that the input is valid. -func JoinQualifiedName(namespace, name string) string { - return path.Join(namespace, name) -} - -// ShortenString returns the first N slice of a string. -func ShortenString(str string, n int) string { - if len(str) <= n { - return str - } - return str[:n] -} - -// isVowel returns true if the rune is a vowel (case insensitive). -func isVowel(c rune) bool { - vowels := []rune{'a', 'e', 'i', 'o', 'u'} - for _, value := range vowels { - if value == unicode.ToLower(c) { - return true - } - } - return false -} diff --git a/pkg/util/strings/strings_test.go b/pkg/util/strings/strings_test.go deleted file mode 100644 index 3c6e22e406d..00000000000 --- a/pkg/util/strings/strings_test.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2014 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 strings - -import ( - "testing" -) - -func TestSplitQualifiedName(t *testing.T) { - testCases := []struct { - input string - output []string - }{ - {"kubernetes.io/blah", []string{"kubernetes.io", "blah"}}, - {"blah", []string{"", "blah"}}, - {"kubernetes.io/blah/blah", []string{"kubernetes.io", "blah"}}, - } - for i, tc := range testCases { - namespace, name := SplitQualifiedName(tc.input) - if namespace != tc.output[0] || name != tc.output[1] { - t.Errorf("case[%d]: expected (%q, %q), got (%q, %q)", i, tc.output[0], tc.output[1], namespace, name) - } - } -} - -func TestJoinQualifiedName(t *testing.T) { - testCases := []struct { - input []string - output string - }{ - {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, - {[]string{"blah", ""}, "blah"}, - {[]string{"kubernetes.io", "blah"}, "kubernetes.io/blah"}, - } - for i, tc := range testCases { - res := JoinQualifiedName(tc.input[0], tc.input[1]) - if res != tc.output { - t.Errorf("case[%d]: expected %q, got %q", i, tc.output, res) - } - } -} - -func TestShortenString(t *testing.T) { - testCases := []struct { - input string - outLen int - output string - }{ - {"kubernetes.io", 5, "kuber"}, - {"blah", 34, "blah"}, - {"kubernetes.io", 13, "kubernetes.io"}, - } - for i, tc := range testCases { - res := ShortenString(tc.input, tc.outLen) - if res != tc.output { - t.Errorf("case[%d]: expected %q, got %q", i, tc.output, res) - } - } -} - -func TestIsVowel(t *testing.T) { - tests := []struct { - name string - arg rune - want bool - }{ - { - name: "yes", - arg: 'E', - want: true, - }, - { - name: "no", - arg: 'n', - want: false, - }, - } - for _, tt := range tests { - if got := isVowel(tt.arg); got != tt.want { - t.Errorf("%q. IsVowel() = %v, want %v", tt.name, got, tt.want) - } - } -} diff --git a/test/test_owners.csv b/test/test_owners.csv index 26cdfa575d6..ff69640baf6 100644 --- a/test/test_owners.csv +++ b/test/test_owners.csv @@ -802,7 +802,6 @@ k8s.io/kubernetes/pkg/util/oom,vishh,0, k8s.io/kubernetes/pkg/util/parsers,derekwaynecarr,1, k8s.io/kubernetes/pkg/util/procfs,roberthbailey,1, k8s.io/kubernetes/pkg/util/slice,quinton-hoole,0, -k8s.io/kubernetes/pkg/util/strings,quinton-hoole,0, k8s.io/kubernetes/pkg/util/system,mwielgus,0, k8s.io/kubernetes/pkg/util/tail,zmerlynn,1, k8s.io/kubernetes/pkg/util/taints,rrati,0, From 257ae4da008964786bbc55e39cbd4c6121cebde6 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 17:53:19 +0800 Subject: [PATCH 5/8] Update vendor/k8s.io/utils --- Godeps/Godeps.json | 26 +- Godeps/LICENSES | 420 ++++++++++++++++++ .../Godeps/Godeps.json | 6 +- .../src/k8s.io/apiserver/Godeps/Godeps.json | 8 +- .../src/k8s.io/cli-runtime/Godeps/Godeps.json | 2 +- .../src/k8s.io/client-go/Godeps/Godeps.json | 6 +- .../k8s.io/cloud-provider/Godeps/Godeps.json | 6 +- .../k8s.io/component-base/Godeps/Godeps.json | 2 +- staging/src/k8s.io/csi-api/Godeps/Godeps.json | 6 +- .../k8s.io/kube-aggregator/Godeps/Godeps.json | 6 +- .../Godeps/Godeps.json | 2 +- .../src/k8s.io/kube-proxy/Godeps/Godeps.json | 2 +- .../k8s.io/kube-scheduler/Godeps/Godeps.json | 2 +- staging/src/k8s.io/metrics/Godeps/Godeps.json | 2 +- .../src/k8s.io/node-api/Godeps/Godeps.json | 6 +- .../sample-apiserver/Godeps/Godeps.json | 6 +- .../sample-cli-plugin/Godeps/Godeps.json | 2 +- .../sample-controller/Godeps/Godeps.json | 6 +- vendor/BUILD | 2 + vendor/k8s.io/utils/keymutex/BUILD | 26 ++ vendor/k8s.io/utils/keymutex/hashed.go | 58 +++ vendor/k8s.io/utils/keymutex/keymutex.go | 27 ++ vendor/k8s.io/utils/nsenter/BUILD | 2 - vendor/k8s.io/utils/nsenter/exec.go | 67 --- .../k8s.io/utils/nsenter/exec_unsupported.go | 58 --- vendor/k8s.io/utils/nsenter/nsenter.go | 57 ++- .../utils/nsenter/nsenter_unsupported.go | 35 +- vendor/k8s.io/utils/strings/BUILD | 27 ++ vendor/k8s.io/utils/strings/escape.go | 36 ++ vendor/k8s.io/utils/strings/line_delimiter.go | 64 +++ vendor/k8s.io/utils/strings/strings.go | 46 ++ 31 files changed, 827 insertions(+), 194 deletions(-) create mode 100644 vendor/k8s.io/utils/keymutex/BUILD create mode 100644 vendor/k8s.io/utils/keymutex/hashed.go create mode 100644 vendor/k8s.io/utils/keymutex/keymutex.go delete mode 100644 vendor/k8s.io/utils/nsenter/exec.go delete mode 100644 vendor/k8s.io/utils/nsenter/exec_unsupported.go create mode 100644 vendor/k8s.io/utils/strings/BUILD create mode 100644 vendor/k8s.io/utils/strings/escape.go create mode 100644 vendor/k8s.io/utils/strings/line_delimiter.go create mode 100644 vendor/k8s.io/utils/strings/strings.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 0febbc8e827..6ceaf567a0d 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -4090,39 +4090,47 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/clock", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/exec", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/exec/testing", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/io", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" + }, + { + "ImportPath": "k8s.io/utils/keymutex", + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/nsenter", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" + }, + { + "ImportPath": "k8s.io/utils/strings", + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/Godeps/LICENSES b/Godeps/LICENSES index 41628249ad0..2da5c937067 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -116213,6 +116213,216 @@ third-party archives. ================================================================================ +================================================================================ += vendor/k8s.io/utils/keymutex licensed under: = + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + += vendor/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/k8s.io/utils/nsenter licensed under: = @@ -116633,6 +116843,216 @@ third-party archives. ================================================================================ +================================================================================ += vendor/k8s.io/utils/strings licensed under: = + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + += vendor/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 +================================================================================ + + ================================================================================ = vendor/k8s.io/utils/trace licensed under: = diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index 5c303ad9b53..850dc10b21c 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -2556,15 +2556,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index c3ee8cbccda..f620b658ba1 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -2052,19 +2052,19 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 2f973b487dc..d7a51f34230 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -612,7 +612,7 @@ }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/client-go/Godeps/Godeps.json b/staging/src/k8s.io/client-go/Godeps/Godeps.json index 69318cbc89b..766154c6add 100644 --- a/staging/src/k8s.io/client-go/Godeps/Godeps.json +++ b/staging/src/k8s.io/client-go/Godeps/Godeps.json @@ -616,15 +616,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json index c976b07d2b8..93aae245fc2 100644 --- a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json +++ b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json @@ -952,15 +952,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/component-base/Godeps/Godeps.json b/staging/src/k8s.io/component-base/Godeps/Godeps.json index 774c215ba52..9ad4bcc8e77 100644 --- a/staging/src/k8s.io/component-base/Godeps/Godeps.json +++ b/staging/src/k8s.io/component-base/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" } ] } diff --git a/staging/src/k8s.io/csi-api/Godeps/Godeps.json b/staging/src/k8s.io/csi-api/Godeps/Godeps.json index 1218aa5cc2e..c4e39f69fe4 100644 --- a/staging/src/k8s.io/csi-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-api/Godeps/Godeps.json @@ -548,15 +548,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index bf8d2e15685..e39d8fa453e 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -1832,15 +1832,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json index 7d41706b786..fd72952019d 100644 --- a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" } ] } diff --git a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json index 94aa5161252..538d561a2b3 100644 --- a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" } ] } diff --git a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json index 1532f61221d..5e62cd9764d 100644 --- a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json @@ -152,7 +152,7 @@ }, { "ImportPath": "k8s.io/utils/pointer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" } ] } diff --git a/staging/src/k8s.io/metrics/Godeps/Godeps.json b/staging/src/k8s.io/metrics/Godeps/Godeps.json index 80d6aa9b7c5..317fa041e5e 100644 --- a/staging/src/k8s.io/metrics/Godeps/Godeps.json +++ b/staging/src/k8s.io/metrics/Godeps/Godeps.json @@ -524,7 +524,7 @@ }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/node-api/Godeps/Godeps.json b/staging/src/k8s.io/node-api/Godeps/Godeps.json index 945acb3adc9..b2622459856 100644 --- a/staging/src/k8s.io/node-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/node-api/Godeps/Godeps.json @@ -548,15 +548,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index b920ad905a8..d117d1fbea6 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -1784,15 +1784,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index d881a452c5f..a58978263bb 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -576,7 +576,7 @@ }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json index 9f77150d79d..f125e65ca54 100644 --- a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json @@ -1156,15 +1156,15 @@ }, { "ImportPath": "k8s.io/utils/buffer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/integer", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "k8s.io/utils/trace", - "Rev": "8a87304934321b4b0ad72a7cb3cbc715d67d38c7" + "Rev": "ed37f7428a91fc2a81070808937195dcd46d320e" }, { "ImportPath": "sigs.k8s.io/yaml", diff --git a/vendor/BUILD b/vendor/BUILD index 0ae266cc1a3..03d55b2154d 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -472,8 +472,10 @@ filegroup( "//vendor/k8s.io/utils/exec:all-srcs", "//vendor/k8s.io/utils/integer:all-srcs", "//vendor/k8s.io/utils/io:all-srcs", + "//vendor/k8s.io/utils/keymutex:all-srcs", "//vendor/k8s.io/utils/nsenter:all-srcs", "//vendor/k8s.io/utils/pointer:all-srcs", + "//vendor/k8s.io/utils/strings:all-srcs", "//vendor/k8s.io/utils/trace:all-srcs", "//vendor/sigs.k8s.io/yaml:all-srcs", "//vendor/vbom.ml/util/sortorder:all-srcs", diff --git a/vendor/k8s.io/utils/keymutex/BUILD b/vendor/k8s.io/utils/keymutex/BUILD new file mode 100644 index 00000000000..cc867e4f2e1 --- /dev/null +++ b/vendor/k8s.io/utils/keymutex/BUILD @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "hashed.go", + "keymutex.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/keymutex", + importpath = "k8s.io/utils/keymutex", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/keymutex/hashed.go b/vendor/k8s.io/utils/keymutex/hashed.go new file mode 100644 index 00000000000..54e28b0090a --- /dev/null +++ b/vendor/k8s.io/utils/keymutex/hashed.go @@ -0,0 +1,58 @@ +/* +Copyright 2018 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 keymutex + +import ( + "hash/fnv" + "runtime" + "sync" +) + +// NewHashed returns a new instance of KeyMutex which hashes arbitrary keys to +// a fixed set of locks. `n` specifies number of locks, if n <= 0, we use +// number of cpus. +// Note that because it uses fixed set of locks, different keys may share same +// lock, so it's possible to wait on same lock. +func NewHashed(n int) KeyMutex { + if n <= 0 { + n = runtime.NumCPU() + } + return &hashedKeyMutex{ + mutexes: make([]sync.Mutex, n), + } +} + +type hashedKeyMutex struct { + mutexes []sync.Mutex +} + +// Acquires a lock associated with the specified ID. +func (km *hashedKeyMutex) LockKey(id string) { + km.mutexes[km.hash(id)%len(km.mutexes)].Lock() +} + +// Releases the lock associated with the specified ID. +func (km *hashedKeyMutex) UnlockKey(id string) error { + km.mutexes[km.hash(id)%len(km.mutexes)].Unlock() + return nil +} + +func (km *hashedKeyMutex) hash(id string) int { + h := fnv.New32a() + h.Write([]byte(id)) + return int(h.Sum32()) +} diff --git a/vendor/k8s.io/utils/keymutex/keymutex.go b/vendor/k8s.io/utils/keymutex/keymutex.go new file mode 100644 index 00000000000..89dc022397c --- /dev/null +++ b/vendor/k8s.io/utils/keymutex/keymutex.go @@ -0,0 +1,27 @@ +/* +Copyright 2015 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 keymutex + +// KeyMutex is a thread-safe interface for acquiring locks on arbitrary strings. +type KeyMutex interface { + // Acquires a lock associated with the specified ID, creates the lock if one doesn't already exist. + LockKey(id string) + + // Releases the lock associated with the specified ID. + // Returns an error if the specified ID doesn't exist. + UnlockKey(id string) error +} diff --git a/vendor/k8s.io/utils/nsenter/BUILD b/vendor/k8s.io/utils/nsenter/BUILD index 31fa8ba2400..b8f8051b728 100644 --- a/vendor/k8s.io/utils/nsenter/BUILD +++ b/vendor/k8s.io/utils/nsenter/BUILD @@ -3,8 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "exec.go", - "exec_unsupported.go", "nsenter.go", "nsenter_unsupported.go", ], diff --git a/vendor/k8s.io/utils/nsenter/exec.go b/vendor/k8s.io/utils/nsenter/exec.go deleted file mode 100644 index 134497f0a75..00000000000 --- a/vendor/k8s.io/utils/nsenter/exec.go +++ /dev/null @@ -1,67 +0,0 @@ -// +build linux - -/* -Copyright 2018 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 nsenter - -import ( - "context" - "fmt" - "path/filepath" - - "k8s.io/klog" - "k8s.io/utils/exec" -) - -// Executor wraps executor interface to be executed via nsenter -type Executor struct { - // Exec implementation - executor exec.Interface - // Path to the host's root proc path - hostProcMountNsPath string -} - -// NewNsenterExecutor returns new nsenter based executor -func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { - hostProcMountNsPath := filepath.Join(hostRootFsPath, mountNsPath) - nsExecutor := &Executor{ - hostProcMountNsPath: hostProcMountNsPath, - executor: executor, - } - return nsExecutor -} - -// Command returns a command wrapped with nenter -func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { - fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, - append([]string{cmd}, args...)...) - klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) - return nsExecutor.executor.Command(nsenterPath, fullArgs...) -} - -// CommandContext returns a CommandContext wrapped with nsenter -func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { - fullArgs := append([]string{fmt.Sprintf("--mount=%s", nsExecutor.hostProcMountNsPath), "--"}, - append([]string{cmd}, args...)...) - klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) - return nsExecutor.executor.CommandContext(ctx, nsenterPath, fullArgs...) -} - -// LookPath returns a LookPath wrapped with nsenter -func (nsExecutor *Executor) LookPath(file string) (string, error) { - return "", fmt.Errorf("not implemented, error looking up : %s", file) -} diff --git a/vendor/k8s.io/utils/nsenter/exec_unsupported.go b/vendor/k8s.io/utils/nsenter/exec_unsupported.go deleted file mode 100644 index eecbdfc2921..00000000000 --- a/vendor/k8s.io/utils/nsenter/exec_unsupported.go +++ /dev/null @@ -1,58 +0,0 @@ -// +build !linux - -/* -Copyright 2017 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 nsenter - -import ( - "context" - "fmt" - - "k8s.io/utils/exec" -) - -// Executor wraps executor interface to be executed via nsenter -type Executor struct { - // Exec implementation - executor exec.Interface - // Path to the host's root proc path - hostProcMountNsPath string -} - -// NewNsenterExecutor returns new nsenter based executor -func NewNsenterExecutor(hostRootFsPath string, executor exec.Interface) *Executor { - nsExecutor := &Executor{ - hostProcMountNsPath: hostRootFsPath, - executor: executor, - } - return nsExecutor -} - -// Command returns a command wrapped with nenter -func (nsExecutor *Executor) Command(cmd string, args ...string) exec.Cmd { - return nil -} - -// CommandContext returns a CommandContext wrapped with nsenter -func (nsExecutor *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { - return nil -} - -// LookPath returns a LookPath wrapped with nsenter -func (nsExecutor *Executor) LookPath(file string) (string, error) { - return "", fmt.Errorf("not implemented, error looking up : %s", file) -} diff --git a/vendor/k8s.io/utils/nsenter/nsenter.go b/vendor/k8s.io/utils/nsenter/nsenter.go index 13532f06339..a6fa0c22376 100644 --- a/vendor/k8s.io/utils/nsenter/nsenter.go +++ b/vendor/k8s.io/utils/nsenter/nsenter.go @@ -40,10 +40,13 @@ const ( nsenterPath = "nsenter" ) -// Nsenter is part of experimental support for running the kubelet +// Nsenter is a type alias for backward compatibility +type Nsenter = NSEnter + +// NSEnter is part of experimental support for running the kubelet // in a container. // -// Nsenter requires: +// NSEnter requires: // // 1. Docker >= 1.6 due to the dependency on the slave propagation mode // of the bind-mount of the kubelet root directory in the container. @@ -65,20 +68,20 @@ const ( // systemd is installed/enabled in the operating system. // For more information about mount propagation modes, see: // https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt -type Nsenter struct { +type NSEnter struct { // a map of commands to their paths on the host filesystem paths map[string]string // Path to the host filesystem, typically "/rootfs". Used only for testing. hostRootFsPath string - // Exec implementation, used only for testing + // Exec implementation executor exec.Interface } -// NewNsenter constructs a new instance of Nsenter -func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { - ne := &Nsenter{ +// NewNsenter constructs a new instance of NSEnter +func NewNsenter(hostRootFsPath string, executor exec.Interface) (*NSEnter, error) { + ne := &NSEnter{ hostRootFsPath: hostRootFsPath, executor: executor, } @@ -88,7 +91,7 @@ func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error return ne, nil } -func (ne *Nsenter) initPaths() error { +func (ne *NSEnter) initPaths() error { ne.paths = map[string]string{} binaries := []string{ "mount", @@ -122,7 +125,7 @@ func (ne *Nsenter) initPaths() error { } // Exec executes nsenter commands in hostProcMountNsPath mount namespace -func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { +func (ne *NSEnter) Exec(cmd string, args []string) exec.Cmd { hostProcMountNsPath := filepath.Join(ne.hostRootFsPath, mountNsPath) fullArgs := append([]string{fmt.Sprintf("--mount=%s", hostProcMountNsPath), "--"}, append([]string{ne.AbsHostPath(cmd)}, args...)...) @@ -130,8 +133,27 @@ func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { return ne.executor.Command(nsenterPath, fullArgs...) } +// Command returns a command wrapped with nsenter +func (ne *NSEnter) Command(cmd string, args ...string) exec.Cmd { + return ne.Exec(cmd, args) +} + +// CommandContext returns a CommandContext wrapped with nsenter +func (ne *NSEnter) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { + hostProcMountNsPath := filepath.Join(ne.hostRootFsPath, mountNsPath) + fullArgs := append([]string{fmt.Sprintf("--mount=%s", hostProcMountNsPath), "--"}, + append([]string{ne.AbsHostPath(cmd)}, args...)...) + klog.V(5).Infof("Running nsenter command: %v %v", nsenterPath, fullArgs) + return ne.executor.CommandContext(ctx, nsenterPath, fullArgs...) +} + +// LookPath returns a LookPath wrapped with nsenter +func (ne *NSEnter) LookPath(file string) (string, error) { + return "", fmt.Errorf("not implemented, error looking up : %s", file) +} + // AbsHostPath returns the absolute runnable path for a specified command -func (ne *Nsenter) AbsHostPath(command string) string { +func (ne *NSEnter) AbsHostPath(command string) string { path, ok := ne.paths[command] if !ok { return command @@ -140,7 +162,7 @@ func (ne *Nsenter) AbsHostPath(command string) string { } // SupportsSystemd checks whether command systemd-run exists -func (ne *Nsenter) SupportsSystemd() (string, bool) { +func (ne *NSEnter) SupportsSystemd() (string, bool) { systemdRunPath, ok := ne.paths["systemd-run"] return systemdRunPath, ok && systemdRunPath != "" } @@ -158,7 +180,7 @@ func (ne *Nsenter) SupportsSystemd() (string, bool) { // // BEWARE! EvalSymlinks is not able to detect symlink looks with mustExist=false! // If /tmp/link is symlink to /tmp/link, EvalSymlinks(/tmp/link/foo) returns /tmp/link/foo. -func (ne *Nsenter) EvalSymlinks(pathname string, mustExist bool) (string, error) { +func (ne *NSEnter) EvalSymlinks(pathname string, mustExist bool) (string, error) { var args []string if mustExist { // "realpath -e: all components of the path must exist" @@ -178,16 +200,16 @@ func (ne *Nsenter) EvalSymlinks(pathname string, mustExist bool) (string, error) // KubeletPath returns the path name that can be accessed by containerized // kubelet. It is recommended to resolve symlinks on the host by EvalSymlinks // before calling this function -func (ne *Nsenter) KubeletPath(pathname string) string { +func (ne *NSEnter) KubeletPath(pathname string) string { return filepath.Join(ne.hostRootFsPath, pathname) } -// NewFakeNsenter returns a Nsenter that does not run "nsenter --mount=... --", +// NewFakeNsenter returns a NSEnter that does not run "nsenter --mount=... --", // but runs everything in the same mount namespace as the unit test binary. // rootfsPath is supposed to be a symlink, e.g. /tmp/xyz/rootfs -> /. -// This fake Nsenter is enough for most operations, e.g. to resolve symlinks, +// This fake NSEnter is enough for most operations, e.g. to resolve symlinks, // but it's not enough to call /bin/mount - unit tests don't run as root. -func NewFakeNsenter(rootfsPath string) (*Nsenter, error) { +func NewFakeNsenter(rootfsPath string) (*NSEnter, error) { executor := &fakeExec{ rootfsPath: rootfsPath, } @@ -218,7 +240,7 @@ type fakeExec struct { } func (f fakeExec) Command(cmd string, args ...string) exec.Cmd { - // This will intentionaly panic if Nsenter does not provide enough arguments. + // This will intentionaly panic if NSEnter does not provide enough arguments. realCmd := args[2] realArgs := args[3:] return exec.New().Command(realCmd, realArgs...) @@ -233,3 +255,4 @@ func (fakeExec) CommandContext(ctx context.Context, cmd string, args ...string) } var _ exec.Interface = fakeExec{} +var _ exec.Interface = &NSEnter{} diff --git a/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go b/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go index 0618b9da469..e38c7e81133 100644 --- a/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go +++ b/vendor/k8s.io/utils/nsenter/nsenter_unsupported.go @@ -19,6 +19,9 @@ limitations under the License. package nsenter import ( + "context" + "fmt" + "k8s.io/utils/exec" ) @@ -28,29 +31,49 @@ const ( DefaultHostRootFsPath = "/rootfs" ) -// Nsenter is part of experimental support for running the kubelet +// Nsenter is a type alias for backward compatibility +type Nsenter = NSEnter + +// NSEnter is part of experimental support for running the kubelet // in a container. -type Nsenter struct { +type NSEnter struct { // a map of commands to their paths on the host filesystem Paths map[string]string } -// NewNsenter constructs a new instance of Nsenter +// NewNsenter constructs a new instance of NSEnter func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { return &Nsenter{}, nil } // Exec executes nsenter commands in hostProcMountNsPath mount namespace -func (ne *Nsenter) Exec(cmd string, args []string) exec.Cmd { +func (ne *NSEnter) Exec(cmd string, args []string) exec.Cmd { return nil } // AbsHostPath returns the absolute runnable path for a specified command -func (ne *Nsenter) AbsHostPath(command string) string { +func (ne *NSEnter) AbsHostPath(command string) string { return "" } // SupportsSystemd checks whether command systemd-run exists -func (ne *Nsenter) SupportsSystemd() (string, bool) { +func (ne *NSEnter) SupportsSystemd() (string, bool) { return "", false } + +// Command returns a command wrapped with nenter +func (ne *NSEnter) Command(cmd string, args ...string) exec.Cmd { + return nil +} + +// CommandContext returns a CommandContext wrapped with nsenter +func (ne *NSEnter) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { + return nil +} + +// LookPath returns a LookPath wrapped with nsenter +func (ne *NSEnter) LookPath(file string) (string, error) { + return "", fmt.Errorf("not implemented, error looking up : %s", file) +} + +var _ exec.Interface = &NSEnter{} diff --git a/vendor/k8s.io/utils/strings/BUILD b/vendor/k8s.io/utils/strings/BUILD new file mode 100644 index 00000000000..08bd01b744e --- /dev/null +++ b/vendor/k8s.io/utils/strings/BUILD @@ -0,0 +1,27 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "escape.go", + "line_delimiter.go", + "strings.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/utils/strings", + importpath = "k8s.io/utils/strings", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/utils/strings/escape.go b/vendor/k8s.io/utils/strings/escape.go new file mode 100644 index 00000000000..bae8d81a195 --- /dev/null +++ b/vendor/k8s.io/utils/strings/escape.go @@ -0,0 +1,36 @@ +/* +Copyright 2014 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 strings + +import ( + "strings" +) + +// EscapeQualifiedName converts a plugin name, which might contain a / into a +// string that is safe to use on-disk. This assumes that the input has already +// been validates as a qualified name. we use "~" rather than ":" here in case +// we ever use a filesystem that doesn't allow ":". +func EscapeQualifiedName(in string) string { + return strings.Replace(in, "/", "~", -1) +} + +// UnescapeQualifiedName converts an escaped plugin name (as per EscapeQualifiedName) +// back to its normal form. This assumes that the input has already been +// validates as a qualified name. +func UnescapeQualifiedName(in string) string { + return strings.Replace(in, "~", "/", -1) +} diff --git a/vendor/k8s.io/utils/strings/line_delimiter.go b/vendor/k8s.io/utils/strings/line_delimiter.go new file mode 100644 index 00000000000..8907869c9e7 --- /dev/null +++ b/vendor/k8s.io/utils/strings/line_delimiter.go @@ -0,0 +1,64 @@ +/* +Copyright 2015 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 strings + +import ( + "bytes" + "io" + "strings" +) + +// LineDelimiter is a filter that will split input on lines +// and bracket each line with the delimiter string. +type LineDelimiter struct { + output io.Writer + delimiter []byte + buf bytes.Buffer +} + +// NewLineDelimiter allocates a new io.Writer that will split input on lines +// and bracket each line with the delimiter string. This can be useful in +// output tests where it is difficult to see and test trailing whitespace. +func NewLineDelimiter(output io.Writer, delimiter string) *LineDelimiter { + return &LineDelimiter{output: output, delimiter: []byte(delimiter)} +} + +// Write writes buf to the LineDelimiter ld. The only errors returned are ones +// encountered while writing to the underlying output stream. +func (ld *LineDelimiter) Write(buf []byte) (n int, err error) { + return ld.buf.Write(buf) +} + +// Flush all lines up until now. This will assume insert a linebreak at the current point of the stream. +func (ld *LineDelimiter) Flush() (err error) { + lines := strings.Split(ld.buf.String(), "\n") + for _, line := range lines { + if _, err = ld.output.Write(ld.delimiter); err != nil { + return + } + if _, err = ld.output.Write([]byte(line)); err != nil { + return + } + if _, err = ld.output.Write(ld.delimiter); err != nil { + return + } + if _, err = ld.output.Write([]byte("\n")); err != nil { + return + } + } + return +} diff --git a/vendor/k8s.io/utils/strings/strings.go b/vendor/k8s.io/utils/strings/strings.go new file mode 100644 index 00000000000..8a9f2eced93 --- /dev/null +++ b/vendor/k8s.io/utils/strings/strings.go @@ -0,0 +1,46 @@ +/* +Copyright 2014 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 strings + +import ( + "path" + "strings" +) + +// SplitQualifiedName Splits a fully qualified name and returns its namespace and name. +// Assumes that the input 'str' has been validated. +func SplitQualifiedName(str string) (string, string) { + parts := strings.Split(str, "/") + if len(parts) < 2 { + return "", str + } + return parts[0], parts[1] +} + +// JoinQualifiedName joins 'namespace' and 'name' and returns a fully qualified name +// Assumes that the input is valid. +func JoinQualifiedName(namespace, name string) string { + return path.Join(namespace, name) +} + +// ShortenString returns the first N slice of a string. +func ShortenString(str string, n int) string { + if len(str) <= n { + return str + } + return str[:n] +} From 509bd528957bdb934a1195489d7c410563045a17 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Tue, 29 Jan 2019 17:53:45 +0800 Subject: [PATCH 6/8] migrate NewNsenterExecutor to NewNsenter --- cmd/kubelet/app/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index bedd78500b1..e932f689472 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -369,7 +369,10 @@ func UnsecuredDependencies(s *options.KubeletServer) (*kubelet.Dependencies, err } mounter = mount.NewNsenterMounter(s.RootDirectory, ne) // an exec interface which can use nsenter for flex plugin calls - pluginRunner = nsenter.NewNsenterExecutor(nsenter.DefaultHostRootFsPath, exec.New()) + pluginRunner, err = nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New()) + if err != nil { + return nil, err + } } var dockerClientConfig *dockershim.ClientConfig From 657a1a1a3457bc599005b1ca30c338c03e9d4aa0 Mon Sep 17 00:00:00 2001 From: danielqsj Date: Wed, 30 Jan 2019 10:19:50 +0800 Subject: [PATCH 7/8] change import alias of utils/strings --- .../volume/attachdetach/reconciler/reconciler_test.go | 4 ++-- pkg/kubelet/mountpod/mount_pod.go | 4 ++-- pkg/kubelet/volumemanager/reconciler/reconciler.go | 4 ++-- pkg/volume/awsebs/aws_ebs.go | 4 ++-- pkg/volume/awsebs/aws_ebs_block.go | 7 +++---- pkg/volume/azure_dd/azure_common.go | 4 ++-- pkg/volume/azure_dd/azure_dd_block.go | 4 ++-- pkg/volume/azure_file/azure_file.go | 4 ++-- pkg/volume/azure_file/azure_provision.go | 4 ++-- pkg/volume/cephfs/cephfs.go | 6 +++--- pkg/volume/cinder/cinder.go | 4 ++-- pkg/volume/cinder/cinder_block.go | 4 ++-- pkg/volume/configmap/configmap.go | 6 +++--- pkg/volume/csi/csi_block.go | 8 ++++---- pkg/volume/csi/csi_mounter.go | 6 +++--- pkg/volume/csi/csi_util.go | 7 +++---- pkg/volume/downwardapi/downwardapi.go | 6 +++--- pkg/volume/emptydir/empty_dir.go | 6 +++--- pkg/volume/fc/fc.go | 6 +++--- pkg/volume/flexvolume/plugin.go | 8 ++++---- pkg/volume/flexvolume/probe.go | 4 ++-- pkg/volume/flexvolume/volume.go | 4 ++-- pkg/volume/flocker/flocker.go | 8 ++++---- pkg/volume/gcepd/gce_pd.go | 4 ++-- pkg/volume/gcepd/gce_pd_block.go | 4 ++-- pkg/volume/git_repo/git_repo.go | 6 +++--- pkg/volume/glusterfs/glusterfs.go | 10 +++++----- pkg/volume/iscsi/iscsi.go | 8 ++++---- pkg/volume/local/local.go | 10 +++++----- pkg/volume/nfs/nfs.go | 4 ++-- pkg/volume/photon_pd/photon_pd.go | 4 ++-- pkg/volume/portworx/portworx.go | 4 ++-- pkg/volume/projected/projected.go | 4 ++-- pkg/volume/quobyte/quobyte.go | 8 ++++---- pkg/volume/rbd/rbd.go | 6 +++--- pkg/volume/scaleio/sio_volume.go | 4 ++-- pkg/volume/secret/secret.go | 4 ++-- pkg/volume/storageos/storageos.go | 10 +++++----- pkg/volume/testing/testing.go | 8 ++++---- pkg/volume/util/util.go | 4 ++-- pkg/volume/vsphere_volume/vsphere_volume.go | 6 +++--- pkg/volume/vsphere_volume/vsphere_volume_block.go | 4 ++-- 42 files changed, 116 insertions(+), 118 deletions(-) diff --git a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go index 8c83f77d0e8..bafd2dd6cee 100644 --- a/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go +++ b/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go @@ -32,7 +32,7 @@ import ( volumetesting "k8s.io/kubernetes/pkg/volume/testing" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" "k8s.io/kubernetes/pkg/volume/util/types" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -738,7 +738,7 @@ func Test_ReportMultiAttachError(t *testing.T) { volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) volumeSpec.PersistentVolume.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} uid := string(n.name) + "-" + podName // unique UID - namespace, name := utilsstrings.SplitQualifiedName(podName) + namespace, name := utilstrings.SplitQualifiedName(podName) pod := controllervolumetesting.NewPod(uid, name) pod.Namespace = namespace _, err := dsw.AddPod(types.UniquePodName(uid), pod, volumeSpec, n.name) diff --git a/pkg/kubelet/mountpod/mount_pod.go b/pkg/kubelet/mountpod/mount_pod.go index cf0e97ba4cf..2adb3e9bfbb 100644 --- a/pkg/kubelet/mountpod/mount_pod.go +++ b/pkg/kubelet/mountpod/mount_pod.go @@ -26,7 +26,7 @@ import ( "k8s.io/api/core/v1" "k8s.io/kubernetes/pkg/kubelet/config" kubepod "k8s.io/kubernetes/pkg/kubelet/pod" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // Manager is an interface that tracks pods with mount utilities for individual @@ -68,7 +68,7 @@ func NewManager(rootDirectory string, podManager kubepod.Manager) (Manager, erro func (m *basicManager) getVolumePluginRegistrationPath(pluginName string) string { // sanitize plugin name so it does not escape directory - safePluginName := strings.EscapeQualifiedName(pluginName) + ".json" + safePluginName := utilstrings.EscapeQualifiedName(pluginName) + ".json" return path.Join(m.registrationDirectory, safePluginName) } diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index c02c9e0d5f7..8f083a075a7 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -44,7 +44,7 @@ import ( "k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" volumetypes "k8s.io/kubernetes/pkg/volume/util/types" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // Reconciler runs a periodic loop to reconcile the desired state of the world @@ -678,7 +678,7 @@ func getVolumesFromPodDir(podDir string) ([]podVolume, error) { klog.Errorf("Could not read volume plugin directory %q: %v", volumePluginPath, err) continue } - unescapePluginName := utilsstrings.UnescapeQualifiedName(pluginName) + unescapePluginName := utilstrings.UnescapeQualifiedName(pluginName) for _, volumeName := range volumePluginDirs { mountPath := path.Join(volumePluginPath, volumeName) klog.V(5).Infof("podName: %v, mount path from volume plugin directory: %v, ", podName, mountPath) diff --git a/pkg/volume/awsebs/aws_ebs.go b/pkg/volume/awsebs/aws_ebs.go index ab922073a85..8a98699473c 100644 --- a/pkg/volume/awsebs/aws_ebs.go +++ b/pkg/volume/awsebs/aws_ebs.go @@ -37,7 +37,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -60,7 +60,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) } func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/awsebs/aws_ebs_block.go b/pkg/volume/awsebs/aws_ebs_block.go index d23e29756ff..c316ef23f97 100644 --- a/pkg/volume/awsebs/aws_ebs_block.go +++ b/pkg/volume/awsebs/aws_ebs_block.go @@ -22,16 +22,15 @@ import ( "strconv" "strings" - "k8s.io/klog" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/klog" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{} @@ -172,5 +171,5 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er // path: pods/{podUid}/volumeDevices/kubernetes.io~aws func (ebs *awsElasticBlockStore) GetPodDeviceMapPath() (string, string) { name := awsElasticBlockStorePluginName - return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilsstrings.EscapeQualifiedName(name)), ebs.volName + return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilstrings.EscapeQualifiedName(name)), ebs.volName } diff --git a/pkg/volume/azure_dd/azure_common.go b/pkg/volume/azure_dd/azure_common.go index 451b4048cb5..905369d6958 100644 --- a/pkg/volume/azure_dd/azure_common.go +++ b/pkg/volume/azure_dd/azure_common.go @@ -34,7 +34,7 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -66,7 +66,7 @@ var ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(azureDataDiskPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(azureDataDiskPluginName), volName) } // creates a unique path for disks (even if they share the same *.vhd name) diff --git a/pkg/volume/azure_dd/azure_dd_block.go b/pkg/volume/azure_dd/azure_dd_block.go index c5b6adbde9e..310b424b720 100644 --- a/pkg/volume/azure_dd/azure_dd_block.go +++ b/pkg/volume/azure_dd/azure_dd_block.go @@ -28,7 +28,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &azureDataDiskPlugin{} @@ -157,5 +157,5 @@ func (disk *dataDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) { // path: pods/{podUid}/volumeDevices/kubernetes.io~azure func (disk *dataDisk) GetPodDeviceMapPath() (string, string) { name := azureDataDiskPluginName - return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilsstrings.EscapeQualifiedName(name)), disk.volumeName + return disk.plugin.host.GetPodVolumeDeviceDir(disk.podUID, utilstrings.EscapeQualifiedName(name)), disk.volumeName } diff --git a/pkg/volume/azure_file/azure_file.go b/pkg/volume/azure_file/azure_file.go index 07b25e81e60..92984f8f039 100644 --- a/pkg/volume/azure_file/azure_file.go +++ b/pkg/volume/azure_file/azure_file.go @@ -32,7 +32,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary endpoint for volume plugins @@ -53,7 +53,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(azureFilePluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(azureFilePluginName), volName) } func (plugin *azureFilePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/azure_file/azure_provision.go b/pkg/volume/azure_file/azure_provision.go index 06637ee248f..dab5ff341ac 100644 --- a/pkg/volume/azure_file/azure_provision.go +++ b/pkg/volume/azure_file/azure_provision.go @@ -30,7 +30,7 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.DeletableVolumePlugin = &azureFilePlugin{} @@ -116,7 +116,7 @@ var _ volume.Deleter = &azureFileDeleter{} func (f *azureFileDeleter) GetPath() string { name := azureFilePluginName - return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) + return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedName(name), f.volName) } func (f *azureFileDeleter) Delete() error { diff --git a/pkg/volume/cephfs/cephfs.go b/pkg/volume/cephfs/cephfs.go index 0f7e9e6a157..de7a91372e1 100644 --- a/pkg/volume/cephfs/cephfs.go +++ b/pkg/volume/cephfs/cephfs.go @@ -31,7 +31,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -289,13 +289,13 @@ func (cephfsVolume *cephfsUnmounter) TearDownAt(dir string) error { // GetPath creates global mount path func (cephfsVolume *cephfs) GetPath() string { name := cephfsPluginName - return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) + return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedName(name), cephfsVolume.volName) } // GetKeyringPath creates cephfuse keyring path func (cephfsVolume *cephfs) GetKeyringPath() string { name := cephfsPluginName - volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilsstrings.EscapeQualifiedName(name), cephfsVolume.volName) + volumeDir := cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedName(name), cephfsVolume.volName) volumeKeyringDir := volumeDir + "~keyring" return volumeKeyringDir } diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index 81f19349001..60ffee61952 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -35,7 +35,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/keymutex" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -82,7 +82,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(cinderVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(cinderVolumePluginName), volName) } func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/cinder/cinder_block.go b/pkg/volume/cinder/cinder_block.go index 4e355307074..0938c99f7d7 100644 --- a/pkg/volume/cinder/cinder_block.go +++ b/pkg/volume/cinder/cinder_block.go @@ -27,7 +27,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &cinderPlugin{} @@ -163,5 +163,5 @@ func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { // path: pods/{podUid}/volumeDevices/kubernetes.io~cinder func (cd *cinderVolume) GetPodDeviceMapPath() (string, string) { name := cinderVolumePluginName - return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, utilsstrings.EscapeQualifiedName(name)), cd.volName + return cd.plugin.host.GetPodVolumeDeviceDir(cd.podUID, utilstrings.EscapeQualifiedName(name)), cd.volName } diff --git a/pkg/volume/configmap/configmap.go b/pkg/volume/configmap/configmap.go index 610f7870e3d..60196dfee51 100644 --- a/pkg/volume/configmap/configmap.go +++ b/pkg/volume/configmap/configmap.go @@ -27,7 +27,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -48,7 +48,7 @@ type configMapPlugin struct { var _ volume.VolumePlugin = &configMapPlugin{} func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(configMapPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(configMapPluginName), volName) } func (plugin *configMapPlugin) Init(host volume.VolumeHost) error { @@ -142,7 +142,7 @@ type configMapVolume struct { var _ volume.Volume = &configMapVolume{} func (sv *configMapVolume) GetPath() string { - return sv.plugin.host.GetPodVolumeDir(sv.podUID, strings.EscapeQualifiedName(configMapPluginName), sv.volName) + return sv.plugin.host.GetPodVolumeDir(sv.podUID, utilstrings.EscapeQualifiedName(configMapPluginName), sv.volName) } // configMapVolumeMounter handles retrieving secrets from the API server diff --git a/pkg/volume/csi/csi_block.go b/pkg/volume/csi/csi_block.go index 6e5024c9ed7..fa52af425a7 100644 --- a/pkg/volume/csi/csi_block.go +++ b/pkg/volume/csi/csi_block.go @@ -33,7 +33,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/pkg/volume" ioutil "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) type csiBlockMapper struct { @@ -62,21 +62,21 @@ func (m *csiBlockMapper) GetGlobalMapPath(spec *volume.Spec) (string, error) { // getStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume // Example: plugins/kubernetes.io/csi/volumeDevices/staging/{pvname} func (m *csiBlockMapper) getStagingPath() string { - sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) + sanitizedSpecVolID := utilstrings.EscapeQualifiedName(m.specName) return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "staging", sanitizedSpecVolID) } // getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{pvname} func (m *csiBlockMapper) getPublishPath() string { - sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(m.specName) + sanitizedSpecVolID := utilstrings.EscapeQualifiedName(m.specName) return path.Join(m.plugin.host.GetVolumeDevicePluginDir(csiPluginName), "publish", sanitizedSpecVolID) } // GetPodDeviceMapPath returns pod's device file which will be mapped to a volume // returns: pods/{podUid}/volumeDevices/kubernetes.io~csi, {pvname} func (m *csiBlockMapper) GetPodDeviceMapPath() (string, string) { - path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, utilsstrings.EscapeQualifiedName(csiPluginName)) + path := m.plugin.host.GetPodVolumeDeviceDir(m.podUID, utilstrings.EscapeQualifiedName(csiPluginName)) specName := m.specName klog.V(4).Infof(log("blockMapper.GetPodDeviceMapPath [path=%s; name=%s]", path, specName)) return path, specName diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 3f408303079..53fcbadcd69 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -32,7 +32,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) //TODO (vladimirvivien) move this in a central loc later @@ -79,8 +79,8 @@ func (c *csiMountMgr) GetPath() string { } func getTargetPath(uid types.UID, specVolumeID string, host volume.VolumeHost) string { - specVolID := utilsstrings.EscapeQualifiedName(specVolumeID) - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(csiPluginName), specVolID) + specVolID := utilstrings.EscapeQualifiedName(specVolumeID) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(csiPluginName), specVolID) } // volume.Mounter methods diff --git a/pkg/volume/csi/csi_util.go b/pkg/volume/csi/csi_util.go index 85aafeec5b6..b87cfe9cc4b 100644 --- a/pkg/volume/csi/csi_util.go +++ b/pkg/volume/csi/csi_util.go @@ -21,7 +21,6 @@ import ( "fmt" "os" "path" - "time" api "k8s.io/api/core/v1" @@ -29,7 +28,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/klog" "k8s.io/kubernetes/pkg/volume" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -117,7 +116,7 @@ func log(msg string, parts ...interface{}) string { // symlink for a block device associated with a given specVolumeID. // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/dev func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { - sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) + sanitizedSpecVolID := utilstrings.EscapeQualifiedName(specVolID) return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "dev") } @@ -125,7 +124,7 @@ func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string { // volume data for a block device associated with a given specVolumeID. // path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/data func getVolumeDeviceDataDir(specVolID string, host volume.VolumeHost) string { - sanitizedSpecVolID := utilsstrings.EscapeQualifiedName(specVolID) + sanitizedSpecVolID := utilstrings.EscapeQualifiedName(specVolID) return path.Join(host.GetVolumeDevicePluginDir(csiPluginName), sanitizedSpecVolID, "data") } diff --git a/pkg/volume/downwardapi/downwardapi.go b/pkg/volume/downwardapi/downwardapi.go index 49700b7e486..0a888914458 100644 --- a/pkg/volume/downwardapi/downwardapi.go +++ b/pkg/volume/downwardapi/downwardapi.go @@ -28,7 +28,7 @@ import ( "k8s.io/kubernetes/pkg/fieldpath" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -48,7 +48,7 @@ type downwardAPIPlugin struct { var _ volume.VolumePlugin = &downwardAPIPlugin{} func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(downwardAPIPluginName), volName) } func wrappedVolumeSpec() volume.Spec { @@ -288,7 +288,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu } func (d *downwardAPIVolume) GetPath() string { - return d.plugin.host.GetPodVolumeDir(d.podUID, utilsstrings.EscapeQualifiedName(downwardAPIPluginName), d.volName) + return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedName(downwardAPIPluginName), d.volName) } // downwardAPIVolumeCleaner handles cleaning up downwardAPI volumes diff --git a/pkg/volume/emptydir/empty_dir.go b/pkg/volume/emptydir/empty_dir.go index 2fae1a9c787..8c1bdd17851 100644 --- a/pkg/volume/emptydir/empty_dir.go +++ b/pkg/volume/emptydir/empty_dir.go @@ -30,7 +30,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // TODO: in the near future, this will be changed to be more restrictive @@ -59,7 +59,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(emptyDirPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(emptyDirPluginName), volName) } func (plugin *emptyDirPlugin) Init(host volume.VolumeHost) error { @@ -420,7 +420,7 @@ func (ed *emptyDir) teardownTmpfsOrHugetlbfs(dir string) error { } func (ed *emptyDir) getMetaDir() string { - return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, utilsstrings.EscapeQualifiedName(emptyDirPluginName)), ed.volName) + return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, utilstrings.EscapeQualifiedName(emptyDirPluginName)), ed.volName) } func getVolumeSource(spec *volume.Spec) (*v1.EmptyDirVolumeSource, bool) { diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index e78d2c9d6fc..6b2afafc6f4 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -32,7 +32,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -360,7 +360,7 @@ type fcDisk struct { func (fc *fcDisk) GetPath() string { // safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up - return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName), fc.volName) + return fc.plugin.host.GetPodVolumeDir(fc.podUID, utilstrings.EscapeQualifiedName(fcPluginName), fc.volName) } func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { @@ -373,7 +373,7 @@ func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) { } func (fc *fcDisk) fcPodDeviceMapPath() (string, string) { - return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilsstrings.EscapeQualifiedName(fcPluginName)), fc.volName + return fc.plugin.host.GetPodVolumeDeviceDir(fc.podUID, utilstrings.EscapeQualifiedName(fcPluginName)), fc.volName } type fcDiskMounter struct { diff --git a/pkg/volume/flexvolume/plugin.go b/pkg/volume/flexvolume/plugin.go index f0afd834eb3..5527dba8a9a 100644 --- a/pkg/volume/flexvolume/plugin.go +++ b/pkg/volume/flexvolume/plugin.go @@ -30,7 +30,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/exec" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -71,7 +71,7 @@ type pluginFactory struct{} func (pluginFactory) NewFlexVolumePlugin(pluginDir, name string, runner exec.Interface) (volume.VolumePlugin, error) { execPath := path.Join(pluginDir, name) - driverName := utilsstrings.UnescapeQualifiedName(name) + driverName := utilstrings.UnescapeQualifiedName(name) flexPlugin := &flexVolumePlugin{ driverName: driverName, @@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P var metricsProvider volume.MetricsProvider if plugin.capabilities.SupportsMetrics { metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( - pod.UID, utilsstrings.EscapeQualifiedName(sourceDriver), spec.Name())) + pod.UID, utilstrings.EscapeQualifiedName(sourceDriver), spec.Name())) } else { metricsProvider = &volume.MetricsNil{} } @@ -219,7 +219,7 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type var metricsProvider volume.MetricsProvider if plugin.capabilities.SupportsMetrics { metricsProvider = volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir( - podUID, utilsstrings.EscapeQualifiedName(plugin.driverName), volName)) + podUID, utilstrings.EscapeQualifiedName(plugin.driverName), volName)) } else { metricsProvider = &volume.MetricsNil{} } diff --git a/pkg/volume/flexvolume/probe.go b/pkg/volume/flexvolume/probe.go index bc6e3b30cb8..1657741f572 100644 --- a/pkg/volume/flexvolume/probe.go +++ b/pkg/volume/flexvolume/probe.go @@ -29,7 +29,7 @@ import ( utilfs "k8s.io/kubernetes/pkg/util/filesystem" "k8s.io/kubernetes/pkg/volume" "k8s.io/utils/exec" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) type flexVolumeProber struct { @@ -139,7 +139,7 @@ func (prober *flexVolumeProber) newProbeEvent(driverDirName string, op volume.Pr probeEvent.Plugin = plugin probeEvent.PluginName = plugin.GetPluginName() } else if op == volume.ProbeRemove { - driverName := utilsstrings.UnescapeQualifiedName(driverDirName) + driverName := utilstrings.UnescapeQualifiedName(driverDirName) probeEvent.PluginName = flexVolumePluginNamePrefix + driverName } else { diff --git a/pkg/volume/flexvolume/volume.go b/pkg/volume/flexvolume/volume.go index d9922d64409..7e718f072a2 100644 --- a/pkg/volume/flexvolume/volume.go +++ b/pkg/volume/flexvolume/volume.go @@ -20,7 +20,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) type flexVolume struct { @@ -51,5 +51,5 @@ type flexVolume struct { func (f *flexVolume) GetPath() string { name := f.driverName - return f.plugin.host.GetPodVolumeDir(f.podUID, utilsstrings.EscapeQualifiedName(name), f.volName) + return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedName(name), f.volName) } diff --git a/pkg/volume/flocker/flocker.go b/pkg/volume/flocker/flocker.go index 02a81f7f536..f74f0ef0a14 100644 --- a/pkg/volume/flocker/flocker.go +++ b/pkg/volume/flocker/flocker.go @@ -22,15 +22,15 @@ import ( "path" "time" + flockerapi "github.com/clusterhq/flocker-go" + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog" "k8s.io/kubernetes/pkg/util/env" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" - "k8s.io/utils/strings" - - flockerapi "github.com/clusterhq/flocker-go" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -77,7 +77,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(flockerPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(flockerPluginName), volName) } func makeGlobalFlockerPath(datasetUUID string) string { diff --git a/pkg/volume/gcepd/gce_pd.go b/pkg/volume/gcepd/gce_pd.go index 0c2a5cb4c6d..bf1bf9ccb4c 100644 --- a/pkg/volume/gcepd/gce_pd.go +++ b/pkg/volume/gcepd/gce_pd.go @@ -36,7 +36,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -72,7 +72,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(gcePersistentDiskPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(gcePersistentDiskPluginName), volName) } func (plugin *gcePersistentDiskPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/gcepd/gce_pd_block.go b/pkg/volume/gcepd/gce_pd_block.go index d72a41cd549..165d9e65ce1 100644 --- a/pkg/volume/gcepd/gce_pd_block.go +++ b/pkg/volume/gcepd/gce_pd_block.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.VolumePlugin = &gcePersistentDiskPlugin{} @@ -170,5 +170,5 @@ func (pd *gcePersistentDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) // path: pods/{podUid}/volumeDevices/kubernetes.io~aws func (pd *gcePersistentDisk) GetPodDeviceMapPath() (string, string) { name := gcePersistentDiskPluginName - return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, utilsstrings.EscapeQualifiedName(name)), pd.volName + return pd.plugin.host.GetPodVolumeDeviceDir(pd.podUID, utilstrings.EscapeQualifiedName(name)), pd.volName } diff --git a/pkg/volume/git_repo/git_repo.go b/pkg/volume/git_repo/git_repo.go index 24c71bacec5..8e22e030d52 100644 --- a/pkg/volume/git_repo/git_repo.go +++ b/pkg/volume/git_repo/git_repo.go @@ -28,7 +28,7 @@ import ( "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/exec" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -147,7 +147,7 @@ var _ volume.Volume = &gitRepoVolume{} func (gr *gitRepoVolume) GetPath() string { name := gitRepoPluginName - return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilsstrings.EscapeQualifiedName(name), gr.volName) + return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilstrings.EscapeQualifiedName(name), gr.volName) } // gitRepoVolumeMounter builds git repo volumes. @@ -248,7 +248,7 @@ func (b *gitRepoVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { } func (b *gitRepoVolumeMounter) getMetaDir() string { - return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilsstrings.EscapeQualifiedName(gitRepoPluginName)), b.volName) + return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedName(gitRepoPluginName)), b.volName) } func (b *gitRepoVolumeMounter) execCommand(command string, args []string, dir string) ([]byte, error) { diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index b15497602d1..d7bf9242209 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -42,7 +42,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -200,7 +200,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp mounter: mounter, pod: pod, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, strings.EscapeQualifiedName(glusterfsPluginName), spec.Name())), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilstrings.EscapeQualifiedName(glusterfsPluginName), spec.Name())), }, hosts: ep, path: volPath, @@ -219,7 +219,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types mounter: mounter, pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: podUID}}, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, strings.EscapeQualifiedName(glusterfsPluginName), volName)), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(glusterfsPluginName), volName)), }}, nil } @@ -301,7 +301,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error { func (glusterfsVolume *glusterfs) GetPath() string { name := glusterfsPluginName - return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, strings.EscapeQualifiedName(name), glusterfsVolume.volName) + return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, utilstrings.EscapeQualifiedName(name), glusterfsVolume.volName) } type glusterfsUnmounter struct { @@ -542,7 +542,7 @@ type glusterfsVolumeDeleter struct { func (d *glusterfsVolumeDeleter) GetPath() string { name := glusterfsPluginName - return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, strings.EscapeQualifiedName(name), d.glusterfsMounter.glusterfs.volName) + return d.plugin.host.GetPodVolumeDir(d.glusterfsMounter.glusterfs.pod.UID, utilstrings.EscapeQualifiedName(name), d.glusterfsMounter.glusterfs.volName) } // Traverse the PVs, fetching all the GIDs from those diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index 334df9ee573..e5262ea6178 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -32,7 +32,7 @@ import ( ioutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" "k8s.io/utils/keymutex" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -181,7 +181,7 @@ func (plugin *iscsiPlugin) newUnmounterInternal(volName string, podUID types.UID VolName: volName, manager: manager, plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(iscsiPluginName), volName)), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(iscsiPluginName), volName)), }, mounter: mounter, exec: exec, @@ -285,7 +285,7 @@ type iscsiDisk struct { func (iscsi *iscsiDisk) GetPath() string { name := iscsiPluginName // safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up - return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name), iscsi.VolName) + return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilstrings.EscapeQualifiedName(name), iscsi.VolName) } func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { @@ -299,7 +299,7 @@ func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) { func (iscsi *iscsiDisk) iscsiPodDeviceMapPath() (string, string) { name := iscsiPluginName - return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilsstrings.EscapeQualifiedName(name)), iscsi.VolName + return iscsi.plugin.host.GetPodVolumeDeviceDir(iscsi.podUID, utilstrings.EscapeQualifiedName(name)), iscsi.VolName } type iscsiDiskMounter struct { diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index ecad69301b4..d33e78b63ab 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -35,7 +35,7 @@ import ( "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/validation" "k8s.io/utils/keymutex" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -132,7 +132,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo mounter: plugin.host.GetMounter(plugin.GetPluginName()), plugin: plugin, globalPath: globalLocalPath, - MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilsstrings.EscapeQualifiedName(localVolumePluginName), spec.Name())), + MetricsProvider: volume.NewMetricsStatFS(plugin.host.GetPodVolumeDir(pod.UID, utilstrings.EscapeQualifiedName(localVolumePluginName), spec.Name())), }, mountOptions: util.MountOptionFromSpec(spec), readOnly: readOnly, @@ -392,7 +392,7 @@ type localVolume struct { } func (l *localVolume) GetPath() string { - return l.plugin.host.GetPodVolumeDir(l.podUID, utilsstrings.EscapeQualifiedName(localVolumePluginName), l.volName) + return l.plugin.host.GetPodVolumeDir(l.podUID, utilstrings.EscapeQualifiedName(localVolumePluginName), l.volName) } type localVolumeMounter struct { @@ -584,7 +584,7 @@ func (u *localVolumeUnmapper) TearDownDevice(mapPath, _ string) error { // GetGlobalMapPath returns global map path and error. // path: plugins/kubernetes.io/kubernetes.io/local-volume/volumeDevices/{volumeName} func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { - return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(localVolumePluginName)), + return filepath.Join(lv.plugin.host.GetVolumeDevicePluginDir(utilstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName), nil } @@ -593,5 +593,5 @@ func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { // volName: local-pv-ff0d6d4 func (lv *localVolume) GetPodDeviceMapPath() (string, string) { return lv.plugin.host.GetPodVolumeDeviceDir(lv.podUID, - utilsstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName + utilstrings.EscapeQualifiedName(localVolumePluginName)), lv.volName } diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index e55446d3a45..5a7eeed98da 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/recyclerclient" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -189,7 +189,7 @@ type nfs struct { func (nfsVolume *nfs) GetPath() string { name := nfsPluginName - return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, strings.EscapeQualifiedName(name), nfsVolume.volName) + return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, utilstrings.EscapeQualifiedName(name), nfsVolume.volName) } // Checks prior to mount operations to verify that the required components (binaries, etc.) diff --git a/pkg/volume/photon_pd/photon_pd.go b/pkg/volume/photon_pd/photon_pd.go index c482782a6ed..9dfa7dab3d7 100644 --- a/pkg/volume/photon_pd/photon_pd.go +++ b/pkg/volume/photon_pd/photon_pd.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -290,7 +290,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { func (ppd *photonPersistentDisk) GetPath() string { name := photonPersistentDiskPluginName - return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilsstrings.EscapeQualifiedName(name), ppd.volName) + return ppd.plugin.host.GetPodVolumeDir(ppd.podUID, utilstrings.EscapeQualifiedName(name), ppd.volName) } // TODO: supporting more access mode for PhotonController persistent disk diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index 76de9e6479e..611447f7ae7 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -58,7 +58,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(portworxVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(portworxVolumePluginName), volName) } func (plugin *portworxVolumePlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/projected/projected.go b/pkg/volume/projected/projected.go index c8d51bb2507..e2da1bec276 100644 --- a/pkg/volume/projected/projected.go +++ b/pkg/volume/projected/projected.go @@ -33,7 +33,7 @@ import ( "k8s.io/kubernetes/pkg/volume/downwardapi" "k8s.io/kubernetes/pkg/volume/secret" volumeutil "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -66,7 +66,7 @@ func wrappedVolumeSpec() volume.Spec { } func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(projectedPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(projectedPluginName), volName) } func (plugin *projectedPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/quobyte/quobyte.go b/pkg/volume/quobyte/quobyte.go index 136e72e392e..0250e947d39 100644 --- a/pkg/volume/quobyte/quobyte.go +++ b/pkg/volume/quobyte/quobyte.go @@ -31,7 +31,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool { // If Quobyte is already mounted we don't need to check if the binary is installed if mounter, err := plugin.newMounterInternal(spec, nil, plugin.host.GetMounter(plugin.GetPluginName())); err == nil { qm, _ := mounter.(*quobyteMounter) - pluginDir := plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) + pluginDir := plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) if mounted, err := qm.pluginDirIsMounted(pluginDir); mounted && err == nil { klog.V(4).Infof("quobyte: can support") return true @@ -238,7 +238,7 @@ func (mounter *quobyteMounter) CanMount() error { // SetUp attaches the disk and bind mounts to the volume path. func (mounter *quobyteMounter) SetUp(fsGroup *int64) error { - pluginDir := mounter.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) + pluginDir := mounter.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) return mounter.SetUpAt(pluginDir, fsGroup) } @@ -284,7 +284,7 @@ func (quobyteVolume *quobyte) GetPath() string { // Quobyte has only one mount in the PluginDir where all Volumes are mounted // The Quobyte client does a fixed-user mapping - pluginDir := quobyteVolume.plugin.host.GetPluginDir(strings.EscapeQualifiedName(quobytePluginName)) + pluginDir := quobyteVolume.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName)) return path.Join(pluginDir, fmt.Sprintf("%s#%s@%s", user, group, quobyteVolume.volume)) } diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 0945baa1458..3678ebd9c11 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -37,7 +37,7 @@ import ( "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var ( @@ -75,7 +75,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(rbdPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(rbdPluginName), volName) } func (plugin *rbdPlugin) Init(host volume.VolumeHost) error { @@ -930,7 +930,7 @@ func (rbd *rbd) rbdGlobalMapPath(spec *volume.Spec) (string, error) { func (rbd *rbd) rbdPodDeviceMapPath() (string, string) { name := rbdPluginName - return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, strings.EscapeQualifiedName(name)), rbd.volName + return rbd.plugin.host.GetPodVolumeDeviceDir(rbd.podUID, utilstrings.EscapeQualifiedName(name)), rbd.volName } type rbdDiskUnmapper struct { diff --git a/pkg/volume/scaleio/sio_volume.go b/pkg/volume/scaleio/sio_volume.go index 7d07b4a9640..926005cbd77 100644 --- a/pkg/volume/scaleio/sio_volume.go +++ b/pkg/volume/scaleio/sio_volume.go @@ -32,7 +32,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) type sioVolume struct { @@ -61,7 +61,7 @@ var _ volume.Volume = &sioVolume{} func (v *sioVolume) GetPath() string { return v.plugin.host.GetPodVolumeDir( v.podUID, - utilsstrings.EscapeQualifiedName(sioPluginName), + utilstrings.EscapeQualifiedName(sioPluginName), v.volSpecName) } diff --git a/pkg/volume/secret/secret.go b/pkg/volume/secret/secret.go index 0536dfc23ad..b548acfb3c0 100644 --- a/pkg/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -27,7 +27,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the entry point for plugin detection in a package. @@ -54,7 +54,7 @@ func wrappedVolumeSpec() volume.Spec { } func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, strings.EscapeQualifiedName(secretPluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(secretPluginName), volName) } func (plugin *secretPlugin) Init(host volume.VolumeHost) error { diff --git a/pkg/volume/storageos/storageos.go b/pkg/volume/storageos/storageos.go index 9c3b0f80de3..b2619b07b07 100644 --- a/pkg/volume/storageos/storageos.go +++ b/pkg/volume/storageos/storageos.go @@ -33,7 +33,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. @@ -63,9 +63,9 @@ const ( func getPath(uid types.UID, volNamespace string, volName string, pvName string, host volume.VolumeHost) string { if len(volNamespace) != 0 && len(volName) != 0 && strings.Count(volName, ".") == 0 { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName+"."+volNamespace+"."+volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(storageosPluginName), pvName+"."+volNamespace+"."+volName) } - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(storageosPluginName), pvName) } func (plugin *storageosPlugin) Init(host volume.VolumeHost) error { @@ -431,7 +431,7 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error { } func makeGlobalPDName(host volume.VolumeHost, pvName, volNamespace, volName string) string { - return path.Join(host.GetPluginDir(utilsstrings.EscapeQualifiedName(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) + return path.Join(host.GetPluginDir(utilstrings.EscapeQualifiedName(storageosPluginName)), mount.MountsInGlobalPDPath, pvName+"."+volNamespace+"."+volName) } // Given the pod id and PV name, finds the volume's namespace and name from the @@ -443,7 +443,7 @@ func getVolumeInfo(pvName string, podUID types.UID, host volume.VolumeHost) (str return volNamespace, volName, nil } - volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, utilsstrings.EscapeQualifiedName(storageosPluginName), pvName)) + volumeDir := filepath.Dir(host.GetPodVolumeDir(podUID, utilstrings.EscapeQualifiedName(storageosPluginName), pvName)) files, err := ioutil.ReadDir(volumeDir) if err != nil { return "", "", fmt.Errorf("Could not read mounts from pod volume dir: %s", err) diff --git a/pkg/volume/testing/testing.go b/pkg/volume/testing/testing.go index 07c19b62154..1628585cd34 100644 --- a/pkg/volume/testing/testing.go +++ b/pkg/volume/testing/testing.go @@ -43,7 +43,7 @@ import ( "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/recyclerclient" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -765,7 +765,7 @@ func (fv *FakeVolume) GetPath() string { } func (fv *FakeVolume) getPath() string { - return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName), fv.VolName)) + return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilstrings.EscapeQualifiedName(fv.Plugin.PluginName), fv.VolName)) } func (fv *FakeVolume) TearDown() error { @@ -810,7 +810,7 @@ func (fv *FakeVolume) GetGlobalMapPath(spec *Spec) (string, error) { // Block volume support func (fv *FakeVolume) getGlobalMapPath() (string, error) { - return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName)), "pluginDependentPath"), nil + return path.Join(fv.Plugin.Host.GetVolumeDevicePluginDir(utilstrings.EscapeQualifiedName(fv.Plugin.PluginName)), "pluginDependentPath"), nil } // Block volume support @@ -830,7 +830,7 @@ func (fv *FakeVolume) GetPodDeviceMapPath() (string, string) { // Block volume support func (fv *FakeVolume) getPodDeviceMapPath() (string, string) { - return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilsstrings.EscapeQualifiedName(fv.Plugin.PluginName))), fv.VolName + return path.Join(fv.Plugin.Host.GetPodVolumeDeviceDir(fv.PodUID, utilstrings.EscapeQualifiedName(fv.Plugin.PluginName))), fv.VolName } // Block volume support diff --git a/pkg/volume/util/util.go b/pkg/volume/util/util.go index f2de07e2b52..34018f8f0ee 100644 --- a/pkg/volume/util/util.go +++ b/pkg/volume/util/util.go @@ -47,7 +47,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util/types" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) const ( @@ -820,7 +820,7 @@ func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.Per // GetPersistentVolumeClaimQualifiedName returns a qualified name for pvc. func GetPersistentVolumeClaimQualifiedName(claim *v1.PersistentVolumeClaim) string { - return utilsstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) + return utilstrings.JoinQualifiedName(claim.GetNamespace(), claim.GetName()) } // CheckVolumeModeFilesystem checks VolumeMode. diff --git a/pkg/volume/vsphere_volume/vsphere_volume.go b/pkg/volume/vsphere_volume/vsphere_volume.go index eca25233143..c9a96ae90f4 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume.go +++ b/pkg/volume/vsphere_volume/vsphere_volume.go @@ -32,7 +32,7 @@ import ( "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) // This is the primary entrypoint for volume plugins. @@ -54,7 +54,7 @@ const ( ) func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName), volName) + return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(vsphereVolumePluginName), volName) } // vSphere Volume Plugin @@ -298,7 +298,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string { func (vv *vsphereVolume) GetPath() string { name := vsphereVolumePluginName - return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilsstrings.EscapeQualifiedName(name), vv.volName) + return vv.plugin.host.GetPodVolumeDir(vv.podUID, utilstrings.EscapeQualifiedName(name), vv.volName) } // vSphere Persistent Volume Plugin diff --git a/pkg/volume/vsphere_volume/vsphere_volume_block.go b/pkg/volume/vsphere_volume/vsphere_volume_block.go index 806002b6f0b..71600bfbced 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume_block.go +++ b/pkg/volume/vsphere_volume/vsphere_volume_block.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - utilsstrings "k8s.io/utils/strings" + utilstrings "k8s.io/utils/strings" ) var _ volume.BlockVolumePlugin = &vsphereVolumePlugin{} @@ -157,5 +157,5 @@ func (v *vsphereVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) { } func (v *vsphereVolume) GetPodDeviceMapPath() (string, string) { - return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, utilsstrings.EscapeQualifiedName(vsphereVolumePluginName)), v.volName + return v.plugin.host.GetPodVolumeDeviceDir(v.podUID, utilstrings.EscapeQualifiedName(vsphereVolumePluginName)), v.volName } From cf1fb8a1cd1e908b29fbcc37d32375d820a6537b Mon Sep 17 00:00:00 2001 From: danielqsj Date: Thu, 31 Jan 2019 22:01:13 +0800 Subject: [PATCH 8/8] fix format issue --- pkg/kubelet/volumemanager/reconciler/BUILD | 2 +- pkg/kubelet/volumemanager/reconciler/reconciler.go | 2 +- pkg/volume/gcepd/BUILD | 2 +- pkg/volume/rbd/BUILD | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/kubelet/volumemanager/reconciler/BUILD b/pkg/kubelet/volumemanager/reconciler/BUILD index 38c35e589ba..4d2a960c7b5 100644 --- a/pkg/kubelet/volumemanager/reconciler/BUILD +++ b/pkg/kubelet/volumemanager/reconciler/BUILD @@ -28,8 +28,8 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/klog:go_default_library", - "//vendor/k8s.io/utils/strings:go_default_library", "//vendor/k8s.io/utils/path:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index bc13ac8bf59..0de32ca6812 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -43,8 +43,8 @@ import ( "k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" volumetypes "k8s.io/kubernetes/pkg/volume/util/types" - utilstrings "k8s.io/utils/strings" utilpath "k8s.io/utils/path" + utilstrings "k8s.io/utils/strings" ) // Reconciler runs a periodic loop to reconcile the desired state of the world diff --git a/pkg/volume/gcepd/BUILD b/pkg/volume/gcepd/BUILD index 630bad76e7c..955fe5300dd 100644 --- a/pkg/volume/gcepd/BUILD +++ b/pkg/volume/gcepd/BUILD @@ -33,8 +33,8 @@ go_library( "//staging/src/k8s.io/cloud-provider:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", - "//vendor/k8s.io/utils/strings:go_default_library", "//vendor/k8s.io/utils/path:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], ) diff --git a/pkg/volume/rbd/BUILD b/pkg/volume/rbd/BUILD index 11232c8df7a..d50005da483 100644 --- a/pkg/volume/rbd/BUILD +++ b/pkg/volume/rbd/BUILD @@ -34,8 +34,8 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/klog:go_default_library", - "//vendor/k8s.io/utils/strings:go_default_library", "//vendor/k8s.io/utils/path:go_default_library", + "//vendor/k8s.io/utils/strings:go_default_library", ], )