diff --git a/components/codeflare/codeflare.go b/components/codeflare/codeflare.go index 534e58c319e..909fb3f620e 100644 --- a/components/codeflare/codeflare.go +++ b/components/codeflare/codeflare.go @@ -35,6 +35,18 @@ type CodeFlare struct { components.Component `json:""` } +func (c *CodeFlare) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "codeflare-operator-controller-image": "RELATED_IMAGE_ODH_CODEFLARE_OPERATOR_IMAGE", // no need mcad, embedded in cfo + } + + if err := deploy.ApplyParams(ParamsPath, imageParamMap); err != nil { + return fmt.Errorf("failed update image from %s : %w", CodeflarePath+"/bases", err) + } + + return nil +} + func (c *CodeFlare) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(c.DevFlags.Manifests) != 0 { @@ -65,9 +77,6 @@ func (c *CodeFlare) ReconcileComponent(ctx context.Context, platform cluster.Platform, _ bool) error { l := c.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "codeflare-operator-controller-image": "RELATED_IMAGE_ODH_CODEFLARE_OPERATOR_IMAGE", // no need mcad, embedded in cfo - } enabled := c.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -90,11 +99,8 @@ func (c *CodeFlare) ReconcileComponent(ctx context.Context, dependentOperator, ComponentName) } - // Update image parameters only when we do not have customized manifests set - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (c.DevFlags == nil || len(c.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(ParamsPath, imageParamMap, map[string]string{"namespace": dscispec.ApplicationsNamespace}); err != nil { - return fmt.Errorf("failed update image from %s : %w", CodeflarePath+"/bases", err) - } + if err := deploy.ApplyParams(ParamsPath, map[string]string{}, map[string]string{"namespace": dscispec.ApplicationsNamespace}); err != nil { + return fmt.Errorf("failed update image from %s : %w", CodeflarePath+"/bases", err) } } diff --git a/components/dashboard/dashboard.go b/components/dashboard/dashboard.go index 30937c89673..0d07530c236 100644 --- a/components/dashboard/dashboard.go +++ b/components/dashboard/dashboard.go @@ -42,6 +42,24 @@ type Dashboard struct { components.Component `json:""` } +func (d *Dashboard) Init(platform cluster.Platform) error { + imageParamMap := map[string]string{ + "odh-dashboard-image": "RELATED_IMAGE_ODH_DASHBOARD_IMAGE", + } + entryPath := map[cluster.Platform]string{ + cluster.SelfManagedRhods: PathDownstream + "/onprem", + cluster.ManagedRhods: PathDownstream + "/addon", + cluster.OpenDataHub: PathUpstream, + cluster.Unknown: PathUpstream, + }[platform] + + if err := deploy.ApplyParams(entryPath, imageParamMap); err != nil { + return err + } + + return nil +} + func (d *Dashboard) OverrideManifests(ctx context.Context, platform cluster.Platform) error { // If devflags are set, update default manifests path if len(d.DevFlags.Manifests) != 0 { @@ -85,7 +103,6 @@ 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 @@ -100,8 +117,6 @@ 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 @@ -122,7 +137,7 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, } // 4. update params.env regardless devFlags is provided of not - if err := deploy.ApplyParams(entryPath, imageParamMap, extraParamsMap); err != nil { + if err := deploy.ApplyParams(entryPath, nil, extraParamsMap); err != nil { return fmt.Errorf("failed to update params.env from %s : %w", entryPath, err) } } diff --git a/components/datasciencepipelines/datasciencepipelines.go b/components/datasciencepipelines/datasciencepipelines.go index 388b54bd707..90b99b9c42f 100644 --- a/components/datasciencepipelines/datasciencepipelines.go +++ b/components/datasciencepipelines/datasciencepipelines.go @@ -41,6 +41,33 @@ type DataSciencePipelines struct { components.Component `json:""` } +func (d *DataSciencePipelines) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + // v1 + "IMAGES_APISERVER": "RELATED_IMAGE_ODH_ML_PIPELINES_API_SERVER_IMAGE", + "IMAGES_ARTIFACT": "RELATED_IMAGE_ODH_ML_PIPELINES_ARTIFACT_MANAGER_IMAGE", + "IMAGES_PERSISTENTAGENT": "RELATED_IMAGE_ODH_ML_PIPELINES_PERSISTENCEAGENT_IMAGE", + "IMAGES_SCHEDULEDWORKFLOW": "RELATED_IMAGE_ODH_ML_PIPELINES_SCHEDULEDWORKFLOW_IMAGE", + "IMAGES_CACHE": "RELATED_IMAGE_ODH_ML_PIPELINES_CACHE_IMAGE", + "IMAGES_DSPO": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_OPERATOR_CONTROLLER_IMAGE", + // v2 + "IMAGESV2_ARGO_APISERVER": "RELATED_IMAGE_ODH_ML_PIPELINES_API_SERVER_V2_IMAGE", + "IMAGESV2_ARGO_PERSISTENCEAGENT": "RELATED_IMAGE_ODH_ML_PIPELINES_PERSISTENCEAGENT_V2_IMAGE", + "IMAGESV2_ARGO_SCHEDULEDWORKFLOW": "RELATED_IMAGE_ODH_ML_PIPELINES_SCHEDULEDWORKFLOW_V2_IMAGE", + "IMAGESV2_ARGO_ARGOEXEC": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_ARGO_ARGOEXEC_IMAGE", + "IMAGESV2_ARGO_WORKFLOWCONTROLLER": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_ARGO_WORKFLOWCONTROLLER_IMAGE", + "V2_DRIVER_IMAGE": "RELATED_IMAGE_ODH_ML_PIPELINES_DRIVER_IMAGE", + "V2_LAUNCHER_IMAGE": "RELATED_IMAGE_ODH_ML_PIPELINES_LAUNCHER_IMAGE", + "IMAGESV2_ARGO_MLMDGRPC": "RELATED_IMAGE_ODH_MLMD_GRPC_SERVER_IMAGE", + } + + if err := deploy.ApplyParams(Path, imageParamMap); err != nil { + return fmt.Errorf("failed to update image from %s : %w", Path, err) + } + + return nil +} + func (d *DataSciencePipelines) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(d.DevFlags.Manifests) != 0 { @@ -72,25 +99,6 @@ func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context, _ bool, ) error { l := d.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - // v1 - "IMAGES_APISERVER": "RELATED_IMAGE_ODH_ML_PIPELINES_API_SERVER_IMAGE", - "IMAGES_ARTIFACT": "RELATED_IMAGE_ODH_ML_PIPELINES_ARTIFACT_MANAGER_IMAGE", - "IMAGES_PERSISTENTAGENT": "RELATED_IMAGE_ODH_ML_PIPELINES_PERSISTENCEAGENT_IMAGE", - "IMAGES_SCHEDULEDWORKFLOW": "RELATED_IMAGE_ODH_ML_PIPELINES_SCHEDULEDWORKFLOW_IMAGE", - "IMAGES_CACHE": "RELATED_IMAGE_ODH_ML_PIPELINES_CACHE_IMAGE", - "IMAGES_DSPO": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_OPERATOR_CONTROLLER_IMAGE", - // v2 - "IMAGESV2_ARGO_APISERVER": "RELATED_IMAGE_ODH_ML_PIPELINES_API_SERVER_V2_IMAGE", - "IMAGESV2_ARGO_PERSISTENCEAGENT": "RELATED_IMAGE_ODH_ML_PIPELINES_PERSISTENCEAGENT_V2_IMAGE", - "IMAGESV2_ARGO_SCHEDULEDWORKFLOW": "RELATED_IMAGE_ODH_ML_PIPELINES_SCHEDULEDWORKFLOW_V2_IMAGE", - "IMAGESV2_ARGO_ARGOEXEC": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_ARGO_ARGOEXEC_IMAGE", - "IMAGESV2_ARGO_WORKFLOWCONTROLLER": "RELATED_IMAGE_ODH_DATA_SCIENCE_PIPELINES_ARGO_WORKFLOWCONTROLLER_IMAGE", - "V2_DRIVER_IMAGE": "RELATED_IMAGE_ODH_ML_PIPELINES_DRIVER_IMAGE", - "V2_LAUNCHER_IMAGE": "RELATED_IMAGE_ODH_ML_PIPELINES_LAUNCHER_IMAGE", - "IMAGESV2_ARGO_MLMDGRPC": "RELATED_IMAGE_ODH_MLMD_GRPC_SERVER_IMAGE", - } - enabled := d.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -101,13 +109,6 @@ func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context, return err } } - // skip check if the dependent operator has beeninstalled, this is done in dashboard - // Update image parameters only when we do not have customized manifests set - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (d.DevFlags == nil || len(d.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(Path, imageParamMap); err != nil { - return fmt.Errorf("failed to update image from %s : %w", Path, err) - } - } // Check for existing Argo Workflows if err := UnmanagedArgoWorkFlowExists(ctx, cli); err != nil { return err diff --git a/components/kserve/kserve.go b/components/kserve/kserve.go index fe2eb2a994d..1c524cc6101 100644 --- a/components/kserve/kserve.go +++ b/components/kserve/kserve.go @@ -56,6 +56,20 @@ type Kserve struct { DefaultDeploymentMode DefaultDeploymentMode `json:"defaultDeploymentMode,omitempty"` } +func (k *Kserve) Init(_ cluster.Platform) error { + // dependentParamMap for odh-model-controller to use. + var dependentParamMap = map[string]string{ + "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", + } + + // Update image parameters for odh-model-controller + if err := deploy.ApplyParams(DependentPath, dependentParamMap); err != nil { + return fmt.Errorf("failed to update image %s: %w", DependentPath, err) + } + + return nil +} + func (k *Kserve) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // Download manifests if defined by devflags // Go through each manifest and set the overlays if defined @@ -98,11 +112,6 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := k.ConfigComponentLogger(logger, ComponentName, dscispec) - // dependentParamMap for odh-model-controller to use. - var dependentParamMap = map[string]string{ - "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", - } - enabled := k.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -142,12 +151,6 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, if err := cluster.UpdatePodSecurityRolebinding(ctx, cli, dscispec.ApplicationsNamespace, "odh-model-controller"); err != nil { return err } - // Update image parameters for odh-model-controller - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (k.DevFlags == nil || len(k.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(DependentPath, dependentParamMap); err != nil { - return fmt.Errorf("failed to update image %s: %w", DependentPath, err) - } - } } if err := deploy.DeployManifestsFromPath(ctx, cli, owner, DependentPath, dscispec.ApplicationsNamespace, ComponentName, enabled); err != nil { diff --git a/components/kueue/kueue.go b/components/kueue/kueue.go index 81bdbfe5638..75004725111 100644 --- a/components/kueue/kueue.go +++ b/components/kueue/kueue.go @@ -31,6 +31,18 @@ type Kueue struct { components.Component `json:""` } +func (k *Kueue) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "odh-kueue-controller-image": "RELATED_IMAGE_ODH_KUEUE_CONTROLLER_IMAGE", // new kueue image + } + + if err := deploy.ApplyParams(Path, imageParamMap); err != nil { + return fmt.Errorf("failed to update image from %s : %w", Path, err) + } + + return nil +} + func (k *Kueue) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(k.DevFlags.Manifests) != 0 { @@ -56,9 +68,6 @@ func (k *Kueue) GetComponentName() string { func (k *Kueue) ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := k.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "odh-kueue-controller-image": "RELATED_IMAGE_ODH_KUEUE_CONTROLLER_IMAGE", // new kueue image - } enabled := k.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -69,11 +78,6 @@ func (k *Kueue) ReconcileComponent(ctx context.Context, cli client.Client, logge return err } } - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (k.DevFlags == nil || len(k.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(Path, imageParamMap); err != nil { - return fmt.Errorf("failed to update image from %s : %w", Path, err) - } - } } // Deploy Kueue Operator if err := deploy.DeployManifestsFromPath(ctx, cli, owner, Path, dscispec.ApplicationsNamespace, ComponentName, enabled); err != nil { diff --git a/components/modelmeshserving/modelmeshserving.go b/components/modelmeshserving/modelmeshserving.go index b6b067221b9..6d8aea4dc95 100644 --- a/components/modelmeshserving/modelmeshserving.go +++ b/components/modelmeshserving/modelmeshserving.go @@ -35,6 +35,33 @@ type ModelMeshServing struct { components.Component `json:""` } +func (m *ModelMeshServing) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "odh-mm-rest-proxy": "RELATED_IMAGE_ODH_MM_REST_PROXY_IMAGE", + "odh-modelmesh-runtime-adapter": "RELATED_IMAGE_ODH_MODELMESH_RUNTIME_ADAPTER_IMAGE", + "odh-modelmesh": "RELATED_IMAGE_ODH_MODELMESH_IMAGE", + "odh-modelmesh-controller": "RELATED_IMAGE_ODH_MODELMESH_CONTROLLER_IMAGE", + "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", + } + + // odh-model-controller to use + var dependentImageParamMap = map[string]string{ + "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", + } + + // Update image parameters + if err := deploy.ApplyParams(Path, imageParamMap); err != nil { + return fmt.Errorf("failed update image from %s : %w", Path, err) + } + + // Update image parameters for odh-model-controller + if err := deploy.ApplyParams(DependentPath, dependentImageParamMap); err != nil { + return err + } + + return nil +} + func (m *ModelMeshServing) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // Go through each manifest and set the overlays if defined for _, subcomponent := range m.DevFlags.Manifests { @@ -80,19 +107,6 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context, _ bool, ) error { l := m.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "odh-mm-rest-proxy": "RELATED_IMAGE_ODH_MM_REST_PROXY_IMAGE", - "odh-modelmesh-runtime-adapter": "RELATED_IMAGE_ODH_MODELMESH_RUNTIME_ADAPTER_IMAGE", - "odh-modelmesh": "RELATED_IMAGE_ODH_MODELMESH_IMAGE", - "odh-modelmesh-controller": "RELATED_IMAGE_ODH_MODELMESH_CONTROLLER_IMAGE", - "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", - } - - // odh-model-controller to use - var dependentImageParamMap = map[string]string{ - "odh-model-controller": "RELATED_IMAGE_ODH_MODEL_CONTROLLER_IMAGE", - } - enabled := m.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -112,12 +126,6 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context, "prometheus-custom"); err != nil { return err } - // Update image parameters - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (m.DevFlags == nil || len(m.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(Path, imageParamMap); err != nil { - return fmt.Errorf("failed update image from %s : %w", Path, err) - } - } } if err := deploy.DeployManifestsFromPath(ctx, cli, owner, Path, dscispec.ApplicationsNamespace, ComponentName, enabled); err != nil { @@ -130,12 +138,6 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context, "odh-model-controller"); err != nil { return err } - // Update image parameters for odh-model-controller - if dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "" { - if err := deploy.ApplyParams(DependentPath, dependentImageParamMap); err != nil { - return err - } - } } if err := deploy.DeployManifestsFromPath(ctx, cli, owner, DependentPath, dscispec.ApplicationsNamespace, m.GetComponentName(), enabled); err != nil { // explicitly ignore error if error contains keywords "spec.selector" and "field is immutable" and return all other error. diff --git a/components/modelregistry/modelregistry.go b/components/modelregistry/modelregistry.go index 5d0610019e5..8dbd27114a3 100644 --- a/components/modelregistry/modelregistry.go +++ b/components/modelregistry/modelregistry.go @@ -47,6 +47,20 @@ type ModelRegistry struct { components.Component `json:""` } +func (m *ModelRegistry) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "IMAGES_MODELREGISTRY_OPERATOR": "RELATED_IMAGE_ODH_MODEL_REGISTRY_OPERATOR_IMAGE", + "IMAGES_GRPC_SERVICE": "RELATED_IMAGE_ODH_MLMD_GRPC_SERVER_IMAGE", + "IMAGES_REST_SERVICE": "RELATED_IMAGE_ODH_MODEL_REGISTRY_IMAGE", + } + + if err := deploy.ApplyParams(Path, imageParamMap); err != nil { + return fmt.Errorf("failed to update image from %s : %w", Path, err) + } + + return nil +} + func (m *ModelRegistry) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(m.DevFlags.Manifests) != 0 { @@ -72,11 +86,6 @@ func (m *ModelRegistry) GetComponentName() string { func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := m.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "IMAGES_MODELREGISTRY_OPERATOR": "RELATED_IMAGE_ODH_MODEL_REGISTRY_OPERATOR_IMAGE", - "IMAGES_GRPC_SERVICE": "RELATED_IMAGE_ODH_MLMD_GRPC_SERVER_IMAGE", - "IMAGES_REST_SERVICE": "RELATED_IMAGE_ODH_MODEL_REGISTRY_IMAGE", - } enabled := m.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -97,14 +106,11 @@ func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Clien } } - // Update image parameters only when we do not have customized manifests set - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (m.DevFlags == nil || len(m.DevFlags.Manifests) == 0) { - extraParamsMap := map[string]string{ - "DEFAULT_CERT": DefaultModelRegistryCert, - } - if err := deploy.ApplyParams(Path, imageParamMap, extraParamsMap); err != nil { - return fmt.Errorf("failed to update image from %s : %w", Path, err) - } + extraParamsMap := map[string]string{ + "DEFAULT_CERT": DefaultModelRegistryCert, + } + if err := deploy.ApplyParams(Path, nil, extraParamsMap); err != nil { + return fmt.Errorf("failed to update image from %s : %w", Path, err) } // Create model registries namespace diff --git a/components/ray/ray.go b/components/ray/ray.go index c1720cfcd6c..01ddb1c4f50 100644 --- a/components/ray/ray.go +++ b/components/ray/ray.go @@ -33,6 +33,17 @@ type Ray struct { components.Component `json:""` } +func (r *Ray) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "odh-kuberay-operator-controller-image": "RELATED_IMAGE_ODH_KUBERAY_OPERATOR_CONTROLLER_IMAGE", + } + if err := deploy.ApplyParams(RayPath, imageParamMap); err != nil { + return fmt.Errorf("failed to update image from %s : %w", RayPath, err) + } + + return nil +} + func (r *Ray) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(r.DevFlags.Manifests) != 0 { @@ -59,10 +70,6 @@ func (r *Ray) ReconcileComponent(ctx context.Context, cli client.Client, logger owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := r.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "odh-kuberay-operator-controller-image": "RELATED_IMAGE_ODH_KUBERAY_OPERATOR_CONTROLLER_IMAGE", - } - enabled := r.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -73,10 +80,8 @@ func (r *Ray) ReconcileComponent(ctx context.Context, cli client.Client, logger return err } } - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (r.DevFlags == nil || len(r.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(RayPath, imageParamMap, map[string]string{"namespace": dscispec.ApplicationsNamespace}); err != nil { - return fmt.Errorf("failed to update image from %s : %w", RayPath, err) - } + if err := deploy.ApplyParams(RayPath, map[string]string{}, map[string]string{"namespace": dscispec.ApplicationsNamespace}); err != nil { + return fmt.Errorf("failed to update namespace from %s : %w", RayPath, err) } } // Deploy Ray Operator diff --git a/components/trainingoperator/trainingoperator.go b/components/trainingoperator/trainingoperator.go index 6ebe12f538b..232f480cff9 100644 --- a/components/trainingoperator/trainingoperator.go +++ b/components/trainingoperator/trainingoperator.go @@ -33,6 +33,18 @@ type TrainingOperator struct { components.Component `json:""` } +func (r *TrainingOperator) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "odh-training-operator-controller-image": "RELATED_IMAGE_ODH_TRAINING_OPERATOR_IMAGE", + } + + if err := deploy.ApplyParams(TrainingOperatorPath, imageParamMap); err != nil { + return err + } + + return nil +} + func (r *TrainingOperator) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(r.DevFlags.Manifests) != 0 { @@ -59,10 +71,6 @@ func (r *TrainingOperator) ReconcileComponent(ctx context.Context, cli client.Cl owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := r.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "odh-training-operator-controller-image": "RELATED_IMAGE_ODH_TRAINING_OPERATOR_IMAGE", - } - enabled := r.GetManagementState() == operatorv1.Managed monitoringEnabled := dscispec.Monitoring.ManagementState == operatorv1.Managed @@ -73,11 +81,6 @@ func (r *TrainingOperator) ReconcileComponent(ctx context.Context, cli client.Cl return err } } - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (r.DevFlags == nil || len(r.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(TrainingOperatorPath, imageParamMap); err != nil { - return err - } - } } // Deploy Training Operator if err := deploy.DeployManifestsFromPath(ctx, cli, owner, TrainingOperatorPath, dscispec.ApplicationsNamespace, ComponentName, enabled); err != nil { diff --git a/components/trustyai/trustyai.go b/components/trustyai/trustyai.go index d7d67d237bd..be6b0e157ea 100644 --- a/components/trustyai/trustyai.go +++ b/components/trustyai/trustyai.go @@ -33,6 +33,19 @@ type TrustyAI struct { components.Component `json:""` } +func (t *TrustyAI) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "trustyaiServiceImage": "RELATED_IMAGE_ODH_TRUSTYAI_SERVICE_IMAGE", + "trustyaiOperatorImage": "RELATED_IMAGE_ODH_TRUSTYAI_SERVICE_OPERATOR_IMAGE", + } + + if err := deploy.ApplyParams(Path, imageParamMap); err != nil { + return fmt.Errorf("failed to update image %s: %w", Path, err) + } + + return nil +} + func (t *TrustyAI) OverrideManifests(ctx context.Context, _ cluster.Platform) error { // If devflags are set, update default manifests path if len(t.DevFlags.Manifests) != 0 { @@ -56,10 +69,6 @@ func (t *TrustyAI) GetComponentName() string { func (t *TrustyAI) ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { - var imageParamMap = map[string]string{ - "trustyaiServiceImage": "RELATED_IMAGE_ODH_TRUSTYAI_SERVICE_IMAGE", - "trustyaiOperatorImage": "RELATED_IMAGE_ODH_TRUSTYAI_SERVICE_OPERATOR_IMAGE", - } l := t.ConfigComponentLogger(logger, ComponentName, dscispec) enabled := t.GetManagementState() == operatorv1.Managed @@ -72,11 +81,6 @@ func (t *TrustyAI) ReconcileComponent(ctx context.Context, cli client.Client, lo return err } } - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (t.DevFlags == nil || len(t.DevFlags.Manifests) == 0) { - if err := deploy.ApplyParams(Path, imageParamMap); err != nil { - return fmt.Errorf("failed to update image %s: %w", Path, err) - } - } } // Deploy TrustyAI Operator if err := deploy.DeployManifestsFromPath(ctx, cli, owner, Path, dscispec.ApplicationsNamespace, t.GetComponentName(), enabled); err != nil { diff --git a/components/workbenches/workbenches.go b/components/workbenches/workbenches.go index a10addccf70..bfc9c437c9e 100644 --- a/components/workbenches/workbenches.go +++ b/components/workbenches/workbenches.go @@ -40,6 +40,24 @@ type Workbenches struct { components.Component `json:""` } +func (w *Workbenches) Init(_ cluster.Platform) error { + var imageParamMap = map[string]string{ + "odh-notebook-controller-image": "RELATED_IMAGE_ODH_NOTEBOOK_CONTROLLER_IMAGE", + "odh-kf-notebook-controller-image": "RELATED_IMAGE_ODH_KF_NOTEBOOK_CONTROLLER_IMAGE", + } + + // for kf-notebook-controller image + if err := deploy.ApplyParams(notebookControllerPath, imageParamMap); err != nil { + return fmt.Errorf("failed to update image %s: %w", notebookControllerPath, err) + } + // for odh-notebook-controller image + if err := deploy.ApplyParams(kfnotebookControllerPath, imageParamMap); err != nil { + return fmt.Errorf("failed to update image %s: %w", kfnotebookControllerPath, err) + } + + return nil +} + func (w *Workbenches) OverrideManifests(ctx context.Context, platform cluster.Platform) error { // Download manifests if defined by devflags // Go through each manifest and set the overlays if defined @@ -99,10 +117,6 @@ func (w *Workbenches) GetComponentName() string { func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client, logger logr.Logger, owner metav1.Object, dscispec *dsciv1.DSCInitializationSpec, platform cluster.Platform, _ bool) error { l := w.ConfigComponentLogger(logger, ComponentName, dscispec) - var imageParamMap = map[string]string{ - "odh-notebook-controller-image": "RELATED_IMAGE_ODH_NOTEBOOK_CONTROLLER_IMAGE", - "odh-kf-notebook-controller-image": "RELATED_IMAGE_ODH_KF_NOTEBOOK_CONTROLLER_IMAGE", - } // Set default notebooks namespace // Create rhods-notebooks namespace in managed platforms @@ -136,20 +150,6 @@ func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client, } l.WithValues("Path", notebookControllerPath).Info("apply manifests done NBC") - // Update image parameters for nbc - if enabled { - if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (w.DevFlags == nil || len(w.DevFlags.Manifests) == 0) { - // for kf-notebook-controller image - if err := deploy.ApplyParams(notebookControllerPath, imageParamMap); err != nil { - return fmt.Errorf("failed to update image %s: %w", notebookControllerPath, err) - } - // for odh-notebook-controller image - if err := deploy.ApplyParams(kfnotebookControllerPath, imageParamMap); err != nil { - return fmt.Errorf("failed to update image %s: %w", kfnotebookControllerPath, err) - } - } - } - var manifestsPath string if platform == cluster.OpenDataHub || platform == "" { // only for ODH after transit to kubeflow repo