mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
Fresh dep ensure
This commit is contained in:
22
vendor/k8s.io/kubernetes/pkg/volume/storageos/BUILD
generated
vendored
22
vendor/k8s.io/kubernetes/pkg/volume/storageos/BUILD
generated
vendored
@ -19,14 +19,14 @@ go_library(
|
||||
"//pkg/util/strings:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//pkg/volume/util:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource: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",
|
||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/github.com/storageos/go-api:go_default_library",
|
||||
"//vendor/github.com/storageos/go-api/types:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -41,12 +41,12 @@ go_test(
|
||||
"//pkg/util/mount:go_default_library",
|
||||
"//pkg/volume:go_default_library",
|
||||
"//pkg/volume/testing: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",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||
"//vendor/github.com/storageos/go-api/types:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/fake:go_default_library",
|
||||
"//vendor/k8s.io/client-go/util/testing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
56
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos.go
generated
vendored
56
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos.go
generated
vendored
@ -24,7 +24,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
@ -343,14 +343,14 @@ func (b *storageosMounter) CanMount() error {
|
||||
func (b *storageosMounter) SetUp(fsGroup *int64) error {
|
||||
// Need a namespace to find the volume, try pod's namespace if not set.
|
||||
if b.volNamespace == "" {
|
||||
glog.V(2).Infof("Setting StorageOS volume namespace to pod namespace: %s", b.podNamespace)
|
||||
klog.V(2).Infof("Setting StorageOS volume namespace to pod namespace: %s", b.podNamespace)
|
||||
b.volNamespace = b.podNamespace
|
||||
}
|
||||
|
||||
// Attach the StorageOS volume as a block device
|
||||
devicePath, err := b.manager.AttachVolume(b)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to attach StorageOS volume %s: %s", b.volName, err.Error())
|
||||
klog.Errorf("Failed to attach StorageOS volume %s: %s", b.volName, err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ func (b *storageosMounter) SetUp(fsGroup *int64) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(4).Infof("Successfully mounted StorageOS volume %s into global mount directory", b.volName)
|
||||
klog.V(4).Infof("Successfully mounted StorageOS volume %s into global mount directory", b.volName)
|
||||
|
||||
// Bind mount the volume into the pod
|
||||
return b.SetUpAt(b.GetPath(), fsGroup)
|
||||
@ -369,9 +369,9 @@ func (b *storageosMounter) SetUp(fsGroup *int64) error {
|
||||
// SetUp bind mounts the disk global mount to the give volume path.
|
||||
func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
notMnt, err := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
glog.V(4).Infof("StorageOS volume set up: %s %v %v", dir, !notMnt, err)
|
||||
klog.V(4).Infof("StorageOS volume set up: %s %v %v", dir, !notMnt, err)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
glog.Errorf("Cannot validate mount point: %s %v", dir, err)
|
||||
klog.Errorf("Cannot validate mount point: %s %v", dir, err)
|
||||
return err
|
||||
}
|
||||
if !notMnt {
|
||||
@ -379,7 +379,7 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(dir, 0750); err != nil {
|
||||
glog.Errorf("mkdir failed on disk %s (%v)", dir, err)
|
||||
klog.Errorf("mkdir failed on disk %s (%v)", dir, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -391,39 +391,39 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||
mountOptions := util.JoinMountOptions(b.mountOptions, options)
|
||||
|
||||
globalPDPath := makeGlobalPDName(b.plugin.host, b.pvName, b.volNamespace, b.volName)
|
||||
glog.V(4).Infof("Attempting to bind mount to pod volume at %s", dir)
|
||||
klog.V(4).Infof("Attempting to bind mount to pod volume at %s", dir)
|
||||
|
||||
err = b.mounter.Mount(globalPDPath, dir, "", mountOptions)
|
||||
if err != nil {
|
||||
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
klog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
if !notMnt {
|
||||
if mntErr = b.mounter.Unmount(dir); mntErr != nil {
|
||||
glog.Errorf("Failed to unmount: %v", mntErr)
|
||||
klog.Errorf("Failed to unmount: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
klog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
if !notMnt {
|
||||
glog.Errorf("%s is still mounted, despite call to unmount(). Will try again next sync loop.", dir)
|
||||
klog.Errorf("%s is still mounted, despite call to unmount(). Will try again next sync loop.", dir)
|
||||
return err
|
||||
}
|
||||
}
|
||||
os.Remove(dir)
|
||||
glog.Errorf("Mount of disk %s failed: %v", dir, err)
|
||||
klog.Errorf("Mount of disk %s failed: %v", dir, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if !b.readOnly {
|
||||
volume.SetVolumeOwnership(b, fsGroup)
|
||||
}
|
||||
glog.V(4).Infof("StorageOS volume setup complete on %s", dir)
|
||||
klog.V(4).Infof("StorageOS volume setup complete on %s", dir)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ func (b *storageosUnmounter) GetPath() string {
|
||||
// resource was the last reference to that disk on the kubelet.
|
||||
func (b *storageosUnmounter) TearDown() error {
|
||||
if len(b.volNamespace) == 0 || len(b.volName) == 0 {
|
||||
glog.Warningf("volNamespace: %q, volName: %q not set, skipping TearDown", b.volNamespace, b.volName)
|
||||
klog.Warningf("volNamespace: %q, volName: %q not set, skipping TearDown", b.volNamespace, b.volName)
|
||||
return fmt.Errorf("pvName not specified for TearDown, waiting for next sync loop")
|
||||
}
|
||||
// Unmount from pod
|
||||
@ -495,7 +495,7 @@ func (b *storageosUnmounter) TearDown() error {
|
||||
|
||||
err := b.TearDownAt(mountPath)
|
||||
if err != nil {
|
||||
glog.Errorf("Unmount from pod failed: %v", err)
|
||||
klog.Errorf("Unmount from pod failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -503,25 +503,25 @@ func (b *storageosUnmounter) TearDown() error {
|
||||
globalPDPath := makeGlobalPDName(b.plugin.host, b.pvName, b.volNamespace, b.volName)
|
||||
devicePath, _, err := mount.GetDeviceNameFromMount(b.mounter, globalPDPath)
|
||||
if err != nil {
|
||||
glog.Errorf("Detach failed when getting device from global mount: %v", err)
|
||||
klog.Errorf("Detach failed when getting device from global mount: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Unmount from plugin's disk global mount dir.
|
||||
err = b.TearDownAt(globalPDPath)
|
||||
if err != nil {
|
||||
glog.Errorf("Detach failed during unmount: %v", err)
|
||||
klog.Errorf("Detach failed during unmount: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Detach loop device
|
||||
err = b.manager.DetachVolume(b, devicePath)
|
||||
if err != nil {
|
||||
glog.Errorf("Detach device %s failed for volume %s: %v", devicePath, b.pvName, err)
|
||||
klog.Errorf("Detach device %s failed for volume %s: %v", devicePath, b.pvName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
glog.V(4).Infof("Successfully unmounted StorageOS volume %s and detached devices", b.pvName)
|
||||
klog.V(4).Infof("Successfully unmounted StorageOS volume %s and detached devices", b.pvName)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -530,10 +530,10 @@ func (b *storageosUnmounter) TearDown() error {
|
||||
// resource was the last reference to that disk on the kubelet.
|
||||
func (b *storageosUnmounter) TearDownAt(dir string) error {
|
||||
if err := util.UnmountPath(dir, b.mounter); err != nil {
|
||||
glog.V(4).Infof("Unmounted StorageOS volume %s failed with: %v", b.pvName, err)
|
||||
klog.V(4).Infof("Unmounted StorageOS volume %s failed with: %v", b.pvName, err)
|
||||
}
|
||||
if err := b.manager.UnmountVolume(b); err != nil {
|
||||
glog.V(4).Infof("Mount reference for volume %s could not be removed from StorageOS: %v", b.pvName, err)
|
||||
klog.V(4).Infof("Mount reference for volume %s could not be removed from StorageOS: %v", b.pvName, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -602,7 +602,11 @@ func (c *storageosProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
c.labels[k] = v
|
||||
}
|
||||
capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||
c.sizeGB = int(util.RoundUpSize(capacity.Value(), 1024*1024*1024))
|
||||
var err error
|
||||
c.sizeGB, err = util.RoundUpToGiBInt(capacity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
apiCfg, err := parsePVSecret(adminSecretNamespace, adminSecretName, c.plugin.host.GetKubeClient())
|
||||
if err != nil {
|
||||
@ -612,7 +616,7 @@ func (c *storageosProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
|
||||
vol, err := c.manager.CreateVolume(c)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to create volume: %v", err)
|
||||
klog.Errorf("failed to create volume: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
if vol.FSType == "" {
|
||||
@ -713,7 +717,7 @@ func getAPICfg(spec *volume.Spec, pod *v1.Pod, kubeClient clientset.Interface) (
|
||||
func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (*storageosAPIConfig, error) {
|
||||
secret, err := util.GetSecretForPod(pod, secretName, kubeClient)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
klog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
return nil, fmt.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
|
||||
}
|
||||
return parseAPIConfig(secret)
|
||||
@ -724,7 +728,7 @@ func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interfa
|
||||
func parsePVSecret(namespace, secretName string, kubeClient clientset.Interface) (*storageosAPIConfig, error) {
|
||||
secret, err := util.GetSecretForPV(namespace, secretName, storageosPluginName, kubeClient)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
klog.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
return nil, fmt.Errorf("failed to get secret from [%q/%q]", namespace, secretName)
|
||||
}
|
||||
return parseAPIConfig(secret)
|
||||
|
26
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos_util.go
generated
vendored
26
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos_util.go
generated
vendored
@ -25,9 +25,9 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
|
||||
"github.com/golang/glog"
|
||||
storageosapi "github.com/storageos/go-api"
|
||||
storageostypes "github.com/storageos/go-api/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -88,7 +88,7 @@ func (u *storageosUtil) NewAPI(apiCfg *storageosAPIConfig) error {
|
||||
apiPass: defaultAPIPassword,
|
||||
apiVersion: defaultAPIVersion,
|
||||
}
|
||||
glog.V(4).Infof("Using default StorageOS API settings: addr %s, version: %s", apiCfg.apiAddr, defaultAPIVersion)
|
||||
klog.V(4).Infof("Using default StorageOS API settings: addr %s, version: %s", apiCfg.apiAddr, defaultAPIVersion)
|
||||
}
|
||||
|
||||
api, err := storageosapi.NewVersionedClient(apiCfg.apiAddr, defaultAPIVersion)
|
||||
@ -122,7 +122,7 @@ func (u *storageosUtil) CreateVolume(p *storageosProvisioner) (*storageosVolume,
|
||||
|
||||
vol, err := u.api.VolumeCreate(opts)
|
||||
if err != nil {
|
||||
glog.Errorf("volume create failed for volume %q (%v)", opts.Name, err)
|
||||
klog.Errorf("volume create failed for volume %q (%v)", opts.Name, err)
|
||||
return nil, err
|
||||
}
|
||||
return &storageosVolume{
|
||||
@ -157,7 +157,7 @@ func (u *storageosUtil) AttachVolume(b *storageosMounter) (string, error) {
|
||||
|
||||
vol, err := u.api.Volume(b.volNamespace, b.volName)
|
||||
if err != nil {
|
||||
glog.Warningf("volume retrieve failed for volume %q with namespace %q (%v)", b.volName, b.volNamespace, err)
|
||||
klog.Warningf("volume retrieve failed for volume %q with namespace %q (%v)", b.volName, b.volNamespace, err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
@ -170,14 +170,14 @@ func (u *storageosUtil) AttachVolume(b *storageosMounter) (string, error) {
|
||||
Namespace: vol.Namespace,
|
||||
}
|
||||
if err := u.api.VolumeUnmount(opts); err != nil {
|
||||
glog.Warningf("Couldn't clear existing StorageOS mount reference: %v", err)
|
||||
klog.Warningf("Couldn't clear existing StorageOS mount reference: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
srcPath := path.Join(b.deviceDir, vol.ID)
|
||||
dt, err := pathDeviceType(srcPath)
|
||||
if err != nil {
|
||||
glog.Warningf("volume source path %q for volume %q not ready (%v)", srcPath, b.volName, err)
|
||||
klog.Warningf("volume source path %q for volume %q not ready (%v)", srcPath, b.volName, err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ func (u *storageosUtil) MountVolume(b *storageosMounter, mntDevice, deviceMountP
|
||||
}
|
||||
}
|
||||
if err = os.MkdirAll(deviceMountPath, 0750); err != nil {
|
||||
glog.Errorf("mkdir failed on disk %s (%v)", deviceMountPath, err)
|
||||
klog.Errorf("mkdir failed on disk %s (%v)", deviceMountPath, err)
|
||||
return err
|
||||
}
|
||||
options := []string{}
|
||||
@ -255,7 +255,7 @@ func (u *storageosUtil) UnmountVolume(b *storageosUnmounter) error {
|
||||
if err := u.NewAPI(b.apiCfg); err != nil {
|
||||
// We can't always get the config we need, so allow the unmount to
|
||||
// succeed even if we can't remove the mount reference from the API.
|
||||
glog.V(4).Infof("Could not remove mount reference in the StorageOS API as no credentials available to the unmount operation")
|
||||
klog.V(4).Infof("Could not remove mount reference in the StorageOS API as no credentials available to the unmount operation")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -291,11 +291,11 @@ func (u *storageosUtil) DeviceDir(b *storageosMounter) string {
|
||||
|
||||
ctrl, err := u.api.Controller(b.plugin.host.GetHostName())
|
||||
if err != nil {
|
||||
glog.Warningf("node device path lookup failed: %v", err)
|
||||
klog.Warningf("node device path lookup failed: %v", err)
|
||||
return defaultDeviceDir
|
||||
}
|
||||
if ctrl == nil || ctrl.DeviceDir == "" {
|
||||
glog.Warningf("node device path not set, using default: %s", defaultDeviceDir)
|
||||
klog.Warningf("node device path not set, using default: %s", defaultDeviceDir)
|
||||
return defaultDeviceDir
|
||||
}
|
||||
return ctrl.DeviceDir
|
||||
@ -327,7 +327,7 @@ func attachFileDevice(path string, exec mount.Exec) (string, error) {
|
||||
|
||||
// If no existing loop device for the path, create one
|
||||
if blockDevicePath == "" {
|
||||
glog.V(4).Infof("Creating device for path: %s", path)
|
||||
klog.V(4).Infof("Creating device for path: %s", path)
|
||||
blockDevicePath, err = makeLoopDevice(path, exec)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -349,7 +349,7 @@ func getLoopDevice(path string, exec mount.Exec) (string, error) {
|
||||
args := []string{"-j", path}
|
||||
out, err := exec.Run(losetupPath, args...)
|
||||
if err != nil {
|
||||
glog.V(2).Infof("Failed device discover command for path %s: %v", path, err)
|
||||
klog.V(2).Infof("Failed device discover command for path %s: %v", path, err)
|
||||
return "", err
|
||||
}
|
||||
return parseLosetupOutputForDevice(out)
|
||||
@ -359,7 +359,7 @@ func makeLoopDevice(path string, exec mount.Exec) (string, error) {
|
||||
args := []string{"-f", "-P", "--show", path}
|
||||
out, err := exec.Run(losetupPath, args...)
|
||||
if err != nil {
|
||||
glog.V(2).Infof("Failed device create command for path %s: %v", path, err)
|
||||
klog.V(2).Infof("Failed device create command for path %s: %v", path, err)
|
||||
return "", err
|
||||
}
|
||||
return parseLosetupOutputForDevice(out)
|
||||
|
6
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos_util_test.go
generated
vendored
6
vendor/k8s.io/kubernetes/pkg/volume/storageos/storageos_util_test.go
generated
vendored
@ -30,7 +30,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testApiSecretName = "storageos-api"
|
||||
var testAPISecretName = "storageos-api"
|
||||
var testVolName = "storageos-test-vol"
|
||||
var testPVName = "storageos-test-pv"
|
||||
var testNamespace = "storageos-test-namespace"
|
||||
@ -133,8 +133,8 @@ func TestCreateVolume(t *testing.T) {
|
||||
}
|
||||
|
||||
options := volume.VolumeOptions{
|
||||
PVName: testPVName,
|
||||
PVC: volumetest.CreateTestPVC(fmt.Sprintf("%dGi", testSize), []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
|
||||
PVName: testPVName,
|
||||
PVC: volumetest.CreateTestPVC(fmt.Sprintf("%dGi", testSize), []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
|
||||
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user