Merge pull request #27128 from markturansky/disable_provisioning
Automatic merge from submit-queue Allow disabling of dynamic provisioning Allow administrators to opt-out of dynamic provisioning. Provisioning is still on by default, which is the current behavior. Per a conversation with @jsafrane, a boolean toggle was added and plumbed through into the controller. Deliberate disabling will simply return nil from `provisionClaim` whereas a misconfigured provisioner will continue on and generate error events for the PVC. @kubernetes/rh-storage @saad-ali @thockin @abhgupta
This commit is contained in:
@@ -555,7 +555,7 @@ func newVolumeReactor(client *fake.Clientset, ctrl *PersistentVolumeController,
|
||||
return reactor
|
||||
}
|
||||
|
||||
func newTestController(kubeClient clientset.Interface, volumeSource, claimSource cache.ListerWatcher) *PersistentVolumeController {
|
||||
func newTestController(kubeClient clientset.Interface, volumeSource, claimSource cache.ListerWatcher, enableDynamicProvisioning bool) *PersistentVolumeController {
|
||||
if volumeSource == nil {
|
||||
volumeSource = framework.NewFakeControllerSource()
|
||||
}
|
||||
@@ -572,6 +572,7 @@ func newTestController(kubeClient clientset.Interface, volumeSource, claimSource
|
||||
volumeSource,
|
||||
claimSource,
|
||||
record.NewFakeRecorder(1000), // event recorder
|
||||
enableDynamicProvisioning,
|
||||
)
|
||||
|
||||
// Speed up the test
|
||||
@@ -830,7 +831,7 @@ func runSyncTests(t *testing.T, tests []controllerTest) {
|
||||
|
||||
// Initialize the controller
|
||||
client := &fake.Clientset{}
|
||||
ctrl := newTestController(client, nil, nil)
|
||||
ctrl := newTestController(client, nil, nil, true)
|
||||
reactor := newVolumeReactor(client, ctrl, nil, nil, test.errors)
|
||||
for _, claim := range test.initialClaims {
|
||||
ctrl.claims.Add(claim)
|
||||
@@ -874,7 +875,7 @@ func runMultisyncTests(t *testing.T, tests []controllerTest) {
|
||||
|
||||
// Initialize the controller
|
||||
client := &fake.Clientset{}
|
||||
ctrl := newTestController(client, nil, nil)
|
||||
ctrl := newTestController(client, nil, nil, true)
|
||||
reactor := newVolumeReactor(client, ctrl, nil, nil, test.errors)
|
||||
for _, claim := range test.initialClaims {
|
||||
ctrl.claims.Add(claim)
|
||||
|
Reference in New Issue
Block a user