Skip to content

Commit

Permalink
Merge pull request #115 from SovereignCloudStack/ani/update-speccs-af…
Browse files Browse the repository at this point in the history
…ter-hook

✨ Update spec.cluster stack only after after controlplane is initialized and after cluster upgrade
  • Loading branch information
aniruddha2000 authored Mar 12, 2024
2 parents 2668dc6 + 1633e54 commit a9c9020
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
}
}

clusterAddon.Spec.ClusterStack = cluster.Spec.Topology.Class
clusterAddon.Spec.Version = releaseAsset.Meta.Versions.Components.ClusterAddon

if clusterAddon.Status.Ready {
Expand Down Expand Up @@ -327,6 +326,8 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
// clusterAddon.Spec.Version = metadata.Versions.Components.ClusterAddon
conditions.MarkTrue(clusterAddon, csov1alpha1.HelmChartAppliedCondition)

clusterAddon.Spec.ClusterStack = cluster.Spec.Topology.Class

// store the release kubernetes version and current hook
clusterAddon.Status.Ready = true

Expand All @@ -347,6 +348,11 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
if shouldRequeue {
return reconcile.Result{RequeueAfter: 20 * time.Second}, nil
}

}

if clusterAddon.Spec.Hook == "AfterControlPlaneInitialized" || clusterAddon.Spec.Hook == "BeforeClusterUpgrade" {
clusterAddon.Spec.ClusterStack = cluster.Spec.Topology.Class
}

// Helm chart has been applied successfully
Expand Down

0 comments on commit a9c9020

Please sign in to comment.