@@ -898,29 +898,6 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
898898 }
899899 })
900900
901- When ("namespace-selector is mutated" , func () {
902- It ("should delete managed NAD in namespaces that no longer apply to namespace-selector" , func () {
903- By ("remove one active namespace from CR namespace-selector" )
904- activeTenantNs := testTenantNamespaces [1 ]
905- patch := fmt .Sprintf (`[{"op": "replace", "path": "./spec/namespaceSelector/matchExpressions/0/values", "value": [%q]}]` , activeTenantNs )
906- _ , err := e2ekubectl .RunKubectl ("" , "patch" , clusterUserDefinedNetworkResource , testClusterUdnName , "--type=json" , "-p=" + patch )
907- Expect (err ).NotTo (HaveOccurred ())
908-
909- By ("verify status reports remained target namespaces only as active" )
910- expectedActiveNs := []string {activeTenantNs }
911- Eventually (
912- validateClusterUDNStatusReportsActiveNamespacesFunc (oc .AdminDynamicClient (), testClusterUdnName , expectedActiveNs ... ),
913- 1 * time .Minute , 3 * time .Second ).Should (Succeed ())
914-
915- removedTenantNs := testTenantNamespaces [0 ]
916- By ("verify managed NAD not exist in removed target namespace" )
917- Eventually (func () bool {
918- _ , err := nadClient .NetworkAttachmentDefinitions (removedTenantNs ).Get (context .Background (), testClusterUdnName , metav1.GetOptions {})
919- return err != nil && kerrors .IsNotFound (err )
920- }, time .Second * 300 , time .Second * 1 ).Should (BeTrue (),
921- "NAD in target namespaces should be deleted following CR namespace-selector mutation" )
922- })
923- })
924901
925902 Context ("pod connected to ClusterUserDefinedNetwork" , func () {
926903 const testPodName = "test-pod-cluster-udn"
@@ -989,79 +966,6 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
989966 })
990967 })
991968
992- It ("when primary network exist, ClusterUserDefinedNetwork status should report not-ready" , func () {
993- namespace , err := f .CreateNamespace (context .TODO (), f .BaseName , map [string ]string {
994- "e2e-framework" : f .BaseName ,
995- RequiredUDNNamespaceLabel : "" ,
996- })
997- Expect (err ).NotTo (HaveOccurred ())
998- err = udnWaitForOpenShift (oc , namespace .Name )
999- Expect (err ).NotTo (HaveOccurred ())
1000- f .Namespace = namespace
1001- testTenantNamespaces := []string {
1002- f .Namespace .Name + "blue" ,
1003- f .Namespace .Name + "red" ,
1004- }
1005- By ("Creating test tenants namespaces" )
1006- for _ , nsName := range testTenantNamespaces {
1007- _ , err := cs .CoreV1 ().Namespaces ().Create (context .Background (), & v1.Namespace {
1008- ObjectMeta : metav1.ObjectMeta {
1009- Name : nsName ,
1010- Labels : map [string ]string {RequiredUDNNamespaceLabel : "" },
1011- }}, metav1.CreateOptions {})
1012- Expect (err ).NotTo (HaveOccurred ())
1013- DeferCleanup (func () error {
1014- err := cs .CoreV1 ().Namespaces ().Delete (context .Background (), nsName , metav1.DeleteOptions {})
1015- return err
1016- })
1017- }
1018-
1019- By ("create primary network NAD in one of the tenant namespaces" )
1020- const primaryNadName = "some-primary-net"
1021- primaryNetTenantNs := testTenantNamespaces [0 ]
1022- primaryNetNad := generateNAD (newNetworkAttachmentConfig (networkAttachmentConfigParams {
1023- role : "primary" ,
1024- topology : "layer3" ,
1025- name : primaryNadName ,
1026- networkName : primaryNadName ,
1027- cidr : correctCIDRFamily (oc , userDefinedNetworkIPv4Subnet , userDefinedNetworkIPv6Subnet ),
1028- }))
1029- _ , err = nadClient .NetworkAttachmentDefinitions (primaryNetTenantNs ).Create (context .Background (), primaryNetNad , metav1.CreateOptions {})
1030- Expect (err ).NotTo (HaveOccurred ())
1031-
1032- By ("create primary Cluster UDN CR" )
1033- cudnName := randomNetworkMetaName ()
1034- cleanup , err := createManifest (f .Namespace .Name , newPrimaryClusterUDNManifest (oc , cudnName , testTenantNamespaces ... ))
1035- Expect (err ).NotTo (HaveOccurred ())
1036- DeferCleanup (func () {
1037- cleanup ()
1038- _ , err := e2ekubectl .RunKubectl ("" , "delete" , "clusteruserdefinednetwork" , cudnName , "--wait" , fmt .Sprintf ("--timeout=%ds" , 60 ))
1039- Expect (err ).NotTo (HaveOccurred ())
1040- })
1041-
1042- expectedMessage := fmt .Sprintf ("primary network already exist in namespace %q: %q" , primaryNetTenantNs , primaryNadName )
1043- Eventually (func (g Gomega ) []metav1.Condition {
1044- conditionsJSON , err := e2ekubectl .RunKubectl (f .Namespace .Name , "get" , "clusteruserdefinednetwork" , cudnName , "-o" , "jsonpath={.status.conditions}" )
1045- g .Expect (err ).NotTo (HaveOccurred ())
1046- var actualConditions []metav1.Condition
1047- g .Expect (json .Unmarshal ([]byte (conditionsJSON ), & actualConditions )).To (Succeed ())
1048- return normalizeConditions (actualConditions )
1049- }, 5 * time .Second , 1 * time .Second ).Should (SatisfyAny (
1050- ConsistOf (metav1.Condition {
1051- Type : "NetworkReady" ,
1052- Status : metav1 .ConditionFalse ,
1053- Reason : "NetworkAttachmentDefinitionSyncError" ,
1054- Message : expectedMessage ,
1055- }),
1056- ConsistOf (metav1.Condition {
1057- Type : "NetworkCreated" ,
1058- Status : metav1 .ConditionFalse ,
1059- Reason : "NetworkAttachmentDefinitionSyncError" ,
1060- Message : expectedMessage ,
1061- }),
1062- ))
1063- })
1064-
1065969 Context ("UDN Pod" , func () {
1066970 const (
1067971 testUdnName = "test-net"
0 commit comments