Skip to content

Commit

Permalink
update: rename variables rhods to rhoai (#1313)
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
Co-authored-by: ajaypratap003 <[email protected]>
  • Loading branch information
zdtsw and ajaypratap003 authored Oct 22, 2024
1 parent a0860f4 commit 511977e
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand All @@ -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
}
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion components/datasciencepipelines/datasciencepipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion components/modelmeshserving/modelmeshserving.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion components/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion components/trainingoperator/trainingoperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions components/trustyai/trustyai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions components/workbenches/workbenches.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions controllers/dscinitialization/dscinitialization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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")
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion controllers/dscinitialization/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -357,15 +357,15 @@ 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()
if err != nil {
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{}
Expand All @@ -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{}
Expand Down
20 changes: 10 additions & 10 deletions pkg/cluster/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -168,23 +168,23 @@ 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) {
switch os.Getenv("ODH_PLATFORM_TYPE") {
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)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/cluster/const.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pkg/upgrade/uninstallation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}))

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 511977e

Please sign in to comment.