Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AKS: Add-On Profiles #1751

Merged
merged 42 commits into from
Aug 14, 2018
Merged

Conversation

tombuildsstuff
Copy link
Contributor

Includes the changes originally contributed by @lfshr in #1502 - but updates this to resolve the merge conflicts

lfshr and others added 30 commits July 2, 2018 19:31
This is default when network_profile is not specified.
We already test this.
Better to make this explicit.
Tests pass:

```
$ acctests azurerm TestAccAzureRMKubernetesCluster_basic
=== RUN   TestAccAzureRMKubernetesCluster_basic
--- PASS: TestAccAzureRMKubernetesCluster_basic (1329.57s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1329.613s
```
@yves-vogl
Copy link
Contributor

Thanks for your work!

@@ -321,6 +372,7 @@ func resourceArmKubernetesClusterCreate(d *schema.ResourceData, meta interface{}
agentProfiles := expandAzureRmKubernetesClusterAgentProfiles(d)
servicePrincipalProfile := expandAzureRmKubernetesClusterServicePrincipal(d)
networkProfile := expandAzureRmKubernetesClusterNetworkProfile(d)
addOnProfile := expandAzureRmKubernetesClusterAddOnProfile(d)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I being nit-picky to request this to be addonProfiles instead of addOnProfile? (just to reflect AddonProfiles with camel-casing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not at all - the schema field is addon_profile to match the general convention, but I can push a commit to update this :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tom! 😄

Copy link
Contributor Author

@tombuildsstuff tombuildsstuff Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed: be893dc :)

@tombuildsstuff
Copy link
Contributor Author

@yves-vogl this is mostly @lfshr's work/original PR - I've just pushed a couple of commits to finish it off, so thanks to @lfshr here :)

@lfshr
Copy link
Contributor

lfshr commented Aug 10, 2018

#1488 has a dependency on this

@tombuildsstuff
Copy link
Contributor Author

Resource Tests pass:

screenshot 2018-08-10 at 14 00 07

@tombuildsstuff
Copy link
Contributor Author

Data Source tests pass:

screenshot 2018-08-10 at 14 48 48

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nitpicks + 1 blocker (deduplication of code).

@@ -419,3 +465,49 @@ func flattenKubernetesClusterDataSourceNetworkProfile(profile *containerservice.

return []interface{}{values}
}

func flattenKubernetesClusterDataSourceAddonProfiles(profile map[string]*containerservice.ManagedClusterAddonProfile) interface{} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just rename either this function or flattenAzureRmKubernetesClusterAddonProfiles and reuse it? It's exactly the same function with the same interface, just a different name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably - but historically this has caused us issues where the schema's diverged - so we're trying to avoid that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow, how could it diverge if the output is coming from the exact same API call? If the API response is going to diverge, then both functions (as they're exactly the same except name) need fixing, AFAICT?

Copy link
Contributor Author

@tombuildsstuff tombuildsstuff Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the schema being the Terraform schema here - since one is a Data Source and hence Computed (this one) vs the other being a Resource / not computed. We've had PR's in the past with folks adding items to each independently, which means there's a Set error when this happens - as such it appears preferable to dupe this logic?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see what do you mean 🤔That's tricky, yeah.

I wish we had a better way to reuse parts of schema between resources and data sources 😞

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this discussion -- this is something we can run into on AWS as well since we generally are pushing for separate schema definitions and read functions, but usually sharing the flatten functions. 🤔

testCheckAzureRMKubernetesClusterExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "addon_profile.0.http_application_routing.#", "1"),
resource.TestCheckResourceAttrSet(resourceName, "addon_profile.0.http_application_routing.0.enabled"),
resource.TestCheckResourceAttrSet(resourceName, "addon_profile.0.http_application_routing.0.http_application_routing_zone_name"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Can't/shouldn't we be testing the exact value, instead of just whether it's set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a computed value from the API - so we're just ensuring it's returned

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant mainly enabled (which presumably is just "true"), I'm not sure about http_application_routing_zone_name, but in theory TestMatchResourceAttrSet might work?

Again, it's just a nitpick, so feel free to ignore ;-)

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]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: This could live in a separate file/dir (test-fixtures) and be reused in any other tests which need SSH pubkey.

* `linux_profile` - (Required) A Linux Profile block as documented below.

* `agent_pool_profile` - (Required) One or more Agent Pool Profile's block as documented below.

* `service_principal` - (Required) A Service Principal block as documented below.

---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - what's the point of separating these arguments by line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separating arguments by line means the diff's/merge conflicts are generally clearer
the dashes are to make it clearer to read - see the VM resource for an example: https://www.terraform.io/docs/providers/azurerm/r/virtual_machine.html - which makes it clearer what's required / makes it easier to understand


* `network_plugin` - (Required) Network plugin to use for networking. Currently supported values are `azure` and `kubenet`. Changing this forces a new resource to be created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I'd actually argue that backticks were more appropriate here as they enable highlighting of the string and make it stand out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot

@tombuildsstuff tombuildsstuff merged commit 531df6d into master Aug 14, 2018
@tombuildsstuff tombuildsstuff deleted the containerservices-advancednetworking branch August 14, 2018 12:28
tombuildsstuff added a commit that referenced this pull request Aug 14, 2018
@tombuildsstuff
Copy link
Contributor Author

hey @yves-vogl @lfshr

Just to let you know that we've just shipped support for this as a part of v1.13.0 of the AzureRM Provider :)

Thanks!

@thommaa
Copy link

thommaa commented Sep 5, 2018

@tombuildsstuff Hi, thanks for implementing it.

For both addon_profile elements: http_application_routing and oms_agent, you have choosen ForceNew: true. What was the motivation or intension to force a new cluster, when changing the values?

The Azure CLI offers inplace update of an existing cluster. az aks enable-addons

@lfshr
Copy link
Contributor

lfshr commented Sep 5, 2018

@thommaa I believe that the azure-sdk-for-go threw an error when trying to update the cluster.

@yves-vogl
Copy link
Contributor

@thommaa @lfshr Oh, maybe a low hanging fruit for contribution to the SDK :-P

@lfshr
Copy link
Contributor

lfshr commented Sep 5, 2018

@thommaa @yves-vogl I'll try and do some more testing at some point this week (before spider-man gets released ofc)

@yves-vogl
Copy link
Contributor

yves-vogl commented Sep 5, 2018

I'll try to have a look at the sources, too. We currently make heavy use of those stuff and it seems to be just fair if we spend some customer paid hours for contribution. So if any help is required, let us know.

@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants