-
Notifications
You must be signed in to change notification settings - Fork 21
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
Remove cache stores for VPCNetworkConfig #1025
base: main
Are you sure you want to change the base?
Conversation
9671225
to
0648db5
Compare
/e2e |
1 similar comment
/e2e |
0648db5
to
776f18b
Compare
6fe027e
to
1e165d5
Compare
/e2e |
2 similar comments
/e2e |
/e2e |
518b665
to
b119538
Compare
Signed-off-by: Yanjun Zhou <[email protected]>
Signed-off-by: Yanjun Zhou <[email protected]>
b119538
to
ef13639
Compare
log.Info("Failed to get network config info using network config name", "Name", ncName) | ||
return nil | ||
log.Info("Network config info does not exist", "Name", ncName) | ||
return nil, nil |
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.
how about use 'NetworkConfig' for line 122/118?
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.
Sounds good. There are many occurrence of network config, I replaced them all by NetworkConfig, thanks
pkg/nsx/services/vpc/vpc.go
Outdated
} | ||
|
||
func IsPreCreatedVPC(nc common.VPCNetworkConfigInfo) bool { | ||
return nc.VPCPath != "" | ||
} | ||
|
||
func buildNetworkConfigInfo(vpcConfigCR *v1alpha1.VPCNetworkConfiguration) (*common.VPCNetworkConfigInfo, error) { | ||
org, project, err := nsxProjectPathToId(vpcConfigCR.Spec.NSXProject) |
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.
move it to build.go?
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.
Updated, thanks!
pkg/nsx/services/vpc/vpc.go
Outdated
|
||
func isDefaultNetworkConfigCR(vpcConfigCR *v1alpha1.VPCNetworkConfiguration) bool { | ||
annos := vpcConfigCR.GetAnnotations() | ||
val, exist := annos[common.AnnotationDefaultNetworkConfig] |
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.
the same function isDefaultNetworkConfigCR/nsxProjectPathToId in the vpcnetworkconfig_handler.go, could you reuse them?
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.
These 2 functions are not used in vpcnetworkconfig_handler, removed them, thanks!
Signed-off-by: Yanjun Zhou <[email protected]>
Current we maintain 2 caches, VPCNSNetworkConfigStore and VPCNetworkConfigStore,
for mapping between Namespace, VPCNetworkConfig name and VPCNetworkConfig Info.
But those information are parsed based Namespace and VPCNetworkConfig CRs, which
are cached in controller runtime client. Thus we remove the cache in NSX Operator and
rely on controller runtime client cache to get those information.
Testing done:
Create a Namespace and create VM on the Namespace. The VM can power on with IP.