Skip to content

Commit 902bb92

Browse files
committed
add description
1 parent 78c772a commit 902bb92

File tree

5 files changed

+47
-17
lines changed

5 files changed

+47
-17
lines changed

frontend/src/__mocks__/mockInferenceServiceK8sResource.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type MockResourceConfigType = {
77
name?: string;
88
namespace?: string;
99
displayName?: string;
10+
description?: string;
1011
modelName?: string;
1112
secretName?: string;
1213
deleted?: boolean;
@@ -88,6 +89,7 @@ export const mockInferenceServiceK8sResource = ({
8889
name = 'test-inference-service',
8990
namespace = 'test-project',
9091
displayName = 'Test Inference Service',
92+
description = undefined,
9193
modelName = 'test-model',
9294
secretName = 'test-secret',
9395
deleted = false,
@@ -128,6 +130,7 @@ export const mockInferenceServiceK8sResource = ({
128130
metadata: {
129131
annotations: {
130132
'openshift.io/display-name': displayName,
133+
...(description && { 'openshift.io/description': description }),
131134
'serving.kserve.io/deploymentMode': isModelMesh
132135
? DeploymentMode.ModelMesh
133136
: isKserveRaw

frontend/src/__tests__/cypress/cypress/pages/modelServing.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,10 @@ class ModelServingWizard extends Wizard {
889889
return cy.findByTestId('model-deployment-name');
890890
}
891891

892+
findModelDeploymentDescriptionInput() {
893+
return cy.findByTestId('model-deployment-description');
894+
}
895+
892896
findModelFormatSelect() {
893897
return cy.findByTestId('model-framework-select');
894898
}

frontend/src/__tests__/cypress/cypress/tests/mocked/modelServing/modelServingDeploy.cy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ describe('Model Serving Deploy Wizard', () => {
306306
modelServingWizard.findAdvancedOptionsStep().should('be.disabled');
307307
modelServingWizard.findNextButton().should('be.disabled');
308308
modelServingWizard.findModelDeploymentNameInput().type('test-model');
309+
modelServingWizard.findModelDeploymentDescriptionInput().type('test-description');
309310
modelServingWizard.findAdvancedOptionsStep().should('be.enabled');
310311
hardwareProfileSection.findSelect().should('contain.text', 'Small');
311312

@@ -360,6 +361,7 @@ describe('Model Serving Deploy Wizard', () => {
360361
},
361362
annotations: {
362363
'openshift.io/display-name': 'test-model',
364+
'openshift.io/description': 'test-description',
363365
'opendatahub.io/hardware-profile-namespace': 'opendatahub',
364366
'opendatahub.io/hardware-profile-name': 'small-profile',
365367
'opendatahub.io/model-type': 'generative',
@@ -652,6 +654,7 @@ describe('Model Serving Deploy Wizard', () => {
652654
modelType: ServingRuntimeModelType.PREDICTIVE,
653655
hardwareProfileName: 'large-profile',
654656
hardwareProfileNamespace: 'opendatahub',
657+
description: 'test-description',
655658
resources: {
656659
requests: {
657660
cpu: '4',
@@ -690,6 +693,9 @@ describe('Model Serving Deploy Wizard', () => {
690693
modelServingWizardEdit.findNextButton().should('be.enabled').click();
691694

692695
// Step 2: Model deployment
696+
modelServingWizardEdit
697+
.findModelDeploymentDescriptionInput()
698+
.should('contain.text', 'test-description');
693699
modelServingWizardEdit.findModelDeploymentStep().should('be.enabled');
694700
modelServingWizardEdit.findAdvancedOptionsStep().should('be.enabled');
695701
modelServingWizardEdit.findNextButton().should('be.enabled');

packages/kserve/src/deploy.ts

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type CreatingInferenceServiceObject = {
2121
project: string;
2222
name: string;
2323
k8sName: string;
24+
description: string;
2425
modelType: ServingRuntimeModelType;
2526
hardwareProfile: HardwareProfileConfig;
2627
modelFormat: SupportedModelFormats;
@@ -49,6 +50,7 @@ export const deployKServeDeployment = async (
4950
project: projectName,
5051
name: wizardData.k8sNameDesc.data.name,
5152
k8sName: wizardData.k8sNameDesc.data.k8sName.value,
53+
description: wizardData.k8sNameDesc.data.description,
5254
modelType: wizardData.modelType.data,
5355
hardwareProfile: wizardData.hardwareProfileConfig.formData,
5456
modelFormat: wizardData.modelFormatState.modelFormat,
@@ -89,12 +91,9 @@ const assembleInferenceService = (
8991
): InferenceServiceKind => {
9092
const {
9193
project,
92-
name,
9394
k8sName,
94-
modelType,
9595
hardwareProfile,
9696
modelFormat,
97-
tokenAuth,
9897
externalRoute,
9998
numReplicas,
10099
runtimeArgs,
@@ -127,20 +126,9 @@ const assembleInferenceService = (
127126
};
128127

129128
const annotations = { ...inferenceService.metadata.annotations };
130-
annotations['openshift.io/display-name'] = name.trim();
131-
annotations['opendatahub.io/model-type'] = modelType;
129+
const updatedAnnotations = applyAnnotations(annotations, data);
132130

133-
annotations['opendatahub.io/hardware-profile-name'] =
134-
hardwareProfile.selectedProfile?.metadata.name;
135-
136-
annotations['opendatahub.io/hardware-profile-namespace'] =
137-
hardwareProfile.selectedProfile?.metadata.namespace;
138-
139-
if (tokenAuth && tokenAuth.length > 0) {
140-
annotations['security.opendatahub.io/enable-auth'] = 'true';
141-
}
142-
143-
inferenceService.metadata.annotations = annotations;
131+
inferenceService.metadata.annotations = updatedAnnotations;
144132

145133
if (externalRoute) {
146134
if (!inferenceService.metadata.labels) {
@@ -194,3 +182,33 @@ const createInferenceService = (
194182
),
195183
);
196184
};
185+
186+
const applyAnnotations = (
187+
annotations: Record<string, string>,
188+
data: CreatingInferenceServiceObject,
189+
) => {
190+
const { name, description, modelType, hardwareProfile, tokenAuth } = data;
191+
const updatedAnnotations = { ...annotations };
192+
updatedAnnotations['openshift.io/display-name'] = name.trim();
193+
if (description) {
194+
updatedAnnotations['openshift.io/description'] = description;
195+
}
196+
updatedAnnotations['opendatahub.io/model-type'] = modelType;
197+
const isLegacyHardwareProfile = !hardwareProfile.selectedProfile?.metadata.uid;
198+
if (!isLegacyHardwareProfile) {
199+
updatedAnnotations['opendatahub.io/hardware-profile-name'] =
200+
hardwareProfile.selectedProfile?.metadata.name || '';
201+
} else {
202+
const legacyName = hardwareProfile.selectedProfile?.metadata.name;
203+
if (legacyName) {
204+
updatedAnnotations['opendatahub.io/legacy-hardware-profile-name'] = legacyName;
205+
}
206+
}
207+
updatedAnnotations['opendatahub.io/hardware-profile-namespace'] =
208+
hardwareProfile.selectedProfile?.metadata.namespace || '';
209+
210+
if (tokenAuth && tokenAuth.length > 0) {
211+
updatedAnnotations['security.opendatahub.io/enable-auth'] = 'true';
212+
}
213+
return updatedAnnotations;
214+
};

packages/model-serving/src/components/deploymentWizard/steps/ModelDeploymentStep.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const ModelDeploymentStepContent: React.FC<ModelDeploymentStepProps> = ({
2626
dataTestId="model-deployment"
2727
nameLabel="Model deployment name"
2828
nameHelperText="This is the name of the inference service created when the model is deployed." // TODO: make this non-Kserve specific
29-
hideDescription
3029
/>
3130
<ModelServingHardwareProfileSection
3231
project={projectName}

0 commit comments

Comments
 (0)