From 6f2010fa3ab39b10ca86ad68cd6b8f8eb5cfaa72 Mon Sep 17 00:00:00 2001 From: Abhi Date: Thu, 21 Nov 2019 18:46:16 +0530 Subject: [PATCH] fix(dev-catalog): reject the internal objects when creating objects out from CSV --- .../operator-lifecycle-manager/src/dev-catalog.ts | 8 ++++++++ frontend/public/components/catalog/catalog-page.tsx | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/packages/operator-lifecycle-manager/src/dev-catalog.ts b/frontend/packages/operator-lifecycle-manager/src/dev-catalog.ts index e13c1ac035ca..38f840eddbe0 100644 --- a/frontend/packages/operator-lifecycle-manager/src/dev-catalog.ts +++ b/frontend/packages/operator-lifecycle-manager/src/dev-catalog.ts @@ -4,6 +4,12 @@ import { ClusterServiceVersionKind } from './types'; import { referenceForProvidedAPI, providedAPIsFor } from './components'; import * as operatorLogo from './operator.svg'; +const isInternal = (crd: { name: string }): boolean => { + const blacklistedAnnotation = 'operators.operatorframework.io/internal-objects'; + const internalOpList = _.get(crd, ['csv', 'metadata', 'annotations', blacklistedAnnotation], []); + return !!internalOpList.find((op) => op === crd.name); +}; + export const normalizeClusterServiceVersions = ( clusterServiceVersions: ClusterServiceVersionKind[], ): K8sResourceKind[] => { @@ -24,6 +30,8 @@ export const normalizeClusterServiceVersions = ( : all.concat([cur]), [], ) + // remove internal CRDs + .filter((crd) => !isInternal(crd)) .map((desc) => ({ // NOTE: Faking a real k8s object to avoid fetching all CRDs obj: { diff --git a/frontend/public/components/catalog/catalog-page.tsx b/frontend/public/components/catalog/catalog-page.tsx index a4bf0101e97e..8206787804cb 100644 --- a/frontend/public/components/catalog/catalog-page.tsx +++ b/frontend/public/components/catalog/catalog-page.tsx @@ -114,15 +114,7 @@ export class CatalogListPage extends React.Component