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

model service network #896

Merged
merged 54 commits into from
Nov 21, 2024
Merged

model service network #896

merged 54 commits into from
Nov 21, 2024

Conversation

olasaadi99
Copy link
Contributor

No description provided.

@olasaadi99 olasaadi99 marked this pull request as draft September 30, 2024 15:00
@olasaadi99 olasaadi99 linked an issue Sep 30, 2024 that may be closed by this pull request
2 tasks
@olasaadi99 olasaadi99 requested review from adisos and zivnevo October 1, 2024 07:14
@olasaadi99
Copy link
Contributor Author

you can review before fixing test
service network added

@olasaadi99 olasaadi99 marked this pull request as ready for review October 6, 2024 09:48
Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

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

  1. Need dedicated tests:
    1. SGs/NACLs block connectivity to all/part-of service network
    2. Connectivity to service network is allowed, but not to public internet (and vice versa)
  2. Need to generate a Drawio SquareTreeNode for the service network, like we have for public internet (consult with @haim-kermany )

pkg/ibmvpc/examples/out/analysis_out/actual.txt Outdated Show resolved Hide resolved
pkg/ibmvpc/examples/out/analysis_out/expected.txt Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/ibmvpc/implicit_routing.go Outdated Show resolved Hide resolved
pkg/ibmvpc/vpc.go Show resolved Hide resolved
@olasaadi99 olasaadi99 marked this pull request as draft October 14, 2024 11:21
@zivnevo
Copy link
Member

zivnevo commented Nov 11, 2024

I ran ./bin/vpcanalyzer report endpoints -c pkg/ibmvpc/examples/input/input_s ervice_network_test.json -o html -f test.html and got the below image.

* Is it correct to have the service network under "Public Internet"?

* Some "Various IP Ranges" nodes are actually service network. It seems like there is some mix there.

* Also, what's "NS" on the icon?

image

NS stands for network services... I understood it should under the public internet, should I move them?

@haim-kermany
Service network icons should appear under IBM Cloud - you can have them floating outside all regions, or put them into a region of their own, called Service Network.
NS should be SN (Service Network).

Signed-off-by: Ziv Nevo <[email protected]>
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/ibmvpc/parser.go Outdated Show resolved Hide resolved
pkg/ibmvpc/parser.go Outdated Show resolved Hide resolved
@haim-kermany
Copy link
Contributor

I ran ./bin/vpcanalyzer report endpoints -c pkg/ibmvpc/examples/input/input_s ervice_network_test.json -o html -f test.html and got the below image.

* Is it correct to have the service network under "Public Internet"?

* Some "Various IP Ranges" nodes are actually service network. It seems like there is some mix there.

* Also, what's "NS" on the icon?

image

NS stands for network services... I understood it should under the public internet, should I move them?

@haim-kermany Service network icons should appear under IBM Cloud - you can have them floating outside all regions, or put them into a region of their own, called Service Network. NS should be SN (Service Network).

its not trivial, can we consider doing it in a different PR?

pkg/ibmvpc/vpc.go Show resolved Hide resolved
@@ -241,7 +241,7 @@ func updateSubnetsConnectivityByTransitGateway(src, dst VPCResourceIntf,
c *VPCConfig) (
*netset.TransportSet, error) {
// assuming a single router representing the tgw for a "MultipleVPCsConfig"
if len(c.RoutingResources) != 1 {
if len(c.RoutingResources) != 2 { // expecting tgw and sgw (virtual gateway)
Copy link
Member

Choose a reason for hiding this comment

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

Will this hold for AWS as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aws does not get here

Copy link
Member

Choose a reason for hiding this comment

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

@adisos , I need your help here. Is the change to the check valid?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would change this check.. and also the the next line in which it assumes that tgw is at index 0 of this slice. Instead, I think it is better to check here that c.RoutingResources contains exactly one router of kind TGW for MultipleVPCsConfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -15,7 +15,8 @@ type TextOutputFormatter struct {
}

func multipleVPCsConfigHeader(c *VPCConfig) (string, error) {
if len(c.RoutingResources) != 1 {
if len(c.RoutingResources) != 2 { // expecting tgw and sgw (virtual gateway)
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aws does not support multi-vpc

Copy link
Member

Choose a reason for hiding this comment

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

We may want to support multi-vpc in AWS in the future.
@adisos , any insight here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would change this check here as well, to check here that c.RoutingResources contains exactly one router of kind TGW for MultipleVPCsConfig.
If we support multiple VPCs for AWS as well, this is a more consistent check, and does not depend on whether or not service network gateway is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

pkg/vpcmodel/explainabilityInput.go Outdated Show resolved Hide resolved
pkg/vpcmodel/explainabilityInput.go Outdated Show resolved Hide resolved
pkg/vpcmodel/explainabilityPrint.go Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
@zivnevo
Copy link
Member

zivnevo commented Nov 11, 2024

I ran ./bin/vpcanalyzer report endpoints -c pkg/ibmvpc/examples/input/input_s ervice_network_test.json -o html -f test.html and got the below image.

* Is it correct to have the service network under "Public Internet"?

* Some "Various IP Ranges" nodes are actually service network. It seems like there is some mix there.

* Also, what's "NS" on the icon?

image

NS stands for network services... I understood it should under the public internet, should I move them?

@haim-kermany Service network icons should appear under IBM Cloud - you can have them floating outside all regions, or put them into a region of their own, called Service Network. NS should be SN (Service Network).

its not trivial, can we consider doing it in a different PR?

Let's just replace NS with SN in this PR. Please open an issue for changing the layout

@haim-kermany
Copy link
Contributor

@zivnevo pushed a solution that looks like that:
image
seems OK if the number of SN are not too big.

pkg/ibmvpc/vpc.go Outdated Show resolved Hide resolved
@olasaadi99 olasaadi99 requested a review from zivnevo November 18, 2024 10:39
Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

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

A few more small things

pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
pkg/vpcmodel/externalNetwork.go Outdated Show resolved Hide resolved
Copy link
Member

@zivnevo zivnevo left a comment

Choose a reason for hiding this comment

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

Last two comments

Comment on lines 18 to 30
var tgw RoutingResource
tgwRouterFound := false
for _, router := range c.RoutingResources {
if router.Kind() == resourceTypeTGW {
if tgwRouterFound {
return "", errors.New("unexpected number of RoutingResources for MultipleVPCsConfig, expecting only one TGW")
}
tgw = router
tgwRouterFound = true
}
}
if !tgwRouterFound {
return "", errors.New("unexpected number of RoutingResources for MultipleVPCsConfig, expecting TGW")
Copy link
Member

Choose a reason for hiding this comment

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

Since this code is duplicated in pkg/vpcmodel/subnetsConnectivity.go, I think it deserves a function. Can be a method of VPCConfig

Comment on lines 18 to 19
var tgw RoutingResource
tgwRouterFound := false
Copy link
Member

Choose a reason for hiding this comment

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

No need for the Boolean variable. You can simple check if tgw != nil

@olasaadi99 olasaadi99 merged commit 20cec14 into main Nov 21, 2024
4 checks passed
@olasaadi99 olasaadi99 deleted the 401_service_network branch November 21, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

model service network
4 participants