-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make throttling nmagent fetches for nodesubnet more dynamic (#3023)
* feat(CNS): Early work on better throttling in NMAgent fetch for nodesubnet * feat(CNS): Update NMAgent fetches to be async with binary exponential backoff * chore: check for empty nmagent response * test: update test for empty response * style: make linter happy * chore: fix some comments * fix: Fix bug in refresh * refactor: Address comments * refactor: ignore primary ip * refactor: move refresh out of ipfetcher * test: add ip fetcher tests * fix: remove broken import * fix: fix import * fix: fix linting * fix: fix some failing tests * chore: Remove unused function * test: test updates * fix: address comments * chore: add missed file * chore: add comment about static interval * feat: address Evan's comment to require Equal method on cached results * chore: add missed file * feat: more efficient equality * refactor: address Evan's comment * refactor: address Tim's comment * fix: undo accidental commit * fix: make linter happy * fix: make linter happy
- Loading branch information
1 parent
3ed0bcd
commit b5046a0
Showing
12 changed files
with
581 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package nmagent | ||
|
||
// Equal compares two Interfaces objects for equality. | ||
func (i Interfaces) Equal(other Interfaces) bool { | ||
if len(i.Entries) != len(other.Entries) { | ||
return false | ||
} | ||
for idx, entry := range i.Entries { | ||
if !entry.Equal(other.Entries[idx]) { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
|
||
// Equal compares two Interface objects for equality. | ||
func (i Interface) Equal(other Interface) bool { | ||
if len(i.InterfaceSubnets) != len(other.InterfaceSubnets) { | ||
return false | ||
} | ||
for idx, subnet := range i.InterfaceSubnets { | ||
if !subnet.Equal(other.InterfaceSubnets[idx]) { | ||
return false | ||
} | ||
} | ||
if i.IsPrimary != other.IsPrimary || !i.MacAddress.Equal(other.MacAddress) { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
// Equal compares two InterfaceSubnet objects for equality. | ||
func (s InterfaceSubnet) Equal(other InterfaceSubnet) bool { | ||
if len(s.IPAddress) != len(other.IPAddress) { | ||
return false | ||
} | ||
if s.Prefix != other.Prefix { | ||
return false | ||
} | ||
for idx, ip := range s.IPAddress { | ||
if !ip.Equal(other.IPAddress[idx]) { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
|
||
// Equal compares two NodeIP objects for equality. | ||
func (ip NodeIP) Equal(other NodeIP) bool { | ||
return ip.IsPrimary == other.IsPrimary && ip.Address.Equal(other.Address) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package refresh | ||
|
||
type equaler[T any] interface { | ||
Equal(T) bool | ||
} |
Oops, something went wrong.