Skip to content

Commit

Permalink
Merge branch 'main' into chore_187
Browse files Browse the repository at this point in the history
  • Loading branch information
zdtsw authored Feb 26, 2025
2 parents 6723525 + 27809c7 commit 36587c6
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 2.24.0
VERSION ?= 2.25.0
# IMAGE_TAG_BASE defines the opendatahub.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
Expand Down
5 changes: 5 additions & 0 deletions apis/components/v1alpha1/modelcontroller_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type ModelControllerSpec struct {
// ModelMeshServing DSCModelMeshServing `json:"modelMeshServing,omitempty"`
Kserve *ModelControllerKerveSpec `json:"kserve,omitempty"`
ModelMeshServing *ModelControllerMMSpec `json:"modelMeshServing,omitempty"`
ModelRegistry *ModelControllerMRSpec `json:"modelRegistry,omitempty"`
}

// a mini version of the DSCKserve only keep devflags and management spec
Expand All @@ -80,6 +81,10 @@ func (s *ModelControllerMMSpec) GetDevFlags() *common.DevFlags {
return s.DevFlags
}

type ModelControllerMRSpec struct {
ManagementState operatorv1.ManagementState `json:"managementState,omitempty"`
}

// ModelControllerStatus defines the observed state of ModelController
type ModelControllerStatus struct {
common.Status `json:",inline"`
Expand Down
20 changes: 20 additions & 0 deletions apis/components/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 @@ -135,6 +135,12 @@ spec:
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
modelRegistry:
properties:
managementState:
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
type: object
status:
description: ModelControllerStatus defines the observed state of ModelController
Expand Down
10 changes: 5 additions & 5 deletions bundle/manifests/opendatahub-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ metadata:
capabilities: Full Lifecycle
categories: AI/Machine Learning, Big Data
certified: "False"
containerImage: quay.io/opendatahub/opendatahub-operator:v2.24.0
createdAt: "2025-02-12T13:47:30Z"
olm.skipRange: '>=1.0.0 <2.24.0'
containerImage: quay.io/opendatahub/opendatahub-operator:v2.25.0
createdAt: "2025-02-25T16:26:47Z"
olm.skipRange: '>=1.0.0 <2.25.0'
operators.operatorframework.io/builder: operator-sdk-v1.31.0
operators.operatorframework.io/internal-objects: '["featuretrackers.features.opendatahub.io",
"codeflares.components.platform.opendatahub.io", "dashboards.components.platform.opendatahub.io",
Expand All @@ -127,7 +127,7 @@ metadata:
"feastoperators.components.platform.opendatahub.io"]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/opendatahub-io/opendatahub-operator
name: opendatahub-operator.v2.24.0
name: opendatahub-operator.v2.25.0
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1402,7 +1402,7 @@ spec:
selector:
matchLabels:
component: opendatahub-operator
version: 2.24.0
version: 2.25.0
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ spec:
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
modelRegistry:
properties:
managementState:
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
type: object
status:
description: ModelControllerStatus defines the observed state of ModelController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
capabilities: Full Lifecycle
categories: AI/Machine Learning, Big Data
certified: "False"
containerImage: quay.io/opendatahub/opendatahub-operator:v2.24.0
createdAt: "2025-2-12T00:00:00Z"
olm.skipRange: '>=1.0.0 <2.24.0'
containerImage: quay.io/opendatahub/opendatahub-operator:v2.25.0
createdAt: "2025-2-25T00:00:00Z"
olm.skipRange: '>=1.0.0 <2.25.0'
operators.operatorframework.io/internal-objects: '["featuretrackers.features.opendatahub.io",
"codeflares.components.platform.opendatahub.io", "dashboards.components.platform.opendatahub.io",
"datasciencepipelines.components.platform.opendatahub.io", "kserves.components.platform.opendatahub.io",
Expand All @@ -18,7 +18,7 @@ metadata:
"workbenches.components.platform.opendatahub.io", "monitorings.services.platform.opendatahub.io","modelcontrollers.components.platform.opendatahub.io",
"feastoperators.components.platform.opendatahub.io"]'
repository: https://github.com/opendatahub-io/opendatahub-operator
name: opendatahub-operator.v2.24.0
name: opendatahub-operator.v2.25.0
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -180,4 +180,4 @@ spec:
selector:
matchLabels:
component: opendatahub-operator
version: 2.24.0
version: 2.25.0
8 changes: 8 additions & 0 deletions controllers/components/modelcontroller/modelcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) common.Pla
mState = operatorv1.Managed
}

mrState := operatorv1.Removed
if dsc.Spec.Components.ModelRegistry.ManagementState == operatorv1.Managed {
mrState = operatorv1.Managed
}

