Skip to content

feat: allow for configuring auto_scaler_profile#278

Merged
lonegunmanb merged 14 commits intoAzure:masterfrom
pluralsh:upstream-auto-scaler-profile
Jan 17, 2023
Merged

feat: allow for configuring auto_scaler_profile#278
lonegunmanb merged 14 commits intoAzure:masterfrom
pluralsh:upstream-auto-scaler-profile

Conversation

@davidspek
Copy link
Copy Markdown
Contributor

@davidspek davidspek commented Nov 21, 2022

Describe your changes

This PR allows for users to specify the auto_scaler_profile settings when autoscaling is enabled. Some of these settings are quite vital too having the autoscaler work nicely.

Issue number

#000

Checklist before requesting a review

  • The pr title can be used to describe what this pr did in CHANGELOG.md file
  • I have executed pre-commit on my machine
  • I have passed pr-check on my machine

Thanks for your cooperation!

@davidspek
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@davidspek davidspek force-pushed the upstream-auto-scaler-profile branch from c385e54 to a78909e Compare November 21, 2022 17:21
@zioproto
Copy link
Copy Markdown
Contributor

Hello, thanks for your contribution @davidspek

Could you please run locally the pre-commit and pr-check steps as explained here:

https://github.com/Azure/terraform-azurerm-aks#pre-commit--pr-check--test

I see this step is failing for this PR:

docker pull mcr.microsoft.com/azterraform:latest 
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform:latest make pr-check

the variables in the variables.tf file are not in the order expected by the linter.

thanks

@davidspek
Copy link
Copy Markdown
Contributor Author

@zioproto Thanks for the quick response. I had run the commands locally but it seems like it didn't run quite correctly. Everything should be good now.

Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Hello @davidspek, thanks for opening this pr! Almost LGTM but we'd like to keep our variables' description and default value as same as the officical document, so would you please align the description and default value for us? Thanks for your understanding!

Comment thread variables.tf Outdated
Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Thanks @davidspek for your reply, we still need enum and number values in the description to be correctly backquoted, would you please copy the descriptions from this markdown document? Thanks for your understanding!

Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb Sorry for the late response. I've made the changes you've requested. Regarding the new_pod_scale_up_delay, it might be related to my specific environment. But given that it'll take me quite some time to try and validate that I've changed the PR to be inline with the provider documentation. We can change this to 0s (which I think it should be set to be default) down the road with a fix in the provider as well.

Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Thanks @davidspek for this update, we use terraform-docs to generate readme file from terraform code including this variables.tf, so it's very important to keep variables' description value to valid markdown format so the generated readme file's format could be correct. In the description we should backquote the value. I would suggest that we just copy the provider's document in provider's repo.

Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb Sorry for all the back and forth with all this. I just pushed a commit that I think resolves all your comments.

Comment thread variables.tf
@davidspek davidspek temporarily deployed to acctests December 5, 2022 02:24 Inactive
Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Hi @davidspek thanks for the update, almost LGTM and we've passed the e2e test. Only one change request, we can remove default = null, after that, we're good to merge.

Thanks for your understanding and contribution!

@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb Sorry for the late response, I was away on vacation. I'll remove the merge conflicts and make the last change shortly.

@davidspek davidspek force-pushed the upstream-auto-scaler-profile branch from 5fa3faa to 75accb6 Compare December 19, 2022 14:02
@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb If I remove the default = null for auto_scaler_profile_scale_down_delay_after_delete it becomes a required value for the module and the test will fail. I don't think we would want that to be a required value right?

@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb It seems like default = null is now required and used in lots of places. I've added where needed so the tests pass properly.

Comment thread variables.tf Outdated
@davidspek davidspek requested review from lonegunmanb and zioproto and removed request for lonegunmanb and zioproto December 21, 2022 11:09
@lonegunmanb
Copy link
Copy Markdown
Member

Hello @davidspek , I'm sorry we've met an issue on our pipeline so we have to upgrade the Github action yaml files in this repo, would you please merge your branch with the latest master branch so we can run the e2e test? Apology for the inconvenience, we're still refactoring the pipeline.

@davidspek davidspek force-pushed the upstream-auto-scaler-profile branch from d2d79c6 to a727416 Compare December 22, 2022 12:26
@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb No problem. I've rebased on the latest master and pushed it now.

@lonegunmanb
Copy link
Copy Markdown
Member

lonegunmanb commented Dec 24, 2022

Hello @davidspek , we have a version upgrade test failure:

Terraform will perform the following actions:
        
          # module.aks.azurerm_kubernetes_cluster.main will be updated in-place
          ~ resource "azurerm_kubernetes_cluster" "main" {
                id                                  = "/subscriptions/f7a632a5-49db-4c5e-9828-cd62cb753971/resourceGroups/876f024bb7fd76f9-rg/providers/Microsoft.ContainerService/managedClusters/prefix-876f024bb7fd76f9-aks"
                name                                = "prefix-876f024bb7fd76f9-aks"
                tags                                = {}
                # (30 unchanged attributes hidden)
        
              ~ auto_scaler_profile {
                  ~ new_pod_scale_up_delay           = "0s" -> "10s"
                  ~ skip_nodes_with_local_storage    = false -> true
                    # (15 unchanged attributes hidden)
                }
        
                # (9 unchanged blocks hidden)
            }

If our users upgrade the module's version to the merged version then they would face such change. The issue was caused by reusing var.enable_auto_scaling as this new added dynamic block's toggle so once the user has set this variable to true, they might see the surprise change when they upgrade the module's version.

I would suggest adding a new variable as the toggle to turn on and off this dynamic block.

Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

We need a new toggle variable for this new added dynamic block to avoid surprise change.

@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb Sorry for the late reply, we were out of office during the holidays. Before I make the above change, would you otherwise prefer a single map variable with all the settings for the autoscaling profile, rather than a dedicated variable for each autoscaler profile setting?

@davidspek davidspek requested review from lonegunmanb and zioproto and removed request for lonegunmanb and zioproto January 11, 2023 11:59
@lonegunmanb
Copy link
Copy Markdown
Member

@lonegunmanb Sorry for the late reply, we were out of office during the holidays. Before I make the above change, would you otherwise prefer a single map variable with all the settings for the autoscaling profile, rather than a dedicated variable for each autoscaler profile setting?

Good point! I'm doing such practices in new created module like this one by using object type with optional attributes. The new object type solves some map's issues so I would prefer object.

But for aks module, my concern is we need keep consistency among our variables. Maybe someday we could publish a major release, converting variables into object types, but for now I would say let's preserve the status quo.

Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Thanks @davidspek for updating this pr, only some tiny issues to solve would make this pr been merged.

Comment thread variables.tf Outdated
Comment thread variables.tf Outdated
Comment thread main.tf Outdated
Comment thread test/unit/unit_test.go Outdated
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
@davidspek davidspek force-pushed the upstream-auto-scaler-profile branch from 3683dad to 93bea23 Compare January 16, 2023 14:01
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
@davidspek
Copy link
Copy Markdown
Contributor Author

@lonegunmanb Should be all good now.

Copy link
Copy Markdown
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

Thanks @davidspek, LGMT! 🚀

@lonegunmanb lonegunmanb merged commit c3753fe into Azure:master Jan 17, 2023
@davidspek davidspek deleted the upstream-auto-scaler-profile branch January 17, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants