From 420dc216bd46eeb7a1ddcf20c546d8f9a291d8b8 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Fri, 21 Apr 2023 16:37:57 +0300 Subject: [PATCH] fix: Delete custom catalog sources even without app.kubernetes.io/part-of=che.eclipse.org label (#2663) Signed-off-by: Anatolii Bazko --- src/tasks/olm-tasks.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/tasks/olm-tasks.ts b/src/tasks/olm-tasks.ts index 94dda877c..ecafd655f 100644 --- a/src/tasks/olm-tasks.ts +++ b/src/tasks/olm-tasks.ts @@ -13,14 +13,13 @@ import {CheCtlContext, CliContext, EclipseCheContext} from '../context' import * as Listr from 'listr' import { KubeClient } from '../api/kube-client' -import {getEmbeddedTemplatesDirectory, isPartOfEclipseChe, newListr, safeLoadFromYamlFile} from '../utils/utls' +import {getEmbeddedTemplatesDirectory, newListr, safeLoadFromYamlFile} from '../utils/utls' import * as path from 'path' import { V1Role, V1RoleBinding } from '@kubernetes/client-node' import * as yaml from 'js-yaml' import {CommonTasks} from './common-tasks' import {CHE_NAMESPACE_FLAG, CHE_OPERATOR_IMAGE_FLAG, CLUSTER_MONITORING_FLAG, DELETE_ALL_FLAG} from '../flags' import {EclipseChe} from './installers/eclipse-che/eclipse-che' -import {PART_OF_ECLIPSE_CHE_SELECTOR} from '../constants' import {DevWorkspace} from './installers/dev-workspace/dev-workspace' export namespace OlmTasks { @@ -38,17 +37,12 @@ export namespace OlmTasks { // CatalogSource const catalogSource = await kubeHelper.getCatalogSource(subscription.spec.source, subscription.spec.sourceNamespace) - if (isPartOfEclipseChe(catalogSource)) { + if (catalogSource?.metadata.name !== EclipseChe.STABLE_CHANNEL_CATALOG_SOURCE) { title = `${title} and CatalogSource ${subscription.spec.source}` deleteResources.push(() => kubeHelper.deleteCatalogSource(subscription!.spec.source, subscription!.spec.sourceNamespace)) } } - const catalogSources = await kubeHelper.listCatalogSource(namespace, PART_OF_ECLIPSE_CHE_SELECTOR) - for (const catalogSource of catalogSources) { - deleteResources.push(() => kubeHelper.deleteCatalogSource(catalogSource.metadata.name!, catalogSource.metadata.namespace!)) - } - // ClusterServiceVersion const csvs = await kubeHelper.getCSVWithPrefix(csvPrefix, namespace) for (const csv of csvs) {