-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azurerm_kubernetes_cluster support for open_service_mesh (#13462)
- Loading branch information
1 parent
f78b268
commit 0003503
Showing
6 changed files
with
201 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ var kubernetesAddOnTests = map[string]func(t *testing.T){ | |
"addonProfileAppGatewayAppGatewayId": testAccKubernetesCluster_addonProfileIngressApplicationGateway_appGatewayId, | ||
"addonProfileAppGatewaySubnetCIDR": testAccKubernetesCluster_addonProfileIngressApplicationGateway_subnetCIDR, | ||
"addonProfileAppGatewaySubnetID": testAccKubernetesCluster_addonProfileIngressApplicationGateway_subnetId, | ||
"addonProfileOpenServiceMesh": testAccKubernetesCluster_addonProfileOpenServiceMesh, | ||
} | ||
|
||
var addOnAppGatewaySubnetCIDR string = "10.241.0.0/16" // AKS will use 10.240.0.0/16 for the aks subnet so use 10.241.0.0/16 for the app gateway subnet | ||
|
@@ -341,6 +342,39 @@ func testAccKubernetesCluster_addonProfileIngressApplicationGateway_subnetId(t * | |
}) | ||
} | ||
|
||
func TestAccKubernetesCluster_addonProfileOpenServiceMesh(t *testing.T) { | ||
checkIfShouldRunTestsIndividually(t) | ||
testAccKubernetesCluster_addonProfileOpenServiceMesh(t) | ||
} | ||
|
||
func testAccKubernetesCluster_addonProfileOpenServiceMesh(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") | ||
r := KubernetesClusterResource{} | ||
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
// Enable OSM | ||
Config: r.addonProfileOpenServiceMeshConfig(data, true), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
check.That(data.ResourceName).Key("addon_profile.0.open_service_mesh.#").HasValue("1"), | ||
check.That(data.ResourceName).Key("addon_profile.0.open_service_mesh.0.enabled").HasValue("true"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
// Disable OSM | ||
Config: r.addonProfileOpenServiceMeshConfig(data, false), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
check.That(data.ResourceName).Key("addon_profile.0.open_service_mesh.#").HasValue("1"), | ||
check.That(data.ResourceName).Key("addon_profile.0.open_service_mesh.0.enabled").HasValue("false"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}) | ||
} | ||
|
||
func (KubernetesClusterResource) addonProfileAciConnectorLinuxConfig(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
|
@@ -1095,3 +1129,47 @@ resource "azurerm_kubernetes_cluster" "test" { | |
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) | ||
} | ||
|
||
func (KubernetesClusterResource) addonProfileOpenServiceMeshConfig(data acceptance.TestData, enabled bool) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-aks-%d" | ||
location = "%s" | ||
} | ||
resource "azurerm_kubernetes_cluster" "test" { | ||
name = "acctestaks%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
dns_prefix = "acctestaks%d" | ||
linux_profile { | ||
admin_username = "acctestuser%d" | ||
ssh_key { | ||
key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt [email protected]" | ||
} | ||
} | ||
default_node_pool { | ||
name = "default" | ||
node_count = 1 | ||
vm_size = "Standard_DS2_v2" | ||
} | ||
addon_profile { | ||
open_service_mesh { | ||
enabled = %t | ||
} | ||
} | ||
identity { | ||
type = "SystemAssigned" | ||
} | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, enabled) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters