@@ -29,16 +29,22 @@ func StartCloudNodeLifecycleControllerWrapper(initContext app.ControllerInitCont
29
29
30
30
//nolint:gocritic // need to follow upstream function signature
31
31
func startCloudNodeLifecycleController (ctx context.Context ,
32
- initContext app.ControllerInitContext ,
32
+ _ app.ControllerInitContext ,
33
33
controlexContext controllermanagerapp.ControllerContext ,
34
34
completedConfig * config.CompletedConfig ,
35
35
cloud cloudprovider.Interface ,
36
36
) (controller.Interface , bool , error ) {
37
+ // Use CCM's kubeconfig to create a clientset for the custom node lifecycle controller because we need permissions
38
+ // to list and delete VolumeAttachments
39
+ ccmClientSet , err := clientset .NewForConfig (completedConfig .Kubeconfig )
40
+ if err != nil {
41
+ return nil , false , fmt .Errorf ("failed to create clientset from ccm kubeconfig: %w" , err )
42
+ }
43
+
37
44
// Start the cloudNodeLifecycleController
38
45
cloudNodeLifecycleController , err := NewCloudNodeLifecycleController (
39
46
completedConfig .SharedInformers .Core ().V1 ().Nodes (),
40
- // cloud node lifecycle controller uses existing cluster role from node-controller
41
- completedConfig .ClientBuilder .ClientOrDie (initContext .ClientName ),
47
+ ccmClientSet ,
42
48
cloud ,
43
49
completedConfig .ComponentConfig .KubeCloudShared .NodeMonitorPeriod .Duration ,
44
50
)
0 commit comments