viya4-iac-azure icon indicating copy to clipboard operation
viya4-iac-azure copied to clipboard

feat: (IAC-651) add ability to set pod_cidr and service_cidr while using kubenet

Open stturc opened this issue 2 years ago • 8 comments

Hello Team,

I am looking for the ability to set aks_pod_cidr and aks_service_cidr and not use the default settings while using the kubenet network_plugin setting. However, it appears that these are hardcoded when using the kubenet setting.

What I have done is:

  1. Change service_cidr, dns_service_ip, and docker_bridge_cidr (for consistency) to use the aks_* version of the variable, regardless of the network_plugin setting.
  2. Since pod_cidr is not able to be used with other network_plugin settings like azure, it is set to use the aks_pod_cidr when it is on kubenet, or is set to null if not.

If you have any questions or want any changes, please tag me and let me know.

stturc avatar Jul 14 '22 23:07 stturc

FYI @thpang, I have updated this PR to have validation in both variables.tf files (the main and the azure_aks module). I am not sure which one (or both) you want to validate it in.

Also, I have done some initial testing and everything looks good to me.

stturc avatar Aug 02 '22 19:08 stturc

In general is there a reason on the conditional elements you have null as a value? When in a conditional I would expect either true or false. This applies to all items in this PR.

Not a reason besides that is what I found in the examples I saw. I am fairly new to terraform, so if changing those to false would be a cleaner example and fit into the style guides, then I am good with changing them.

stturc avatar Sep 06 '22 20:09 stturc

@stturc if you can adjust the null values I mentioned and assign those their more logical value. I'll review this PR again. Thx.

thpang avatar Sep 09 '22 19:09 thpang

@stturc any progress on the changes requested? Looking to approve this PR. Thx

thpang avatar Sep 15 '22 12:09 thpang

@stturc the null value issue and default values for your validation blocks needs to be addressed. Thx in advance.

thpang avatar Sep 19 '22 21:09 thpang

@stturc this is a good fix; however, you've not updated the values. Plans on when you'll get to this?

thpang avatar Sep 27 '22 20:09 thpang

Apologies for the delay @thpang . I have updated the PR now, please take a look when you get a chance.

stturc avatar Sep 29 '22 04:09 stturc

@thpang Let me know if you don't want to use the can(cidrnetmask) for empty strings and i'll make the changes for everything except the pod_cidr, which I think needs to stay the way it is.

stturc avatar Oct 04 '22 17:10 stturc

@thpang are you good with the changes? Checking as there are few unresolved conversations.

riragh avatar Jan 19 '23 17:01 riragh

@stturc, I was trying to test the changes in this PR, however the upstream staging branch has updated a few times now and the changes in your branch support_cidr_changes are stale. Could you please sync your forked branch with the upstream repository?

riragh avatar Mar 07 '23 20:03 riragh

@riragh I have updated this one with the current main branch. Hopefully it is mergable now.

stturc avatar Mar 07 '23 21:03 stturc

Using the updated code, verified following test scenarios, see the internal ticket for details:

Scenario Task Cadence kubernetes_version Orchestration
1 No values are set and the default pod and service cidrs are created and functioning fast:2020 1.23 Deployment Operator
2 Set the pod_cidr, use the default service_cidr and all pods/services start and function fast:2020 1.24 Deployment Operator
3 Set the service_cidr, use the default pod_cidr and all pods/services start and function Stable 2023.02 1.24 Deploy Command
4 Set both the pod/service ciders and all pods/services start and function fast:2020 1.25 Deployment Operator

riragh avatar Mar 10 '23 21:03 riragh

Hold off merging this branch until next upcoming release.

riragh avatar Mar 10 '23 21:03 riragh

@stturc could you please rebase this branch with the remote staging branch?

riragh avatar Mar 17 '23 18:03 riragh