Skip to content

Commit 0f29e9e

Browse files
authored
fix: delete correct cluster-autoscaler HCP (#859)
**What problem does this PR solve?**: The HCP will always be deployed in the management cluster's namespace. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent cbb5575 commit 0f29e9e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/handlers/generic/lifecycle/clusterautoscaler/strategy_helmaddon.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,18 @@ func (s helmAddonStrategy) delete(
7777
cluster *clusterv1.Cluster,
7878
log logr.Logger,
7979
) error {
80+
// The cluster-autoscaler is different from other addons.
81+
// It requires all resources to be created in the management cluster,
82+
// which means creating the HelmChartProxy always targeting the management cluster.
83+
targetCluster, err := findTargetCluster(ctx, s.client, cluster)
84+
if err != nil {
85+
return err
86+
}
87+
8088
hcp := &caaphv1.HelmChartProxy{
8189
ObjectMeta: metav1.ObjectMeta{
8290
Name: addonResourceNameForCluster(cluster),
83-
Namespace: cluster.Namespace,
91+
Namespace: targetCluster.Namespace,
8492
},
8593
}
8694

0 commit comments

Comments
 (0)