diff --git a/backend/src/utils/resourceUtils.ts b/backend/src/utils/resourceUtils.ts index f503c0182c..2ac5ed2c63 100644 --- a/backend/src/utils/resourceUtils.ts +++ b/backend/src/utils/resourceUtils.ts @@ -1,14 +1,6 @@ import * as _ from 'lodash'; import createError from 'http-errors'; -import { - PatchUtils, - V1ConfigMap, - V1Namespace, - V1NamespaceList, - V1Role, - V1RoleBinding, - V1RoleBindingList, -} from '@kubernetes/client-node'; +import { V1ConfigMap, V1Role, V1RoleBinding, V1RoleBindingList } from '@kubernetes/client-node'; import { AcceleratorProfileKind, BuildPhase, @@ -40,7 +32,6 @@ import { import { getComponentFeatureFlags } from './features'; import { blankDashboardCR } from './constants'; import { getIsAppEnabled, getRouteForApplication, getRouteForClusterId } from './componentUtils'; -import { createCustomError } from './requestUtils'; import { getDetectedAccelerators } from '../routes/api/accelerators/acceleratorUtils'; import { FastifyRequest } from 'fastify'; import { fetchClusterStatus } from './dsc'; @@ -908,124 +899,6 @@ export const cleanupGPU = async (fastify: KubeFastifyInstance): Promise => await createSuccessfulMigrationConfigMap(fastify, CONFIG_MAP_NAME, DESCRIPTION); } }; -/** - * @deprecated - Look to remove asap (see comments below) - * Converts namespaces that have a display-name annotation suffixed with `[DSP]` over to using a label. - * This is migration code from 1.19 to 1.20+. When customers are no longer on 1.19, we should remove - * this code. - */ -export const cleanupDSPSuffix = async (fastify: KubeFastifyInstance): Promise => { - const CONFIG_MAP_NAME = 'dsg-prune-flag'; - - const continueProcessing = await fastify.kube.coreV1Api - .readNamespacedConfigMap(CONFIG_MAP_NAME, fastify.kube.namespace) - .then(() => { - // Found configmap, we're note continuing - return false; - }) - .catch((e) => { - if (e.statusCode === 404) { - // No config saying we have already pruned settings - return true; - } - throw e; - }); - - if (continueProcessing) { - const configMap: V1ConfigMap = { - metadata: { - name: CONFIG_MAP_NAME, - namespace: fastify.kube.namespace, - }, - data: { - startedPrune: 'true', - }, - }; - await fastify.kube.coreV1Api - .createNamespacedConfigMap(fastify.kube.namespace, configMap) - .then(() => fastify.log.info('Successfully created prune setting')) - .catch((e) => { - throw createCustomError( - 'Unable to create DSG prune setting configmap', - e.response?.body?.message || e.message, - ); - }); - } else { - // Already processed, exit early and save the processing - return; - } - - let namespaces: V1Namespace[] = []; - - let continueValue: string | undefined = undefined; - do { - const listNamespaces: V1NamespaceList = await fastify.kube.coreV1Api - .listNamespace(undefined, undefined, continueValue, undefined, undefined, 100) - .then((response) => response.body); - - const { - metadata: { _continue: continueProp }, - items, - } = listNamespaces; - - namespaces = namespaces.concat(items); - continueValue = continueProp; - } while (continueValue); - - const SUFFIX = '[DSP]'; - - const toChangeNamespaces = namespaces.filter( - (namespace) => - // Don't touch any openshift or kube namespaces - !( - namespace.metadata.name.startsWith('openshift') || - namespace.metadata.name.startsWith('kube') - ) && - // Just get the namespaces who are suffixed so we can convert them - namespace.metadata.annotations?.['openshift.io/display-name']?.endsWith(SUFFIX), - ); - - if (toChangeNamespaces.length === 0) { - return; - } - - fastify.log.info(`Updating ${toChangeNamespaces.length} Namespace(s) over to DSG with labels.`); - - const data = (namespace: V1Namespace) => { - const displayName = namespace.metadata.annotations['openshift.io/display-name']; - - return { - metadata: { - annotations: { - 'openshift.io/display-name': displayName.slice(0, displayName.length - SUFFIX.length), - }, - labels: { - 'opendatahub.io/dashboard': 'true', - }, - }, - }; - }; - - const calls = toChangeNamespaces.map((namespace) => - fastify.kube.coreV1Api - .patchNamespace( - namespace.metadata.name, - data(namespace), - undefined, - undefined, - undefined, - undefined, - { - headers: { 'Content-type': PatchUtils.PATCH_FORMAT_JSON_MERGE_PATCH }, - }, - ) - .then(() => fastify.log.info(`Converted ${namespace.metadata.name} over to using labels.`)), - ); - - Promise.all(calls).then(() => { - fastify.log.info('Completed updating Namespaces'); - }); -}; /** * TODO: There should be a better way to go about this... but the namespace is unlikely to ever change diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts index 3da816e1e2..6bb7c02239 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts @@ -57,7 +57,10 @@ describe('Home page AI Flows', () => { homeAISection.getProjectCard().find().should('not.exist'); - homePage.initHomeIntercepts({ disableModelServing: true }); + homePage.initHomeIntercepts({ + disableModelServing: true, + disableModelRegistry: true, + }); homePage.visit(); homeAISection.getModelsFlowCard().find().should('not.exist'); diff --git a/frontend/src/pages/home/aiFlows/DeployAndMonitorGallery.tsx b/frontend/src/pages/home/aiFlows/DeployAndMonitorGallery.tsx index 2627a21195..d99a59a59a 100644 --- a/frontend/src/pages/home/aiFlows/DeployAndMonitorGallery.tsx +++ b/frontend/src/pages/home/aiFlows/DeployAndMonitorGallery.tsx @@ -3,14 +3,40 @@ import { Content } from '@patternfly/react-core'; import { ProjectObjectType, SectionType } from '~/concepts/design/utils'; import InfoGalleryItem from '~/concepts/design/InfoGalleryItem'; import useServingPlatformStatuses from '~/pages/modelServing/useServingPlatformStatuses'; +import useIsAreaAvailable from '~/concepts/areas/useIsAreaAvailable'; +import { SupportedArea } from '~/concepts/areas'; import InfoGallery from './InfoGallery'; const DeployAndMonitorGallery: React.FC<{ onClose: () => void }> = ({ onClose }) => { const servingPlatformStatuses = useServingPlatformStatuses(); + const { status: modelRegistryAvailable } = useIsAreaAvailable(SupportedArea.MODEL_REGISTRY); const modelMeshEnabled = servingPlatformStatuses.modelMesh.enabled; + const kServeEnabled = servingPlatformStatuses.kServe.enabled; const infoItems = []; + if (modelRegistryAvailable) { + infoItems.push( + + + Model registries provide a structured and organized way to store, version, deploy, and + track models, ensuring that they are easily accessible and manageable throughout their + lifecycle. + + + } + isOpen + />, + ); + } + if (modelMeshEnabled) { infoItems.push( void }> = ({ onClose }) ); } - infoItems.push( - - - Deploy models to test them and integrate them into applications. Deploying a model makes - it accessible via an API, enabling you to return predictions based on data inputs. + if (modelMeshEnabled || kServeEnabled) { + infoItems.push( + + + Deploy models to test them and integrate them into applications. Deploying a model + makes it accessible via an API, enabling you to return predictions based on data + inputs. + - - } - isOpen - />, - ); + } + isOpen + />, + ); + } return ( { const { status: pipelinesAvailable } = useIsAreaAvailable(SupportedArea.DS_PIPELINES); const { status: projectsAvailable } = useIsAreaAvailable(SupportedArea.DS_PROJECTS_VIEW); const { status: modelServingAvailable } = useIsAreaAvailable(SupportedArea.MODEL_SERVING); + const { status: modelRegistryAvailable } = useIsAreaAvailable(SupportedArea.MODEL_REGISTRY); const [selected, setSelected] = React.useState(); return React.useMemo(() => { @@ -55,12 +56,12 @@ export const useAIFlows = (): React.ReactNode => { />, ); } - if (modelServingAvailable) { + if (modelServingAvailable || modelRegistryAvailable) { cards.push(