@@ -288,9 +288,13 @@ func CreateScenarioResources(scenario PodScenario, testScenarios TestScenarios)
288288 return fmt .Errorf ("failed to get network info for %s/%s: %w" , scenario .VnetName , scenario .SubnetName , err )
289289 }
290290
291- // Create unique names for this scenario
292- pnName := fmt .Sprintf ("pn-%s-%s-%s" , testScenarios .BuildID , scenario .VnetName , scenario .SubnetName )
293- pniName := fmt .Sprintf ("pni-%s-%s-%s" , testScenarios .BuildID , scenario .VnetName , scenario .SubnetName )
291+ // Create unique names for this scenario (simplify vnet name and make K8s compatible)
292+ // Remove "cx_vnet_" prefix and replace underscores with hyphens
293+ vnetShort := strings .TrimPrefix (scenario .VnetName , "cx_vnet_" )
294+ vnetShort = strings .ReplaceAll (vnetShort , "_" , "-" )
295+ subnetNameSafe := strings .ReplaceAll (scenario .SubnetName , "_" , "-" )
296+ pnName := fmt .Sprintf ("pn-%s-%s-%s" , testScenarios .BuildID , vnetShort , subnetNameSafe )
297+ pniName := fmt .Sprintf ("pni-%s-%s-%s" , testScenarios .BuildID , vnetShort , subnetNameSafe )
294298
295299 resources := TestResources {
296300 Kubeconfig : kubeconfig ,
@@ -358,8 +362,14 @@ func CreateScenarioResources(scenario PodScenario, testScenarios TestScenarios)
358362// DeleteScenarioResources deletes all resources for a specific pod scenario
359363func DeleteScenarioResources (scenario PodScenario , buildID string ) error {
360364 kubeconfig := fmt .Sprintf ("/tmp/%s.kubeconfig" , scenario .Cluster )
361- pnName := fmt .Sprintf ("pn-%s-%s-%s" , buildID , scenario .VnetName , scenario .SubnetName )
362- pniName := fmt .Sprintf ("pni-%s-%s-%s" , buildID , scenario .VnetName , scenario .SubnetName )
365+
366+ // Create same names as creation (simplify vnet name and make K8s compatible)
367+ // Remove "cx_vnet_" prefix and replace underscores with hyphens
368+ vnetShort := strings .TrimPrefix (scenario .VnetName , "cx_vnet_" )
369+ vnetShort = strings .ReplaceAll (vnetShort , "_" , "-" )
370+ subnetNameSafe := strings .ReplaceAll (scenario .SubnetName , "_" , "-" )
371+ pnName := fmt .Sprintf ("pn-%s-%s-%s" , buildID , vnetShort , subnetNameSafe )
372+ pniName := fmt .Sprintf ("pni-%s-%s-%s" , buildID , vnetShort , subnetNameSafe )
363373 podName := fmt .Sprintf ("pod-%s" , scenario .PodNameSuffix )
364374
365375 // Delete pod
0 commit comments