Skip to content

Commit

Permalink
Merge pull request #13183 from rhamilto/CONSOLE-3758
Browse files Browse the repository at this point in the history
CONSOLE-3758:  add support for new features annotations while preserv…
  • Loading branch information
openshift-ci[bot] committed Oct 12, 2023
2 parents aeeeddf + 91d2e15 commit 7d79a03
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down
Expand Up @@ -151,11 +151,6 @@ export const OperatorHubList: React.FC<OperatorHubListProps> = ({
[],
);

// TODO remove lodash and implement using Array.prototye.reduce
const infraFeatures = _.uniq(
_.compact(_.map(parsedInfraFeatures, (key) => InfraFeatures[key])),
);

const {
certifiedLevel,
healthIndex,
Expand All @@ -164,7 +159,18 @@ export const OperatorHubList: React.FC<OperatorHubListProps> = ({
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,
Expand All @@ -179,13 +185,34 @@ export const OperatorHubList: React.FC<OperatorHubListProps> = ({

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(
Expand Down

0 comments on commit 7d79a03

Please sign in to comment.