Skip to content

Commit

Permalink
fix(dev-catalog): reject the internal objects when creating objects o…
Browse files Browse the repository at this point in the history
…ut from CSV
  • Loading branch information
abhinandan13jan committed Nov 22, 2019
1 parent 82b4695 commit fbf573c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Expand Up @@ -4,6 +4,12 @@ import { ClusterServiceVersionKind } from './types';
import { referenceForProvidedAPI, providedAPIsFor } from './components';
import * as operatorLogo from './operator.svg';

const isInternal = (crd: { name: string }): string | boolean => {
const blacklistedAnnotation = 'operators.operatorframework.io/internal-objects';
const internalOpList = _.get(crd, ['csv', 'metadata', 'annotations', blacklistedAnnotation], []);
return internalOpList.find((op) => op === crd.name) || false;
};

export const normalizeClusterServiceVersions = (
clusterServiceVersions: ClusterServiceVersionKind[],
): K8sResourceKind[] => {
Expand All @@ -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: {
Expand Down
10 changes: 1 addition & 9 deletions frontend/public/components/catalog/catalog-page.tsx
Expand Up @@ -114,15 +114,7 @@ export class CatalogListPage extends React.Component<CatalogListPageProps, Catal
...projectTemplateItems,
];

//blacklisting all CRDs with annotation 'operators.operatorframework.io/internal-object' set to true
const filteredItems = _.reject(items, [
'obj',
'metadata',
'annotations',
'operators.operatorframework.io/internal-object',
]);

return _.sortBy(filteredItems, 'tileName');
return _.sortBy(items, 'tileName');
}

normalizeClusterServiceClasses(serviceClasses) {
Expand Down

0 comments on commit fbf573c

Please sign in to comment.