Skip to content

Enhance security group registration by resolving VNetId#2283

Merged
cb-github-robot merged 2 commits intocloud-barista:mainfrom
leehyeoklee:improve-registration
Jan 22, 2026
Merged

Enhance security group registration by resolving VNetId#2283
cb-github-robot merged 2 commits intocloud-barista:mainfrom
leehyeoklee:improve-registration

Conversation

@leehyeoklee
Copy link
Copy Markdown
Contributor

Description
This PR fixes a issue in the Security Group registration logic where the VNet was being assigned arbitrarily.

1. Before (The Issue)

  • When registering a Security Group, the system assigned a random VNetId from any VNet that shared the same Connection Name.
for _, r := range content.VNet {
			if r.ConnectionName == u.ConnectionName {
				u.VNetId = r.Id
			}
  • Risk: If multiple VNets existed in the same connection, the Security Group could be linked to the wrong VNet.

2. After ( The Solution)

  • Implemented a precise matching logic using the actual CSP data:
    1. Call Spider's /getsecuritygroupowner API using the Security Group's CSP ID.
    2. Retrieve the actual VPC information (NameId, SystemId) from the response.
    3. Search through Tumblebug's registered VNets to find a match for the returned VPC SystemId.
    4. Assign the matched VNet to u.VNetId.
  • Error Handling: If no matching VNet is found in Tumblebug, the system now returns a clear error message instead of proceeding with a wrong association.

Copy link
Copy Markdown
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

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

@leehyeoklee Could you help reduce usage of the term IID ? It is not understandable concept and term in CB-TB code base in general. I know that it is not avoidable sometimes (only for interacting with CB-SP), but we should try to use CB-TB terms and concepts. :)

@leehyeoklee
Copy link
Copy Markdown
Contributor Author

I changed the method to return SystemId directly instead of the IID struct, reducing the use of the IID term and concept!

cspVNetId, err := getCspVNetIdFromSecurityGroup(u.ConnectionName, u.CspResourceId)

@seokho-son
Copy link
Copy Markdown
Member

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Jan 22, 2026
@cb-github-robot cb-github-robot merged commit 1fcfb26 into cloud-barista:main Jan 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This PR is approved and will be merged soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants