Skip to content

Commit

Permalink
[Upstream]: cherry-pick updates
Browse files Browse the repository at this point in the history
Apply OVMS template from dashboard for RHODS only (opendatahub-io#382)
Splitting distributed workflows component into codeflare and ray. Fixes opendatahub-io#369 (opendatahub-io#377)
Add ODHDashboardconfig in dasboard component
Add admin group for downstream

Signed-off-by: Wen Zhou <wenzhou@redhat.com>
(cherry picked from commit 1c16d59)
  • Loading branch information
zdtsw authored and VaishnaviHire committed Jul 31, 2023
1 parent 7931847 commit 9997738
Show file tree
Hide file tree
Showing 21 changed files with 256 additions and 147 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ components. At a given time, ODH supports only **one** instance of the CR, which
enabled: true
datasciencepipelines:
enabled: true
distributedworkloads:
enabled: true
kserve:
enabled: true
modelmeshserving:
Expand Down
10 changes: 7 additions & 3 deletions apis/datasciencecluster/v1alpha1/datasciencecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package v1alpha1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/distributedworkloads"
"github.com/opendatahub-io/opendatahub-operator/v2/components/codeflare"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/ray"
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -52,8 +53,11 @@ type Components struct {
// Kserve component configuration
Kserve kserve.Kserve `json:"kserve,omitempty"`

// DistributeWorkloads component configuration
DistributeWorkloads distributedworkloads.DistributedWorkloads `json:"distributedWorkloads,omitempty"`
// CodeFlare component configuration
CodeFlare codeflare.CodeFlare `json:"codeflare,omitempty"`

// Ray component configuration
Ray ray.Ray `json:"ray,omitempty"`
}

// DataScienceClusterStatus defines the observed state of DataScienceCluster
Expand Down
3 changes: 2 additions & 1 deletion apis/datasciencecluster/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ spec:
components:
description: Override and fine tune specific component configurations.
properties:
dashboard:
description: Dashboard component configuration
codeflare:
description: CodeFlare component configuration
properties:
enabled:
description: Set to "true" to enable component, "false" to
Expand All @@ -48,8 +48,8 @@ spec:
required:
- enabled
type: object
datasciencepipelines:
description: DataServicePipeline component configuration
dashboard:
description: Dashboard component configuration
properties:
enabled:
description: Set to "true" to enable component, "false" to
Expand All @@ -58,8 +58,8 @@ spec:
required:
- enabled
type: object
distributedWorkloads:
description: DistributeWorkloads component configuration
datasciencepipelines:
description: DataServicePipeline component configuration
properties:
enabled:
description: Set to "true" to enable component, "false" to
Expand Down Expand Up @@ -88,6 +88,16 @@ spec:
required:
- enabled
type: object
ray:
description: Ray component configuration
properties:
enabled:
description: Set to "true" to enable component, "false" to
disable component. A disabled component will not be installed.
type: boolean
required:
- enabled
type: object
workbenches:
description: Workbenches component configuration
properties:
Expand Down
9 changes: 6 additions & 3 deletions bundle/manifests/rhods-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ metadata:
},
"spec": {
"components": {
"dashboard": {
"codeflare": {
"enabled": false
},
"datasciencepipelines": {
"dashboard": {
"enabled": false
},
"distributedworkloads": {
"datasciencepipelines": {
"enabled": false
},
"kserve": {
Expand All @@ -105,6 +105,9 @@ metadata:
"modelmeshserving": {
"enabled": false
},
"ray": {
"enabled": false
},
"workbenches": {
"enabled": false
}
Expand Down
54 changes: 54 additions & 0 deletions components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package codeflare

import (
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)

const (
ComponentName = "codeflare"
CodeflarePath = deploy.DefaultManifestPath + "/" + "codeflare-stack" + "/base"
)

var imageParamMap = map[string]string{}

type CodeFlare struct {
components.Component `json:""`
}

func (d *CodeFlare) SetImageParamsMap(imageMap map[string]string) map[string]string {
imageParamMap = imageMap
return imageParamMap
}

func (d *CodeFlare) GetComponentName() string {
return ComponentName
}

// Verifies that CodeFlare implements ComponentInterface
var _ components.ComponentInterface = (*CodeFlare)(nil)

func (d *CodeFlare) ReconcileComponent(owner metav1.Object, client client.Client, scheme *runtime.Scheme, enabled bool, namespace string) error {

// Update image parameters
if err := deploy.ApplyImageParams(CodeflarePath, imageParamMap); err != nil {
return err
}

// Deploy Codeflare
err := deploy.DeployManifestsFromPath(owner, client, ComponentName,
CodeflarePath,
namespace,
scheme, enabled)

return err

}

func (in *CodeFlare) DeepCopyInto(out *CodeFlare) {
*out = *in
out.Component = in.Component
}
49 changes: 44 additions & 5 deletions components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dashboard

import (
"fmt"

"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/common"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
Expand All @@ -12,10 +11,12 @@ import (
)

const (
ComponentName = "odh-dashboard"
Path = deploy.DefaultManifestPath + "/" + ComponentName + "/base"
PathISVSM = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/apps-onprem"
PathISVAddOn = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/apps-addon"
ComponentName = "odh-dashboard"
Path = deploy.DefaultManifestPath + "/" + ComponentName + "/base"
PathISVSM = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/apps-onprem"
PathISVAddOn = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/apps-addon"
PathOVMS = deploy.DefaultManifestPath + "/" + ComponentName + "/modelserving"
PathODHDashboardConfig = deploy.DefaultManifestPath + "/" + ComponentName + "/odhdashboardconfig"
)

var imageParamMap = map[string]string{
Expand Down Expand Up @@ -58,11 +59,49 @@ func (d *Dashboard) ReconcileComponent(owner metav1.Object, cli client.Client, s
}
}

// Apply RHODS specific configs
if platform != deploy.OpenDataHub {
// Replace admin group
if platform == deploy.SelfManagedRhods {
err = common.ReplaceStringsInFile(PathODHDashboardConfig+"/odhdashboardconfig.yaml", map[string]string{
"<admin_groups>": "rhods-admins",
})
if err != nil {
return err
}
} else {
err = common.ReplaceStringsInFile(PathODHDashboardConfig+"/odhdashboardconfig.yaml", map[string]string{
"<admin_groups>": "dedicated-admins",
})
if err != nil {
return err
}
}
// Create ODHDashboardConfig if it doesn't exist already
err = deploy.DeployManifestsFromPath(owner, cli, ComponentName,
PathODHDashboardConfig,
namespace,
scheme, enabled)
if err != nil {
return fmt.Errorf("failed to set dashboard config from %s: %v", PathODHDashboardConfig, err)
}

// Apply modelserving config
err = deploy.DeployManifestsFromPath(owner, cli, ComponentName,
PathOVMS,
namespace,
scheme, enabled)
if err != nil {
return fmt.Errorf("failed to set dashboard OVMS from %s: %v", PathOVMS, err)
}
}

// Update image parameters
if err := deploy.ApplyImageParams(Path, imageParamMap); err != nil {
return err
}

// Deploy odh-dashboard manifests
err = deploy.DeployManifestsFromPath(owner, cli, ComponentName,
Path,
namespace,
Expand Down
68 changes: 0 additions & 68 deletions components/distributedworkloads/distributedworkloads.go

This file was deleted.

52 changes: 52 additions & 0 deletions components/ray/ray.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package ray

import (
"github.com/opendatahub-io/opendatahub-operator/v2/components"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)

const (
ComponentName = "ray"
RayPath = deploy.DefaultManifestPath + "/" + "ray/operator" + "/base"
)

var imageParamMap = map[string]string{}

type Ray struct {
components.Component `json:""`
}

func (d *Ray) SetImageParamsMap(imageMap map[string]string) map[string]string {
imageParamMap = imageMap
return imageParamMap
}

func (d *Ray) GetComponentName() string {
return ComponentName
}

// Verifies that Ray implements ComponentInterface
var _ components.ComponentInterface = (*Ray)(nil)

func (d *Ray) ReconcileComponent(owner metav1.Object, client client.Client, scheme *runtime.Scheme, enabled bool, namespace string) error {

// Update image parameters
if err := deploy.ApplyImageParams(RayPath, imageParamMap); err != nil {
return err
}
// Deploy Ray Operator
err := deploy.DeployManifestsFromPath(owner, client, ComponentName,
RayPath,
namespace,
scheme, enabled)
return err

}

func (in *Ray) DeepCopyInto(out *Ray) {
*out = *in
out.Component = in.Component
}
Loading

0 comments on commit 9997738

Please sign in to comment.