Skip to content

Commit

Permalink
Splitting distributed workflows component into codeflare and ray. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
etirelli committed Jul 28, 2023
1 parent 385f72a commit b49a1bc
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 132 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ metadata:
"kind": "OdhQuickStart",
"metadata": {
"annotations": {
"internal.config.kubernetes.io/previousKinds": "OdhQuickStart",
"internal.config.kubernetes.io/previousNames": "create-jupyter-notebook",
"internal.config.kubernetes.io/previousNamespaces": "default",
"opendatahub.io/categories": "Getting started,Notebook environments"
},
"labels": {
Expand Down Expand Up @@ -167,7 +170,7 @@ metadata:
operators.operatorframework.io/internal-objects: '[dscinitialization.opendatahub.io]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/opendatahub-io/opendatahub-operator
name: opendatahub-operator.v2.0.0
name: opendatahub-operator.v0.0.6
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -414,7 +417,7 @@ spec:
- --leader-elect
command:
- /manager
image: REPLACE_IMAGE:latest
image: quay.io/etirelli/opendatahub-operator:dev-0.0.6
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -506,4 +509,4 @@ spec:
maturity: alpha
provider:
name: ODH
version: 2.0.0
version: 0.0.6
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
}
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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 @@ -49,8 +49,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 @@ -59,8 +59,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 @@ -89,6 +89,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
Loading

0 comments on commit b49a1bc

Please sign in to comment.