From 68011005676b3bb5cdc451e9c264e991a5a8a859 Mon Sep 17 00:00:00 2001 From: thatInfrastructureGuy Date: Mon, 4 Mar 2019 12:03:41 -0800 Subject: [PATCH] As per review: fixed indentation. Type casted to string whereever necessary. Removed check for calico in CustomizeDiff block. Signed-off-by: thatInfrastructureGuy --- azurerm/data_source_kubernetes_cluster.go | 2 +- azurerm/resource_arm_kubernetes_cluster.go | 8 +------- azurerm/resource_arm_kubernetes_cluster_test.go | 6 +++--- website/docs/r/kubernetes_cluster.html.markdown | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/azurerm/data_source_kubernetes_cluster.go b/azurerm/data_source_kubernetes_cluster.go index 730fada28ab4..2301734b53ca 100644 --- a/azurerm/data_source_kubernetes_cluster.go +++ b/azurerm/data_source_kubernetes_cluster.go @@ -618,7 +618,7 @@ func flattenKubernetesClusterDataSourceNetworkProfile(profile *containerservice. values["network_plugin"] = profile.NetworkPlugin if profile.NetworkPolicy != "" { - values["network_policy"] = profile.NetworkPolicy + values["network_policy"] = string(profile.NetworkPolicy) } if profile.ServiceCidr != nil { diff --git a/azurerm/resource_arm_kubernetes_cluster.go b/azurerm/resource_arm_kubernetes_cluster.go index d17fc367193e..af647bf135ed 100644 --- a/azurerm/resource_arm_kubernetes_cluster.go +++ b/azurerm/resource_arm_kubernetes_cluster.go @@ -43,12 +43,6 @@ func resourceArmKubernetesCluster() *schema.Resource { return nil } - networkPolicy := profile["network_policy"].(string) - - if networkPolicy != "calico" { - return nil - } - dockerBridgeCidr := profile["docker_bridge_cidr"].(string) dnsServiceIP := profile["dns_service_ip"].(string) serviceCidr := profile["service_cidr"].(string) @@ -1069,7 +1063,7 @@ func flattenKubernetesClusterNetworkProfile(profile *containerservice.NetworkPro values["network_plugin"] = profile.NetworkPlugin if profile.NetworkPolicy != "" { - values["network_policy"] = profile.NetworkPolicy + values["network_policy"] = string(profile.NetworkPolicy) } if profile.ServiceCidr != nil { diff --git a/azurerm/resource_arm_kubernetes_cluster_test.go b/azurerm/resource_arm_kubernetes_cluster_test.go index ed66107c5f71..73fe337c55ab 100644 --- a/azurerm/resource_arm_kubernetes_cluster_test.go +++ b/azurerm/resource_arm_kubernetes_cluster_test.go @@ -1224,7 +1224,7 @@ resource "azurerm_kubernetes_cluster" "test" { network_profile { network_plugin = "%s" - network_policy = "%s" + network_policy = "%s" } } `, rInt, location, rInt, rInt, rInt, rInt, rInt, clientId, clientSecret, networkPlugin, networkPolicy) @@ -1301,8 +1301,8 @@ resource "azurerm_kubernetes_cluster" "test" { } network_profile { - network_plugin = "%s" - network_policy = "%s" + network_plugin = "%s" + network_policy = "%s" dns_service_ip = "10.10.0.10" docker_bridge_cidr = "172.18.0.1/16" service_cidr = "10.10.0.0/16" diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 6cce3608eaca..a338108c9aaa 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -146,7 +146,7 @@ A `network_profile` block supports the following: -> **NOTE:** When `network_plugin` is set to `azure` - the `vnet_subnet_id` field in the `agent_pool_profile` block must be set. -* `network_policy` - (Optional) Sets up network policy to be used with Azure CNI. [Network policy allows us to control the traffic flow between pods](https://docs.microsoft.com/en-us/azure/aks/use-network-policies). This field can only be set when `network_plugin` is set to `azure`. Currently only accepted value is `calico` which installs Calico daemonset. Changing this forces a new resource to be created. +* `network_policy` - (Optional) Sets up network policy to be used with Azure CNI. [Network policy allows us to control the traffic flow between pods](https://docs.microsoft.com/en-us/azure/aks/use-network-policies). This field can only be set when `network_plugin` is set to `azure`. Currently the only accepted value is `calico` which installs Calico daemonset. Changing this forces a new resource to be created. * `dns_service_ip` - (Optional) IP address within the Kubernetes service address range that will be used by cluster service discovery (kube-dns). This is required when `network_plugin` is set to `azure`. Changing this forces a new resource to be created.