return &componentApi.ModelController{
TypeMeta: metav1.TypeMeta{
Kind: componentApi.ModelControllerKind,
Expand All @@ -70,6 +75,9 @@ func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) common.Pla
DevFlagsSpec: dsc.Spec.Components.Kserve.DevFlagsSpec,
NIM: dsc.Spec.Components.Kserve.NIM,
},
ModelRegistry: &componentApi.ModelControllerMRSpec{
ManagementState: mrState,
},
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ func initialize(_ context.Context, rr *odhtypes.ReconciliationRequest) error {
if mc.Spec.Kserve.ManagementState == operatorv1.Managed {
nimState = mc.Spec.Kserve.NIM.ManagementState
}

mrState := operatorv1.Removed
if mc.Spec.ModelRegistry != nil && mc.Spec.ModelRegistry.ManagementState == operatorv1.Managed {
mrState = operatorv1.Managed
}

extraParamsMap := map[string]string{
"nim-state": strings.ToLower(string(nimState)),
"kserve-state": strings.ToLower(string(mc.Spec.Kserve.ManagementState)),
"modelmeshserving-state": strings.ToLower(string(mc.Spec.ModelMeshServing.ManagementState)),
"modelregistry-state": strings.ToLower(string(mrState)),
}
if err := odhdeploy.ApplyParams(rr.Manifests[0].String(), nil, extraParamsMap); err != nil {
return fmt.Errorf("failed to update images on path %s: %w", rr.Manifests[0].String(), err)
Expand Down
17 changes: 17 additions & 0 deletions docs/api-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,22 @@ _Appears in:_
| `devFlags` _[DevFlags](#devflags)_ | Add developer fields | | |


#### ModelControllerMRSpec







_Appears in:_
- [ModelControllerSpec](#modelcontrollerspec)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `managementState` _[ManagementState](#managementstate)_ | | | |


#### ModelControllerSpec


Expand All @@ -1229,6 +1245,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `kserve` _[ModelControllerKerveSpec](#modelcontrollerkervespec)_ | ModelMeshServing DSCModelMeshServing `json:"modelMeshServing,omitempty"` | | |
| `modelMeshServing` _[ModelControllerMMSpec](#modelcontrollermmspec)_ | | | |
| `modelRegistry` _[ModelControllerMRSpec](#modelcontrollermrspec)_ | | | |


#### ModelControllerStatus
Expand Down
13 changes: 9 additions & 4 deletions tests/e2e/modelcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,30 @@ type ModelControllerTestCtx struct {

func (c *ModelControllerTestCtx) validateComponentEnabled(t *testing.T) {
t.Run("ModelMeshServing enabled", func(t *testing.T) {
c.validateComponentDeployed(t, operatorv1.Managed, operatorv1.Removed, metav1.ConditionTrue)
c.validateComponentDeployed(t, operatorv1.Managed, operatorv1.Removed, operatorv1.Removed, metav1.ConditionTrue)
})
t.Run("Kserve enabled", func(t *testing.T) {
c.validateComponentDeployed(t, operatorv1.Removed, operatorv1.Managed, metav1.ConditionTrue)
c.validateComponentDeployed(t, operatorv1.Removed, operatorv1.Managed, operatorv1.Removed, metav1.ConditionTrue)
})
t.Run("Kserve and ModelMeshServing enabled", func(t *testing.T) {
c.validateComponentDeployed(t, operatorv1.Managed, operatorv1.Managed, metav1.ConditionTrue)
c.validateComponentDeployed(t, operatorv1.Managed, operatorv1.Managed, operatorv1.Removed, metav1.ConditionTrue)
})
t.Run("ModelRegistry enabled", func(t *testing.T) {
c.validateComponentDeployed(t, operatorv1.Managed, operatorv1.Managed, operatorv1.Managed, metav1.ConditionTrue)
})
}

func (c *ModelControllerTestCtx) validateComponentDisabled(t *testing.T) {
t.Run("Kserve and ModelMeshServing disabled", func(t *testing.T) {
c.validateComponentDeployed(t, operatorv1.Removed, operatorv1.Removed, metav1.ConditionFalse)
c.validateComponentDeployed(t, operatorv1.Removed, operatorv1.Removed, operatorv1.Removed, metav1.ConditionFalse)
})
}

func (c *ModelControllerTestCtx) validateComponentDeployed(
t *testing.T,
modelMeshState operatorv1.ManagementState,
kserveState operatorv1.ManagementState,
modelRegistryState operatorv1.ManagementState,
status metav1.ConditionStatus,
) {
t.Helper()
Expand All @@ -74,6 +78,7 @@ func (c *ModelControllerTestCtx) validateComponentDeployed(
testf.TransformPipeline(
testf.Transform(`.spec.components.%s.managementState = "%s"`, componentApi.ModelMeshServingComponentName, modelMeshState),
testf.Transform(`.spec.components.%s.managementState = "%s"`, componentApi.KserveComponentName, kserveState),
testf.Transform(`.spec.components.%s.managementState = "%s"`, componentApi.ModelRegistryComponentName, modelRegistryState),
),
).Eventually().WithTimeout(30 * time.Second).WithPolling(1 * time.Second).Should(
Succeed(),
Expand Down

0 comments on commit 36587c6

Please sign in to comment.