@@ -481,6 +481,7 @@ describe('getInfrastructureFeatures', () => {
481481 const result = getInfrastructureFeatures (
482482 {
483483 [ OLMAnnotation . InfrastructureFeatures ] : '["tokenAuth"]' ,
484+ [ OLMAnnotation . TokenAuthAWS ] : 'true' ,
484485 } ,
485486 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
486487 ) ;
@@ -493,6 +494,7 @@ describe('getInfrastructureFeatures', () => {
493494 const result = getInfrastructureFeatures (
494495 {
495496 [ OLMAnnotation . InfrastructureFeatures ] : '["TokenAuth"]' ,
497+ [ OLMAnnotation . TokenAuthAWS ] : 'true' ,
496498 } ,
497499 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
498500 ) ;
@@ -505,6 +507,7 @@ describe('getInfrastructureFeatures', () => {
505507 const result = getInfrastructureFeatures (
506508 {
507509 [ OLMAnnotation . InfrastructureFeatures ] : '["tokenAuth"]' ,
510+ [ OLMAnnotation . TokenAuthAzure ] : 'true' ,
508511 } ,
509512 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
510513 ) ;
@@ -517,6 +520,7 @@ describe('getInfrastructureFeatures', () => {
517520 const result = getInfrastructureFeatures (
518521 {
519522 [ OLMAnnotation . InfrastructureFeatures ] : '["TokenAuth"]' ,
523+ [ OLMAnnotation . TokenAuthAzure ] : 'true' ,
520524 } ,
521525 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
522526 ) ;
@@ -541,6 +545,7 @@ describe('getInfrastructureFeatures', () => {
541545 const result = getInfrastructureFeatures (
542546 {
543547 [ OLMAnnotation . InfrastructureFeatures ] : '["tokenAuthGCP"]' ,
548+ [ OLMAnnotation . TokenAuthGCP ] : 'true' ,
544549 } ,
545550 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
546551 ) ;
@@ -553,6 +558,7 @@ describe('getInfrastructureFeatures', () => {
553558 const result = getInfrastructureFeatures (
554559 {
555560 [ OLMAnnotation . InfrastructureFeatures ] : '["TokenAuthGCP"]' ,
561+ [ OLMAnnotation . TokenAuthGCP ] : 'true' ,
556562 } ,
557563 { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
558564 ) ;
@@ -570,6 +576,96 @@ describe('getInfrastructureFeatures', () => {
570576 ) ;
571577 expect ( result ) . toEqual ( [ ] ) ;
572578 } ) ;
579+ it ( `excludes token auth GCP feature when annotation is explicitly set to false` , ( ) => {
580+ const clusterIsAWSSTS = false ;
581+ const clusterIsAzureWIF = false ;
582+ const clusterIsGCPWIF = true ;
583+ const result = getInfrastructureFeatures (
584+ {
585+ [ OLMAnnotation . TokenAuthGCP ] : 'false' ,
586+ } ,
587+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
588+ ) ;
589+ expect ( result ) . toEqual ( [ ] ) ;
590+ } ) ;
591+ it ( `excludes legacy token auth GCP feature when annotation is explicitly set to false on GCP WIF cluster` , ( ) => {
592+ const clusterIsAWSSTS = false ;
593+ const clusterIsAzureWIF = false ;
594+ const clusterIsGCPWIF = true ;
595+ const result = getInfrastructureFeatures (
596+ {
597+ [ OLMAnnotation . InfrastructureFeatures ] : '["TokenAuthGCP"]' ,
598+ [ OLMAnnotation . TokenAuthGCP ] : 'false' ,
599+ } ,
600+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
601+ ) ;
602+ expect ( result ) . toEqual ( [ ] ) ;
603+ } ) ;
604+ it ( `excludes token auth AWS feature when annotation is not present on AWS STS cluster` , ( ) => {
605+ const clusterIsAWSSTS = true ;
606+ const clusterIsAzureWIF = false ;
607+ const clusterIsGCPWIF = false ;
608+ const result = getInfrastructureFeatures (
609+ { } , // No TokenAuthAWS annotation
610+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
611+ ) ;
612+ expect ( result ) . toEqual ( [ ] ) ;
613+ expect ( result ) . not . toContain ( InfrastructureFeature . TokenAuth ) ;
614+ } ) ;
615+ it ( `excludes token auth Azure feature when annotation is not present on Azure WIF cluster` , ( ) => {
616+ const clusterIsAWSSTS = false ;
617+ const clusterIsAzureWIF = true ;
618+ const clusterIsGCPWIF = false ;
619+ const result = getInfrastructureFeatures (
620+ { } , // No TokenAuthAzure annotation
621+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
622+ ) ;
623+ expect ( result ) . toEqual ( [ ] ) ;
624+ expect ( result ) . not . toContain ( InfrastructureFeature . TokenAuth ) ;
625+ } ) ;
626+ it ( `excludes token auth GCP feature when annotation is not present on GCP WIF cluster` , ( ) => {
627+ const clusterIsAWSSTS = false ;
628+ const clusterIsAzureWIF = false ;
629+ const clusterIsGCPWIF = true ;
630+ const result = getInfrastructureFeatures (
631+ { } , // No TokenAuthGCP annotation
632+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
633+ ) ;
634+ expect ( result ) . toEqual ( [ ] ) ;
635+ expect ( result ) . not . toContain ( InfrastructureFeature . TokenAuthGCP ) ;
636+ } ) ;
637+ it ( `requires explicit true annotation for all token auth providers (opt-in behavior)` , ( ) => {
638+ const clusterIsAWSSTS = true ;
639+ const clusterIsAzureWIF = true ;
640+ const clusterIsGCPWIF = true ;
641+ // Test with annotations missing
642+ const resultMissing = getInfrastructureFeatures (
643+ { } ,
644+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
645+ ) ;
646+ expect ( resultMissing ) . toEqual ( [ ] ) ;
647+ // Test with annotations set to 'false'
648+ const resultFalse = getInfrastructureFeatures (
649+ {
650+ [ OLMAnnotation . TokenAuthAWS ] : 'false' ,
651+ [ OLMAnnotation . TokenAuthAzure ] : 'false' ,
652+ [ OLMAnnotation . TokenAuthGCP ] : 'false' ,
653+ } ,
654+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
655+ ) ;
656+ expect ( resultFalse ) . toEqual ( [ ] ) ;
657+ // Test with annotations set to 'true' - only this should include features
658+ const resultTrue = getInfrastructureFeatures (
659+ {
660+ [ OLMAnnotation . TokenAuthAWS ] : 'true' ,
661+ [ OLMAnnotation . TokenAuthAzure ] : 'true' ,
662+ [ OLMAnnotation . TokenAuthGCP ] : 'true' ,
663+ } ,
664+ { clusterIsAWSSTS, clusterIsAzureWIF, clusterIsGCPWIF } ,
665+ ) ;
666+ expect ( resultTrue ) . toContain ( InfrastructureFeature . TokenAuth ) ;
667+ expect ( resultTrue ) . toContain ( InfrastructureFeature . TokenAuthGCP ) ;
668+ } ) ;
573669 it ( `includes features defined by latest annotation format` , ( ) => {
574670 const clusterIsAWSSTS = true ;
575671 const clusterIsAzureWIF = true ;
0 commit comments