@@ -161,8 +161,8 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
161161
162162 // usually this is only nil in unit tests
163163 if restConfig != nil {
164- restConfig .QPS = r .RestConfigSettings . QPS
165- restConfig .Burst = r .RestConfigSettings . Burst
164+ restConfig .QPS = r .QPS
165+ restConfig .Burst = r .Burst
166166
167167 clientSet , err := kubernetes .NewForConfig (restConfig )
168168 if err != nil {
@@ -860,52 +860,51 @@ check:
860860
861861 in .clusterAddon .SetStagePhase (stage .Name , stage .Action , csov1alpha1 .StagePhaseWaitingForPostCondition )
862862 goto check
863- } else {
864- // Delete part
865- logger .V (1 ).Info ("starting to template helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
866- helmTemplate , err := helmTemplateNewClusterStack (in , stage .Name )
867- if err != nil {
868- conditions .MarkFalse (
869- in .clusterAddon ,
870- csov1alpha1 .HelmChartTemplatedCondition ,
871- csov1alpha1 .TemplateNewClusterStackFailedReason ,
872- clusterv1 .ConditionSeverityError ,
873- "failed to template new helm chart: %s" , err .Error (),
874- )
863+ }
864+ // Delete part
865+ logger .V (1 ).Info ("starting to template helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
866+ helmTemplate , err := helmTemplateNewClusterStack (in , stage .Name )
867+ if err != nil {
868+ conditions .MarkFalse (
869+ in .clusterAddon ,
870+ csov1alpha1 .HelmChartTemplatedCondition ,
871+ csov1alpha1 .TemplateNewClusterStackFailedReason ,
872+ clusterv1 .ConditionSeverityError ,
873+ "failed to template new helm chart: %s" , err .Error (),
874+ )
875875
876- return false , nil
877- }
878- logger .V (1 ).Info ("finished templating helm chart and starting to delete helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
876+ return false , nil
877+ }
878+ logger .V (1 ).Info ("finished templating helm chart and starting to delete helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
879879
880- deletedResources , shouldRequeue , err := in .kubeClient .DeleteNewClusterStack (ctx , helmTemplate )
881- if err != nil {
882- conditions .MarkFalse (
883- in .clusterAddon ,
884- csov1alpha1 .HelmChartDeletedCondition ,
885- csov1alpha1 .FailedToDeleteObjectsReason ,
886- clusterv1 .ConditionSeverityInfo ,
887- "failed to successfully delete helm chart: %q" , stage .Name ,
888- )
880+ deletedResources , shouldRequeue , err := in .kubeClient .DeleteNewClusterStack (ctx , helmTemplate )
881+ if err != nil {
882+ conditions .MarkFalse (
883+ in .clusterAddon ,
884+ csov1alpha1 .HelmChartDeletedCondition ,
885+ csov1alpha1 .FailedToDeleteObjectsReason ,
886+ clusterv1 .ConditionSeverityInfo ,
887+ "failed to successfully delete helm chart: %q" , stage .Name ,
888+ )
889889
890- return false , fmt .Errorf ("failed to delete objects from cluster addon Helm chart: %w" , err )
891- }
892- if shouldRequeue {
893- return true , nil
894- }
890+ return false , fmt .Errorf ("failed to delete objects from cluster addon Helm chart: %w" , err )
891+ }
892+ if shouldRequeue {
893+ return true , nil
894+ }
895895
896- // This is for the current stage objects and will be removed once done.
897- in .clusterAddon .Status .Resources = deletedResources
898- logger .V (1 ).Info ("finished deleting helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
896+ // This is for the current stage objects and will be removed once done.
897+ in .clusterAddon .Status .Resources = deletedResources
898+ logger .V (1 ).Info ("finished deleting helm chart" , "clusterStack" , in .clusterAddon .Spec .ClusterStack , "name" , stage .Name , "hook" , in .clusterAddon .Spec .Hook )
899899
900- // remove status resource if deleted successfully
901- in .clusterAddon .Status .Resources = make ([]* csov1alpha1.Resource , 0 )
900+ // remove status resource if deleted successfully
901+ in .clusterAddon .Status .Resources = make ([]* csov1alpha1.Resource , 0 )
902902
903- // delete the false condition with failed to apply reason
904- conditions .Delete (in .clusterAddon , csov1alpha1 .HelmChartDeletedCondition )
903+ // delete the false condition with failed to apply reason
904+ conditions .Delete (in .clusterAddon , csov1alpha1 .HelmChartDeletedCondition )
905905
906- in .clusterAddon .SetStagePhase (stage .Name , stage .Action , csov1alpha1 .StagePhaseWaitingForPostCondition )
907- goto check
908- }
906+ in .clusterAddon .SetStagePhase (stage .Name , stage .Action , csov1alpha1 .StagePhaseWaitingForPostCondition )
907+ goto check
909908
910909 case csov1alpha1 .StagePhaseWaitingForPostCondition :
911910 // If WaitForPostCondition is mentioned.
0 commit comments