Skip to content

Commit

Permalink
fix: Delete custom catalog sources even without app.kubernetes.io/par…
Browse files Browse the repository at this point in the history
…t-of=che.eclipse.org label (#2663)

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Apr 21, 2023
1 parent 1248462 commit 420dc21
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/tasks/olm-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down

0 comments on commit 420dc21

Please sign in to comment.