Skip to content

Commit

Permalink
Validation for model names and disabled NIM metrics hyperlink (#3314)
Browse files Browse the repository at this point in the history
* fix: added validation for model names and disabled the NIM models metrics hyperlink on the Models tab

Signed-off-by: Olga Lavtar <[email protected]>

* fix: RHOAIENG-13881 - model deployment name allowed illegal chars

Signed-off-by: Olga Lavtar <[email protected]>

* fix: disabling NIM models metrics hyperlink on the Models tab

Signed-off-by: Olga Lavtar <[email protected]>

* fix: fix not to allow numbers in the Model deployment name

Signed-off-by: Olga Lavtar <[email protected]>

---------

Signed-off-by: Olga Lavtar <[email protected]>
  • Loading branch information
olavtar authored Oct 24, 2024
1 parent d801754 commit d9788f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,24 @@ const InferenceServiceTableRow: React.FC<InferenceServiceTableRowProps> = ({
isGlobal,
columnNames,
}) => {
const { projects } = React.useContext(ProjectsContext);
const project = projects.find(byName(inferenceService.metadata.namespace)) ?? null;
const isKServeNIMEnabled = project ? isProjectNIMSupported(project) : false;

const [modelMetricsEnabled] = useModelMetricsEnabled();
const kserveMetricsEnabled = useIsAreaAvailable(SupportedArea.K_SERVE_METRICS).status;

const modelMesh = isModelMesh(inferenceService);
const modelMeshMetricsSupported = modelMetricsEnabled && modelMesh;
const kserveMetricsSupported = modelMetricsEnabled && kserveMetricsEnabled && !modelMesh;
const kserveMetricsSupported =
modelMetricsEnabled && kserveMetricsEnabled && !modelMesh && !isKServeNIMEnabled;
const displayName = getDisplayNameFromK8sResource(inferenceService);

const { projects } = React.useContext(ProjectsContext);
const project = projects.find(byName(inferenceService.metadata.namespace)) ?? null;
const isKServeNIMEnabled = project ? isProjectNIMSupported(project) : false;

return (
<>
<Td dataLabel="Name">
<ResourceNameTooltip resource={inferenceService}>
{modelMeshMetricsSupported ? (
<Link
data-testid={`metrics-link-${displayName}`}
to={
isGlobal
? `/modelServing/${inferenceService.metadata.namespace}/metrics/${inferenceService.metadata.name}`
: `/projects/${inferenceService.metadata.namespace}/metrics/model/${inferenceService.metadata.name}`
}
>
{displayName}
</Link>
) : kserveMetricsSupported ? (
{modelMeshMetricsSupported || kserveMetricsSupported ? (
<Link
data-testid={`metrics-link-${displayName}`}
to={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const DeployNIMServiceModal: React.FC<DeployNIMServiceModalProps> = ({

const servingRuntimeName =
editInfo?.inferenceServiceEditInfo?.spec.predictor.model?.runtime ||
translateDisplayNameForK8s(createDataInferenceService.name);
translateDisplayNameForK8s(createDataInferenceService.name, { safeK8sPrefix: 'nim-' });

const nimPVCName = getUniqueId('nim-pvc');

Expand Down

0 comments on commit d9788f8

Please sign in to comment.