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

azurerm_kubernetes_* - Upgrade to go-azure-sdk #18705

Merged
merged 6 commits into from
Oct 25, 2022

Conversation

aristosvo
Copy link
Collaborator

@aristosvo aristosvo commented Oct 11, 2022

PR to migrate to go-azure-sdk for azurerm_kubernetes_*

Status: compiling, run all tests, rebased

Next steps: Review time!

Acceptance tests

Most passing, leftovers seem random failures except on MaintenanceConfig tests

=== CONT  TestAccKubernetesCluster_completeMaintenanceConfig
testcase.go:110: Step 1/2 error: Error running apply: exit status 1
Error: creating/updating maintenance config for Managed Cluster (Subscription: "*******"
Resource Group Name: "acctestRG-aks-221017225106165211"
Resource Name: "acctestaks221017225106165211"): maintenanceconfigurations.MaintenanceConfigurationsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UnmarshalError" Message="UnmarshalEntity encountered error: parsing time \"\\\"2021-12-30 12:00:00 +0000 UTC\\\"\" as \"\\\"2006-01-02T15:04:05Z07:00\\\"\": cannot parse \" 12:00:00 +0000 UTC\\\"\" as \"T\"."
with azurerm_kubernetes_cluster.test,
on terraform_plugin_test.tf line 11, in resource "azurerm_kubernetes_cluster" "test":
11: resource "azurerm_kubernetes_cluster" "test" {

=== CONT  TestAccKubernetesCluster_updateMaintenanceConfig
testcase.go:110: Step 3/6 error: Error running apply: exit status 1
Error: creating/updating Maintenance Configuration for Managed Kubernetes Cluster ("Managed Cluster (Subscription: \"*******\"\nResource Group Name: \"acctestRG-aks-221017225636884801\"\nResource Name: \"acctestaks221017225636884801\")"): maintenanceconfigurations.MaintenanceConfigurationsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UnmarshalError" Message="UnmarshalEntity encountered error: parsing time \"\\\"2021-12-30 12:00:00 +0000 UTC\\\"\" as \"\\\"2006-01-02T15:04:05Z07:00\\\"\": cannot parse \" 12:00:00 +0000 UTC\\\"\" as \"T\"."
with azurerm_kubernetes_cluster.test,
on terraform_plugin_test.tf line 11, in resource "azurerm_kubernetes_cluster" "test":
11: resource "azurerm_kubernetes_cluster" "test" {
--- FAIL: TestAccKubernetesCluster_updateMaintenanceConfig (793.81s)

And fixed:

 make acctests SERVICE='containers' TESTARGS='-run=TestAccKubernetesCluster_completeMaintenanceConfig\|TestAccKubernetesCluster_updateMaintenanceConfig'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/containers -run=TestAccKubernetesCluster_completeMaintenanceConfig\|TestAccKubernetesCluster_updateMaintenanceConfig -timeout 180m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccKubernetesCluster_completeMaintenanceConfig
=== PAUSE TestAccKubernetesCluster_completeMaintenanceConfig
=== RUN   TestAccKubernetesCluster_updateMaintenanceConfig
=== PAUSE TestAccKubernetesCluster_updateMaintenanceConfig
=== CONT  TestAccKubernetesCluster_completeMaintenanceConfig
=== CONT  TestAccKubernetesCluster_updateMaintenanceConfig
--- PASS: TestAccKubernetesCluster_completeMaintenanceConfig (638.73s)
--- PASS: TestAccKubernetesCluster_updateMaintenanceConfig (774.75s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/containers    776.536s

and a different error showing up:

=== CONT  TestAccKubernetesCluster_upgradeSettings
------- Stderr: -------
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4549de4]
goroutine 335 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/containers.ConvertDefaultNodePoolToAgentPool(0xc003363710)
  /opt/teamcity-agent/work/5e6516bb4d10eb66/internal/services/containers/kubernetes_nodepool.go:702 +0x9a4
github.com/hashicorp/terraform-provider-azurerm/internal/services/containers.resourceKubernetesClusterCreate(0x0?, {0x5b16880?, 0xc001e13000}) 

And fixed:

> make acctests SERVICE='containers' TESTARGS='-run=TestAccKubernetesCluster_upgradeSettings'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/containers -run=TestAccKubernetesCluster_upgradeSettings -timeout 180m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccKubernetesCluster_upgradeSettings
=== PAUSE TestAccKubernetesCluster_upgradeSettings
=== CONT  TestAccKubernetesCluster_upgradeSettings
--- PASS: TestAccKubernetesCluster_upgradeSettings (889.38s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/containers    891.108s

@aristosvo aristosvo marked this pull request as ready for review October 13, 2022 14:07
@aristosvo aristosvo changed the title [WIP] - azurerm_kubernetes_* - Upgrade to go-azure-sdk azurerm_kubernetes_* - Upgrade to go-azure-sdk Oct 13, 2022
ApiServerAccessProfile is not returned by default anymore
@@ -910,6 +912,7 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
Type: pluginsdk.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
Copy link
Collaborator Author

@aristosvo aristosvo Oct 14, 2022

Choose a reason for hiding this comment

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

@tombuildsstuff ApiServerAccessProfile is not returned when having 'default' settings anymore, which means I'm setting values by default now below. Does this mean I should add Default: false to the schema (like done)? Does this change requires a state migration?

Or is there a simpler solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

Taking a look through here this should be fine (but unnecessary) since this implicitly defaults to false in the read function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, it implicitly defaults to 'false' in the read function, which is a change. I made it here explicit.

The main question is whether this defaulting (implicit or explicit) is a breaking change which requires a state migration, as this is also a ForceNew setting.

@djsly
Copy link
Contributor

djsly commented Oct 17, 2022

@aristosvo what's the best practice, should I wait till you merge ? or should I create a new PR based on your PR to add missing features that the SDK brings in ?

@aristosvo
Copy link
Collaborator Author

aristosvo commented Oct 18, 2022

I think HC wants to merge this one first anyway (and it might still need some small changes to comply).

But that shouldn't stop you from working on it. I'm not sure how good your rebase skills are, but a PR based on this work should be possible with a relatively simple rebase after merging.

Btw, I expect #18667 to be merged first anyway, as that one is already being reviewed atm.

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

The tests look mostly fine, there is one new failure which looks like it might have coincided with the dalek running. We triggered another round of tests, once those are done and the merge conflict is resolved this should be good to go!

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @aristosvo LGTM 🥮

@stephybun stephybun merged commit 4d482bd into hashicorp:main Oct 25, 2022
@github-actions github-actions bot added this to the v3.29.0 milestone Oct 25, 2022
stephybun added a commit that referenced this pull request Oct 25, 2022
@github-actions
Copy link

This functionality has been released in v3.29.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
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.

5 participants