Skip to content

Commit 2d32f4d

Browse files
adding a check for hrp ready condition being unknown
Signed-off-by: Chaitanya Kolluru <[email protected]>
1 parent 4eb5438 commit 2d32f4d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

controllers/helmchartproxy/helmchartproxy_controller.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,38 @@ func (r *HelmChartProxyReconciler) reconcileNormal(ctx context.Context, helmChar
270270
return 0
271271
})
272272

273+
// If HelmReleaseProxiesReadyCondition is Unknown, create the first batch
274+
// of HelmReleaseProxies and exit.
275+
if conditions.IsUnknown(helmChartProxy, addonsv1alpha1.HelmReleaseProxiesReadyCondition) {
276+
count := 0
277+
stepSize, err := intstr.GetScaledValueFromIntOrPercent(helmChartProxy.Spec.RolloutStepSize, len(clusters), true)
278+
if err != nil {
279+
return err
280+
}
281+
282+
// If HelmReleaseProxiesReadyCondition is Unknown and the first batch of HelmReleaseProxies have
283+
// been created, then exit early.
284+
if stepSize == len(helmReleaseProxies) {
285+
return nil
286+
}
287+
288+
for _, meta := range rolloutMetaSorted {
289+
// The first batch of helmReleaseProxies have been reconciled.
290+
if count >= stepSize {
291+
return nil
292+
}
293+
294+
err := r.reconcileForCluster(ctx, helmChartProxy, meta.cluster)
295+
if err != nil {
296+
return err
297+
}
298+
count++
299+
}
300+
// In cases where the count of remaining HelmReleaseProxies to be rolled
301+
// out is less than rollout step size.
302+
return nil
303+
}
304+
273305
// If HelmReleaseProxiesReadyCondition is false, reconcile existing
274306
// HelmReleaseProxies and exit.
275307
if conditions.IsFalse(helmChartProxy, addonsv1alpha1.HelmReleaseProxiesReadyCondition) {

0 commit comments

Comments
 (0)