Skip to content

Conversation

@jackfrancis
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

The current defaults flow for AzureCluster subnet configuration is tricky. This adds some clarifying comments.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 12, 2025
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 12, 2025
// We need at least one subnet for nodes.
// If no node subnets are defined, and there is no cluster subnet defined,
// create a default 10.1.0.0/16 node subnet.
// TODO why do we prefer to fallback to "create a single, large node subnet"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nojnhuh can you answer this question?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this asking "why separate subnets for control plane and worker nodes?" One reason would be so that each subnet can refer to a different NSG. The control plane subnet is tied to a NSG that exposes SSH and the API server port and the worker node subnet doesn't expose any ports by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not that. It's more that we seem to have this breakdown:

  1. Cluster subnet (can also be overloaded to be the subnet for all nodes)
  2. Zero or more "node" subnets

I understand the value of having multiple node subnets (different pools having discrete subnets), and I understand the value of not requiring any node subnets (just use a single subnet for everything [what we call the "cluster" subnet]). What I don't understand is why we have logic to say: if we have neither, create a single node subnet. It seems more intuitive to create a single "cluster" subnet in this case.

(And yes ACK on the differences between CP subnet and node subnets)

Copy link
Contributor

Choose a reason for hiding this comment

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

I can't find any discussion related to that in #4253. Possibly to keep the same behavior as before CAPZ had a notion of a "cluster" subnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's good enough for me, removed the TODO, I think keeping back-compat is the way forward.

@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.08%. Comparing base (a171336) to head (d2fb23f).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5817      +/-   ##
==========================================
+ Coverage   53.06%   53.08%   +0.02%     
==========================================
  Files         279      279              
  Lines       29677    29686       +9     
==========================================
+ Hits        15747    15758      +11     
+ Misses      13114    13112       -2     
  Partials      816      816              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jackfrancis jackfrancis force-pushed the azurecluster-subnet-comments branch from 359c054 to d2fb23f Compare August 12, 2025 17:32
Copy link
Contributor

@nojnhuh nojnhuh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e3d833b8b9b4cdc54898455713f8f65b930284c3

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2025
@k8s-ci-robot k8s-ci-robot merged commit ecd4c98 into kubernetes-sigs:main Aug 12, 2025
22 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Aug 12, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in CAPZ Planning Aug 12, 2025
@jackfrancis jackfrancis deleted the azurecluster-subnet-comments branch August 15, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants