Skip to content

Commit

Permalink
ingeg: Group Autopilot together
Browse files Browse the repository at this point in the history
TODO: Let inttests run for this
Does this break some startup behavior?

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Oct 1, 2024
1 parent 0d94b6c commit 6b1a253
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions cmd/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,6 @@ func (c *command) start(ctx context.Context) error {
))
}

if !slices.Contains(c.DisableComponents, constant.AutopilotComponentName) {
logrus.Debug("starting manifest saver")
manifestsSaver, err := controller.NewManifestsSaver("autopilot", c.K0sVars.DataDir)
if err != nil {
logrus.Warnf("failed to initialize reconcilers manifests saver: %s", err.Error())
return err
}
clusterComponents.Add(ctx, controller.NewCRD(manifestsSaver, "autopilot"))
}

if !slices.Contains(c.DisableComponents, constant.APIEndpointReconcilerComponentName) && nodeConfig.Spec.API.ExternalAddress != "" {
clusterComponents.Add(ctx, controller.NewEndpointReconciler(
nodeConfig,
Expand Down Expand Up @@ -557,12 +547,21 @@ func (c *command) start(ctx context.Context) error {
logrus.Info("Telemetry is disabled")
}

clusterComponents.Add(ctx, &controller.Autopilot{
K0sVars: c.K0sVars,
KubeletExtraArgs: c.KubeletExtraArgs,
AdminClientFactory: adminClientFactory,
EnableWorker: c.EnableWorker,
})
if !slices.Contains(c.DisableComponents, constant.AutopilotComponentName) {
logrus.Debug("starting manifest saver")
manifestsSaver, err := controller.NewManifestsSaver("autopilot", c.K0sVars.DataDir)
if err != nil {
logrus.Warnf("failed to initialize reconcilers manifests saver: %s", err.Error())
return err
}
clusterComponents.Add(ctx, controller.NewCRD(manifestsSaver, "autopilot"))
clusterComponents.Add(ctx, &controller.Autopilot{
K0sVars: c.K0sVars,
KubeletExtraArgs: c.KubeletExtraArgs,
AdminClientFactory: adminClientFactory,
EnableWorker: c.EnableWorker,
})
}

apClientFactory, err := apclient.NewClientFactory(adminClientFactory.GetRESTConfig())
if err != nil {
Expand Down

0 comments on commit 6b1a253

Please sign in to comment.