Skip to content

Commit

Permalink
feat: add support for modelmeshserving as component
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
zdtsw committed Nov 19, 2024
1 parent acd89b8 commit 206adab
Show file tree
Hide file tree
Showing 35 changed files with 1,914 additions and 440 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ Example commands to run test suite for the dashboard `component` only, with the
make run-nowebhook
```
```shell
make e2e-test -e OPERATOR_NAMESPACE=<namespace> -e E2E_TEST_FLAGS="--test-operator-controller=false --test-webhook=false --test-component=dashboard,trustyai"
make e2e-test -e OPERATOR_NAMESPACE=<namespace> -e E2E_TEST_FLAGS="--test-operator-controller=false --test-webhook=false --test-component=dashboard"
```


Expand Down
83 changes: 83 additions & 0 deletions apis/components/v1/modelcontroller_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
operatorv1 "github.com/openshift/api/operator/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
ModelControllerComponentName = "odh-model-controller" // shared by kserve and modelmeshserving
// value should match whats set in the XValidation below
ModelControllerInstanceName = "default-modelcontroller"
ModelControllerKind = "ModelController"
)

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default-modelcontroller'",message="ModelController name must be default-modelcontroller"
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`,description="Ready"
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="Reason"

// ModelController is the Schema for the modelmeshservings API
type ModelController struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ModelControllerSpec `json:"spec,omitempty"`
Status ModelControllerStatus `json:"status,omitempty"`
}

// ModelControllerSpec defines the desired state of ModelController
type ModelControllerSpec struct {
// ModelControllerCommonSpec `json:",inline"`
components.DevFlagsSpec `json:",inline"`
ModelMeshServing operatorv1.ManagementState `json:"modelMeshServing,omitempty"`
// TODO Kserve
}

type ModelControllerCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
}

// ModelControllerStatus defines the observed state of ModelController
type ModelControllerStatus struct {
components.Status `json:",inline"`
}

// +kubebuilder:object:root=true
// ModelControllerList contains a list of ModelController
type ModelControllerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ModelController `json:"items"`
}

func init() {
SchemeBuilder.Register(&ModelController{}, &ModelControllerList{})
}

func (c *ModelController) GetDevFlags() *components.DevFlags { return nil }

func (c *ModelController) GetStatus() *components.Status {
return &c.Status.Status
}
54 changes: 34 additions & 20 deletions apis/components/v1/modelmeshserving_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,21 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// ModelMeshServingSpec defines the desired state of ModelMeshServing
type ModelMeshServingSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of ModelMeshServing. Edit modelmeshserving_types.go to remove/update
Foo string `json:"foo,omitempty"`
}
const (
ModelMeshServingComponentName = "model-mesh"
// value should match whats set in the XValidation below
ModelMeshServingInstanceName = "default-modelmesh"
ModelMeshServingKind = "ModelMeshServing"
)

// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
components.Status `json:",inline"`
}
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default-modelmesh'",message="ModelMeshServing name must be default-modelmesh"
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`,description="Ready"
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="Reason"

// ModelMeshServing is the Schema for the modelmeshservings API
type ModelMeshServing struct {
Expand All @@ -51,16 +46,21 @@ type ModelMeshServing struct {
Status ModelMeshServingStatus `json:"status,omitempty"`
}

func (c *ModelMeshServing) GetDevFlags() *components.DevFlags {
return nil
// ModelMeshServingSpec defines the desired state of ModelMeshServing
type ModelMeshServingSpec struct {
ModelMeshServingCommonSpec `json:",inline"`
}

func (c *ModelMeshServing) GetStatus() *components.Status {
return &c.Status.Status
type ModelMeshServingCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
}

// +kubebuilder:object:root=true
// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
components.Status `json:",inline"`
}

// +kubebuilder:object:root=true
// ModelMeshServingList contains a list of ModelMeshServing
type ModelMeshServingList struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -71,3 +71,17 @@ type ModelMeshServingList struct {
func init() {
SchemeBuilder.Register(&ModelMeshServing{}, &ModelMeshServingList{})
}

func (c *ModelMeshServing) GetDevFlags() *components.DevFlags {
return c.Spec.DevFlags
}
func (c *ModelMeshServing) GetStatus() *components.Status {
return &c.Status.Status
}

// DSCModelMeshServing contains all the configuration exposed in DSC instance for ModelMeshServing component
type DSCModelMeshServing struct {
components.ManagementSpec `json:",inline"`
// configuration fields common across components
ModelMeshServingCommonSpec `json:",inline"`
}
143 changes: 142 additions & 1 deletion apis/components/v1/zz_generated.deepcopy.go

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

5 changes: 1 addition & 4 deletions apis/datasciencecluster/v1/datasciencecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/codeflare"
"github.com/opendatahub-io/opendatahub-operator/v2/components/datasciencepipelines"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/modelmeshserving"
"github.com/opendatahub-io/opendatahub-operator/v2/components/workbenches"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
)
Expand All @@ -49,16 +48,14 @@ type Components struct {
Workbenches workbenches.Workbenches `json:"workbenches,omitempty"`

// ModelMeshServing component configuration.
// Does not support enabled Kserve at the same time
ModelMeshServing modelmeshserving.ModelMeshServing `json:"modelmeshserving,omitempty"`
ModelMeshServing componentsv1.DSCModelMeshServing `json:"modelmeshserving,omitempty"`

// DataServicePipeline component configuration.
// Require OpenShift Pipelines Operator to be installed before enable component
DataSciencePipelines datasciencepipelines.DataSciencePipelines `json:"datasciencepipelines,omitempty"`

// Kserve component configuration.
// Require OpenShift Serverless and OpenShift Service Mesh Operators to be installed before enable component
// Does not support enabled ModelMeshServing at the same time
Kserve kserve.Kserve `json:"kserve,omitempty"`

// Kueue component configuration.
Expand Down
Loading

0 comments on commit 206adab

Please sign in to comment.