diff --git a/backend/src/types.ts b/backend/src/types.ts index 1b8e0e6e1e..8676718fc3 100644 --- a/backend/src/types.ts +++ b/backend/src/types.ts @@ -29,6 +29,8 @@ export type DashboardConfig = K8sResourceCommon & { disableCustomServingRuntimes: boolean; modelMetricsNamespace: string; disablePipelines: boolean; + disableKServe: boolean; + disableModelMesh: boolean; }; groupsConfig?: { adminGroups: string; diff --git a/backend/src/utils/constants.ts b/backend/src/utils/constants.ts index 1699c0eac1..0604d40052 100644 --- a/backend/src/utils/constants.ts +++ b/backend/src/utils/constants.ts @@ -53,6 +53,8 @@ export const blankDashboardCR: DashboardConfig = { disableCustomServingRuntimes: false, modelMetricsNamespace: '', disablePipelines: false, + disableKServe: false, + disableModelMesh: true, }, notebookController: { enabled: true, diff --git a/backend/src/utils/resourceUtils.ts b/backend/src/utils/resourceUtils.ts index 3fe6353169..d75a54de00 100644 --- a/backend/src/utils/resourceUtils.ts +++ b/backend/src/utils/resourceUtils.ts @@ -105,6 +105,21 @@ const fetchOrCreateDashboardCR = async ( ) .then((res) => { const dashboardCR = res?.body as DashboardConfig; + if ( + dashboardCR && + dashboardCR.spec.dashboardConfig.disableKServe === undefined && + dashboardCR.spec.dashboardConfig.disableModelMesh === undefined + ) { + // return a merge between dashboardCR and blankDashboardCR but changing spec.disableKServe to true and spec.disableModelMesh to false + return _.merge({}, blankDashboardCR, dashboardCR, { + spec: { + dashboardConfig: { + disableKServe: true, + disableModelMesh: false, + }, + }, + }); + } return _.merge({}, blankDashboardCR, dashboardCR); // merge with blank CR to prevent any missing values }) .catch((e) => { diff --git a/docs/dashboard-config.md b/docs/dashboard-config.md index cf20d49269..8fe24e3e41 100644 --- a/docs/dashboard-config.md +++ b/docs/dashboard-config.md @@ -24,6 +24,8 @@ The following are a list of features that are supported, along with there defaul | disableModelServing | false | Disables Model Serving from the dashboard and from Data Science Projects. | | disableProjectSharing | false | Disables Project Sharing from Data Science Projects. | | disableCustomServingRuntimes | false | Disables Custom Serving Runtimes from the Admin Panel. | +| disableKServe | false | Disables the ability to select KServe as a Serving Platform. | +| disableModelMesh | true | Disables the ability to select ModelMesh as a Serving Platform. | | modelMetricsNamespace | false | Enables the namespace in which the Model Serving Metrics' Prometheus Operator is installed. | ## Defaults diff --git a/frontend/src/__mocks__/mockDashboardConfig.ts b/frontend/src/__mocks__/mockDashboardConfig.ts index b388678b38..ea65cdf1a5 100644 --- a/frontend/src/__mocks__/mockDashboardConfig.ts +++ b/frontend/src/__mocks__/mockDashboardConfig.ts @@ -13,6 +13,8 @@ type MockDashboardConfigType = { disableProjects?: boolean; disableModelServing?: boolean; disableCustomServingRuntimes?: boolean; + disableKServe?: boolean; + disableModelMesh?: boolean; }; export const mockDashboardConfig = ({ @@ -27,6 +29,8 @@ export const mockDashboardConfig = ({ disableProjects = false, disableModelServing = false, disableCustomServingRuntimes = false, + disableKServe = false, + disableModelMesh = true, }: MockDashboardConfigType): DashboardConfig => ({ apiVersion: 'opendatahub.io/v1alpha', kind: 'OdhDashboardConfig', @@ -54,6 +58,8 @@ export const mockDashboardConfig = ({ modelMetricsNamespace: 'test-project', disablePipelines: false, disableProjectSharing: false, + disableKServe, + disableModelMesh, }, notebookController: { enabled: true, diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 50898f5b44..122f211107 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -91,6 +91,8 @@ export type DashboardCommonConfig = { disableCustomServingRuntimes: boolean; modelMetricsNamespace: string; disablePipelines: boolean; + disableKServe: boolean; + disableModelMesh: boolean; }; export type NotebookControllerUserState = { diff --git a/manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml b/manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml index 8108ce32aa..b13a2f8fef 100644 --- a/manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml +++ b/manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml @@ -53,6 +53,10 @@ spec: type: string disablePipelines: type: boolean + disableKServe: + type: boolean + disableModelMesh: + type: boolean groupsConfig: type: object required: diff --git a/manifests/overlays/odhdashboardconfig/odh-dashboard-config.yaml b/manifests/overlays/odhdashboardconfig/odh-dashboard-config.yaml index 677c300dc9..65faa28048 100644 --- a/manifests/overlays/odhdashboardconfig/odh-dashboard-config.yaml +++ b/manifests/overlays/odhdashboardconfig/odh-dashboard-config.yaml @@ -19,6 +19,8 @@ spec: disableProjectSharing: true disableCustomServingRuntimes: true modelMetricsNamespace: '' + disableKServe: false + disableModelMesh: true notebookController: enabled: true notebookSizes: