From 00af70889c858f4d9f53ae3c906af1d66fbcddf9 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Tue, 30 Jul 2024 08:12:48 +0200 Subject: [PATCH] fix: devFlags for dashboard did not set correct values (#1136) - priority for image: when set devFlag: devFlag > imageParam when ot set devFlag: imageParam > default value during operator build time - prioirty for url, title, groups: regardless set devFlags or not, always determinate by Platform value Signed-off-by: Wen Zhou --- components/dashboard/dashboard.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/components/dashboard/dashboard.go b/components/dashboard/dashboard.go index aea2d4f55ef..fbe6c9f2979 100644 --- a/components/dashboard/dashboard.go +++ b/components/dashboard/dashboard.go @@ -85,6 +85,7 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, enabled := d.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed + imageParamMap := make(map[string]string) if enabled { // 1. cleanup OAuth client related secret and CR if dashboard is in 'installed false' status @@ -99,6 +100,8 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, if OverridePath != "" { entryPath = OverridePath } + } else { // Update image parameters if devFlags is not provided + imageParamMap["odh-dashboard-image"] = "RELATED_IMAGE_ODH_DASHBOARD_IMAGE" } // 2. platform specific RBAC @@ -112,22 +115,15 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, } } - // 3. Update image parameters - var imageParamMap = map[string]string{ - "odh-dashboard-image": "RELATED_IMAGE_ODH_DASHBOARD_IMAGE", - } - - // 4. Append or Update variable for component to consume + // 3. Append or Update variable for component to consume extraParamsMap, err := updateKustomizeVariable(ctx, cli, platform, dscispec) if err != nil { return errors.New("failed to set variable for extraParamsMap") } - // 5. update params.env - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (d.DevFlags == nil || len(d.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(entryPath, imageParamMap, false, extraParamsMap); err != nil { - return fmt.Errorf("failed to update params.env from %s : %w", entryPath, err) - } + // 4. update params.env regardless devFlags is provided of not + if err := deploy.ApplyParams(entryPath, imageParamMap, false, extraParamsMap); err != nil { + return fmt.Errorf("failed to update params.env from %s : %w", entryPath, err) } }