diff --git a/internal/controller/managedcluster_controller.go b/internal/controller/managedcluster_controller.go index d1a69be7..de9629b9 100644 --- a/internal/controller/managedcluster_controller.go +++ b/internal/controller/managedcluster_controller.go @@ -387,7 +387,7 @@ func (r *ManagedClusterReconciler) updateServices(ctx context.Context, mc *hmc.M tmpl := &hmc.ServiceTemplate{} tmplRef := types.NamespacedName{Name: svc.Template, Namespace: mc.Namespace} if err := r.Get(ctx, tmplRef, tmpl); err != nil { - return ctrl.Result{}, fmt.Errorf("failed to get Template (%s)", tmplRef.String()) + return ctrl.Result{}, fmt.Errorf("failed to get Template (%s): %w", tmplRef.String(), err) } source, err := r.getServiceTemplateSource(ctx, tmpl) @@ -416,7 +416,7 @@ func (r *ManagedClusterReconciler) updateServices(ctx context.Context, mc *hmc.M }) } - if _, _, err := sveltos.ReconcileProfile(ctx, r.Client, l, mc.Namespace, mc.Name, + if _, err := sveltos.ReconcileProfile(ctx, r.Client, l, mc.Namespace, mc.Name, map[string]string{ hmc.FluxHelmChartNamespaceKey: mc.Namespace, hmc.FluxHelmChartNameKey: mc.Name, @@ -453,9 +453,9 @@ func (r *ManagedClusterReconciler) getServiceTemplateSource(ctx context.Context, hc := &sourcev1.HelmChart{} if err := r.Get(ctx, types.NamespacedName{ Namespace: tmpl.Status.ChartRef.Namespace, - Name: tmpl.Spec.Helm.ChartName, + Name: tmpl.Status.ChartRef.Name, }, hc); err != nil { - return nil, fmt.Errorf("failed to get HelmChart (%s)", tmplRef.String()) + return nil, fmt.Errorf("failed to get HelmChart (%s): %w", tmplRef.String(), err) } repo := &sourcev1.HelmRepository{} @@ -465,7 +465,7 @@ func (r *ManagedClusterReconciler) getServiceTemplateSource(ctx context.Context, Namespace: hc.Namespace, Name: hc.Spec.SourceRef.Name, }, repo); err != nil { - return nil, fmt.Errorf("failed to get HelmRepository (%s)", tmplRef.String()) + return nil, fmt.Errorf("failed to get HelmRepository (%s): %w", tmplRef.String(), err) } return repo, nil diff --git a/internal/sveltos/profile.go b/internal/sveltos/profile.go index 989e0fe5..4b694818 100644 --- a/internal/sveltos/profile.go +++ b/internal/sveltos/profile.go @@ -55,7 +55,7 @@ func ReconcileProfile(ctx context.Context, name string, matchLabels map[string]string, opts ReconcileProfileOpts, -) (*sveltosv1beta1.Profile, controllerutil.OperationResult, error) { +) (*sveltosv1beta1.Profile, error) { cp := &sveltosv1beta1.Profile{ ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, @@ -120,14 +120,14 @@ func ReconcileProfile(ctx context.Context, return nil }) if err != nil { - return nil, operation, err + return nil, err } if operation == controllerutil.OperationResultCreated || operation == controllerutil.OperationResultUpdated { - l.Info(fmt.Sprintf("Successfully %s Profile (%s)", string(operation), cp.Name)) + l.Info(fmt.Sprintf("Successfully %s Profile (%s/%s)", string(operation), cp.Namespace, cp.Name)) } - return cp, operation, nil + return cp, nil } func DeleteProfile(ctx context.Context, cl client.Client, namespace string, name string) error { diff --git a/templates/provider/projectsveltos/Chart.lock b/templates/provider/projectsveltos/Chart.lock index aa2e201b..8dd63225 100644 --- a/templates/provider/projectsveltos/Chart.lock +++ b/templates/provider/projectsveltos/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: projectsveltos repository: https://projectsveltos.github.io/helm-charts - version: 0.38.1 -digest: sha256:6fae3801c4b89a99b64a8185d21d6b12ec7cf4f40b15c5555985afa88894f4a8 -generated: "2024-09-13T11:52:06.517657-04:00" + version: 0.38.2 +digest: sha256:49e61851b4a79742612428f193ae6f450bd3b85959e3f9c3639342064b612058 +generated: "2024-09-25T20:27:28.220464-04:00"