48
48
supportedFeatures = sets .NewString ("layering" )
49
49
)
50
50
51
- // This is the primary entrypoint for volume plugins.
51
+ // ProbeVolumePlugins is the primary entrypoint for volume plugins.
52
52
func ProbeVolumePlugins () []volume.VolumePlugin {
53
53
return []volume.VolumePlugin {& rbdPlugin {}}
54
54
}
@@ -72,7 +72,7 @@ const (
72
72
secretKeyName = "key" // key name used in secret
73
73
rbdImageFormat1 = "1"
74
74
rbdImageFormat2 = "2"
75
- rbdDefaultAdminId = "admin"
75
+ rbdDefaultAdminID = "admin"
76
76
rbdDefaultAdminSecretNamespace = "default"
77
77
rbdDefaultPool = "rbd"
78
78
)
@@ -154,7 +154,7 @@ func (plugin *rbdPlugin) getAdminAndSecret(spec *volume.Spec) (string, string, e
154
154
}
155
155
156
156
if admin == "" {
157
- admin = rbdDefaultAdminId
157
+ admin = rbdDefaultAdminID
158
158
}
159
159
secret , err := parsePVSecret (adminSecretNamespace , adminSecretName , plugin .host .GetKubeClient ())
160
160
if err != nil {
@@ -182,22 +182,22 @@ func (plugin *rbdPlugin) ExpandVolumeDevice(spec *volume.Spec, newSize resource.
182
182
Image : spec .PersistentVolume .Spec .RBD .RBDImage ,
183
183
Pool : spec .PersistentVolume .Spec .RBD .RBDPool ,
184
184
plugin : plugin ,
185
- manager : & RBDUtil {},
185
+ manager : & rbdUtil {},
186
186
mounter : & mount.SafeFormatAndMount {Interface : plugin .host .GetMounter (plugin .GetPluginName ())},
187
187
exec : plugin .host .GetExec (plugin .GetPluginName ()),
188
188
},
189
189
Mon : spec .PersistentVolume .Spec .RBD .CephMonitors ,
190
- adminId : admin ,
190
+ adminID : admin ,
191
191
adminSecret : secret ,
192
192
},
193
193
}
194
194
195
195
expandedSize , err := expander .ResizeImage (oldSize , newSize )
196
196
if err != nil {
197
197
return oldSize , err
198
- } else {
199
- return expandedSize , nil
200
198
}
199
+ return expandedSize , nil
200
+
201
201
}
202
202
203
203
func (plugin * rbdPlugin ) NodeExpand (resizeOptions volume.NodeResizeOptions ) (bool , error ) {
@@ -283,9 +283,9 @@ func (plugin *rbdPlugin) createMounterFromVolumeSpecAndPod(spec *volume.Spec, po
283
283
}
284
284
285
285
return & rbdMounter {
286
- rbd : newRBD ("" , spec .Name (), img , pool , ro , plugin , & RBDUtil {}),
286
+ rbd : newRBD ("" , spec .Name (), img , pool , ro , plugin , & rbdUtil {}),
287
287
Mon : mon ,
288
- Id : id ,
288
+ ID : id ,
289
289
Keyring : keyring ,
290
290
Secret : secret ,
291
291
fsType : fstype ,
@@ -316,7 +316,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.Vol
316
316
}
317
317
318
318
// Inject real implementations here, test through the internal function.
319
- return plugin .newMounterInternal (spec , pod .UID , & RBDUtil {}, secret )
319
+ return plugin .newMounterInternal (spec , pod .UID , & rbdUtil {}, secret )
320
320
}
321
321
322
322
func (plugin * rbdPlugin ) newMounterInternal (spec * volume.Spec , podUID types.UID , manager diskManager , secret string ) (volume.Mounter , error ) {
@@ -356,7 +356,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
356
356
return & rbdMounter {
357
357
rbd : newRBD (podUID , spec .Name (), img , pool , ro , plugin , manager ),
358
358
Mon : mon ,
359
- Id : id ,
359
+ ID : id ,
360
360
Keyring : keyring ,
361
361
Secret : secret ,
362
362
fsType : fstype ,
@@ -367,7 +367,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
367
367
368
368
func (plugin * rbdPlugin ) NewUnmounter (volName string , podUID types.UID ) (volume.Unmounter , error ) {
369
369
// Inject real implementations here, test through the internal function.
370
- return plugin .newUnmounterInternal (volName , podUID , & RBDUtil {})
370
+ return plugin .newUnmounterInternal (volName , podUID , & rbdUtil {})
371
371
}
372
372
373
373
func (plugin * rbdPlugin ) newUnmounterInternal (volName string , podUID types.UID , manager diskManager ) (volume.Unmounter , error ) {
@@ -498,7 +498,7 @@ func (plugin *rbdPlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, _
498
498
}
499
499
}
500
500
501
- return plugin .newBlockVolumeMapperInternal (spec , uid , & RBDUtil {}, secret , plugin .host .GetMounter (plugin .GetPluginName ()), plugin .host .GetExec (plugin .GetPluginName ()))
501
+ return plugin .newBlockVolumeMapperInternal (spec , uid , & rbdUtil {}, secret , plugin .host .GetMounter (plugin .GetPluginName ()), plugin .host .GetExec (plugin .GetPluginName ()))
502
502
}
503
503
504
504
func (plugin * rbdPlugin ) newBlockVolumeMapperInternal (spec * volume.Spec , podUID types.UID , manager diskManager , secret string , mounter mount.Interface , exec utilexec.Interface ) (volume.BlockVolumeMapper , error ) {
@@ -537,7 +537,7 @@ func (plugin *rbdPlugin) newBlockVolumeMapperInternal(spec *volume.Spec, podUID
537
537
}
538
538
539
539
func (plugin * rbdPlugin ) NewBlockVolumeUnmapper (volName string , podUID types.UID ) (volume.BlockVolumeUnmapper , error ) {
540
- return plugin .newUnmapperInternal (volName , podUID , & RBDUtil {})
540
+ return plugin .newUnmapperInternal (volName , podUID , & rbdUtil {})
541
541
}
542
542
543
543
func (plugin * rbdPlugin ) newUnmapperInternal (volName string , podUID types.UID , manager diskManager ) (volume.BlockVolumeUnmapper , error ) {
@@ -575,21 +575,21 @@ func (plugin *rbdPlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) {
575
575
return nil , err
576
576
}
577
577
578
- return plugin .newDeleterInternal (spec , admin , secret , & RBDUtil {})
578
+ return plugin .newDeleterInternal (spec , admin , secret , & rbdUtil {})
579
579
}
580
580
581
581
func (plugin * rbdPlugin ) newDeleterInternal (spec * volume.Spec , admin , secret string , manager diskManager ) (volume.Deleter , error ) {
582
582
return & rbdVolumeDeleter {
583
583
rbdMounter : & rbdMounter {
584
584
rbd : newRBD ("" , spec .Name (), spec .PersistentVolume .Spec .RBD .RBDImage , spec .PersistentVolume .Spec .RBD .RBDPool , false , plugin , manager ),
585
585
Mon : spec .PersistentVolume .Spec .RBD .CephMonitors ,
586
- adminId : admin ,
586
+ adminID : admin ,
587
587
adminSecret : secret ,
588
588
}}, nil
589
589
}
590
590
591
591
func (plugin * rbdPlugin ) NewProvisioner (options volume.VolumeOptions ) (volume.Provisioner , error ) {
592
- return plugin .newProvisionerInternal (options , & RBDUtil {})
592
+ return plugin .newProvisionerInternal (options , & rbdUtil {})
593
593
}
594
594
595
595
func (plugin * rbdPlugin ) newProvisionerInternal (options volume.VolumeOptions , manager diskManager ) (volume.Provisioner , error ) {
@@ -633,13 +633,13 @@ func (r *rbdVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
633
633
arr := dstrings .Split (v , "," )
634
634
r .Mon = append (r .Mon , arr ... )
635
635
case "adminid" :
636
- r .adminId = v
636
+ r .adminID = v
637
637
case "adminsecretname" :
638
638
adminSecretName = v
639
639
case "adminsecretnamespace" :
640
640
adminSecretNamespace = v
641
641
case "userid" :
642
- r .Id = v
642
+ r .ID = v
643
643
case "pool" :
644
644
r .Pool = v
645
645
case "usersecretname" :
@@ -655,9 +655,8 @@ func (r *rbdVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
655
655
for _ , f := range arr {
656
656
if ! supportedFeatures .Has (f ) {
657
657
return nil , fmt .Errorf ("invalid feature %q for volume plugin %s, supported features are: %v" , f , r .plugin .GetPluginName (), supportedFeatures )
658
- } else {
659
- r .imageFeatures = append (r .imageFeatures , f )
660
658
}
659
+ r .imageFeatures = append (r .imageFeatures , f )
661
660
}
662
661
case volume .VolumeParameterFSType :
663
662
fstype = v
@@ -684,14 +683,14 @@ func (r *rbdVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
684
683
if secretName == "" && keyring == "" {
685
684
return nil , fmt .Errorf ("must specify either keyring or user secret name" )
686
685
}
687
- if r .adminId == "" {
688
- r .adminId = rbdDefaultAdminId
686
+ if r .adminID == "" {
687
+ r .adminID = rbdDefaultAdminID
689
688
}
690
689
if r .Pool == "" {
691
690
r .Pool = rbdDefaultPool
692
691
}
693
- if r .Id == "" {
694
- r .Id = r .adminId
692
+ if r .ID == "" {
693
+ r .ID = r .adminID
695
694
}
696
695
697
696
// create random image name
@@ -727,7 +726,7 @@ func (r *rbdVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
727
726
}
728
727
}
729
728
730
- rbd .RadosUser = r .Id
729
+ rbd .RadosUser = r .ID
731
730
rbd .FSType = fstype
732
731
pv .Spec .PersistentVolumeSource .RBD = rbd
733
732
pv .Spec .PersistentVolumeReclaimPolicy = r .options .PersistentVolumeReclaimPolicy
@@ -808,12 +807,12 @@ type rbdMounter struct {
808
807
* rbd
809
808
// capitalized so they can be exported in persistRBD()
810
809
Mon []string
811
- Id string
810
+ ID string
812
811
Keyring string
813
812
Secret string
814
813
fsType string
815
814
adminSecret string
816
- adminId string
815
+ adminID string
817
816
mountOptions []string
818
817
imageFormat string
819
818
imageFeatures []string
@@ -822,10 +821,10 @@ type rbdMounter struct {
822
821
823
822
var _ volume.Mounter = & rbdMounter {}
824
823
825
- func (b * rbd ) GetAttributes () volume.Attributes {
824
+ func (rbd * rbd ) GetAttributes () volume.Attributes {
826
825
return volume.Attributes {
827
- ReadOnly : b .ReadOnly ,
828
- Managed : ! b .ReadOnly ,
826
+ ReadOnly : rbd .ReadOnly ,
827
+ Managed : ! rbd .ReadOnly ,
829
828
SupportsSELinux : true ,
830
829
}
831
830
}
@@ -890,7 +889,7 @@ type rbdDiskMapper struct {
890
889
keyring string
891
890
secret string
892
891
adminSecret string
893
- adminId string
892
+ adminID string
894
893
imageFormat string
895
894
imageFeatures []string
896
895
}
@@ -930,7 +929,7 @@ func (rbd *rbd) rbdGlobalMapPath(spec *volume.Spec) (string, error) {
930
929
}
931
930
932
931
mounter := & rbdMounter {
933
- rbd : newRBD ("" , spec .Name (), img , pool , ro , rbd .plugin , & RBDUtil {}),
932
+ rbd : newRBD ("" , spec .Name (), img , pool , ro , rbd .plugin , & rbdUtil {}),
934
933
Mon : mon ,
935
934
}
936
935
return rbd .manager .MakeGlobalVDPDName (* mounter .rbd ), nil
@@ -1082,9 +1081,8 @@ func getVolumeAccessModes(spec *volume.Spec) ([]v1.PersistentVolumeAccessMode, e
1082
1081
if spec .PersistentVolume != nil {
1083
1082
if spec .PersistentVolume .Spec .RBD != nil {
1084
1083
return spec .PersistentVolume .Spec .AccessModes , nil
1085
- } else {
1086
- return nil , fmt .Errorf ("Spec does not reference a RBD volume type" )
1087
1084
}
1085
+ return nil , fmt .Errorf ("Spec does not reference a RBD volume type" )
1088
1086
}
1089
1087
1090
1088
return nil , nil
0 commit comments