@@ -524,126 +524,86 @@ const createNSPsforTeam = async (team) => {
524
524
} ,
525
525
} ;
526
526
527
- const nsAllowWithinNS = {
527
+ const nsAllowWrongSecretstoVirtualDesktop = {
528
528
kind : 'NetworkPolicy' ,
529
529
apiVersion : 'networking.k8s.io/v1' ,
530
530
metadata : {
531
- name : 'allow-same-namespace ' ,
531
+ name : 'allow-wrongsecrets-access ' ,
532
532
namespace : `t-${ team } ` ,
533
533
} ,
534
534
spec : {
535
535
podSelector : {
536
536
matchLabels : {
537
- team : ` ${ team } ` ,
537
+ app : 'wrongsecrets' ,
538
538
} ,
539
539
} ,
540
540
ingress : [
541
541
{
542
542
from : [
543
543
{
544
- namespaceSelector : {
544
+ podSelector : {
545
545
matchLabels : {
546
- 'kubernetes.io/metadata.name' : `t- ${ team } ` ,
546
+ app : 'virtualdesktop' ,
547
547
} ,
548
548
} ,
549
549
} ,
550
550
] ,
551
- ports : [
552
- {
553
- port : 8080 ,
554
- protocol : 'TCP' ,
555
- } ,
556
- {
557
- port : 3000 ,
558
- protocol : 'TCP' ,
559
- } ,
560
- ] ,
561
551
} ,
562
552
] ,
563
553
} ,
564
554
egress : [
565
555
{
566
556
to : [
567
557
{
568
- namespaceSelector : {
558
+ podSelector : {
569
559
matchLabels : {
570
- 'kubernetes.io/metadata.name' : `t- ${ team } ` ,
560
+ app : 'virtualdesktop' ,
571
561
} ,
572
562
} ,
573
563
} ,
574
564
] ,
575
- ports : [
576
- {
577
- port : 8080 ,
578
- protocol : 'TCP' ,
579
- } ,
580
- {
581
- port : 3000 ,
582
- protocol : 'TCP' ,
583
- } ,
584
- ] ,
585
565
} ,
586
566
] ,
587
567
} ;
588
568
589
- const nsAllowToTalkToDefault = {
569
+ const nsAllowVirtualDesktoptoWrongSecrets = {
590
570
kind : 'NetworkPolicy' ,
591
571
apiVersion : 'networking.k8s.io/v1' ,
592
572
metadata : {
593
- name : 'allow-ns-to-default-and-back ' ,
573
+ name : 'allow-virtualdesktop-access ' ,
594
574
namespace : `t-${ team } ` ,
595
575
} ,
596
576
spec : {
597
577
podSelector : {
598
578
matchLabels : {
599
- team : ` ${ team } ` ,
579
+ app : 'virtualdesktop' ,
600
580
} ,
601
581
} ,
602
582
ingress : [
603
583
{
604
584
from : [
605
585
{
606
- namespaceSelector : {
586
+ podSelector : {
607
587
matchLabels : {
608
- 'kubernetes.io/metadata.name' : 'default ' ,
588
+ app : 'wrongsecrets ' ,
609
589
} ,
610
590
} ,
611
591
} ,
612
592
] ,
613
- ports : [
614
- {
615
- port : 8080 ,
616
- protocol : 'TCP' ,
617
- } ,
618
- {
619
- port : 3000 ,
620
- protocol : 'TCP' ,
621
- } ,
622
- ] ,
623
593
} ,
624
594
] ,
625
595
} ,
626
596
egress : [
627
597
{
628
598
to : [
629
599
{
630
- namespaceSelector : {
600
+ podSelector : {
631
601
matchLabels : {
632
- 'kubernetes.io/metadata.name' : 'default ' ,
602
+ app : 'wrongsecrets ' ,
633
603
} ,
634
604
} ,
635
605
} ,
636
606
] ,
637
- ports : [
638
- {
639
- port : 8080 ,
640
- protocol : 'TCP' ,
641
- } ,
642
- {
643
- port : 3000 ,
644
- protocol : 'TCP' ,
645
- } ,
646
- ] ,
647
607
} ,
648
608
] ,
649
609
} ;
@@ -763,12 +723,12 @@ const createNSPsforTeam = async (team) => {
763
723
throw new Error ( JSON . stringify ( error ) ) ;
764
724
} ) ;
765
725
await k8sNetworkingApi
766
- . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowWithinNS )
726
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowWrongSecretstoVirtualDesktop )
767
727
. catch ( ( error ) => {
768
728
throw new Error ( JSON . stringify ( error ) ) ;
769
729
} ) ;
770
730
await k8sNetworkingApi
771
- . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowToTalkToDefault )
731
+ . createNamespacedNetworkPolicy ( `t-${ team } ` , nsAllowVirtualDesktoptoWrongSecrets )
772
732
. catch ( ( error ) => {
773
733
throw new Error ( JSON . stringify ( error ) ) ;
774
734
} ) ;
0 commit comments