Skip to content

Commit 492bdf0

Browse files
committed
feat: remove useless steps
Signed-off-by: PoAn Yang <[email protected]>
1 parent 8f08192 commit 492bdf0

File tree

2 files changed

+0
-120
lines changed

2 files changed

+0
-120
lines changed

pkg/plan/bootstrap.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,34 +119,6 @@ func (p *plan) addInstructions(cfg *config.Config, dataDir string) error {
119119
return err
120120
}
121121

122-
if err := p.addInstruction(rancher.ToScaleDownFleetControllerInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil {
123-
return err
124-
}
125-
126-
if err := p.addInstruction(rancher.ToUpdateClientSecretInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil {
127-
return err
128-
}
129-
130-
if err := p.addInstruction(rancher.ToScaleUpFleetControllerInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil {
131-
return err
132-
}
133-
134-
// Above Rancher v2.9.x, we cannot patch provisioing cluster with empty rkeConfig,
135-
// so we need to delete the webhook validation configuration.
136-
if semver.Compare(cfg.RancherVersion, "v2.9.0") >= 0 {
137-
if err := p.addInstruction(rancher.ToDeleteRancherWebhookValidationConfiguration(k8sVersion)); err != nil {
138-
return err
139-
}
140-
}
141-
142-
// Patch local provisioning cluster status before installing bootstrap resources,
143-
// so bundles can be created first and managed charts can be installed smoothly.
144-
if semver.Compare(cfg.RancherVersion, "v2.8.0") >= 0 {
145-
if err := p.addInstruction(rancher.PatchLocalProvisioningClusterStatus(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil {
146-
return err
147-
}
148-
}
149-
150122
// If clusterrepo check fails, it waits 5 minutes and retries.
151123
// Install harvester-cluster-repo deployment before clusterrepo,
152124
// so we can avoid the 5 minutes waiting time.
@@ -162,12 +134,6 @@ func (p *plan) addInstructions(cfg *config.Config, dataDir string) error {
162134
return err
163135
}
164136

165-
if semver.Compare(cfg.RancherVersion, "v2.9.0") >= 0 {
166-
if err := p.addInstruction(rancher.ToRestartRancherWebhookInstruction(k8sVersion)); err != nil {
167-
return err
168-
}
169-
}
170-
171137
if err := p.addInstruction(rancher.ToWaitSUCInstruction(cfg.RancherInstallerImage, cfg.SystemDefaultRegistry, k8sVersion)); err != nil {
172138
return err
173139
}

pkg/rancher/wait.go

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -82,76 +82,6 @@ func ToWaitClusterClientSecretInstruction(_, _, k8sVersion string) (*applyinator
8282
return instruction, nil
8383
}
8484

85-
func ToUpdateClientSecretInstruction(_, _, k8sVersion string) (*applyinator.OneTimeInstruction, error) {
86-
cmd, err := self.Self()
87-
if err != nil {
88-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
89-
}
90-
instruction := &applyinator.OneTimeInstruction{}
91-
instruction.Name = "update-client-secret"
92-
instruction.SaveOutput = true
93-
instruction.Args = []string{"update-client-secret"}
94-
instruction.Env = kubectl.Env(k8sVersion)
95-
instruction.Command = cmd
96-
return instruction, nil
97-
}
98-
99-
func ToScaleDownFleetControllerInstruction(_, _, k8sVersion string) (*applyinator.OneTimeInstruction, error) {
100-
cmd, err := self.Self()
101-
if err != nil {
102-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
103-
}
104-
instruction := &applyinator.OneTimeInstruction{}
105-
instruction.Name = "scale-down-fleet-controller"
106-
instruction.SaveOutput = true
107-
instruction.Args = []string{"retry", kubectl.Command(k8sVersion), "-n", "cattle-fleet-system", "scale", "--replicas", "0", "deploy/fleet-controller"}
108-
instruction.Env = kubectl.Env(k8sVersion)
109-
instruction.Command = cmd
110-
return instruction, nil
111-
}
112-
113-
func ToScaleUpFleetControllerInstruction(_, _, k8sVersion string) (*applyinator.OneTimeInstruction, error) {
114-
cmd, err := self.Self()
115-
if err != nil {
116-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
117-
}
118-
instruction := &applyinator.OneTimeInstruction{}
119-
instruction.Name = "scale-up-fleet-controller"
120-
instruction.SaveOutput = true
121-
instruction.Args = []string{"retry", kubectl.Command(k8sVersion), "-n", "cattle-fleet-system", "scale", "--replicas", "1", "deploy/fleet-controller"}
122-
instruction.Env = kubectl.Env(k8sVersion)
123-
instruction.Command = cmd
124-
return instruction, nil
125-
}
126-
127-
func ToDeleteRancherWebhookValidationConfiguration(k8sVersion string) (*applyinator.OneTimeInstruction, error) {
128-
cmd, err := self.Self()
129-
if err != nil {
130-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
131-
}
132-
instruction := &applyinator.OneTimeInstruction{}
133-
instruction.Name = "delete-rancher-webhook-validation-configuration"
134-
instruction.SaveOutput = true
135-
instruction.Args = []string{"retry", kubectl.Command(k8sVersion), "delete", "validatingwebhookconfiguration", "rancher.cattle.io"}
136-
instruction.Env = kubectl.Env(k8sVersion)
137-
instruction.Command = cmd
138-
return instruction, nil
139-
}
140-
141-
func ToRestartRancherWebhookInstruction(k8sVersion string) (*applyinator.OneTimeInstruction, error) {
142-
cmd, err := self.Self()
143-
if err != nil {
144-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
145-
}
146-
instruction := &applyinator.OneTimeInstruction{}
147-
instruction.Name = "restart-rancher-webhook"
148-
instruction.SaveOutput = true
149-
instruction.Args = []string{"retry", kubectl.Command(k8sVersion), "-n", "cattle-system", "rollout", "restart", "deploy/rancher-webhook"}
150-
instruction.Env = kubectl.Env(k8sVersion)
151-
instruction.Command = cmd
152-
return instruction, nil
153-
}
154-
15585
func ToCreateStvAggregationSecret(k8sVersion string) (*applyinator.OneTimeInstruction, error) {
15686
cmd, err := self.Self()
15787
if err != nil {
@@ -165,19 +95,3 @@ func ToCreateStvAggregationSecret(k8sVersion string) (*applyinator.OneTimeInstru
16595
instruction.Command = cmd
16696
return instruction, nil
16797
}
168-
169-
// Needs to patch status subresource
170-
// k patch cluster.provisioning local -n fleet-local --subresource=status --type=merge --patch '{"status":{"fleetWorkspaceName": "fleet-local"}}'
171-
func PatchLocalProvisioningClusterStatus(_, _, k8sVersion string) (*applyinator.OneTimeInstruction, error) {
172-
cmd, err := self.Self()
173-
if err != nil {
174-
return nil, fmt.Errorf("resolving location of %s: %w", os.Args[0], err)
175-
}
176-
instruction := &applyinator.OneTimeInstruction{}
177-
instruction.Name = "patch-provisioning-cluster-status"
178-
instruction.SaveOutput = true
179-
instruction.Args = []string{"retry", kubectl.Command(k8sVersion), "-n", "fleet-local", "patch", "cluster.provisioning", "local", "--subresource=status", "--type=merge", "--patch", "{\"status\":{\"fleetWorkspaceName\": \"fleet-local\"}}"}
180-
instruction.Env = kubectl.Env(k8sVersion)
181-
instruction.Command = cmd
182-
return instruction, nil
183-
}

0 commit comments

Comments
 (0)