mirror of https://github.com/k3s-io/k3s
fix golint errors in pkg/volume/*
parent
5a8f831964
commit
18a904d187
|
@ -403,8 +403,6 @@ pkg/version/verflag
|
||||||
pkg/volume
|
pkg/volume
|
||||||
pkg/volume/azure_dd
|
pkg/volume/azure_dd
|
||||||
pkg/volume/azure_file
|
pkg/volume/azure_file
|
||||||
pkg/volume/cephfs
|
|
||||||
pkg/volume/configmap
|
|
||||||
pkg/volume/csi/fake
|
pkg/volume/csi/fake
|
||||||
pkg/volume/git_repo
|
pkg/volume/git_repo
|
||||||
pkg/volume/host_path
|
pkg/volume/host_path
|
||||||
|
@ -415,7 +413,6 @@ pkg/volume/photon_pd
|
||||||
pkg/volume/portworx
|
pkg/volume/portworx
|
||||||
pkg/volume/rbd
|
pkg/volume/rbd
|
||||||
pkg/volume/scaleio
|
pkg/volume/scaleio
|
||||||
pkg/volume/secret
|
|
||||||
pkg/volume/storageos
|
pkg/volume/storageos
|
||||||
pkg/volume/testing
|
pkg/volume/testing
|
||||||
pkg/volume/util/fs
|
pkg/volume/util/fs
|
||||||
|
|
|
@ -34,7 +34,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/volume/util"
|
"k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is the primary entrypoint for volume plugins.
|
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
|
||||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||||
return []volume.VolumePlugin{&cephfsPlugin{nil}}
|
return []volume.VolumePlugin{&cephfsPlugin{nil}}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ func (plugin *cephfsPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
|
||||||
path: path,
|
path: path,
|
||||||
secret: secret,
|
secret: secret,
|
||||||
id: id,
|
id: id,
|
||||||
secret_file: secretFile,
|
secretFile: secretFile,
|
||||||
readonly: readOnly,
|
readonly: readOnly,
|
||||||
mounter: mounter,
|
mounter: mounter,
|
||||||
plugin: plugin,
|
plugin: plugin,
|
||||||
|
@ -188,7 +188,7 @@ type cephfs struct {
|
||||||
path string
|
path string
|
||||||
id string
|
id string
|
||||||
secret string
|
secret string
|
||||||
secret_file string
|
secretFile string
|
||||||
readonly bool
|
readonly bool
|
||||||
mounter mount.Interface
|
mounter mount.Interface
|
||||||
plugin *cephfsPlugin
|
plugin *cephfsPlugin
|
||||||
|
@ -213,7 +213,7 @@ func (cephfsVolume *cephfsMounter) GetAttributes() volume.Attributes {
|
||||||
// Checks prior to mount operations to verify that the required components (binaries, etc.)
|
// Checks prior to mount operations to verify that the required components (binaries, etc.)
|
||||||
// to mount the volume are available on the underlying node.
|
// to mount the volume are available on the underlying node.
|
||||||
// If not, it returns an error
|
// If not, it returns an error
|
||||||
func (cephfsMounter *cephfsMounter) CanMount() error {
|
func (cephfsVolume *cephfsMounter) CanMount() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,10 +250,10 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// cephfs fuse mount succeeded.
|
// cephfs fuse mount succeeded.
|
||||||
return nil
|
return nil
|
||||||
} else {
|
}
|
||||||
// if cephfs fuse mount failed, fallback to kernel mount.
|
// if cephfs fuse mount failed, fallback to kernel mount.
|
||||||
glog.V(2).Infof("CephFS fuse mount failed: %v, fallback to kernel mount.", err)
|
glog.V(2).Infof("CephFS fuse mount failed: %v, fallback to kernel mount.", err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
glog.V(4).Info("CephFS kernel mount.")
|
glog.V(4).Info("CephFS kernel mount.")
|
||||||
|
|
||||||
|
@ -298,19 +298,19 @@ func (cephfsVolume *cephfs) GetKeyringPath() string {
|
||||||
|
|
||||||
func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
||||||
// cephfs mount option
|
// cephfs mount option
|
||||||
ceph_opt := ""
|
cephOpt := ""
|
||||||
// override secretfile if secret is provided
|
// override secretfile if secret is provided
|
||||||
if cephfsVolume.secret != "" {
|
if cephfsVolume.secret != "" {
|
||||||
ceph_opt = "name=" + cephfsVolume.id + ",secret=" + cephfsVolume.secret
|
cephOpt = "name=" + cephfsVolume.id + ",secret=" + cephfsVolume.secret
|
||||||
} else {
|
} else {
|
||||||
ceph_opt = "name=" + cephfsVolume.id + ",secretfile=" + cephfsVolume.secret_file
|
cephOpt = "name=" + cephfsVolume.id + ",secretfile=" + cephfsVolume.secretFile
|
||||||
}
|
}
|
||||||
// build option array
|
// build option array
|
||||||
opt := []string{}
|
opt := []string{}
|
||||||
if cephfsVolume.readonly {
|
if cephfsVolume.readonly {
|
||||||
opt = append(opt, "ro")
|
opt = append(opt, "ro")
|
||||||
}
|
}
|
||||||
opt = append(opt, ceph_opt)
|
opt = append(opt, cephOpt)
|
||||||
|
|
||||||
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
||||||
hosts := cephfsVolume.mon
|
hosts := cephfsVolume.mon
|
||||||
|
@ -331,8 +331,8 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cephfsMounter *cephfsMounter) checkFuseMount() bool {
|
func (cephfsVolume *cephfsMounter) checkFuseMount() bool {
|
||||||
execute := cephfsMounter.plugin.host.GetExec(cephfsMounter.plugin.GetPluginName())
|
execute := cephfsVolume.plugin.host.GetExec(cephfsVolume.plugin.GetPluginName())
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux":
|
case "linux":
|
||||||
if _, err := execute.Run("/usr/bin/test", "-x", "/sbin/mount.fuse.ceph"); err == nil {
|
if _, err := execute.Run("/usr/bin/test", "-x", "/sbin/mount.fuse.ceph"); err == nil {
|
||||||
|
@ -346,7 +346,7 @@ func (cephfsMounter *cephfsMounter) checkFuseMount() bool {
|
||||||
|
|
||||||
func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
||||||
// cephfs keyring file
|
// cephfs keyring file
|
||||||
keyring_file := ""
|
keyringFile := ""
|
||||||
// override secretfile if secret is provided
|
// override secretfile if secret is provided
|
||||||
if cephfsVolume.secret != "" {
|
if cephfsVolume.secret != "" {
|
||||||
// TODO: cephfs fuse currently doesn't support secret option,
|
// TODO: cephfs fuse currently doesn't support secret option,
|
||||||
|
@ -380,10 +380,10 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
keyring_file = path.Join(keyringPath, fileName)
|
keyringFile = path.Join(keyringPath, fileName)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
keyring_file = cephfsVolume.secret_file
|
keyringFile = cephfsVolume.secretFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
// build src like mon1:6789,mon2:6789,mon3:6789:/
|
||||||
|
@ -399,7 +399,7 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
||||||
|
|
||||||
mountArgs := []string{}
|
mountArgs := []string{}
|
||||||
mountArgs = append(mountArgs, "-k")
|
mountArgs = append(mountArgs, "-k")
|
||||||
mountArgs = append(mountArgs, keyring_file)
|
mountArgs = append(mountArgs, keyringFile)
|
||||||
mountArgs = append(mountArgs, "-m")
|
mountArgs = append(mountArgs, "-m")
|
||||||
mountArgs = append(mountArgs, src)
|
mountArgs = append(mountArgs, src)
|
||||||
mountArgs = append(mountArgs, mountpoint)
|
mountArgs = append(mountArgs, mountpoint)
|
||||||
|
@ -423,7 +423,7 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
||||||
command := exec.Command("ceph-fuse", mountArgs...)
|
command := exec.Command("ceph-fuse", mountArgs...)
|
||||||
output, err := command.CombinedOutput()
|
output, err := command.CombinedOutput()
|
||||||
if err != nil || !(strings.Contains(string(output), "starting fuse")) {
|
if err != nil || !(strings.Contains(string(output), "starting fuse")) {
|
||||||
return fmt.Errorf("Ceph-fuse failed: %v\narguments: %s\nOutput: %s\n", err, mountArgs, string(output))
|
return fmt.Errorf("Ceph-fuse failed: %v\narguments: %s\nOutput: %s", err, mountArgs, string(output))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProbeVolumePlugin is the entry point for plugin detection in a package.
|
// ProbeVolumePlugins is the entry point for plugin detection in a package.
|
||||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||||
return []volume.VolumePlugin{&configMapPlugin{}}
|
return []volume.VolumePlugin{&configMapPlugin{}}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ func (b *configMapVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this function is exported so that it can be called from the projection volume driver
|
// MakePayload function is exported so that it can be called from the projection volume driver
|
||||||
func MakePayload(mappings []v1.KeyToPath, configMap *v1.ConfigMap, defaultMode *int32, optional bool) (map[string]volumeutil.FileProjection, error) {
|
func MakePayload(mappings []v1.KeyToPath, configMap *v1.ConfigMap, defaultMode *int32, optional bool) (map[string]volumeutil.FileProjection, error) {
|
||||||
if defaultMode == nil {
|
if defaultMode == nil {
|
||||||
return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
|
return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
|
||||||
|
|
|
@ -74,7 +74,7 @@ type sioClient struct {
|
||||||
spClient *sio.StoragePool
|
spClient *sio.StoragePool
|
||||||
provisionMode string
|
provisionMode string
|
||||||
sdcPath string
|
sdcPath string
|
||||||
sdcGuid string
|
sdcGUID string
|
||||||
instanceID string
|
instanceID string
|
||||||
inited bool
|
inited bool
|
||||||
diskRegex *regexp.Regexp
|
diskRegex *regexp.Regexp
|
||||||
|
@ -301,11 +301,11 @@ func (c *sioClient) IID() (string, error) {
|
||||||
|
|
||||||
// if instanceID not set, retrieve it
|
// if instanceID not set, retrieve it
|
||||||
if c.instanceID == "" {
|
if c.instanceID == "" {
|
||||||
guid, err := c.getGuid()
|
guid, err := c.getGUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
sdc, err := c.sysClient.FindSdc("SdcGuid", guid)
|
sdc, err := c.sysClient.FindSdc("SdcGUID", guid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Error(log("failed to retrieve sdc info %s", err))
|
glog.Error(log("failed to retrieve sdc info %s", err))
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -316,10 +316,10 @@ func (c *sioClient) IID() (string, error) {
|
||||||
return c.instanceID, nil
|
return c.instanceID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getGuid returns instance GUID, if not set using resource labels
|
// getGUID returns instance GUID, if not set using resource labels
|
||||||
// it attempts to fallback to using drv_cfg binary
|
// it attempts to fallback to using drv_cfg binary
|
||||||
func (c *sioClient) getGuid() (string, error) {
|
func (c *sioClient) getGUID() (string, error) {
|
||||||
if c.sdcGuid == "" {
|
if c.sdcGUID == "" {
|
||||||
glog.V(4).Info(log("sdc guid label not set, falling back to using drv_cfg"))
|
glog.V(4).Info(log("sdc guid label not set, falling back to using drv_cfg"))
|
||||||
cmd := c.getSdcCmd()
|
cmd := c.getSdcCmd()
|
||||||
output, err := c.exec.Run(cmd, "--query_guid")
|
output, err := c.exec.Run(cmd, "--query_guid")
|
||||||
|
@ -327,9 +327,9 @@ func (c *sioClient) getGuid() (string, error) {
|
||||||
glog.Error(log("drv_cfg --query_guid failed: %v", err))
|
glog.Error(log("drv_cfg --query_guid failed: %v", err))
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
c.sdcGuid = strings.TrimSpace(string(output))
|
c.sdcGUID = strings.TrimSpace(string(output))
|
||||||
}
|
}
|
||||||
return c.sdcGuid, nil
|
return c.sdcGUID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSioDiskPaths traverse local disk devices to retrieve device path
|
// getSioDiskPaths traverse local disk devices to retrieve device path
|
||||||
|
@ -342,10 +342,10 @@ func (c *sioClient) getSioDiskPaths() ([]os.FileInfo, error) {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// sioDiskIDPath may not exist yet which is fine
|
// sioDiskIDPath may not exist yet which is fine
|
||||||
return []os.FileInfo{}, nil
|
return []os.FileInfo{}, nil
|
||||||
} else {
|
}
|
||||||
glog.Error(log("failed to ReadDir %s: %v", sioDiskIDPath, err))
|
glog.Error(log("failed to ReadDir %s: %v", sioDiskIDPath, err))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result := []os.FileInfo{}
|
result := []os.FileInfo{}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
@ -360,13 +360,13 @@ func (c *sioClient) getSioDiskPaths() ([]os.FileInfo, error) {
|
||||||
|
|
||||||
// GetVolumeRefs counts the number of references an SIO volume has a disk device.
|
// GetVolumeRefs counts the number of references an SIO volume has a disk device.
|
||||||
// This is useful in preventing premature detach.
|
// This is useful in preventing premature detach.
|
||||||
func (c *sioClient) GetVolumeRefs(volId sioVolumeID) (refs int, err error) {
|
func (c *sioClient) GetVolumeRefs(volID sioVolumeID) (refs int, err error) {
|
||||||
files, err := c.getSioDiskPaths()
|
files, err := c.getSioDiskPaths()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if strings.Contains(file.Name(), string(volId)) {
|
if strings.Contains(file.Name(), string(volID)) {
|
||||||
refs++
|
refs++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (m *sioMgr) getClient() (sioInterface, error) {
|
||||||
client.spName = configs[confKey.storagePool]
|
client.spName = configs[confKey.storagePool]
|
||||||
client.sdcPath = configs[confKey.sdcRootPath]
|
client.sdcPath = configs[confKey.sdcRootPath]
|
||||||
client.provisionMode = configs[confKey.storageMode]
|
client.provisionMode = configs[confKey.storageMode]
|
||||||
client.sdcGuid = configs[confKey.sdcGuid]
|
client.sdcGUID = configs[confKey.sdcGUID]
|
||||||
|
|
||||||
m.client = client
|
m.client = client
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ func (f *fakeSio) Devs() (map[string]string, error) {
|
||||||
return f.devs, nil
|
return f.devs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeSio) GetVolumeRefs(volId sioVolumeID) (int, error) {
|
func (f *fakeSio) GetVolumeRefs(volID sioVolumeID) (int, error) {
|
||||||
if f.volume == nil {
|
if f.volume == nil {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ type sioPlugin struct {
|
||||||
volumeMtx keymutex.KeyMutex
|
volumeMtx keymutex.KeyMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
|
||||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||||
p := &sioPlugin{
|
p := &sioPlugin{
|
||||||
host: nil,
|
host: nil,
|
||||||
|
|
|
@ -54,7 +54,7 @@ var (
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
secretNamespace,
|
secretNamespace,
|
||||||
sdcGuid string
|
sdcGUID string
|
||||||
}{
|
}{
|
||||||
gateway: "gateway",
|
gateway: "gateway",
|
||||||
sslEnabled: "sslEnabled",
|
sslEnabled: "sslEnabled",
|
||||||
|
@ -71,9 +71,9 @@ var (
|
||||||
readOnly: "readOnly",
|
readOnly: "readOnly",
|
||||||
username: "username",
|
username: "username",
|
||||||
password: "password",
|
password: "password",
|
||||||
sdcGuid: "sdcGuid",
|
sdcGUID: "sdcGUID",
|
||||||
}
|
}
|
||||||
sdcGuidLabelName = "scaleio.sdcGuid"
|
sdcGUIDLabelName = "scaleio.sdcGUID"
|
||||||
sdcRootPath = "/opt/emc/scaleio/sdc/bin"
|
sdcRootPath = "/opt/emc/scaleio/sdc/bin"
|
||||||
|
|
||||||
secretNotFoundErr = errors.New("secret not found")
|
secretNotFoundErr = errors.New("secret not found")
|
||||||
|
@ -232,30 +232,30 @@ func attachSecret(plug *sioPlugin, namespace string, configData map[string]strin
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// attachSdcGuid injects the sdc guid node label value into config
|
// attachSdcGUID injects the sdc guid node label value into config
|
||||||
func attachSdcGuid(plug *sioPlugin, conf map[string]string) error {
|
func attachSdcGUID(plug *sioPlugin, conf map[string]string) error {
|
||||||
guid, err := getSdcGuidLabel(plug)
|
guid, err := getSdcGUIDLabel(plug)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
conf[confKey.sdcGuid] = guid
|
conf[confKey.sdcGUID] = guid
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSdcGuidLabel fetches the scaleio.sdcGuid node label
|
// getSdcGUIDLabel fetches the scaleio.sdcGuid node label
|
||||||
// associated with the node executing this code.
|
// associated with the node executing this code.
|
||||||
func getSdcGuidLabel(plug *sioPlugin) (string, error) {
|
func getSdcGUIDLabel(plug *sioPlugin) (string, error) {
|
||||||
nodeLabels, err := plug.host.GetNodeLabels()
|
nodeLabels, err := plug.host.GetNodeLabels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
label, ok := nodeLabels[sdcGuidLabelName]
|
label, ok := nodeLabels[sdcGUIDLabelName]
|
||||||
if !ok {
|
if !ok {
|
||||||
glog.V(4).Info(log("node label %s not found", sdcGuidLabelName))
|
glog.V(4).Info(log("node label %s not found", sdcGUIDLabelName))
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(4).Info(log("found node label %s=%s", sdcGuidLabelName, label))
|
glog.V(4).Info(log("found node label %s=%s", sdcGUIDLabelName, label))
|
||||||
return label, nil
|
return label, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ func (v *sioVolume) Provision(selectedNode *api.Node, allowedTopologies []api.To
|
||||||
// setup volume attrributes
|
// setup volume attrributes
|
||||||
genName := v.generateName("k8svol", 11)
|
genName := v.generateName("k8svol", 11)
|
||||||
var oneGig int64 = 1024 * 1024 * 1024
|
var oneGig int64 = 1024 * 1024 * 1024
|
||||||
var eightGig int64 = 8 * oneGig
|
eightGig := 8 * oneGig
|
||||||
|
|
||||||
capacity := v.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)]
|
capacity := v.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)]
|
||||||
volSizeBytes := capacity.Value()
|
volSizeBytes := capacity.Value()
|
||||||
|
@ -393,7 +393,7 @@ func (v *sioVolume) setSioMgr() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge in Sdc Guid label value
|
// merge in Sdc Guid label value
|
||||||
if err := attachSdcGuid(v.plugin, configData); err != nil {
|
if err := attachSdcGUID(v.plugin, configData); err != nil {
|
||||||
glog.Error(log("failed to retrieve sdc guid: %v", err))
|
glog.Error(log("failed to retrieve sdc guid: %v", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ func (v *sioVolume) resetSioMgr() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge in Sdc Guid label value
|
// merge in Sdc Guid label value
|
||||||
if err := attachSdcGuid(v.plugin, configData); err != nil {
|
if err := attachSdcGUID(v.plugin, configData); err != nil {
|
||||||
glog.Error(log("failed to retrieve sdc guid: %v", err))
|
glog.Error(log("failed to retrieve sdc guid: %v", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ func newPluginMgr(t *testing.T, apiObject runtime.Object) (*volume.VolumePluginM
|
||||||
tmpDir,
|
tmpDir,
|
||||||
fakeClient,
|
fakeClient,
|
||||||
nil,
|
nil,
|
||||||
map[string]string{sdcGuidLabelName: "abc-123"},
|
map[string]string{sdcGUIDLabelName: "abc-123"},
|
||||||
)
|
)
|
||||||
plugMgr := &volume.VolumePluginMgr{}
|
plugMgr := &volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, host)
|
plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, host)
|
||||||
|
@ -206,9 +206,9 @@ func TestVolumeMounterUnmounter(t *testing.T) {
|
||||||
t.Errorf("SetUp() - expecting multiple volume disabled by default")
|
t.Errorf("SetUp() - expecting multiple volume disabled by default")
|
||||||
}
|
}
|
||||||
|
|
||||||
// did we read sdcGuid label
|
// did we read sdcGUID label
|
||||||
if _, ok := sioVol.sioMgr.configData[confKey.sdcGuid]; !ok {
|
if _, ok := sioVol.sioMgr.configData[confKey.sdcGUID]; !ok {
|
||||||
t.Errorf("Expected to find node label scaleio.sdcGuid, but did not find it")
|
t.Errorf("Expected to find node label scaleio.sdcGUID, but did not find it")
|
||||||
}
|
}
|
||||||
|
|
||||||
// rebuild spec
|
// rebuild spec
|
||||||
|
@ -349,9 +349,9 @@ func TestVolumeProvisioner(t *testing.T) {
|
||||||
t.Fatalf("Expected success, got: %v", err)
|
t.Fatalf("Expected success, got: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// did we read sdcGuid label
|
// did we read sdcGUID label
|
||||||
if _, ok := sioVol.sioMgr.configData[confKey.sdcGuid]; !ok {
|
if _, ok := sioVol.sioMgr.configData[confKey.sdcGUID]; !ok {
|
||||||
t.Errorf("Expected to find node label scaleio.sdcGuid, but did not find it")
|
t.Errorf("Expected to find node label scaleio.sdcGUID, but did not find it")
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMultiMap applied
|
// isMultiMap applied
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProbeVolumePlugin is the entry point for plugin detection in a package.
|
// ProbeVolumePlugins is the entry point for plugin detection in a package.
|
||||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||||
return []volume.VolumePlugin{&secretPlugin{}}
|
return []volume.VolumePlugin{&secretPlugin{}}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ func (b *secretVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this function is exported so that it can be called from the projection volume driver
|
// MakePayload function is exported so that it can be called from the projection volume driver
|
||||||
func MakePayload(mappings []v1.KeyToPath, secret *v1.Secret, defaultMode *int32, optional bool) (map[string]volumeutil.FileProjection, error) {
|
func MakePayload(mappings []v1.KeyToPath, secret *v1.Secret, defaultMode *int32, optional bool) (map[string]volumeutil.FileProjection, error) {
|
||||||
if defaultMode == nil {
|
if defaultMode == nil {
|
||||||
return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
|
return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
|
||||||
|
@ -281,9 +281,9 @@ func MakePayload(mappings []v1.KeyToPath, secret *v1.Secret, defaultMode *int32,
|
||||||
if optional {
|
if optional {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err_msg := "references non-existent secret key"
|
errMsg := "references non-existent secret key"
|
||||||
glog.Errorf(err_msg)
|
glog.Errorf(errMsg)
|
||||||
return nil, fmt.Errorf(err_msg)
|
return nil, fmt.Errorf(errMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileProjection.Data = []byte(content)
|
fileProjection.Data = []byte(content)
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testApiSecretName = "storageos-api"
|
var testAPISecretName = "storageos-api"
|
||||||
var testVolName = "storageos-test-vol"
|
var testVolName = "storageos-test-vol"
|
||||||
var testPVName = "storageos-test-pv"
|
var testPVName = "storageos-test-pv"
|
||||||
var testNamespace = "storageos-test-namespace"
|
var testNamespace = "storageos-test-namespace"
|
||||||
|
|
Loading…
Reference in New Issue