INNER CODE UNIT · Go
getLBToProcess
istio-ecosystem/admiral · admiral/pkg/clusters/admiralDatabaseClient.go:340
func getLBToProcess(updatedLB []string, cache *[]string) []string {
clusersToProcess := make([]string, 0)
if cache == nil || len(*cache) == 0 {
*cache = updatedLB
return updatedLB
}
if len(updatedLB) == 0 {
clusersToProcess = *cache
*cache = updatedLB
return clusersToProcess
}
//Validate if New ClusterAdded
for _, clusterFromAdmiralParam := range updatedLB {
if !slices.Contains(*cache, clusterFromAdmiralParam) {
clusersToProcess = append(clusersToProcess, clusterFromAdmiralParam)
*cache = append(*cache, clusterFromAdmiralParam)