-
Notifications
You must be signed in to change notification settings - Fork 305
Add network package containing the NetworkInfo struct #2078
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
Add network package containing the NetworkInfo struct #2078
Conversation
Hi @mmamczur. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
267d4ab
to
f86def6
Compare
// ServiceNetwork determines the network data to be used for the LB resources. | ||
// This function currently returns only the default network but will provide | ||
// secondary networks information for multi-networked services in the future. | ||
func ServiceNetwork(_ *apiv1.Service, cloudProvider cloudNetworkProvider) (*NetworkInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServiceNetwork => NewNetworkInfo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could rename it but the main point of this func is to figure out the network values for the service, with funcs named like NewAbc I soft of expect them to not do that much besides creating the struct
with multinetwork all logic to get the GCE VPC and subnetwork will go here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough, let see how it evolves and decide later
pkg/neg/controller_test.go
Outdated
@@ -1030,6 +1010,7 @@ func TestMergeCSMPortInfoMap(t *testing.T) { | |||
defer controller.stop() | |||
n1s1 := newTestServiceCus(t, controller, "namespace1", "service1", []int32{80, 90}) | |||
n2s1 := newTestServiceCus(t, controller, "namespace2", "service1", []int32{90}) | |||
defaultNetwork := &network.NetworkInfo{K8sNetwork: "default"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can declare this defaultNetwork var at the very top of the file
in the
var (
...
)
section
@@ -393,6 +399,7 @@ func (s *transactionSyncer) ensureNetworkEndpointGroups() error { | |||
s.recorder, | |||
s.NegSyncerKey.GetAPIVersion(), | |||
s.customName, | |||
s.networkInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why ensureNetworkEndpointGroup is not part of transactionSyncer 😲 ?
NWM...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Michał, this is just random comment I had reading the code.
you can skip it
if networkEndpointType != negtypes.NonGCPPrivateEndpointType && | ||
// Only perform the following checks when the NEGs are not Non-GCP NEGs. | ||
// Non-GCP NEGs do not have associated network and subnetwork. | ||
(!utils.EqualResourceIDs(neg.Network, cloud.NetworkURL()) || | ||
!utils.EqualResourceIDs(neg.Subnetwork, cloud.SubnetworkURL())) { | ||
(!utils.EqualResourceIDs(neg.Network, networkInfo.NetworkURL) || | ||
!utils.EqualResourceIDs(neg.Subnetwork, networkInfo.SubnetworkURL)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if should be a method
if isNonGCPNEG(networkEndpointType, neg, networkInfo) {
...
ehhh...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Michał, this is just random comment I had reading the code.
you can skip it
overall I like the idea of NetworkInfo struct |
f86def6
to
c10c64d
Compare
/ok-to-test |
/lgtm |
This struct holds the networking URLs that are now used when creating GCE resources (this commit contains changes for NEGs). Currently only the default network information is always populated but it will be different for multi-networked services.
c10c64d
to
bcb2ea9
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cezarygerard, mmamczur 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 |
This struct holds the networking URLs that are now used when creating GCE resources (this commit contains changes for NEGs).
Currently only the default network information is always populated but it will be different for multi-networked services.
Why adding to PortInfo/ServicePort: