Skip to content

Commit

Permalink
Replace bastion env var with function parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jont828 committed Oct 11, 2021
1 parent 9f4ce9a commit b82be8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions test/e2e/azure_privatecluster.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:build e2e
// +build e2e

/*
Expand Down Expand Up @@ -224,7 +223,7 @@ func AzurePrivateClusterSpec(ctx context.Context, inputGetter func() AzurePrivat
}

// SetupExistingVNet creates a resource group and a VNet to be used by a workload cluster.
func SetupExistingVNet(ctx context.Context, vnetCidr string, cpSubnetCidrs, nodeSubnetCidrs map[string]string) func() {
func SetupExistingVNet(ctx context.Context, vnetCidr string, cpSubnetCidrs, nodeSubnetCidrs map[string]string, bastionSubnetName, bastionSubnetCidr string) func() {
By("creating Azure clients with the workload cluster's subscription")
settings, err := auth.GetSettingsFromEnvironment()
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -348,9 +347,9 @@ func SetupExistingVNet(ctx context.Context, vnetCidr string, cpSubnetCidrs, node
// Create the AzureBastion subnet.
subnets = append(subnets, network.Subnet{
SubnetPropertiesFormat: &network.SubnetPropertiesFormat{
AddressPrefix: pointer.StringPtr("10.0.2.0/24"),
AddressPrefix: pointer.StringPtr(bastionSubnetCidr),
},
Name: pointer.StringPtr(fmt.Sprintf("%s-azure-bastion-subnet", os.Getenv(AzureCustomVNetName))),
Name: pointer.StringPtr(bastionSubnetName),
})

vnetFuture, err := vnetClient.CreateOrUpdate(ctx, groupName, os.Getenv(AzureCustomVNetName), network.VirtualNetwork{
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ var _ = Describe("Workload cluster creation", func() {
additionalCleanup = SetupExistingVNet(ctx,
"10.0.0.0/16",
map[string]string{fmt.Sprintf("%s-controlplane-subnet", os.Getenv(AzureCustomVNetName)): "10.0.0.0/24"},
map[string]string{fmt.Sprintf("%s-node-subnet", os.Getenv(AzureCustomVNetName)): "10.0.1.0/24"})
map[string]string{fmt.Sprintf("%s-node-subnet", os.Getenv(AzureCustomVNetName)): "10.0.1.0/24"},
fmt.Sprintf("%s-azure-bastion-subnet", os.Getenv(AzureCustomVNetName)),
"10.0.2.0/24",
)
})

clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ const (
AzureCPSubnetCidr = "AZURE_CP_SUBNET_CIDR"
AzureVNetCidr = "AZURE_PRIVATE_VNET_CIDR"
AzureNodeSubnetCidr = "AZURE_NODE_SUBNET_CIDR"
AzureBastionSubnetCIDR = "AZURE_BASTION_SUBNET_CIDR"
AzureBastionSubnetName = "AZURE_BASTION_SUBNET_NAME"
MultiTenancyIdentityName = "MULTI_TENANCY_IDENTITY_NAME"
ClusterIdentityName = "CLUSTER_IDENTITY_NAME"
ClusterIdentityNamespace = "CLUSTER_IDENTITY_NAMESPACE"
Expand Down

0 comments on commit b82be8c

Please sign in to comment.