-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2001 from christianvogt/global-model-serving
handle kserve in global model serving page
- Loading branch information
Showing
15 changed files
with
238 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { KnownLabels } from '~/k8sTypes'; | ||
|
||
export const LABEL_SELECTOR_DASHBOARD_RESOURCE = `${KnownLabels.DASHBOARD_RESOURCE}=true`; | ||
export const LABEL_SELECTOR_MODEL_SERVING_PROJECT = `${KnownLabels.MODEL_SERVING_PROJECT}=true`; | ||
export const LABEL_SELECTOR_MODEL_SERVING_PROJECT = KnownLabels.MODEL_SERVING_PROJECT; | ||
export const LABEL_SELECTOR_DATA_CONNECTION_AWS = `${KnownLabels.DATA_CONNECTION_AWS}=true`; | ||
export const LABEL_SELECTOR_PROJECT_SHARING = `${KnownLabels.PROJECT_SHARING}=true`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
frontend/src/pages/modelServing/screens/global/InferenceServiceModel.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/src/pages/modelServing/screens/global/InferenceServiceServingRuntime.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
import { ServingRuntimeKind } from '~/k8sTypes'; | ||
import { getDisplayNameFromServingRuntimeTemplate } from '~/pages/modelServing/customServingRuntimes/utils'; | ||
|
||
type Props = { | ||
servingRuntime?: ServingRuntimeKind; | ||
}; | ||
|
||
const InferenceServiceServingRuntime: React.FC<Props> = ({ servingRuntime }) => ( | ||
<>{servingRuntime ? getDisplayNameFromServingRuntimeTemplate(servingRuntime) : 'Unknown'}</> | ||
); | ||
|
||
export default InferenceServiceServingRuntime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
frontend/src/pages/modelServing/screens/global/__tests__/InferenceServiceProject.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { mockInferenceServiceK8sResource } from '~/__mocks__/mockInferenceServiceK8sResource'; | ||
import InferenceServiceProject from '~/pages/modelServing/screens/global/InferenceServiceProject'; | ||
import { ProjectsContext } from '~/concepts/projects/ProjectsContext'; | ||
import { mockProjectK8sResource } from '~/__mocks__/mockProjectK8sResource'; | ||
import { ProjectKind } from '~/k8sTypes'; | ||
|
||
describe('InferenceServiceProject', () => { | ||
it('should render error if loading fails', () => { | ||
const result = render( | ||
<InferenceServiceProject inferenceService={mockInferenceServiceK8sResource({})} />, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
loadError: new Error('test loading error'), | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText(/test loading error/)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render modelmesh project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [ | ||
mockProjectK8sResource({ | ||
k8sName: 'my-project', | ||
displayName: 'My Project', | ||
enableModelMesh: true, | ||
}), | ||
], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).toBeInTheDocument(); | ||
expect(result.queryByText('Multi-model serving enabled')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render kserve project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [ | ||
mockProjectK8sResource({ | ||
k8sName: 'my-project', | ||
displayName: 'My Project', | ||
enableModelMesh: false, | ||
}), | ||
], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).toBeInTheDocument(); | ||
expect(result.queryByText('Single model serving enabled')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render kserve project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [] as ProjectKind[], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).not.toBeInTheDocument(); | ||
expect(result.queryByText('Unknown')).toBeInTheDocument(); | ||
expect(result.queryByText('Single model serving enabled')).not.toBeInTheDocument(); | ||
expect(result.queryByText('Multi-model serving enabled')).not.toBeInTheDocument(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...d/src/pages/modelServing/screens/global/__tests__/InferenceServiceServingRuntime.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import InferenceServiceServingRuntime from '~/pages/modelServing/screens/global/InferenceServiceServingRuntime'; | ||
import { mockServingRuntimeK8sResource } from '~/__mocks__/mockServingRuntimeK8sResource'; | ||
|
||
describe('InferenceServiceServingRuntime', () => { | ||
it('should handle undefined serving runtime', () => { | ||
const wrapper = render(<InferenceServiceServingRuntime />); | ||
expect(wrapper.container.textContent).toBe('Unknown'); | ||
}); | ||
|
||
it('should display serving runtime name', () => { | ||
const mockServingRuntime = mockServingRuntimeK8sResource({}); | ||
const wrapper = render(<InferenceServiceServingRuntime servingRuntime={mockServingRuntime} />); | ||
expect(wrapper.container.textContent).toBe('OpenVINO Serving Runtime (Supports GPUs)'); | ||
}); | ||
}); |
Oops, something went wrong.