@@ -524,6 +524,58 @@ const createNSPsforTeam = async (team) => {
524
524
} ,
525
525
} ;
526
526
527
+ const nsAllowBalancer = {
528
+ kind : 'NetworkPolicy' ,
529
+ apiVersion : 'networking.k8s.io/v1' ,
530
+ metadata : {
531
+ name : 'balancer-access-to-namespace' ,
532
+ namespace : `t-${ team } ` ,
533
+ } ,
534
+ spec : {
535
+ podSelector : { } ,
536
+ ingress : [
537
+ {
538
+ from : [
539
+ {
540
+ namespaceSelector : {
541
+ matchLabels : {
542
+ 'kubernetes.io/metadata.name' : 'default' ,
543
+ } ,
544
+ } ,
545
+ } ,
546
+ {
547
+ podSelector : {
548
+ matchLabels : {
549
+ 'app.kubernetes.io/name' : 'wrongsecrets-ctf-party' ,
550
+ } ,
551
+ } ,
552
+ } ,
553
+ ] ,
554
+ } ,
555
+ ] ,
556
+ } ,
557
+ egress : [
558
+ {
559
+ to : [
560
+ {
561
+ namespaceSelector : {
562
+ matchLabels : {
563
+ 'kubernetes.io/metadata.name' : 'default' ,
564
+ } ,
565
+ } ,
566
+ } ,
567
+ {
568
+ podSelector : {
569
+ matchLabels : {
570
+ 'app.kubernetes.io/name' : 'wrongsecrets-ctf-party' ,
571
+ } ,
572
+ } ,
573
+ } ,
574
+ ] ,
575
+ } ,
576
+ ] ,
577
+ } ;
578
+
527
579
const nsAllowWrongSecretstoVirtualDesktop = {
528
580
kind : 'NetworkPolicy' ,
529
581
apiVersion : 'networking.k8s.io/v1' ,
@@ -723,17 +775,22 @@ const createNSPsforTeam = async (team) => {
723
775
throw new Error ( JSON . stringify ( error ) ) ;
724
776
} ) ;
725
777
await k8sNetworkingApi
726
- . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowWrongSecretstoVirtualDesktop )
778
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowOnlyDNS )
727
779
. catch ( ( error ) => {
728
780
throw new Error ( JSON . stringify ( error ) ) ;
729
781
} ) ;
730
782
await k8sNetworkingApi
731
- . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowVirtualDesktoptoWrongSecrets )
783
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowBalancer )
732
784
. catch ( ( error ) => {
733
785
throw new Error ( JSON . stringify ( error ) ) ;
734
786
} ) ;
735
787
await k8sNetworkingApi
736
- . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowOnlyDNS )
788
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowWrongSecretstoVirtualDesktop )
789
+ . catch ( ( error ) => {
790
+ throw new Error ( JSON . stringify ( error ) ) ;
791
+ } ) ;
792
+ await k8sNetworkingApi
793
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowVirtualDesktoptoWrongSecrets )
737
794
. catch ( ( error ) => {
738
795
throw new Error ( JSON . stringify ( error ) ) ;
739
796
} ) ;
0 commit comments