Skip to content

Commit

Permalink
Fix panic in the provider when chartSpec is not set in the Template
Browse files Browse the repository at this point in the history
Closes #818
  • Loading branch information
eromanova authored and Kshatrix committed Dec 20, 2024
1 parent cbd3fe3 commit 2e92fb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions internal/controller/managedcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions internal/controller/management_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2e92fb6

Please sign in to comment.