-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 (azurerm_kubernetes_cluster
, azurerm_kubernetes_cluster_node_pool
): add support for version aliases
#17084
Conversation
azurerm_kubernetes_cluster
, azurerm_kubernetes_cluster_node_pool
: add support for version aliasesazurerm_kubernetes_cluster
, azurerm_kubernetes_cluster_node_pool
): add support for version aliases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @weisdd! Overall this is off to a good start, I have a few suggestions/questions in addition to the comments left in-line:
- Could we add an additional test for version aliases, I think it's acceptable to hard code the value of the aliased version into the test config since they aren't being used in the other tests.
- It would be helpful to update the docs as well so that users know it's possible to omit the patch version.
- What would happen if a user specified a version alias for the node pool but supplied a patch version for the control plane e.g.
1.22
for node pool and1.22.4
for control plane. Perhaps some additional validation should be added to prevent this? I'm thinking this could be a good place to add that
https://github.com/weisdd/terraform-provider-azurerm/blob/124a8d9fa66eb952a1658b9ea0dd389dc2ffbd68/internal/services/containers/kubernetes_cluster_resource.go#L1028-L1036
- Allow alias version; - Do not rely on CurrentKubernetesVersion in resourceKubernetesClusterRead to avoid state drift.
4a167e3
to
b21488e
Compare
@stephybun Thanks for the review, I appreciate it! You can find my replies to your questions below. 1. Could we add an additional test for version aliases, I think it's acceptable to hard code the value of the aliased version into the test config since they aren't being used in the other tests. git:(feature/aks-version-alias) ✗ make acctests SERVICE='containers' TESTARGS='-run=TestAccKubernetesCluster_upgradeControlPlaneAndAllPoolsTogetherVersionAlias' TESTTIMEOUT='60m'
==> 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_upgradeControlPlaneAndAllPoolsTogetherVersionAlias -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN TestAccKubernetesCluster_upgradeControlPlaneAndAllPoolsTogetherVersionAlias
=== PAUSE TestAccKubernetesCluster_upgradeControlPlaneAndAllPoolsTogetherVersionAlias
=== CONT TestAccKubernetesCluster_upgradeControlPlaneAndAllPoolsTogetherVersionAlias
--- PASS: TestAccKubernetesCluster_upgradeControlPlaneAndAllPoolsTogetherVersionAlias (1969.08s)
PASS
ok github.com/hashicorp/terraform-provider-azurerm/internal/services/containers 1969.103s 2. It would be helpful to update the docs as well so that users know it's possible to omit the patch version. 3. What would happen if a user specified a version alias for the node pool but supplied a patch version for the control plane e.g. 1.22 for node pool and 1.22.4 for control plane. Perhaps some additional validation should be added to prevent this? I'm thinking this could be a good place to add that
Please, let me know if there are any other changes that you'd like to see implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes @weisdd! I have one last remark about the test but otherwise this should be good to go!
internal/services/containers/kubernetes_cluster_upgrade_test.go
Outdated
Show resolved
Hide resolved
internal/services/containers/kubernetes_cluster_upgrade_test.go
Outdated
Show resolved
Hide resolved
@stephybun I've just made the requested changes. Thanks for your help with making it all better! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This functionality has been released in v3.12.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! |
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. |
Issue
Recently, AKS moved alias minor version support to GA (changelog), which allows users to specify, say,
1.20
instead of1.20.1
.The azurerm provider does not currently support the feature, thus the PR:
Fixes: #17085
Suggested changes
2022-01-02-preview
to2022-03-02-preview
as the former demands x.y.z version syntax whereas the latter allows aliases;validateNodePoolSupportsVersion
needs to be adjusted to allow not only exact versions, but also aliases. My code in that part is unlikely to be considered the best way of doing things, so feel free to suggest a different approach:=>
resourceKubernetesClusterRead
should not be updatekubernetes_version
toprops.CurrentKubernetesVersion
, because it creates a state drift that cannot be overcome:=>
Questions / points of discussion
Since it's the first time I'm playing with the
azurerm
provider, I'm not really sure if all the code that got automatically generated should come as part of the PR or I was supposed to omit it. Please, let me know if something needs to be deleted;I know that there are some acceptance tests with cluster upgrades that currently rely on these versions:
If the expectation is to cover version aliases with tests, then what exactly should be done? - Should I just change the versions specified above or create another test that would rely on different variables?