sharing a common pod pvc indexer among volume controllers

This commit is contained in:
Yecheng Fu
2020-05-29 20:29:25 +08:00
parent eaf2f54bba
commit 8422044f17
8 changed files with 126 additions and 95 deletions

View File

@@ -538,12 +538,16 @@ func startGarbageCollectorController(ctx ControllerContext) (http.Handler, bool,
}
func startPVCProtectionController(ctx ControllerContext) (http.Handler, bool, error) {
go pvcprotection.NewPVCProtectionController(
pvcProtectionController, err := pvcprotection.NewPVCProtectionController(
ctx.InformerFactory.Core().V1().PersistentVolumeClaims(),
ctx.InformerFactory.Core().V1().Pods(),
ctx.ClientBuilder.ClientOrDie("pvc-protection-controller"),
utilfeature.DefaultFeatureGate.Enabled(features.StorageObjectInUseProtection),
).Run(1, ctx.Stop)
)
if err != nil {
return nil, true, fmt.Errorf("failed to start the pvc protection controller: %v", err)
}
go pvcProtectionController.Run(1, ctx.Stop)
return nil, true, nil
}