diff --git a/pkg/plan/bootstrap.go b/pkg/plan/bootstrap.go index 72d5881..5d7ed83 100644 --- a/pkg/plan/bootstrap.go +++ b/pkg/plan/bootstrap.go @@ -111,10 +111,18 @@ func (p *plan) addInstructions(cfg *config.Config, dataDir string) error { return err } + if err := p.addInstruction(rancher.ToScaleDownFleetControllerInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil { + return err + } + if err := p.addInstruction(rancher.ToUpdateClientSecretInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil { return err } + if err := p.addInstruction(rancher.ToScaleUpFleetControllerInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil { + return err + } + if err := p.addInstruction(resources.ToInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion, dataDir)); err != nil { return err } diff --git a/pkg/rancher/wait.go b/pkg/rancher/wait.go index a2818f4..e17e7c3 100644 --- a/pkg/rancher/wait.go +++ b/pkg/rancher/wait.go @@ -95,3 +95,31 @@ func ToUpdateClientSecretInstruction(imageOverride, systemDefaultRegistry, k8sVe Command: cmd, }, nil } + +func ToScaleDownFleetControllerInstruction(imageOverride, systemDefaultRegistry, k8sVersion string) (*applyinator.Instruction, error) { + cmd, err := self.Self() + if err != nil { + return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err) + } + return &applyinator.Instruction{ + Name: "scale-down-fleet-controller", + SaveOutput: true, + Args: []string{"retry", kubectl.Command(k8sVersion), "-n", "cattle-fleet-system", "scale", "--replicas", "0", "deploy/fleet-controller"}, + Env: kubectl.Env(k8sVersion), + Command: cmd, + }, nil +} + +func ToScaleUpFleetControllerInstruction(imageOverride, systemDefaultRegistry, k8sVersion string) (*applyinator.Instruction, error) { + cmd, err := self.Self() + if err != nil { + return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err) + } + return &applyinator.Instruction{ + Name: "scale-up-fleet-controller", + SaveOutput: true, + Args: []string{"retry", kubectl.Command(k8sVersion), "-n", "cattle-fleet-system", "scale", "--replicas", "1", "deploy/fleet-controller"}, + Env: kubectl.Env(k8sVersion), + Command: cmd, + }, nil +}