diff --git a/cmd/controller-manager/app/controllers.go b/cmd/controller-manager/app/controllers.go index 54ffd9ffb..709a6999b 100644 --- a/cmd/controller-manager/app/controllers.go +++ b/cmd/controller-manager/app/controllers.go @@ -23,7 +23,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/kubefed/pkg/controller/util" - "kubesphere.io/kubesphere/pkg/controller/storage/snapshot" + "kubesphere.io/kubesphere/pkg/controller/storage/snapshotclass" iamv1alpha2 "kubesphere.io/api/iam/v1alpha2" @@ -103,7 +103,7 @@ func addControllers( kubernetesInformer.Storage().V1beta1().CSIDrivers(), ) - volumeSnapshotController := snapshot.NewController( + volumeSnapshotController := snapshotclass.NewController( kubernetesInformer.Storage().V1().StorageClasses(), client.Snapshot().SnapshotV1beta1().VolumeSnapshotClasses(), informerFactory.SnapshotSharedInformerFactory().Snapshot().V1beta1().VolumeSnapshotClasses(), diff --git a/pkg/controller/storage/capability/capability_controller.go b/pkg/controller/storage/capability/capability_controller.go index bdbaef632..8d205b312 100644 --- a/pkg/controller/storage/capability/capability_controller.go +++ b/pkg/controller/storage/capability/capability_controller.go @@ -205,10 +205,10 @@ func (c *StorageCapabilityController) syncHandler(key string) error { // Get StorageClass storageClass, err := c.storageClassLister.Get(name) - //Cloning and volumeSnapshot support only available for CSI drivers. + // Cloning and volumeSnapshot support only available for CSI drivers. isCSIStorage := c.hasCSIDriver(storageClass) - //Annotate storageClass + // Annotate storageClass storageClassUpdated := storageClass.DeepCopy() err = c.addStorageClassSnapshotAnnotation(storageClassUpdated, isCSIStorage) if err != nil { diff --git a/pkg/controller/storage/capability/capability_controller_test.go b/pkg/controller/storage/capability/capability_controller_test.go index d54ab3d66..0ebb7d684 100644 --- a/pkg/controller/storage/capability/capability_controller_test.go +++ b/pkg/controller/storage/capability/capability_controller_test.go @@ -105,7 +105,6 @@ func (f *fixture) runController(scName string, startInformers bool, expectError var actions []core.Action actions = append(actions, f.k8sClient.Actions()...) - //actions = append(actions, f.ksClient.Actions()...) filerActions := filterInformerActions(actions) if len(filerActions) != len(f.actions) { f.t.Errorf("count of actions: differ (-got, +want): %s", cmp.Diff(filerActions, f.actions)) @@ -241,15 +240,15 @@ func TestStorageClassHadAnnotation(t *testing.T) { storageClassUpdate := storageClass.DeepCopy() csiDriver := newCSIDriver("csi.example.com") - //Object exist + // Object exist fixture.storageObjects = append(fixture.storageObjects, storageClass) fixture.storageClassLister = append(fixture.storageClassLister, storageClass) fixture.csiDriverLister = append(fixture.csiDriverLister, csiDriver) - //Action expected + // Action expected fixture.expectUpdateStorageClassAction(storageClassUpdate) - //Run test + // Run test fixture.run(getKey(storageClass, t)) } @@ -261,14 +260,14 @@ func TestStorageClassHadOneAnnotation(t *testing.T) { storageClassUpdate.Annotations[annotationAllowClone] = "true" csiDriver := newCSIDriver("csi.example.com") - //Object exist + // Object exist fixture.storageObjects = append(fixture.storageObjects, storageClass) fixture.storageClassLister = append(fixture.storageClassLister, storageClass) fixture.csiDriverLister = append(fixture.csiDriverLister, csiDriver) - //Action expected + // Action expected fixture.expectUpdateStorageClassAction(storageClassUpdate) - //Run test + // Run test fixture.run(getKey(storageClass, t)) } diff --git a/pkg/controller/storage/snapshot/snapshot_controller.go b/pkg/controller/storage/snapshotclass/snapshotclass_controller.go similarity index 98% rename from pkg/controller/storage/snapshot/snapshot_controller.go rename to pkg/controller/storage/snapshotclass/snapshotclass_controller.go index 696d10da4..e341ebc9c 100644 --- a/pkg/controller/storage/snapshot/snapshot_controller.go +++ b/pkg/controller/storage/snapshotclass/snapshotclass_controller.go @@ -16,7 +16,7 @@ */ -package snapshot +package snapshotclass import ( "context" @@ -56,8 +56,8 @@ type VolumeSnapshotClassController struct { snapshotClassWorkQueue workqueue.RateLimitingInterface } -//This controller is responseible to watch StorageClass -//When storageClass has created ,create snapshot class +// This controller is responsible to watch StorageClass +// When storageClass has created ,create snapshot class func NewController( storageClassInformer storageinformersv1.StorageClassInformer, snapshotClassClient snapshotclient.VolumeSnapshotClassInterface, diff --git a/pkg/controller/storage/snapshot/snapshot_controller_test.go b/pkg/controller/storage/snapshotclass/snapshotclass_controller_test.go similarity index 99% rename from pkg/controller/storage/snapshot/snapshot_controller_test.go rename to pkg/controller/storage/snapshotclass/snapshotclass_controller_test.go index 04ae8e1fb..db8ea4643 100644 --- a/pkg/controller/storage/snapshot/snapshot_controller_test.go +++ b/pkg/controller/storage/snapshotclass/snapshotclass_controller_test.go @@ -16,7 +16,7 @@ */ -package snapshot +package snapshotclass import ( "reflect" @@ -108,7 +108,6 @@ func (f *fixture) runController(scName string, startInformers bool, expectError var actions []core.Action actions = append(actions, f.snapshotClassClient.Actions()...) actions = append(actions, f.k8sClient.Actions()...) - //actions = append(actions, f.ksClient.Actions()...) filerActions := filterInformerActions(actions) if len(filerActions) != len(f.actions) { f.t.Errorf("count of actions: differ (-got, +want): %s", cmp.Diff(filerActions, f.actions))