Skip to content

Commit

Permalink
use different rg for vnet in custom vnet e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
nojnhuh committed Oct 26, 2023
1 parent 6987809 commit c44cd84
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions azure/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s *ClusterScope) RouteTableSpecs() []azure.ResourceSpecGetter {
specs = append(specs, &routetables.RouteTableSpec{
Name: subnet.RouteTable.Name,
Location: s.Location(),
ResourceGroup: s.ResourceGroup(),
ResourceGroup: s.Vnet().ResourceGroup,
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
})
Expand Down Expand Up @@ -358,7 +358,7 @@ func (s *ClusterScope) NSGSpecs() []azure.ResourceSpecGetter {
nsgspecs[i] = &securitygroups.NSGSpec{
Name: subnet.SecurityGroup.Name,
SecurityRules: subnet.SecurityGroup.SecurityRules,
ResourceGroup: s.ResourceGroup(),
ResourceGroup: s.Vnet().ResourceGroup,
Location: s.Location(),
ClusterName: s.ClusterName(),
AdditionalTags: s.AdditionalTags(),
Expand Down
2 changes: 1 addition & 1 deletion templates/test/ci/cluster-template-prow-custom-vnet.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
networkSpec:
vnet:
resourceGroup: ${AZURE_RESOURCE_GROUP}
resourceGroup: ${AZURE_CUSTOM_VNET_RESOURCE_GROUP}
name: ${AZURE_CUSTOM_VNET_NAME}
subnets:
- name: ${AZURE_CUSTOM_VNET_NAME}-controlplane-subnet
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/azure_privatecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func SetupExistingVNet(ctx context.Context, vnetCidr string, cpSubnetCidrs, node
routetableClient.Authorizer = authorizer

By("creating a resource group")
groupName := os.Getenv(AzureResourceGroup)
groupName := os.Getenv(AzureCustomVnetResourceGroup)
_, err = groupClient.CreateOrUpdate(ctx, groupName, resources.Group{
Location: ptr.To(os.Getenv(AzureLocation)),
Tags: map[string]*string{
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ var _ = Describe("Workload cluster creation", func() {
}
dumpSpecResourcesAndCleanup(ctx, cleanInput)
Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureCustomVnetResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureVNetName)).To(Succeed())
Expect(os.Unsetenv(ClusterIdentityName)).To(Succeed())
Expect(os.Unsetenv(ClusterIdentityNamespace)).To(Succeed())
Expand All @@ -155,6 +156,7 @@ var _ = Describe("Workload cluster creation", func() {
clusterName = getClusterName(clusterNamePrefix, "public-custom-vnet")
By("Creating a custom virtual network", func() {
Expect(os.Setenv(AzureCustomVNetName, "custom-vnet")).To(Succeed())
Expect(os.Setenv(AzureCustomVnetResourceGroup, clusterName+"-vnetrg")).To(Succeed())
additionalCleanup = SetupExistingVNet(ctx,
"10.0.0.0/16",
map[string]string{fmt.Sprintf("%s-controlplane-subnet", os.Getenv(AzureCustomVNetName)): "10.0.0.0/24"},
Expand Down
1 change: 1 addition & 0 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
AzureExtendedLocationType = "AZURE_EXTENDEDLOCATION_TYPE"
AzureExtendedLocationName = "AZURE_EXTENDEDLOCATION_NAME"
AzureResourceGroup = "AZURE_RESOURCE_GROUP"
AzureCustomVnetResourceGroup = "AZURE_CUSTOM_VNET_RESOURCE_GROUP"
AzureVNetName = "AZURE_VNET_NAME"
AzureCustomVNetName = "AZURE_CUSTOM_VNET_NAME"
AzureInternalLBIP = "AZURE_INTERNAL_LB_IP"
Expand Down

0 comments on commit c44cd84

Please sign in to comment.