-
Notifications
You must be signed in to change notification settings - Fork 257
chore: start breaking up CNS main #3465
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Evan Baker <[email protected]>
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
PR Overview
This PR is a chore aimed at starting the process of breaking up the large CNS main file into smaller, more manageable components.
- Introduces a new file for version information in cns/service/version.go
- Sets up a helper function to print application version details
Reviewed Changes
File | Description |
---|---|
cns/service/version.go | Adds a helper for printing version details |
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
cns/service/version.go:1
- [nitpick] The file is located in the 'cns/service' directory but declares 'package main'. Consider renaming it (e.g., to 'service') to align with its directory context.
package main
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.
afaik there is no code changes, right? also I was wondering if moving main out of cns/service would be an option down the line 🤔
No code changes, only copy/pasting.
eventually - I'm aiming for cobra. But it's very far down the line. |
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
Pull request closed due to inactivity. |
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
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.
Yeah I think once these are also moved then we are good to go:
aks.go
func InitializeMultiTenantController()
func pollNodeInfoCRDAndUpdatePlugin()
managed.go
?
type NodeInterrogator
func registerNode()
func sendRegisterNodeRequest()
- These are only used if cns is
Managed
channel mode
cns/restserver/nodesubnet.go
func getPodInfoByIPProvider()
could go here, because there's another function func InitalizeNodeSubnet()
that is already there, and is only called when channel mode is AzureHost
This actually results in a cycle
And then this one is probably a stretch, should we make an args.go
for the var args = acn.ArgumentList{..}
?
Super nice to be doing this! Thanks Evan!
|
||
// Prints description and version information. | ||
func printVersion() { | ||
fmt.Printf("Azure Container Network Service\n") |
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'm just wondering if up above, it makes sense also to tear out var args = acn.ArgumentList{..}
and also put it into a file like args.go
or something
// Prints description and version information. | ||
func printVersion() { | ||
fmt.Printf("Azure Container Network Service\n") | ||
fmt.Printf("Version %v\n", version) |
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 think we should also take out type NodeInterrogator
,func registerNode()
and func sendRegisterNodeRequest()
and put them into a file called managed.go
, or something, since they are only used if cns is in "managed" mode it seems (not sure really what that is but it could also make this file smaller)
logger.Printf("Set GlobalPodInfoScheme %v (InitializeFromCNI=%t)", cns.GlobalPodInfoScheme, cnsconfig.InitializeFromCNI) | ||
|
||
err = InitializeCRDState(rootCtx, httpRemoteRestService, cnsconfig) | ||
err = initializeCRDState(rootCtx, httpRemoteRestService, cnsconfig) |
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.
Should we also move func InitializeMultiTenantController()
into aks.go
?
initialIBNICCount = 0 | ||
) | ||
|
||
type cniConflistScenario string |
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.
Alright, just a few more things we may want to move out of here and into aks.go
the const:
defaultNodeInfoCRDPollInterval
(maybe that doesn't really warrant a move)
The function:
func pollNodeInfoCRDAndUpdatePlugin
(just the definition of the function not the function call)
no code changes, only rearranging.
starting to break up the huge spaghetti that is
main