From d564e94e0a9828e3665cc074e8b810d878ad674a Mon Sep 17 00:00:00 2001 From: Luca Burgazzoli Date: Thu, 19 Dec 2024 15:31:28 +0100 Subject: [PATCH] Use both current and legacy component name to filter out DevFlags (#1461) --- .../kserve/kserve_controller_actions.go | 18 +++++++++------ .../modelcontroller_actions.go | 2 +- .../modelmeshserving_actions.go | 22 +++++++++++-------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/controllers/components/kserve/kserve_controller_actions.go b/controllers/components/kserve/kserve_controller_actions.go index e13d532ddb3..132fdf4f931 100644 --- a/controllers/components/kserve/kserve_controller_actions.go +++ b/controllers/components/kserve/kserve_controller_actions.go @@ -115,15 +115,19 @@ func devFlags(ctx context.Context, rr *odhtypes.ReconciliationRequest) error { kSourcePath := kserveManifestSourcePath for _, subcomponent := range df.Manifests { - if strings.Contains(subcomponent.URI, componentName) { - if err := deploy.DownloadManifests(ctx, componentName, subcomponent); err != nil { - return err - } + if !strings.Contains(subcomponent.URI, componentName) && !strings.Contains(subcomponent.URI, LegacyComponentName) { + continue + } - if subcomponent.SourcePath != "" { - kSourcePath = subcomponent.SourcePath - } + if err := deploy.DownloadManifests(ctx, componentName, subcomponent); err != nil { + return err + } + + if subcomponent.SourcePath != "" { + kSourcePath = subcomponent.SourcePath } + + break } rr.Manifests = []odhtypes.ManifestInfo{ diff --git a/controllers/components/modelcontroller/modelcontroller_actions.go b/controllers/components/modelcontroller/modelcontroller_actions.go index ab4c7dedbd3..100c79833bd 100644 --- a/controllers/components/modelcontroller/modelcontroller_actions.go +++ b/controllers/components/modelcontroller/modelcontroller_actions.go @@ -79,7 +79,7 @@ func devFlags(ctx context.Context, rr *odhtypes.ReconciliationRequest) error { } for _, subcomponent := range df.Manifests { - if !strings.Contains(subcomponent.URI, ComponentName) { + if !strings.Contains(subcomponent.URI, ComponentName) && !strings.Contains(subcomponent.URI, LegacyComponentName) { continue } diff --git a/controllers/components/modelmeshserving/modelmeshserving_actions.go b/controllers/components/modelmeshserving/modelmeshserving_actions.go index 77632e04aba..45567294739 100644 --- a/controllers/components/modelmeshserving/modelmeshserving_actions.go +++ b/controllers/components/modelmeshserving/modelmeshserving_actions.go @@ -49,16 +49,20 @@ func devFlags(ctx context.Context, rr *odhtypes.ReconciliationRequest) error { // Implement devflags support logic // If dev flags are set, update default manifests path for _, subcomponent := range df.Manifests { - if strings.Contains(subcomponent.URI, ComponentName) { - // Download modelmeshserving - if err := odhdeploy.DownloadManifests(ctx, ComponentName, subcomponent); err != nil { - return err - } - // If overlay is defined, update paths - if subcomponent.SourcePath != "" { - rr.Manifests[0].SourcePath = subcomponent.SourcePath - } + if !strings.Contains(subcomponent.URI, ComponentName) && !strings.Contains(subcomponent.URI, LegacyComponentName) { + continue } + + // Download modelmeshserving + if err := odhdeploy.DownloadManifests(ctx, ComponentName, subcomponent); err != nil { + return err + } + // If overlay is defined, update paths + if subcomponent.SourcePath != "" { + rr.Manifests[0].SourcePath = subcomponent.SourcePath + } + + break } return nil