-
Notifications
You must be signed in to change notification settings - Fork 83
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
Support for migration to NLB from CLB #381
base: master
Are you sure you want to change the base?
Conversation
bcd51ec
to
8ae166d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #381 +/- ##
==========================================
+ Coverage 77.08% 77.13% +0.04%
==========================================
Files 75 75
Lines 10523 10567 +44
==========================================
+ Hits 8112 8151 +39
- Misses 1989 1996 +7
+ Partials 422 420 -2 ☔ View full report in Codecov by Sentry. |
admiral/cmd/admiral/cmd/root.go
Outdated
@@ -281,6 +281,7 @@ func GetRootCmd(args []string) *cobra.Command { | |||
rootCmd.PersistentFlags().StringSliceVar(¶ms.NLBEnabledClusters, "nlb_enabled_clusters", []string{}, "Comma seperated list of enabled clusters to be enabled for NLB") | |||
rootCmd.PersistentFlags().StringSliceVar(¶ms.NLBEnabledIdentityList, "nlb_enabled_identity_list", []string{}, "Comma seperated list of enabled idenity list to be enabled for NLB") | |||
rootCmd.PersistentFlags().StringSliceVar(¶ms.CLBEnabledClusters, "clb_enabled_clusters", []string{}, "Comma seperated list of enabled clusters to be enabled for CLB") | |||
rootCmd.PersistentFlags().StringVar(¶ms.NLBIngressLabel, "nlb_ingress_label", common.NLBIstioIngressGatewayLabelValue, "The the value of the `app` label to use to match and find the service that represents the NLB ingress for cross cluster traffic") |
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.
nitpick - 2 the
@@ -88,9 +90,27 @@ func (dynamicConfigDatabaseClient *DynamicConfigDatabaseClient) Delete(data inte | |||
|
|||
func (dynamicConfigDatabaseClient *DynamicConfigDatabaseClient) Get(env, identity string) (interface{}, error) { | |||
//Variable renaming is done to re-purpose existing interface | |||
err := checkIfDynamicConfigDatabaseClientIsInitialize(dynamicConfigDatabaseClient) |
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.
nitpick: checkIfDynamicConfigDatabaseClientIsInitialized
for _, fetchService := range rr.remoteControllers[cluster].ServiceController.Cache.Get(common.NamespaceIstioSystem) { | ||
if fetchService.Labels[common.App] == lbLabel { | ||
log.Infof("task=%s, Processing LB migration for Cluster : %s", common.LBUpdateProcessor, cluster) | ||
go handleServiceEventForDeployment(ctx, fetchService, rr, cluster, rr.GetRemoteController(cluster).DeploymentController, rr.GetRemoteController(cluster).ServiceController, HandleEventForDeployment) |
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.
would this cause CPU issues if many clusters are added/removed ?
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.
Yes. Slightly uptick. Mainly idea is -
- Migrate few clusters NLB
- More clusters to NLB (Optional)
- Migrate all clusters to NLB. In this case will flip label.
@@ -158,16 +178,16 @@ func NewDynamicConfigDatabaseClient(path string, dynamoClientInitFunc func(role | |||
return &dynamicConfigClient, nil | |||
} | |||
|
|||
func UpdateASyncAdmiralConfig(dbClient AdmiralDatabaseManager, syncTime int) { | |||
func UpdateASyncAdmiralConfig(rr *RemoteRegistry, syncTime int) { |
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 func is running in a goroutine but we are not gracefully exiting it. Can we pass in the ctx
and return gracefully when the program exits?
case <-ctx.Done(): |
var clusersToProcess []string | ||
if cache == nil || len(*cache) == 0 { | ||
*cache = updatedLB | ||
clusersToProcess = updatedLB |
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.
nitpick, this variable assignment is not needed. we can just return updatedLB
*cache = updatedLB | ||
clusersToProcess = updatedLB | ||
return clusersToProcess | ||
} else { |
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.
nitpick, we can remove this else
} | ||
} | ||
|
||
func getLBToProcess(updatedLB []string, cache *[]string) []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.
I think I'm unable to follow this.
If NLB Cluster param has c1, c2
and NLB Cache has c1, c2, c3
. This func returns c3
Why do we need to process c3
with NLBIngressLabel
?
Sorry if I'm misunderstanding
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 method little generic. It gets invoked for CLB as well as NLB.
For example if we remove cluster from NLB and add it CLB then this will take care.
log.Infof("task=%s, Processing LB migration for %s. UpdateReceived=%s, ExistingCache=%s, ", common.LBUpdateProcessor, lbLabel, updatedLBs, existingCache) | ||
|
||
for _, cluster := range getLBToProcess(updatedLBs, existingCache) { | ||
for _, fetchService := range rr.remoteControllers[cluster].ServiceController.Cache.Get(common.NamespaceIstioSystem) { |
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.
can we add some nil checks to avoid panics?
//Validate if New ClusterAdded | ||
for _, clusterFromAdmiralParam := range updatedLB { | ||
if !slices.Contains(*cache, clusterFromAdmiralParam) { | ||
clusersToProcess = append(clusersToProcess, clusterFromAdmiralParam) |
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.
we should add the new cluster in the cache, or is it being added somewhere else?
//Validate if cluster Removed | ||
for _, clusterFromCache := range *cache { | ||
if !slices.Contains(updatedLB, clusterFromCache) { | ||
clusersToProcess = append(clusersToProcess, clusterFromCache) |
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.
same, we may need to remove it from the cache
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
Signed-off-by: Viraj Kulkarni <[email protected]>
bfd426d
to
4260c49
Compare
Adding support for migration to NLB from CLB.
Support this phase by phase.