@@ -447,10 +447,6 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
447447 ))
448448 }
449449
450- if ! slices .Contains (flags .DisableComponents , constant .AutopilotComponentName ) {
451- clusterComponents .Add (ctx , controller .NewCRD (c .K0sVars .ManifestsDir , "autopilot" ))
452- }
453-
454450 if enableK0sEndpointReconciler {
455451 clusterComponents .Add (ctx , controller .NewEndpointReconciler (
456452 nodeConfig ,
@@ -512,13 +508,15 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
512508 clusterComponents .Add (ctx , metrics )
513509 }
514510
511+ disableAutopilot := slices .Contains (flags .DisableComponents , constant .AutopilotComponentName )
512+
515513 if ! slices .Contains (flags .DisableComponents , constant .WorkerConfigComponentName ) {
516514 // Create new dedicated leasepool for worker config reconciler
517515 leaseName := fmt .Sprintf ("k0s-%s-%s" , constant .WorkerConfigComponentName , constant .KubernetesMajorMinorVersion )
518516 workerConfigLeasePool := leaderelector .NewLeasePool (c .K0sVars .InvocationID , adminClientFactory , leaseName )
519517 clusterComponents .Add (ctx , workerConfigLeasePool )
520518
521- reconciler , err := workerconfig .NewReconciler (c .K0sVars , nodeConfig .Spec , adminClientFactory , workerConfigLeasePool , enableKonnectivity )
519+ reconciler , err := workerconfig .NewReconciler (c .K0sVars , nodeConfig .Spec , adminClientFactory , workerConfigLeasePool , enableKonnectivity , disableAutopilot )
522520 if err != nil {
523521 return err
524522 }
@@ -528,7 +526,7 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
528526 if ! slices .Contains (flags .DisableComponents , constant .SystemRBACComponentName ) {
529527 clusterComponents .Add (ctx , & controller.SystemRBAC {
530528 Clients : adminClientFactory ,
531- ExcludeAutopilot : slices . Contains ( flags . DisableComponents , constant . AutopilotComponentName ) ,
529+ ExcludeAutopilot : disableAutopilot ,
532530 })
533531 }
534532
@@ -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