Skip to content

Commit

Permalink
Bug 1865998: Tolerate multiple package manifests with the same name
Browse files Browse the repository at this point in the history
This change partially works around upstream OLM bug:

https://bugzilla.redhat.com/show_bug.cgi?id=1814822

Generate a unique key for package manifests in our k8s reducer when name
and namespace aren't unique.
  • Loading branch information
spadgett committed Aug 5, 2020
1 parent e47665c commit 6a812d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/public/module/k8s/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ import {
modelFor,
} from './index';

export const getQN: (obj: K8sResourceKind) => string = ({ metadata: { name, namespace } }) =>
(namespace ? `(${namespace})-` : '') + name;
export const getQN: (obj: K8sResourceKind) => string = (obj) => {
const { name, namespace } = obj.metadata;
// Name + namespace is not unique for PackageManifest resources, so include the catalog source.
// TODO: We should be able to remove this when the upstream OLM bug is fixed.
// https://bugzilla.redhat.com/show_bug.cgi?id=1814822
if (obj.apiVersion === 'packages.operators.coreos.com/v1' && obj.kind === 'PackageManifest') {
return `${name}~${obj.status?.catalogSource || ''}`;
}
return (namespace ? `(${namespace})~` : '') + name;
};

export const k8sBasePath = `${window.SERVER_FLAGS.basePath}api/kubernetes`;

Expand Down

0 comments on commit 6a812d2

Please sign in to comment.