diff --git a/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/index.ts b/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/index.ts index 5b0da190a48..54d3cfc9796 100644 --- a/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/index.ts +++ b/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/index.ts @@ -83,7 +83,16 @@ export enum OperatorHubCSVAnnotationKey { infrastructureFeatures = 'operators.openshift.io/infrastructure-features', validSubscription = 'operators.openshift.io/valid-subscription', tags = 'tags', + disconnected = 'features.operators.openshift.io/disconnected', + fipsCompliant = 'features.operators.openshift.io/fips-compliant', + proxyAware = 'features.operators.openshift.io/proxy-aware', + cnf = 'features.operators.openshift.io/cnf', + cni = 'features.operators.openshift.io/cni', + csi = 'features.operators.openshift.io/csi', + tlsProfiles = 'features.operators.openshift.io/tls-profiles', tokenAuthAWS = 'features.operators.openshift.io/token-auth-aws', + tokenAuthAzure = 'features.operators.openshift.io/token-auth-azure', + tokenAuthGCP = 'features.operators.openshift.io/token-auth-gcp', } export type OperatorHubCSVAnnotations = { @@ -102,7 +111,16 @@ export type OperatorHubCSVAnnotations = { [OperatorHubCSVAnnotationKey.infrastructureFeatures]?: string; [OperatorHubCSVAnnotationKey.validSubscription]?: string; [OperatorHubCSVAnnotationKey.tags]?: string[]; + [OperatorHubCSVAnnotationKey.disconnected]?: string; + [OperatorHubCSVAnnotationKey.fipsCompliant]?: string; + [OperatorHubCSVAnnotationKey.proxyAware]?: string; + [OperatorHubCSVAnnotationKey.cnf]?: string; + [OperatorHubCSVAnnotationKey.cni]?: string; + [OperatorHubCSVAnnotationKey.csi]?: string; + [OperatorHubCSVAnnotationKey.tlsProfiles]?: string; [OperatorHubCSVAnnotationKey.tokenAuthAWS]?: string; + [OperatorHubCSVAnnotationKey.tokenAuthAzure]?: string; + [OperatorHubCSVAnnotationKey.tokenAuthGCP]?: string; } & ObjectMetadata['annotations']; type OperatorHubSpec = { diff --git a/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/operator-hub-page.tsx b/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/operator-hub-page.tsx index b06836f26db..c6f37bf185e 100644 --- a/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/operator-hub-page.tsx +++ b/frontend/packages/operator-lifecycle-manager/src/components/operator-hub/operator-hub-page.tsx @@ -151,11 +151,6 @@ export const OperatorHubList: React.FC = ({ [], ); - // TODO remove lodash and implement using Array.prototye.reduce - const infraFeatures = _.uniq( - _.compact(_.map(parsedInfraFeatures, (key) => InfraFeatures[key])), - ); - const { certifiedLevel, healthIndex, @@ -164,7 +159,18 @@ export const OperatorHubList: React.FC = ({ createdAt, support, capabilities: capabilityLevel, + [OperatorHubCSVAnnotationKey.disconnected]: disconnected, + [OperatorHubCSVAnnotationKey.fipsCompliant]: fipsCompliant, + [OperatorHubCSVAnnotationKey.proxyAware]: proxyAware, + [OperatorHubCSVAnnotationKey.cnf]: cnf, + [OperatorHubCSVAnnotationKey.cni]: cni, + [OperatorHubCSVAnnotationKey.csi]: csi, + // tlsProfiles requires addtional changes + // [OperatorHubCSVAnnotationKey.tlsProfiles]: tlsProfiles, [OperatorHubCSVAnnotationKey.tokenAuthAWS]: tokenAuthAWS, + // tokenAuthAzure and tokenAuthGCP require additional changes + // [OperatorHubCSVAnnotationKey.tokenAuthAzure]: tokenAuthAzure, + // [OperatorHubCSVAnnotationKey.tokenAuthGCP]: tokenAuthGCP, [OperatorHubCSVAnnotationKey.actionText]: marketplaceActionText, [OperatorHubCSVAnnotationKey.remoteWorkflow]: marketplaceRemoteWorkflow, [OperatorHubCSVAnnotationKey.supportWorkflow]: marketplaceSupportWorkflow, @@ -179,13 +185,34 @@ export const OperatorHubList: React.FC = ({ const auth = loaded && authentication?.data; - // FIXME: this is a temporary hack and should be fixed as part of - // a refactor to include the new style of infrastructure features - // tracked in PORTENABLE-525 + let infrastructureFeatures: InfraFeatures[] = parsedInfraFeatures.map( + (key) => InfraFeatures[key], + ); + + const featuresAnnotationsObjects = [ + { key: InfraFeatures.Disconnected, value: disconnected }, + { key: InfraFeatures.FipsMode, value: fipsCompliant }, + { key: InfraFeatures.Proxy, value: proxyAware }, + { key: InfraFeatures.cnf, value: cnf }, + { key: InfraFeatures.cni, value: cni }, + { key: InfraFeatures.csi, value: csi }, + ]; + + featuresAnnotationsObjects.forEach(({ key, value }) => { + if (value === 'false') { + // override existing operators.openshift.io/infrastructure-features annotation value + infrastructureFeatures = infrastructureFeatures.filter((feature) => feature !== key); + } else if (value === 'true') { + infrastructureFeatures.push(key); + } + }); + if (tokenAuthAWS === 'true' && isAWSSTSCluster(cloudCredential, infra, auth)) { - infraFeatures.push(shortLivedTokenAuth); + infrastructureFeatures.push(InfraFeatures[shortLivedTokenAuth]); } + const infraFeatures = _.uniq(_.compact(infrastructureFeatures)); + const clusterServiceVersion = loaded && clusterServiceVersionFor(