diff --git a/internal/controller/managedcluster_controller.go b/internal/controller/managedcluster_controller.go index 3dcc43ad..ffb983dc 100644 --- a/internal/controller/managedcluster_controller.go +++ b/internal/controller/managedcluster_controller.go @@ -312,9 +312,8 @@ func (r *ManagedClusterReconciler) updateCluster(ctx context.Context, mc *hmc.Ma }, ChartRef: clusterTpl.Status.ChartRef, } - reconcileInterval := clusterTpl.Spec.Helm.ChartSpec.Interval.Duration - if reconcileInterval != 0 { - hrReconcileOpts.ReconcileInterval = &reconcileInterval + if clusterTpl.Spec.Helm.ChartSpec != nil { + hrReconcileOpts.ReconcileInterval = &clusterTpl.Spec.Helm.ChartSpec.Interval.Duration } hr, _, err := helm.ReconcileHelmRelease(ctx, r.Client, mc.Name, mc.Namespace, hrReconcileOpts) diff --git a/internal/controller/management_controller.go b/internal/controller/management_controller.go index 8e43c013..1331ddf9 100644 --- a/internal/controller/management_controller.go +++ b/internal/controller/management_controller.go @@ -149,9 +149,8 @@ func (r *ManagementReconciler) Update(ctx context.Context, management *hmc.Manag TargetNamespace: component.targetNamespace, CreateNamespace: component.createNamespace, } - reconcileInterval := template.Spec.Helm.ChartSpec.Interval.Duration - if reconcileInterval != 0 { - hrReconcileOpts.ReconcileInterval = &reconcileInterval + if template.Spec.Helm.ChartSpec != nil { + hrReconcileOpts.ReconcileInterval = &template.Spec.Helm.ChartSpec.Interval.Duration } if _, _, err := helm.ReconcileHelmRelease(ctx, r.Client, component.helmReleaseName, r.SystemNamespace, hrReconcileOpts); err != nil {