-
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
azurerm_kubernetes_cluster
: Support for upgrade path from Azure CNI to Azure CNI Overlay
#26260
base: main
Are you sure you want to change the base?
Conversation
… to Azure CNI Overlay
@stephybun could you please take a look here? |
Hey, any news here? |
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.
Apologies for taking so long to circle back to this @jkroepke. I was umm'ing and ahh'ing over whether this was OK or not since on the surface the change looks small and harmless but this would still require a more in-depth investigation which turned out to be correct.
I left an explanation on my findings in-line, we want to be careful not to introduce issues for users that are using other networking modes. Details are in the comment, let me know if you have any questions!
pluginsdk.ForceNewIfChange("network_profile.0.pod_cidr", func(ctx context.Context, old, new, meta interface{}) bool { | ||
return old.(string) != "" | ||
}), | ||
pluginsdk.ForceNewIfChange("network_profile.0.pod_cidrs", func(ctx context.Context, old, new, meta interface{}) bool { | ||
return len(old.([]interface{})) > 0 | ||
}), |
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.
Although this will work for upgrading from Azure CNI to Azure CNI Overlay, it will cause issues for users that are using other networking configurations which we still need to support.
pod_cidr
and pod_cidrs
are both Optional
and Computed
because there are instances where the API will assign values to these if they're omitted e.g. when using kubenet
, this compounds with the fact that these value change checks performed in the CustomizeDiff
compare the old state value and the new state value and not whether the value in the users configuration has changed.
Ultimately this will end up triggering a ForceNew
for users that are still using kubenet
but haven't specified pod_cidr
or pod_cidrs
(and potentially other scenarios!).
I would appreciate if you could add some test cases (or extend existing test cases) to ensure that we're not triggering a ForceNew
in situations where we shouldn't be, those should also help you to refine the condition needed here to enable the behaviour you're after without introducing unwanted side effects.
Community Note
Description
This PR adds support upgrade-path from Azure CNI to Azure CNI Overlay
Ref: https://learn.microsoft.com/en-us/azure/aks/azure-cni-overlay?tabs=kubectl#azure-cni-cluster-upgrade
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
The existing test
TestAccKubernetesCluster_networkPluginModeUpdate
cover this scenario.Testing
Observing that the upgrade is done in-place:
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_kubernetes_cluster
: Support for upgrade path from Azure CNI to Azure CNI Overlay [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #26259
Note
If this PR changes meaningfully during the course of review please update the title and description as required.