mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Move CSIVolumeFSGroupPolicy to beta
This commit is contained in:
		@@ -1873,7 +1873,12 @@ func TestCSIDriverValidationUpdate(t *testing.T) {
 | 
			
		||||
	notRequiresRepublish := false
 | 
			
		||||
=======
 | 
			
		||||
	resourceVersion := "1"
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
>>>>>>> Relax validation for CSIVolumeFSGroupPolicy
 | 
			
		||||
=======
 | 
			
		||||
	invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
	invalidFSGroupPolicy = "invalid-mode"
 | 
			
		||||
>>>>>>> Move CSIVolumeFSGroupPolicy to beta
 | 
			
		||||
	old := storage.CSIDriver{
 | 
			
		||||
		ObjectMeta: metav1.ObjectMeta{Name: driverName, ResourceVersion: resourceVersion},
 | 
			
		||||
		Spec: storage.CSIDriverSpec{
 | 
			
		||||
@@ -1887,11 +1892,27 @@ func TestCSIDriverValidationUpdate(t *testing.T) {
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Currently there is only one success case: exactly the same
 | 
			
		||||
	// as the existing object.
 | 
			
		||||
	successCases := []storage.CSIDriver{old}
 | 
			
		||||
	// Currently we compare the object against itself
 | 
			
		||||
	// and ensure updates succeed
 | 
			
		||||
	successCases := []storage.CSIDriver{
 | 
			
		||||
		old,
 | 
			
		||||
		// An invalid FSGroupPolicy should still pass
 | 
			
		||||
		{
 | 
			
		||||
			ObjectMeta: metav1.ObjectMeta{Name: driverName, ResourceVersion: resourceVersion},
 | 
			
		||||
			Spec: storage.CSIDriverSpec{
 | 
			
		||||
				AttachRequired: &attachNotRequired,
 | 
			
		||||
				PodInfoOnMount: ¬PodInfoOnMount,
 | 
			
		||||
				VolumeLifecycleModes: []storage.VolumeLifecycleMode{
 | 
			
		||||
					storage.VolumeLifecycleEphemeral,
 | 
			
		||||
					storage.VolumeLifecyclePersistent,
 | 
			
		||||
				},
 | 
			
		||||
				FSGroupPolicy: &invalidFSGroupPolicy,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	for _, csiDriver := range successCases {
 | 
			
		||||
		if errs := ValidateCSIDriverUpdate(&csiDriver, &old); len(errs) != 0 {
 | 
			
		||||
		newDriver := csiDriver.DeepCopy()
 | 
			
		||||
		if errs := ValidateCSIDriverUpdate(&csiDriver, newDriver); len(errs) != 0 {
 | 
			
		||||
			t.Errorf("expected success for %+v: %v", csiDriver, errs)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -1967,6 +1988,21 @@ func TestCSIDriverValidationUpdate(t *testing.T) {
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "FSGroupPolicy invalidated",
 | 
			
		||||
			modify: func(new *storage.CSIDriver) {
 | 
			
		||||
				invalidFSGroupPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
				invalidFSGroupPolicy = "invalid"
 | 
			
		||||
				new.Spec.FSGroupPolicy = &invalidFSGroupPolicy
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "FSGroupPolicy changed",
 | 
			
		||||
			modify: func(new *storage.CSIDriver) {
 | 
			
		||||
				fileFSGroupPolicy := storage.FileFSGroupPolicy
 | 
			
		||||
				new.Spec.FSGroupPolicy = &fileFSGroupPolicy
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, test := range errorCases {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user