From 511977ebff0c43f2d57f5ce4a8a8bb820dae1c99 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Tue, 22 Oct 2024 14:59:41 +0200 Subject: [PATCH] update: rename variables rhods to rhoai (#1313) Signed-off-by: Wen Zhou Co-authored-by: ajaypratap003 --- components/codeflare/codeflare.go | 2 +- components/dashboard/dashboard.go | 20 +++++++++---------- .../datasciencepipelines.go | 2 +- components/kserve/kserve.go | 2 +- components/kueue/kueue.go | 2 +- .../modelmeshserving/modelmeshserving.go | 2 +- components/modelregistry/modelregistry.go | 2 +- components/ray/ray.go | 2 +- .../trainingoperator/trainingoperator.go | 2 +- components/trustyai/trustyai.go | 6 +++--- components/workbenches/workbenches.go | 4 ++-- .../dscinitialization_controller.go | 10 +++++----- controllers/dscinitialization/utils.go | 2 +- main.go | 12 +++++------ pkg/cluster/cluster_config.go | 20 +++++++++---------- pkg/cluster/const.go | 8 ++++---- pkg/upgrade/uninstallation.go | 4 ++-- pkg/upgrade/upgrade.go | 4 ++-- 18 files changed, 53 insertions(+), 53 deletions(-) diff --git a/components/codeflare/codeflare.go b/components/codeflare/codeflare.go index c3c2ec48474..7e114389465 100644 --- a/components/codeflare/codeflare.go +++ b/components/codeflare/codeflare.go @@ -121,7 +121,7 @@ func (c *CodeFlare) ReconcileComponent(ctx context.Context, } // CloudServiceMonitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { // inject prometheus codeflare*.rules in to /opt/manifests/monitoring/prometheus/prometheus-configs.yaml if err := c.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err diff --git a/components/dashboard/dashboard.go b/components/dashboard/dashboard.go index f8b077d4416..47a2ce2ba04 100644 --- a/components/dashboard/dashboard.go +++ b/components/dashboard/dashboard.go @@ -51,8 +51,8 @@ func (d *Dashboard) Init(ctx context.Context, platform cluster.Platform) error { "odh-dashboard-image": "RELATED_IMAGE_ODH_DASHBOARD_IMAGE", } DefaultPath = map[cluster.Platform]string{ - cluster.SelfManagedRhods: PathDownstream + "/onprem", - cluster.ManagedRhods: PathDownstream + "/addon", + cluster.SelfManagedRhoai: PathDownstream + "/onprem", + cluster.ManagedRhoai: PathDownstream + "/addon", cluster.OpenDataHub: PathUpstream, cluster.Unknown: PathUpstream, }[platform] @@ -135,7 +135,7 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, // common: Deploy odh-dashboard manifests // TODO: check if we can have the same component name odh-dashboard for both, or still keep rhods-dashboard for RHOAI switch platform { - case cluster.SelfManagedRhods, cluster.ManagedRhods: + case cluster.SelfManagedRhoai, cluster.ManagedRhoai: // anaconda if err := cluster.CreateSecret(ctx, cli, "anaconda-ce-access", dscispec.ApplicationsNamespace); err != nil { return fmt.Errorf("failed to create access-secret for anaconda: %w", err) @@ -153,7 +153,7 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := d.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentNameDownstream); err != nil { return err } @@ -185,15 +185,15 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context, func updateKustomizeVariable(ctx context.Context, cli client.Client, platform cluster.Platform, dscispec *dsciv1.DSCInitializationSpec) (map[string]string, error) { adminGroups := map[cluster.Platform]string{ - cluster.SelfManagedRhods: "rhods-admins", - cluster.ManagedRhods: "dedicated-admins", + cluster.SelfManagedRhoai: "rhods-admins", + cluster.ManagedRhoai: "dedicated-admins", cluster.OpenDataHub: "odh-admins", cluster.Unknown: "odh-admins", }[platform] sectionTitle := map[cluster.Platform]string{ - cluster.SelfManagedRhods: "OpenShift Self Managed Services", - cluster.ManagedRhods: "OpenShift Managed Services", + cluster.SelfManagedRhoai: "OpenShift Self Managed Services", + cluster.ManagedRhoai: "OpenShift Managed Services", cluster.OpenDataHub: "OpenShift Open Data Hub", cluster.Unknown: "OpenShift Open Data Hub", }[platform] @@ -203,8 +203,8 @@ func updateKustomizeVariable(ctx context.Context, cli client.Client, platform cl return nil, fmt.Errorf("error getting console route URL %s : %w", consoleLinkDomain, err) } consoleURL := map[cluster.Platform]string{ - cluster.SelfManagedRhods: "https://rhods-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, - cluster.ManagedRhods: "https://rhods-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, + cluster.SelfManagedRhoai: "https://rhods-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, + cluster.ManagedRhoai: "https://rhods-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, cluster.OpenDataHub: "https://odh-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, cluster.Unknown: "https://odh-dashboard-" + dscispec.ApplicationsNamespace + "." + consoleLinkDomain, }[platform] diff --git a/components/datasciencepipelines/datasciencepipelines.go b/components/datasciencepipelines/datasciencepipelines.go index ace22681f6b..d11cae6153d 100644 --- a/components/datasciencepipelines/datasciencepipelines.go +++ b/components/datasciencepipelines/datasciencepipelines.go @@ -135,7 +135,7 @@ func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := d.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/kserve/kserve.go b/components/kserve/kserve.go index f7edf65479a..3734551ba56 100644 --- a/components/kserve/kserve.go +++ b/components/kserve/kserve.go @@ -170,7 +170,7 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { // kesrve rules if err := k.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err diff --git a/components/kueue/kueue.go b/components/kueue/kueue.go index 73147085783..0e63f707548 100644 --- a/components/kueue/kueue.go +++ b/components/kueue/kueue.go @@ -93,7 +93,7 @@ func (k *Kueue) ReconcileComponent(ctx context.Context, cli client.Client, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := k.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/modelmeshserving/modelmeshserving.go b/components/modelmeshserving/modelmeshserving.go index 898d1f8617a..40034741cfe 100644 --- a/components/modelmeshserving/modelmeshserving.go +++ b/components/modelmeshserving/modelmeshserving.go @@ -156,7 +156,7 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { // first model-mesh rules if err := m.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err diff --git a/components/modelregistry/modelregistry.go b/components/modelregistry/modelregistry.go index 72c9da1e381..242bea853f1 100644 --- a/components/modelregistry/modelregistry.go +++ b/components/modelregistry/modelregistry.go @@ -165,7 +165,7 @@ func (m *ModelRegistry) ReconcileComponent(ctx context.Context, cli client.Clien } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := m.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/ray/ray.go b/components/ray/ray.go index f11ad8ec55f..8b6e3cc6dfb 100644 --- a/components/ray/ray.go +++ b/components/ray/ray.go @@ -98,7 +98,7 @@ func (r *Ray) ReconcileComponent(ctx context.Context, cli client.Client, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := r.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/trainingoperator/trainingoperator.go b/components/trainingoperator/trainingoperator.go index d422bc9a28a..9346a54f1b9 100644 --- a/components/trainingoperator/trainingoperator.go +++ b/components/trainingoperator/trainingoperator.go @@ -96,7 +96,7 @@ func (r *TrainingOperator) ReconcileComponent(ctx context.Context, cli client.Cl } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := r.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/trustyai/trustyai.go b/components/trustyai/trustyai.go index 114d099901b..b0ad4eb2bed 100644 --- a/components/trustyai/trustyai.go +++ b/components/trustyai/trustyai.go @@ -40,8 +40,8 @@ func (t *TrustyAI) Init(ctx context.Context, platform cluster.Platform) error { log := logf.FromContext(ctx).WithName(ComponentName) DefaultPath = map[cluster.Platform]string{ - cluster.SelfManagedRhods: PathDownstream, - cluster.ManagedRhods: PathDownstream, + cluster.SelfManagedRhoai: PathDownstream, + cluster.ManagedRhoai: PathDownstream, cluster.OpenDataHub: PathUpstream, cluster.Unknown: PathUpstream, }[platform] @@ -110,7 +110,7 @@ func (t *TrustyAI) ReconcileComponent(ctx context.Context, cli client.Client, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := t.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/components/workbenches/workbenches.go b/components/workbenches/workbenches.go index b744a1660d6..46671b4b028 100644 --- a/components/workbenches/workbenches.go +++ b/components/workbenches/workbenches.go @@ -124,7 +124,7 @@ func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client, return err } } - if platform == cluster.SelfManagedRhods || platform == cluster.ManagedRhods { + if platform == cluster.SelfManagedRhoai || platform == cluster.ManagedRhoai { // Intentionally leaving the ownership unset for this namespace. // Specifying this label triggers its deletion when the operator is uninstalled. _, err := cluster.CreateNamespace(ctx, cli, cluster.DefaultNotebooksNamespace, cluster.WithLabels(labels.ODH.OwnedNamespace, "true")) @@ -171,7 +171,7 @@ func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client, } // CloudService Monitoring handling - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { if err := w.UpdatePrometheusConfig(cli, l, enabled && monitoringEnabled, ComponentName); err != nil { return err } diff --git a/controllers/dscinitialization/dscinitialization_controller.go b/controllers/dscinitialization/dscinitialization_controller.go index 023543dd633..47282a484e7 100644 --- a/controllers/dscinitialization/dscinitialization_controller.go +++ b/controllers/dscinitialization/dscinitialization_controller.go @@ -183,7 +183,7 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re switch req.Name { case "prometheus": // prometheus configmap - if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhods { + if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhoai { log.Info("Monitoring enabled to restart deployment", "cluster", "Managed Service Mode") err := r.configureManagedMonitoring(ctx, instance, "updates") if err != nil { @@ -193,7 +193,7 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re return ctrl.Result{}, nil case "addon-managed-odh-parameters": - if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhods { + if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhoai { log.Info("Monitoring enabled when notification updated", "cluster", "Managed Service Mode") err := r.configureManagedMonitoring(ctx, instance, "updates") if err != nil { @@ -203,7 +203,7 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re return ctrl.Result{}, nil case "backup": // revert back to the original prometheus.yml - if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhods { + if instance.Spec.Monitoring.ManagementState == operatorv1.Managed && platform == cluster.ManagedRhoai { log.Info("Monitoring enabled to restore back", "cluster", "Managed Service Mode") err := r.configureManagedMonitoring(ctx, instance, "revertbackup") if err != nil { @@ -219,7 +219,7 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re } switch platform { - case cluster.SelfManagedRhods: + case cluster.SelfManagedRhoai: // Check if user opted for disabling creating user groups if !createUsergroup { log.Info("DSCI disabled usergroup creation") @@ -236,7 +236,7 @@ func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Re return reconcile.Result{}, err } } - case cluster.ManagedRhods: + case cluster.ManagedRhoai: osdConfigsPath := filepath.Join(deploy.DefaultManifestPath, "osd-configs") err = deploy.DeployManifestsFromPath(ctx, r.Client, instance, osdConfigsPath, r.ApplicationsNamespace, "osd", true) if err != nil { diff --git a/controllers/dscinitialization/utils.go b/controllers/dscinitialization/utils.go index 77e43b024cf..b434278a1ad 100644 --- a/controllers/dscinitialization/utils.go +++ b/controllers/dscinitialization/utils.go @@ -192,7 +192,7 @@ func (r *DSCInitializationReconciler) createDefaultRoleBinding(ctx context.Conte func (r *DSCInitializationReconciler) reconcileDefaultNetworkPolicy(ctx context.Context, name string, dscInit *dsciv1.DSCInitialization, platform cluster.Platform) error { log := logf.FromContext(ctx) - if platform == cluster.ManagedRhods || platform == cluster.SelfManagedRhods { + if platform == cluster.ManagedRhoai || platform == cluster.SelfManagedRhoai { // Get operator namepsace operatorNs, err := cluster.GetOperatorNamespace() if err != nil { diff --git a/main.go b/main.go index a59dee6d4a3..e55cc3ba61f 100644 --- a/main.go +++ b/main.go @@ -303,8 +303,8 @@ func main() { //nolint:funlen,maintidx } } - // Create default DSC CR for managed RHODS - if platform == cluster.ManagedRhods { + // Create default DSC CR for managed RHOAI + if platform == cluster.ManagedRhoai { var createDefaultDSCFunc manager.RunnableFunc = func(ctx context.Context) error { err := upgrade.CreateDefaultDSC(ctx, setupClient) if err != nil { @@ -357,7 +357,7 @@ func createSecretCacheConfig(platform cluster.Platform) map[string]cache.Config "openshift-ingress": {}, } switch platform { - case cluster.ManagedRhods: + case cluster.ManagedRhoai: namespaceConfigs["redhat-ods-monitoring"] = cache.Config{} namespaceConfigs["redhat-ods-applications"] = cache.Config{} operatorNs, err := cluster.GetOperatorNamespace() @@ -365,7 +365,7 @@ func createSecretCacheConfig(platform cluster.Platform) map[string]cache.Config operatorNs = "redhat-ods-operator" // fall back case } namespaceConfigs[operatorNs] = cache.Config{} - case cluster.SelfManagedRhods: + case cluster.SelfManagedRhoai: namespaceConfigs["redhat-ods-applications"] = cache.Config{} default: namespaceConfigs["opendatahub"] = cache.Config{} @@ -376,10 +376,10 @@ func createSecretCacheConfig(platform cluster.Platform) map[string]cache.Config func createDeploymentCacheConfig(platform cluster.Platform) map[string]cache.Config { namespaceConfigs := map[string]cache.Config{} switch platform { - case cluster.ManagedRhods: // no need workbench NS, only SFS no Deployment + case cluster.ManagedRhoai: // no need workbench NS, only SFS no Deployment namespaceConfigs["redhat-ods-monitoring"] = cache.Config{} namespaceConfigs["redhat-ods-applications"] = cache.Config{} - case cluster.SelfManagedRhods: + case cluster.SelfManagedRhoai: namespaceConfigs["redhat-ods-applications"] = cache.Config{} default: namespaceConfigs["opendatahub"] = cache.Config{} diff --git a/pkg/cluster/cluster_config.go b/pkg/cluster/cluster_config.go index a2b5aaa4cb4..80271161b06 100644 --- a/pkg/cluster/cluster_config.go +++ b/pkg/cluster/cluster_config.go @@ -137,11 +137,11 @@ func GetClusterServiceVersion(ctx context.Context, c client.Client, namespace st gvk.ClusterServiceVersion.Kind) } -// detectSelfManaged detects if it is Self Managed Rhods or OpenDataHub. +// detectSelfManaged detects if it is Self Managed Rhoai or OpenDataHub. func detectSelfManaged(ctx context.Context, cli client.Client) (Platform, error) { variants := map[string]Platform{ "opendatahub-operator": OpenDataHub, - "rhods-operator": SelfManagedRhods, + "rhods-operator": SelfManagedRhoai, } for k, v := range variants { @@ -157,8 +157,8 @@ func detectSelfManaged(ctx context.Context, cli client.Client) (Platform, error) return Unknown, nil } -// detectManagedRHODS checks if catsrc CR add-on exists ManagedRhods. -func detectManagedRHODS(ctx context.Context, cli client.Client) (Platform, error) { +// detectManagedRhoai checks if catsrc CR add-on exists ManagedRhoai. +func detectManagedRhoai(ctx context.Context, cli client.Client) (Platform, error) { catalogSource := &ofapiv1alpha1.CatalogSource{} operatorNs, err := GetOperatorNamespace() if err != nil { @@ -168,7 +168,7 @@ func detectManagedRHODS(ctx context.Context, cli client.Client) (Platform, error if err != nil { return Unknown, client.IgnoreNotFound(err) } - return ManagedRhods, nil + return ManagedRhoai, nil } func getPlatform(ctx context.Context, cli client.Client) (Platform, error) { @@ -176,15 +176,15 @@ func getPlatform(ctx context.Context, cli client.Client) (Platform, error) { case "OpenDataHub": return OpenDataHub, nil case "ManagedRHOAI": - return ManagedRhods, nil + return SelfManagedRhoai, nil case "SelfManagedRHOAI": - return SelfManagedRhods, nil + return SelfManagedRhoai, nil default: // fall back to detect platform if ODH_PLATFORM_TYPE env is not provided in CSV or set to "" - if platform, err := detectManagedRHODS(ctx, cli); err != nil { + if platform, err := detectManagedRhoai(ctx, cli); err != nil { return Unknown, err - } else if platform == ManagedRhods { - return ManagedRhods, nil + } else if platform == SelfManagedRhoai { + return SelfManagedRhoai, nil } return detectSelfManaged(ctx, cli) } diff --git a/pkg/cluster/const.go b/pkg/cluster/const.go index de5a27de29d..6a6562bff07 100644 --- a/pkg/cluster/const.go +++ b/pkg/cluster/const.go @@ -1,10 +1,10 @@ package cluster const ( - // ManagedRhods defines expected addon catalogsource. - ManagedRhods Platform = "OpenShift AI Cloud Service" - // SelfManagedRhods defines display name in csv. - SelfManagedRhods Platform = "OpenShift AI Self-Managed" + // ManagedRhoai defines expected addon catalogsource. + ManagedRhoai Platform = "OpenShift AI Cloud Service" + // SelfManagedRhoai defines display name in csv. + SelfManagedRhoai Platform = "OpenShift AI Self-Managed" // OpenDataHub defines display name in csv. OpenDataHub Platform = "Open Data Hub" // Unknown indicates that operator is not deployed using OLM. diff --git a/pkg/upgrade/uninstallation.go b/pkg/upgrade/uninstallation.go index cc5c28e3682..0618fd7be45 100644 --- a/pkg/upgrade/uninstallation.go +++ b/pkg/upgrade/uninstallation.go @@ -70,10 +70,10 @@ func OperatorUninstall(ctx context.Context, cli client.Client, platform cluster. log.Info("Removing operator subscription which in turn will remove installplan") subsName := "opendatahub-operator" - if platform == cluster.SelfManagedRhods { + if platform == cluster.SelfManagedRhoai { subsName = "rhods-operator" } - if platform != cluster.ManagedRhods { + if platform != cluster.ManagedRhoai { if err := cluster.DeleteExistingSubscription(ctx, cli, operatorNs, subsName); err != nil { return err } diff --git a/pkg/upgrade/upgrade.go b/pkg/upgrade/upgrade.go index 6b8f857c465..d0e9d44468d 100644 --- a/pkg/upgrade/upgrade.go +++ b/pkg/upgrade/upgrade.go @@ -217,7 +217,7 @@ func CleanupExistingResource(ctx context.Context, ) error { var multiErr *multierror.Error // Special Handling of cleanup of deprecated model monitoring stack - if platform == cluster.ManagedRhods { + if platform == cluster.ManagedRhoai { deprecatedDeployments := []string{"rhods-prometheus-operator"} multiErr = multierror.Append(multiErr, deleteDeprecatedResources(ctx, cli, dscMonitoringNamespace, deprecatedDeployments, &appsv1.DeploymentList{})) @@ -270,7 +270,7 @@ func CleanupExistingResource(ctx context.Context, }) multiErr = multierror.Append(multiErr, deleteResources(ctx, cli, &odhDocJPH)) // only apply on RHOAI since ODH has a different way to create this CR by dashboard - if platform == cluster.SelfManagedRhods || platform == cluster.ManagedRhods { + if platform == cluster.SelfManagedRhoai || platform == cluster.ManagedRhoai { if err := upgradeODCCR(ctx, cli, "odh-dashboard-config", dscApplicationsNamespace, oldReleaseVersion); err != nil { return err }