Skip to content

Commit 7cab771

Browse files
authored
chore: remove the update permissions for VolumeSnapshotClass (#9512)
1 parent d0685cf commit 7cab771

6 files changed

Lines changed: 1 addition & 56 deletions

File tree

config/rbac/role.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -977,20 +977,9 @@ rules:
977977
resources:
978978
- volumesnapshotclasses
979979
verbs:
980-
- create
981-
- delete
982980
- get
983981
- list
984-
- patch
985-
- update
986982
- watch
987-
- apiGroups:
988-
- snapshot.storage.k8s.io
989-
resources:
990-
- volumesnapshotclasses/finalizers
991-
verbs:
992-
- patch
993-
- update
994983
- apiGroups:
995984
- snapshot.storage.k8s.io
996985
resources:

controllers/dataprotection/backup_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ type BackupReconciler struct {
7676
// +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete
7777
// +kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshots,verbs=get;list;watch;create;update;patch;delete
7878
// +kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshots/finalizers,verbs=update;patch
79-
// +kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotclasses,verbs=get;list;watch;create;update;patch;delete
80-
// +kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotclasses/finalizers,verbs=update;patch
79+
// +kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotclasses,verbs=get;list;watch
8180

8281
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch;create;update;patch;delete
8382
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete

controllers/dataprotection/log_collection_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ var _ = Describe("Log Collection Controller", func() {
6565
testapps.ClearResources(&testCtx, generics.StorageClassSignature, ml)
6666
testapps.ClearResourcesWithRemoveFinalizerOption(&testCtx, generics.PersistentVolumeSignature, true, ml)
6767
testapps.ClearResources(&testCtx, generics.StorageProviderSignature, ml)
68-
testapps.ClearResources(&testCtx, generics.VolumeSnapshotClassSignature, ml)
6968
}
7069

7170
BeforeEach(func() {

deploy/helm/config/rbac/role.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -977,20 +977,9 @@ rules:
977977
resources:
978978
- volumesnapshotclasses
979979
verbs:
980-
- create
981-
- delete
982980
- get
983981
- list
984-
- patch
985-
- update
986982
- watch
987-
- apiGroups:
988-
- snapshot.storage.k8s.io
989-
resources:
990-
- volumesnapshotclasses/finalizers
991-
verbs:
992-
- patch
993-
- update
994983
- apiGroups:
995984
- snapshot.storage.k8s.io
996985
resources:

pkg/dataprotection/backup/request_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ var _ = Describe("Request Test", func() {
7777
testapps.ClearResources(&testCtx, generics.StorageClassSignature, ml)
7878
testapps.ClearResourcesWithRemoveFinalizerOption(&testCtx, generics.BackupRepoSignature, true, ml)
7979
testapps.ClearResources(&testCtx, generics.StorageProviderSignature, ml)
80-
testapps.ClearResources(&testCtx, generics.VolumeSnapshotClassSignature, ml)
8180
testapps.ClearResourcesWithRemoveFinalizerOption(&testCtx, generics.PersistentVolumeSignature, true, ml)
8281
}
8382

pkg/testutil/apps/native_object_util.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
package apps
2121

2222
import (
23-
vsv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
2423
corev1 "k8s.io/api/core/v1"
2524
storagev1 "k8s.io/api/storage/v1"
26-
"k8s.io/apimachinery/pkg/api/resource"
2725
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2826
"k8s.io/kubectl/pkg/util/storage"
2927
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -52,23 +50,6 @@ func NewConfigMap(namespace, name string, options ...any) *corev1.ConfigMap {
5250
return cm
5351
}
5452

55-
func SetConfigMapData(key string, value string) func(*corev1.ConfigMap) {
56-
return func(configMap *corev1.ConfigMap) {
57-
configMap.Data[key] = value
58-
}
59-
}
60-
61-
func NewPVC(size string) corev1.PersistentVolumeClaimSpec {
62-
return corev1.PersistentVolumeClaimSpec{
63-
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
64-
Resources: corev1.VolumeResourceRequirements{
65-
Requests: corev1.ResourceList{
66-
corev1.ResourceStorage: resource.MustParse(size),
67-
},
68-
},
69-
}
70-
}
71-
7253
func CreateStorageClass(testCtx *testutil.TestContext, storageClassName string,
7354
allowVolumeExpansion bool) *storagev1.StorageClass {
7455
storageClass := &storagev1.StorageClass{
@@ -83,14 +64,3 @@ func CreateStorageClass(testCtx *testutil.TestContext, storageClassName string,
8364
}
8465
return CreateK8sResource(testCtx, storageClass).(*storagev1.StorageClass)
8566
}
86-
87-
func CreateVolumeSnapshotClass(testCtx *testutil.TestContext) {
88-
volumeSnapshotClass := &vsv1.VolumeSnapshotClass{
89-
ObjectMeta: metav1.ObjectMeta{
90-
Name: "default-vs",
91-
},
92-
Driver: testutil.DefaultCSIDriver,
93-
DeletionPolicy: vsv1.VolumeSnapshotContentDelete,
94-
}
95-
CreateK8sResource(testCtx, volumeSnapshotClass)
96-
}

0 commit comments

Comments
 (0)