@@ -448,10 +448,6 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
448448 ))
449449 }
450450
451- if ! slices .Contains (flags .DisableComponents , constant .AutopilotComponentName ) {
452- clusterComponents .Add (ctx , controller .NewCRD (c .K0sVars .ManifestsDir , "autopilot" ))
453- }
454-
455451 if enableK0sEndpointReconciler {
456452 clusterComponents .Add (ctx , controller .NewEndpointReconciler (
457453 nodeConfig ,
@@ -516,13 +512,15 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
516512 clusterComponents .Add (ctx , metrics )
517513 }
518514
515+ disableAutopilot := slices .Contains (flags .DisableComponents , constant .AutopilotComponentName )
516+
519517 if ! slices .Contains (flags .DisableComponents , constant .WorkerConfigComponentName ) {
520518 // Create new dedicated leasepool for worker config reconciler
521519 leaseName := fmt .Sprintf ("k0s-%s-%s" , constant .WorkerConfigComponentName , constant .KubernetesMajorMinorVersion )
522520 workerConfigLeasePool := leaderelector .NewLeasePool (c .K0sVars .InvocationID , adminClientFactory , leaseName )
523521 clusterComponents .Add (ctx , workerConfigLeasePool )
524522
525- reconciler , err := workerconfig .NewReconciler (c .K0sVars , nodeConfig .Spec , adminClientFactory , workerConfigLeasePool , enableKonnectivity )
523+ reconciler , err := workerconfig .NewReconciler (c .K0sVars , nodeConfig .Spec , adminClientFactory , workerConfigLeasePool , enableKonnectivity , disableAutopilot )
526524 if err != nil {
527525 return err
528526 }
@@ -532,7 +530,7 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
532530 if ! slices .Contains (flags .DisableComponents , constant .SystemRBACComponentName ) {
533531 clusterComponents .Add (ctx , & controller.SystemRBAC {
534532 Clients : adminClientFactory ,
535- ExcludeAutopilot : slices . Contains ( flags . DisableComponents , constant . AutopilotComponentName ) ,
533+ ExcludeAutopilot : disableAutopilot ,
536534 })
537535 }
538536
@@ -577,13 +575,16 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
577575 logrus .Info ("Telemetry is disabled" )
578576 }
579577
580- clusterComponents .Add (ctx , & controller.Autopilot {
581- K0sVars : c .K0sVars ,
582- KubeletExtraArgs : c .KubeletExtraArgs ,
583- KubeAPIPort : nodeConfig .Spec .API .Port ,
584- AdminClientFactory : adminClientFactory ,
585- Workloads : controllerMode .WorkloadsEnabled (),
586- })
578+ if ! disableAutopilot {
579+ clusterComponents .Add (ctx , controller .NewCRD (c .K0sVars .ManifestsDir , "autopilot" ))
580+ clusterComponents .Add (ctx , & controller.Autopilot {
581+ K0sVars : c .K0sVars ,
582+ KubeletExtraArgs : c .KubeletExtraArgs ,
583+ KubeAPIPort : nodeConfig .Spec .API .Port ,
584+ AdminClientFactory : adminClientFactory ,
585+ Workloads : controllerMode .WorkloadsEnabled (),
586+ })
587+ }
587588
588589 if ! slices .Contains (flags .DisableComponents , constant .UpdateProberComponentName ) {
589590 clusterComponents .Add (ctx , controller .NewUpdateProber (
0 commit comments