Skip to content

Commit

Permalink
Merge pull request #1957 from lucferbux/issue-1939
Browse files Browse the repository at this point in the history
Create dashboard configuration to control kserve and modelmesh
  • Loading branch information
openshift-ci[bot] authored Oct 18, 2023
2 parents f1bb65a + b60188e commit 3eaf078
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export type DashboardConfig = K8sResourceCommon & {
disableCustomServingRuntimes: boolean;
modelMetricsNamespace: string;
disablePipelines: boolean;
disableKServe: boolean;
disableModelMesh: boolean;
};
groupsConfig?: {
adminGroups: string;
Expand Down
2 changes: 2 additions & 0 deletions backend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const blankDashboardCR: DashboardConfig = {
disableCustomServingRuntimes: false,
modelMetricsNamespace: '',
disablePipelines: false,
disableKServe: false,
disableModelMesh: true,
},
notebookController: {
enabled: true,
Expand Down
15 changes: 15 additions & 0 deletions backend/src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 2 additions & 0 deletions docs/dashboard-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type MockDashboardConfigType = {
disableProjects?: boolean;
disableModelServing?: boolean;
disableCustomServingRuntimes?: boolean;
disableKServe?: boolean;
disableModelMesh?: boolean;
};

export const mockDashboardConfig = ({
Expand All @@ -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',
Expand Down Expand Up @@ -54,6 +58,8 @@ export const mockDashboardConfig = ({
modelMetricsNamespace: 'test-project',
disablePipelines: false,
disableProjectSharing: false,
disableKServe,
disableModelMesh,
},
notebookController: {
enabled: true,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export type DashboardCommonConfig = {
disableCustomServingRuntimes: boolean;
modelMetricsNamespace: string;
disablePipelines: boolean;
disableKServe: boolean;
disableModelMesh: boolean;
};

export type NotebookControllerUserState = {
Expand Down
4 changes: 4 additions & 0 deletions manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ spec:
type: string
disablePipelines:
type: boolean
disableKServe:
type: boolean
disableModelMesh:
type: boolean
groupsConfig:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
disableProjectSharing: true
disableCustomServingRuntimes: true
modelMetricsNamespace: ''
disableKServe: false
disableModelMesh: true
notebookController:
enabled: true
notebookSizes:
Expand Down

0 comments on commit 3eaf078

Please sign in to comment.