Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ describe('getInfrastructureFeatures', () => {
const result = getInfrastructureFeatures(
{
[OLMAnnotation.InfrastructureFeatures]: '["tokenAuth"]',
[OLMAnnotation.TokenAuthAWS]: 'true',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
Expand All @@ -493,6 +494,7 @@ describe('getInfrastructureFeatures', () => {
const result = getInfrastructureFeatures(
{
[OLMAnnotation.InfrastructureFeatures]: '["TokenAuth"]',
[OLMAnnotation.TokenAuthAWS]: 'true',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
Expand All @@ -505,6 +507,7 @@ describe('getInfrastructureFeatures', () => {
const result = getInfrastructureFeatures(
{
[OLMAnnotation.InfrastructureFeatures]: '["tokenAuth"]',
[OLMAnnotation.TokenAuthAzure]: 'true',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
Expand All @@ -517,6 +520,7 @@ describe('getInfrastructureFeatures', () => {
const result = getInfrastructureFeatures(
{
[OLMAnnotation.InfrastructureFeatures]: '["TokenAuth"]',
[OLMAnnotation.TokenAuthAzure]: 'true',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
Expand Down Expand Up @@ -615,6 +619,30 @@ describe('getInfrastructureFeatures', () => {
});
expect(result).toEqual([InfrastructureFeature.FIPSMode]);
});
it(`excludes TokenAuth when token-auth-aws is explicitly false on AWS STS cluster`, () => {
const clusterIsAWSSTS = true;
const clusterIsAzureWIF = false;
const clusterIsGCPWIF = false;
const result = getInfrastructureFeatures(
{
[OLMAnnotation.TokenAuthAWS]: 'false',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
expect(result).toEqual([]);
});
it(`excludes TokenAuth when token-auth-aws annotation is missing on AWS STS cluster`, () => {
const clusterIsAWSSTS = true;
const clusterIsAzureWIF = false;
const clusterIsGCPWIF = false;
const result = getInfrastructureFeatures(
{
[OLMAnnotation.Disconnected]: 'true',
},
{ clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF },
);
expect(result).toEqual([InfrastructureFeature.Disconnected]);
});
it(`returns empty array when ${OLMAnnotation.InfrastructureFeatures} is empty`, () => {
const result = getInfrastructureFeatures({
[OLMAnnotation.InfrastructureFeatures]: '[]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ export const getInfrastructureFeatures: AnnotationParser<
onError,
});
const azureTokenAuthIsSupported =
clusterIsAzureWIF && annotations[OLMAnnotation.TokenAuthAzure] !== 'false';
clusterIsAzureWIF && annotations[OLMAnnotation.TokenAuthAzure] === 'true';
const awsTokenAuthIsSupported =
clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] !== 'false';
clusterIsAWSSTS && annotations[OLMAnnotation.TokenAuthAWS] === 'true';
return [...parsedInfrastructureFeatures, ...Object.keys(annotations ?? {})].reduce(
(supportedFeatures, key) => {
const feature = infrastructureFeatureMap[key];
Expand Down