mirror of https://github.com/k3s-io/k3s
Merge pull request #19528 from resouer/strings-util
Create strings pkg to fix util issuepull/6/head
commit
33c72db59c
|
@ -54,6 +54,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/util/oom"
|
"k8s.io/kubernetes/pkg/util/oom"
|
||||||
"k8s.io/kubernetes/pkg/util/procfs"
|
"k8s.io/kubernetes/pkg/util/procfs"
|
||||||
"k8s.io/kubernetes/pkg/util/sets"
|
"k8s.io/kubernetes/pkg/util/sets"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -709,7 +710,7 @@ func (dm *DockerManager) runContainer(
|
||||||
return kubecontainer.ContainerID{}, err
|
return kubecontainer.ContainerID{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
dm.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.CreatedContainer, "Created container with docker id %v", util.ShortenString(dockerContainer.ID, 12))
|
dm.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.CreatedContainer, "Created container with docker id %v", utilstrings.ShortenString(dockerContainer.ID, 12))
|
||||||
|
|
||||||
podHasSELinuxLabel := pod.Spec.SecurityContext != nil && pod.Spec.SecurityContext.SELinuxOptions != nil
|
podHasSELinuxLabel := pod.Spec.SecurityContext != nil && pod.Spec.SecurityContext.SELinuxOptions != nil
|
||||||
binds := makeMountBindings(opts.Mounts, podHasSELinuxLabel)
|
binds := makeMountBindings(opts.Mounts, podHasSELinuxLabel)
|
||||||
|
@ -766,10 +767,10 @@ func (dm *DockerManager) runContainer(
|
||||||
|
|
||||||
if err = dm.client.StartContainer(dockerContainer.ID, hc); err != nil {
|
if err = dm.client.StartContainer(dockerContainer.ID, hc); err != nil {
|
||||||
dm.recorder.Eventf(ref, api.EventTypeWarning, kubecontainer.FailedToStartContainer,
|
dm.recorder.Eventf(ref, api.EventTypeWarning, kubecontainer.FailedToStartContainer,
|
||||||
"Failed to start container with docker id %v with error: %v", util.ShortenString(dockerContainer.ID, 12), err)
|
"Failed to start container with docker id %v with error: %v", utilstrings.ShortenString(dockerContainer.ID, 12), err)
|
||||||
return kubecontainer.ContainerID{}, err
|
return kubecontainer.ContainerID{}, err
|
||||||
}
|
}
|
||||||
dm.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.StartedContainer, "Started container with docker id %v", util.ShortenString(dockerContainer.ID, 12))
|
dm.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.StartedContainer, "Started container with docker id %v", utilstrings.ShortenString(dockerContainer.ID, 12))
|
||||||
|
|
||||||
return kubecontainer.DockerID(dockerContainer.ID).ContainerID(), nil
|
return kubecontainer.DockerID(dockerContainer.ID).ContainerID(), nil
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1385,7 @@ func (dm *DockerManager) killContainer(containerID kubecontainer.ContainerID, co
|
||||||
if !ok {
|
if !ok {
|
||||||
glog.Warningf("No ref for pod '%q'", name)
|
glog.Warningf("No ref for pod '%q'", name)
|
||||||
} else {
|
} else {
|
||||||
message := fmt.Sprintf("Killing container with docker id %v", util.ShortenString(ID, 12))
|
message := fmt.Sprintf("Killing container with docker id %v", utilstrings.ShortenString(ID, 12))
|
||||||
if reason != "" {
|
if reason != "" {
|
||||||
message = fmt.Sprint(message, ": ", reason)
|
message = fmt.Sprint(message, ": ", reason)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
utilexec "k8s.io/kubernetes/pkg/util/exec"
|
utilexec "k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/sets"
|
"k8s.io/kubernetes/pkg/util/sets"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -723,7 +724,7 @@ func (r *Runtime) generateEvents(runtimePod *kubecontainer.Pod, reason string, f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that 'rkt id' is the pod id.
|
// Note that 'rkt id' is the pod id.
|
||||||
uuid := util.ShortenString(id.uuid, 8)
|
uuid := utilstrings.ShortenString(id.uuid, 8)
|
||||||
switch reason {
|
switch reason {
|
||||||
case "Created":
|
case "Created":
|
||||||
r.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.CreatedContainer, "Created with rkt id %v", uuid)
|
r.recorder.Eventf(ref, api.EventTypeNormal, kubecontainer.CreatedContainer, "Created with rkt id %v", uuid)
|
||||||
|
|
|
@ -30,6 +30,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"k8s.io/kubernetes/pkg/util/io"
|
"k8s.io/kubernetes/pkg/util/io"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ func (kl *Kubelet) getPodVolumesFromDisk() map[string]volume.Cleaner {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kl *Kubelet) newVolumeCleanerFromPlugins(kind string, name string, podUID types.UID) (volume.Cleaner, error) {
|
func (kl *Kubelet) newVolumeCleanerFromPlugins(kind string, name string, podUID types.UID) (volume.Cleaner, error) {
|
||||||
plugName := util.UnescapeQualifiedNameForDisk(kind)
|
plugName := strings.UnescapeQualifiedNameForDisk(kind)
|
||||||
plugin, err := kl.volumePluginMgr.FindPluginByName(plugName)
|
plugin, err := kl.volumePluginMgr.FindPluginByName(plugName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: Maybe we should launch a cleanup of this dir?
|
// TODO: Maybe we should launch a cleanup of this dir?
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package util
|
package strings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
Copyright 2014 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the first N slice of a string.
|
||||||
|
func ShortenString(str string, n int) string {
|
||||||
|
if len(str) <= n {
|
||||||
|
return str
|
||||||
|
} else {
|
||||||
|
return str[:n]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
Copyright 2014 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -204,23 +203,6 @@ func AllPtrFieldsNil(obj interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Route struct {
|
type Route struct {
|
||||||
Interface string
|
Interface string
|
||||||
Destination net.IP
|
Destination net.IP
|
||||||
|
@ -464,14 +446,6 @@ func GetClient(req *http.Request) string {
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShortenString(str string, n int) string {
|
|
||||||
if len(str) <= n {
|
|
||||||
return str
|
|
||||||
} else {
|
|
||||||
return str[:n]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func FileExists(filename string) (bool, error) {
|
func FileExists(filename string) (bool, error) {
|
||||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
|
@ -183,40 +183,6 @@ func TestAllPtrFieldsNil(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const gatewayfirst = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
|
const gatewayfirst = `Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
|
||||||
eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
|
eth3 00000000 0100FE0A 0003 0 0 1024 00000000 0 0 0
|
||||||
eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
|
eth3 0000FE0A 00000000 0001 0 0 0 0080FFFF 0 0 0
|
||||||
|
|
|
@ -29,9 +29,9 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
awscloud "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
|
awscloud "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ func getVolumeIDFromGlobalMount(host volume.VolumeHost, globalPath string) (stri
|
||||||
|
|
||||||
func (ebs *awsElasticBlockStore) GetPath() string {
|
func (ebs *awsElasticBlockStore) GetPath() string {
|
||||||
name := awsElasticBlockStorePluginName
|
name := awsElasticBlockStorePluginName
|
||||||
return ebs.plugin.host.GetPodVolumeDir(ebs.podUID, util.EscapeQualifiedNameForDisk(name), ebs.volName)
|
return ebs.plugin.host.GetPodVolumeDir(ebs.podUID, utilstrings.EscapeQualifiedNameForDisk(name), ebs.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type awsElasticBlockStoreCleaner struct {
|
type awsElasticBlockStoreCleaner struct {
|
||||||
|
@ -400,7 +400,7 @@ var _ volume.Deleter = &awsElasticBlockStoreDeleter{}
|
||||||
|
|
||||||
func (d *awsElasticBlockStoreDeleter) GetPath() string {
|
func (d *awsElasticBlockStoreDeleter) GetPath() string {
|
||||||
name := awsElasticBlockStorePluginName
|
name := awsElasticBlockStorePluginName
|
||||||
return d.plugin.host.GetPodVolumeDir(d.podUID, util.EscapeQualifiedNameForDisk(name), d.volName)
|
return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedNameForDisk(name), d.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *awsElasticBlockStoreDeleter) Delete() error {
|
func (d *awsElasticBlockStoreDeleter) Delete() error {
|
||||||
|
|
|
@ -23,8 +23,8 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ func (cephfsVolume *cephfsCleaner) TearDownAt(dir string) error {
|
||||||
// GatePath creates global mount path
|
// GatePath creates global mount path
|
||||||
func (cephfsVolume *cephfs) GetPath() string {
|
func (cephfsVolume *cephfs) GetPath() string {
|
||||||
name := cephfsPluginName
|
name := cephfsPluginName
|
||||||
return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, util.EscapeQualifiedNameForDisk(name), cephfsVolume.volName)
|
return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, strings.EscapeQualifiedNameForDisk(name), cephfsVolume.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cephfsVolume *cephfs) cleanup(dir string) error {
|
func (cephfsVolume *cephfs) cleanup(dir string) error {
|
||||||
|
|
|
@ -27,9 +27,9 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ func makeGlobalPDName(host volume.VolumeHost, devName string) string {
|
||||||
|
|
||||||
func (cd *cinderVolume) GetPath() string {
|
func (cd *cinderVolume) GetPath() string {
|
||||||
name := cinderVolumePluginName
|
name := cinderVolumePluginName
|
||||||
return cd.plugin.host.GetPodVolumeDir(cd.podUID, util.EscapeQualifiedNameForDisk(name), cd.volName)
|
return cd.plugin.host.GetPodVolumeDir(cd.podUID, strings.EscapeQualifiedNameForDisk(name), cd.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type cinderVolumeCleaner struct {
|
type cinderVolumeCleaner struct {
|
||||||
|
@ -354,7 +354,7 @@ var _ volume.Deleter = &cinderVolumeDeleter{}
|
||||||
|
|
||||||
func (r *cinderVolumeDeleter) GetPath() string {
|
func (r *cinderVolumeDeleter) GetPath() string {
|
||||||
name := cinderVolumePluginName
|
name := cinderVolumePluginName
|
||||||
return r.plugin.host.GetPodVolumeDir(r.podUID, util.EscapeQualifiedNameForDisk(name), r.volName)
|
return r.plugin.host.GetPodVolumeDir(r.podUID, strings.EscapeQualifiedNameForDisk(name), r.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *cinderVolumeDeleter) Delete() error {
|
func (r *cinderVolumeDeleter) Delete() error {
|
||||||
|
|
|
@ -28,8 +28,8 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/fieldpath"
|
"k8s.io/kubernetes/pkg/fieldpath"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
utilerrors "k8s.io/kubernetes/pkg/util/errors"
|
utilerrors "k8s.io/kubernetes/pkg/util/errors"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
@ -345,7 +345,7 @@ func sortLines(values string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *downwardAPIVolume) GetPath() string {
|
func (d *downwardAPIVolume) GetPath() string {
|
||||||
return d.plugin.host.GetPodVolumeDir(d.podUID, util.EscapeQualifiedNameForDisk(downwardAPIPluginName), d.volName)
|
return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName), d.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// downwardAPIVolumeCleander handles cleaning up downwardAPI volumes
|
// downwardAPIVolumeCleander handles cleaning up downwardAPI volumes
|
||||||
|
@ -372,5 +372,5 @@ func (c *downwardAPIVolumeCleaner) TearDownAt(dir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *downwardAPIVolumeBuilder) getMetaDir() string {
|
func (b *downwardAPIVolumeBuilder) getMetaDir() string {
|
||||||
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, util.EscapeQualifiedNameForDisk(downwardAPIPluginName)), b.volName)
|
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName)), b.volName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
@ -275,7 +275,7 @@ func (ed *emptyDir) GetPath() string {
|
||||||
|
|
||||||
func GetPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
func GetPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
||||||
name := emptyDirPluginName
|
name := emptyDirPluginName
|
||||||
return host.GetPodVolumeDir(uid, util.EscapeQualifiedNameForDisk(name), volName)
|
return host.GetPodVolumeDir(uid, strings.EscapeQualifiedNameForDisk(name), volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TearDown simply discards everything in the directory.
|
// TearDown simply discards everything in the directory.
|
||||||
|
@ -324,5 +324,5 @@ func (ed *emptyDir) teardownTmpfs(dir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ed *emptyDir) getMetaDir() string {
|
func (ed *emptyDir) getMetaDir() string {
|
||||||
return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, util.EscapeQualifiedNameForDisk(emptyDirPluginName)), ed.volName)
|
return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, strings.EscapeQualifiedNameForDisk(emptyDirPluginName)), ed.volName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ type fcDisk struct {
|
||||||
func (fc *fcDisk) GetPath() string {
|
func (fc *fcDisk) GetPath() string {
|
||||||
name := fcPluginName
|
name := fcPluginName
|
||||||
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
||||||
return fc.plugin.host.GetPodVolumeDir(fc.podUID, util.EscapeQualifiedNameForDisk(name), fc.volName)
|
return fc.plugin.host.GetPodVolumeDir(fc.podUID, strings.EscapeQualifiedNameForDisk(name), fc.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type fcDiskBuilder struct {
|
type fcDiskBuilder struct {
|
||||||
|
|
|
@ -26,9 +26,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ func ProbeVolumePlugins(pluginDir string) []volume.VolumePlugin {
|
||||||
// then, executable will be pluginDir/dirname/cifs
|
// then, executable will be pluginDir/dirname/cifs
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
execPath := path.Join(pluginDir, f.Name())
|
execPath := path.Join(pluginDir, f.Name())
|
||||||
plugins = append(plugins, &flexVolumePlugin{driverName: util.UnescapePluginName(f.Name()), execPath: execPath})
|
plugins = append(plugins, &flexVolumePlugin{driverName: utilstrings.UnescapePluginName(f.Name()), execPath: execPath})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return plugins
|
return plugins
|
||||||
|
@ -326,7 +326,7 @@ func (f *flexVolumeBuilder) IsReadOnly() bool {
|
||||||
// GetPathFromPlugin gets the actual volume mount directory based on plugin.
|
// GetPathFromPlugin gets the actual volume mount directory based on plugin.
|
||||||
func (f *flexVolumeDisk) GetPath() string {
|
func (f *flexVolumeDisk) GetPath() string {
|
||||||
name := f.driverName
|
name := f.driverName
|
||||||
return f.plugin.host.GetPodVolumeDir(f.podUID, util.EscapeQualifiedNameForDisk(name), f.volName)
|
return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedNameForDisk(name), f.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TearDown simply deletes everything in the directory.
|
// TearDown simply deletes everything in the directory.
|
||||||
|
|
|
@ -25,9 +25,9 @@ import (
|
||||||
flockerclient "github.com/ClusterHQ/flocker-go"
|
flockerclient "github.com/ClusterHQ/flocker-go"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
@ -151,7 +151,7 @@ func (b flockerBuilder) newFlockerClient() (*flockerclient.Client, error) {
|
||||||
func (b *flockerBuilder) getMetaDir() string {
|
func (b *flockerBuilder) getMetaDir() string {
|
||||||
return path.Join(
|
return path.Join(
|
||||||
b.plugin.host.GetPodPluginDir(
|
b.plugin.host.GetPodPluginDir(
|
||||||
b.flocker.pod.UID, util.EscapeQualifiedNameForDisk(flockerPluginName),
|
b.flocker.pod.UID, strings.EscapeQualifiedNameForDisk(flockerPluginName),
|
||||||
),
|
),
|
||||||
b.datasetName,
|
b.datasetName,
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,9 +26,9 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ func makeGlobalPDName(host volume.VolumeHost, devName string) string {
|
||||||
|
|
||||||
func (pd *gcePersistentDisk) GetPath() string {
|
func (pd *gcePersistentDisk) GetPath() string {
|
||||||
name := gcePersistentDiskPluginName
|
name := gcePersistentDiskPluginName
|
||||||
return pd.plugin.host.GetPodVolumeDir(pd.podUID, util.EscapeQualifiedNameForDisk(name), pd.volName)
|
return pd.plugin.host.GetPodVolumeDir(pd.podUID, strings.EscapeQualifiedNameForDisk(name), pd.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type gcePersistentDiskCleaner struct {
|
type gcePersistentDiskCleaner struct {
|
||||||
|
@ -353,7 +353,7 @@ var _ volume.Deleter = &gcePersistentDiskDeleter{}
|
||||||
|
|
||||||
func (d *gcePersistentDiskDeleter) GetPath() string {
|
func (d *gcePersistentDiskDeleter) GetPath() string {
|
||||||
name := gcePersistentDiskPluginName
|
name := gcePersistentDiskPluginName
|
||||||
return d.plugin.host.GetPodVolumeDir(d.podUID, util.EscapeQualifiedNameForDisk(name), d.volName)
|
return d.plugin.host.GetPodVolumeDir(d.podUID, strings.EscapeQualifiedNameForDisk(name), d.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *gcePersistentDiskDeleter) Delete() error {
|
func (d *gcePersistentDiskDeleter) Delete() error {
|
||||||
|
|
|
@ -24,8 +24,8 @@ import (
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
@ -97,7 +97,7 @@ var _ volume.Volume = &gitRepoVolume{}
|
||||||
|
|
||||||
func (gr *gitRepoVolume) GetPath() string {
|
func (gr *gitRepoVolume) GetPath() string {
|
||||||
name := gitRepoPluginName
|
name := gitRepoPluginName
|
||||||
return gr.plugin.host.GetPodVolumeDir(gr.podUID, util.EscapeQualifiedNameForDisk(name), gr.volName)
|
return gr.plugin.host.GetPodVolumeDir(gr.podUID, utilstrings.EscapeQualifiedNameForDisk(name), gr.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// gitRepoVolumeBuilder builds git repo volumes.
|
// gitRepoVolumeBuilder builds git repo volumes.
|
||||||
|
@ -195,7 +195,7 @@ func (b *gitRepoVolumeBuilder) SetUpAt(dir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *gitRepoVolumeBuilder) getMetaDir() string {
|
func (b *gitRepoVolumeBuilder) getMetaDir() string {
|
||||||
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, util.EscapeQualifiedNameForDisk(gitRepoPluginName)), b.volName)
|
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedNameForDisk(gitRepoPluginName)), b.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *gitRepoVolumeBuilder) execCommand(command string, args []string, dir string) ([]byte, error) {
|
func (b *gitRepoVolumeBuilder) execCommand(command string, args []string, dir string) ([]byte, error) {
|
||||||
|
|
|
@ -24,9 +24,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ func (b *glusterfsBuilder) SetUpAt(dir string) error {
|
||||||
|
|
||||||
func (glusterfsVolume *glusterfs) GetPath() string {
|
func (glusterfsVolume *glusterfs) GetPath() string {
|
||||||
name := glusterfsPluginName
|
name := glusterfsPluginName
|
||||||
return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, util.EscapeQualifiedNameForDisk(name), glusterfsVolume.volName)
|
return glusterfsVolume.plugin.host.GetPodVolumeDir(glusterfsVolume.pod.UID, strings.EscapeQualifiedNameForDisk(name), glusterfsVolume.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type glusterfsCleaner struct {
|
type glusterfsCleaner struct {
|
||||||
|
|
|
@ -23,9 +23,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ type iscsiDisk struct {
|
||||||
func (iscsi *iscsiDisk) GetPath() string {
|
func (iscsi *iscsiDisk) GetPath() string {
|
||||||
name := iscsiPluginName
|
name := iscsiPluginName
|
||||||
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
||||||
return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, util.EscapeQualifiedNameForDisk(name), iscsi.volName)
|
return iscsi.plugin.host.GetPodVolumeDir(iscsi.podUID, utilstrings.EscapeQualifiedNameForDisk(name), iscsi.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type iscsiDiskBuilder struct {
|
type iscsiDiskBuilder struct {
|
||||||
|
|
|
@ -22,8 +22,8 @@ import (
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
@ -137,7 +137,7 @@ type nfs struct {
|
||||||
|
|
||||||
func (nfsVolume *nfs) GetPath() string {
|
func (nfsVolume *nfs) GetPath() string {
|
||||||
name := nfsPluginName
|
name := nfsPluginName
|
||||||
return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, util.EscapeQualifiedNameForDisk(name), nfsVolume.volName)
|
return nfsVolume.plugin.host.GetPodVolumeDir(nfsVolume.pod.UID, strings.EscapeQualifiedNameForDisk(name), nfsVolume.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type nfsBuilder struct {
|
type nfsBuilder struct {
|
||||||
|
@ -210,7 +210,7 @@ func (b *nfsBuilder) SetUpAt(dir string) error {
|
||||||
//
|
//
|
||||||
//func (c *nfsCleaner) GetPath() string {
|
//func (c *nfsCleaner) GetPath() string {
|
||||||
// name := nfsPluginName
|
// name := nfsPluginName
|
||||||
// return c.plugin.host.GetPodVolumeDir(c.pod.UID, util.EscapeQualifiedNameForDisk(name), c.volName)
|
// return c.plugin.host.GetPodVolumeDir(c.pod.UID, strings.EscapeQualifiedNameForDisk(name), c.volName)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var _ volume.Cleaner = &nfsCleaner{}
|
var _ volume.Cleaner = &nfsCleaner{}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
|
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
"k8s.io/kubernetes/pkg/volume/gce_pd"
|
"k8s.io/kubernetes/pkg/volume/gce_pd"
|
||||||
"k8s.io/kubernetes/pkg/volume/host_path"
|
"k8s.io/kubernetes/pkg/volume/host_path"
|
||||||
|
@ -105,7 +105,7 @@ func TestNewBuilder(t *testing.T) {
|
||||||
},
|
},
|
||||||
plugin: gce_pd.ProbeVolumePlugins()[0],
|
plugin: gce_pd.ProbeVolumePlugins()[0],
|
||||||
testFunc: func(builder volume.Builder, plugin volume.VolumePlugin) error {
|
testFunc: func(builder volume.Builder, plugin volume.VolumePlugin) error {
|
||||||
if !strings.Contains(builder.GetPath(), util.EscapeQualifiedNameForDisk(plugin.Name())) {
|
if !strings.Contains(builder.GetPath(), utilstrings.EscapeQualifiedNameForDisk(plugin.Name())) {
|
||||||
return fmt.Errorf("builder path expected to contain plugin name. Got: %s", builder.GetPath())
|
return fmt.Errorf("builder path expected to contain plugin name. Got: %s", builder.GetPath())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -22,9 +22,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
"k8s.io/kubernetes/pkg/util/exec"
|
"k8s.io/kubernetes/pkg/util/exec"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ type rbd struct {
|
||||||
func (rbd *rbd) GetPath() string {
|
func (rbd *rbd) GetPath() string {
|
||||||
name := rbdPluginName
|
name := rbdPluginName
|
||||||
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
|
||||||
return rbd.plugin.host.GetPodVolumeDir(rbd.podUID, util.EscapeQualifiedNameForDisk(name), rbd.volName)
|
return rbd.plugin.host.GetPodVolumeDir(rbd.podUID, strings.EscapeQualifiedNameForDisk(name), rbd.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rbdBuilder struct {
|
type rbdBuilder struct {
|
||||||
|
|
|
@ -24,9 +24,9 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
|
||||||
ioutil "k8s.io/kubernetes/pkg/util/io"
|
ioutil "k8s.io/kubernetes/pkg/util/io"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
"k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
@ -84,7 +84,7 @@ type secretVolume struct {
|
||||||
var _ volume.Volume = &secretVolume{}
|
var _ volume.Volume = &secretVolume{}
|
||||||
|
|
||||||
func (sv *secretVolume) GetPath() string {
|
func (sv *secretVolume) GetPath() string {
|
||||||
return sv.plugin.host.GetPodVolumeDir(sv.podUID, util.EscapeQualifiedNameForDisk(secretPluginName), sv.volName)
|
return sv.plugin.host.GetPodVolumeDir(sv.podUID, strings.EscapeQualifiedNameForDisk(secretPluginName), sv.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// secretVolumeBuilder handles retrieving secrets from the API server
|
// secretVolumeBuilder handles retrieving secrets from the API server
|
||||||
|
@ -117,7 +117,7 @@ var wrappedVolumeSpec = &volume.Spec{
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *secretVolumeBuilder) getMetaDir() string {
|
func (b *secretVolumeBuilder) getMetaDir() string {
|
||||||
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, util.EscapeQualifiedNameForDisk(secretPluginName)), b.volName)
|
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, strings.EscapeQualifiedNameForDisk(secretPluginName)), b.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *secretVolumeBuilder) SetUpAt(dir string) error {
|
func (b *secretVolumeBuilder) SetUpAt(dir string) error {
|
||||||
|
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"k8s.io/kubernetes/pkg/util/io"
|
"k8s.io/kubernetes/pkg/util/io"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fakeVolumeHost is useful for testing volume plugins.
|
// fakeVolumeHost is useful for testing volume plugins.
|
||||||
|
@ -192,7 +193,7 @@ func (fv *FakeVolume) SetUpAt(dir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fv *FakeVolume) GetPath() string {
|
func (fv *FakeVolume) GetPath() string {
|
||||||
return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, util.EscapeQualifiedNameForDisk(fv.Plugin.PluginName), fv.VolName))
|
return path.Join(fv.Plugin.Host.GetPodVolumeDir(fv.PodUID, utilstrings.EscapeQualifiedNameForDisk(fv.Plugin.PluginName), fv.VolName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fv *FakeVolume) TearDown() error {
|
func (fv *FakeVolume) TearDown() error {
|
||||||
|
|
Loading…
Reference in New Issue