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

Support immutable fields check for Subnet/Subnetset #627

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timdengyun
Copy link
Contributor

@timdengyun timdengyun commented Jul 4, 2024

This patch is to:

  1. For Subnet CR, if there is already a nsx subnet created for the CR, The following fields are immutable:
    IPv4SubnetSize/AccessMode/IPAddresses/DHCPConfig

  2. For Subnetset CR, if there is already a nsx subnet allocated from Subnetset There are two cases:
    1). For VM Subnetset
    The following fields are immutable:
    IPv4SubnetSize/AccessMode/DHCPConfig
    2). For POD Subnetset
    The following fields are immutable:
    IPv4SubnetSize/DHCPConfig

  3. Fix the bug that the nsx subnet IPv4SubnetSize is not set by user-defined CR, either from subnet CR or subnetset CR.The current value of IPv4SubnetSize is set by vpcnetworkconfiguration.

The test done:

  1. Create a Subnet CR, and check nsx vpc subnet is created,
    Try to change IPv4SubnetSize/AccessMode/IPAddresses/DHCPConfig in the Subnet CR
    The modification fails because these fields are immutable.

  2. Create a Subnet CR with invalid AccessMode value, in this case, there is no valid nsx VPC subnet created.
    The user can still modify Subnet CR AccessMode until nsx VPC subnet created. Thereafter, AccessMode is unable
    to changed any more.

  3. Create a SubnetSet CR, and create a subnetport CR to use this SubnetSet CR. There is a corresponding nsx VPC subnet created for the subnetport.
    Try to change IPv4SubnetSize/AccessMode/DHCPConfig in the Subnetset CR,
    The modification failed because these fields are immutable.

  4. Create a SubnetSet CR, and there is no any subnetport using this Subnetset CR.
    The user can still modify SubnetSet CR until there is subnet allocated.
    And then IPv4SubnetSize/AccessMode/DHCPConfig become immutable.

  5. Modify the IPv4SubnetSize/AccessMode/DHCPConfig for the default VM SubnetSet in the namespace,
    The modification can succeed when there is no any Subnet allocated from SubnetSet.

  6. Create a subnetport to specify using default VM SubnetSet in the namespace.
    The modification to IPv4SubnetSize/AccessMode/DHCPConfig fails because these fields become immutable.

This patch is to:
1. For Subnet CR, if there is already a nsx subnet created for the CR,
The following fields are immutable:
IPv4SubnetSize/AccessMode/IPAddresses/DHCPConfig
2. For Subnetset CR, if there is already a nsx subnet created from Subnetset
There are two cases:
1). For VM Subnetset
The following fields are immutable:
IPv4SubnetSize/AccessMode/DHCPConfig
2). For POD Subnetset
The following fields are immutable:
IPv4SubnetSize/DHCPConfig

3. Fix the bug that the nsx subnet IPv4SubnetSize is not set by user-defined CR,
either from subnet CR or subnetset CR.The current value of IPv4SubnetSize
is set by vpcnetworkconfiguration.
@timdengyun timdengyun requested review from dantingl and removed request for jwsui July 15, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants