From fe744383135867d56260d50d3c455b67fbff840d Mon Sep 17 00:00:00 2001 From: Dallas <5322142+gitdallas@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:53:40 -0500 Subject: [PATCH] chore: 8499 remove deprecated migrateTemplateDisablement (#3114) Signed-off-by: gitdallas <5322142+gitdallas@users.noreply.github.com> --- backend/src/utils/resourceUtils.ts | 80 ------------------------------ 1 file changed, 80 deletions(-) diff --git a/backend/src/utils/resourceUtils.ts b/backend/src/utils/resourceUtils.ts index 1bec2d7b937..ca21db60aaf 100644 --- a/backend/src/utils/resourceUtils.ts +++ b/backend/src/utils/resourceUtils.ts @@ -18,7 +18,6 @@ import { SubscriptionKind, SubscriptionStatusData, Template, - TemplateList, TolerationEffect, TolerationOperator, } from '../types'; @@ -67,7 +66,6 @@ const DASHBOARD_CONFIG = { const fetchDashboardCR = async (fastify: KubeFastifyInstance): Promise => { return fetchOrCreateDashboardCR(fastify) - .then((dashboardCR) => migrateTemplateDisablement(fastify, dashboardCR)) .then((dashboardCR) => migrateBiasTrustyForRHOAI(fastify, dashboardCR)) .then((dashboardCR) => [dashboardCR]); }; @@ -862,84 +860,6 @@ export const cleanupDSPSuffix = async (fastify: KubeFastifyInstance): Promise => { - if (dashboardConfig.spec.templateDisablement) { - return dashboardConfig; - } - - const namespace = fastify.kube.namespace; - return fastify.kube.customObjectsApi - .listNamespacedCustomObject( - 'template.openshift.io', - 'v1', - namespace, - 'templates', - undefined, - undefined, - undefined, - 'opendatahub.io/dashboard=true', - ) - .then((response) => response.body as TemplateList) - .then((templateList) => { - const templatesDisabled = templateList.items - .filter( - (template) => - template.metadata.annotations?.['opendatahub.io/template-enabled'] === 'false', - ) - .map((template) => getServingRuntimeNameFromTemplate(template)); - if (templatesDisabled.length > 0) { - const options = { - headers: { 'Content-type': PatchUtils.PATCH_FORMAT_JSON_PATCH }, - }; - - return fastify.kube.customObjectsApi - .patchNamespacedCustomObject( - DASHBOARD_CONFIG.group, - DASHBOARD_CONFIG.version, - dashboardConfig.metadata.namespace, - DASHBOARD_CONFIG.plural, - dashboardConfig.metadata.name, - [ - { - op: 'replace', - path: '/spec/templateDisablement', - value: templatesDisabled, - }, - ], - undefined, - undefined, - undefined, - options, - ) - .then(() => { - return { - ...dashboardConfig, - spec: { - ...dashboardConfig.spec, - templateDisablement: templatesDisabled, - }, - }; - }); - } else { - return dashboardConfig; - } - }) - .catch((e) => { - fastify.log.error( - `Error migrating template disablement: ${e.response?.body?.message || e.message || e}`, - ); - return dashboardConfig; - }); -}; - /** * TODO: There should be a better way to go about this... but the namespace is unlikely to ever change */