-
Notifications
You must be signed in to change notification settings - Fork 108
GATEWAYS-4306: exporting metrics for conntrack per zone #137
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
Closed
Closed
Changes from 27 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
e306589
GATEWAYS-4306: exporting metrics for conntrack per zone
shrouti1995 80916dc
GATEWAYS-4306: scaling with event driven approach
shrouti1995 8b03af1
code cleanup
shrouti1995 e8eeddb
GATEWAYS-4306: updating go.mod
shrouti1995 dc73f17
GATEWAYS-4306: updating test cases
shrouti1995 7b31316
GATEWAYS-4306: editing go.mod again
shrouti1995 02ce3ca
conntrack destroy rate limiting part 1
shrouti1995 15e3b1a
conntrack destroy rate limiting part 2
shrouti1995 b1b102c
configuration update
shrouti1995 9796da5
configuration update
shrouti1995 df047c7
review suggestions
shrouti1995 51dbc5b
review comments addressed
shrouti1995 0f97bc6
fix: adding license
shrouti1995 578db7f
editing dynamic strings
shrouti1995 33d1c71
go fmt check edits
shrouti1995 3d1d088
go lint check edits
shrouti1995 68f438c
ci cd version upgrades
shrouti1995 4809d11
clean go.mod
shrouti1995 ff11970
using io instead if ioutil
shrouti1995 5ac45d4
fixing build issue
shrouti1995 64416ca
fixing build issue
shrouti1995 457550e
adding back toolchain
shrouti1995 6b139de
test cases issue solve
shrouti1995 3f97fdb
simplify by mapping with zmKey
shrouti1995 6b5e843
solve lint issue
shrouti1995 70905a1
resolve conflicts
shrouti1995 1a1e9d1
security issue
shrouti1995 4c0669e
Apply suggestions from code review
shrouti1995 96ff4a1
code review suggestions
shrouti1995 5125d48
code restructure
shrouti1995 eeb4fce
Apply suggestions from code review
shrouti1995 98dcb70
code review suggestion
shrouti1995 893e7c6
code review suggestion
shrouti1995 b77cf7d
code review suggestion : with simpler defer
shrouti1995 48399e8
code review suggestion : adding wait group and var name change
shrouti1995 18d82e3
code review suggestion : dead code cleanup
shrouti1995 db13380
Apply suggestions from code review : adding defer to unlocks
shrouti1995 e0c37ee
changing goroutine syntax
shrouti1995 9a9e749
using atomic.Int64
shrouti1995 30a0450
Apply suggestions from code review : enhance readability and minor me…
shrouti1995 864df4e
code review suggestions
shrouti1995 7626e98
code review suggestion : remove unnecessary logs
shrouti1995 77ad346
unnecessary comment and variable deleted
shrouti1995 dbb6cbd
adding all channel close for restart and increasing threasholds
shrouti1995 40aed58
removing unnecessary code
shrouti1995 644fc15
Update ovsnl/conntrack_linux.go
shrouti1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -37,64 +37,82 @@ type Client struct { | |
| // Datapath provides access to DatapathService methods. | ||
| Datapath *DatapathService | ||
|
|
||
| c *genetlink.Conn | ||
| c *genetlink.Conn | ||
| Agg *ZoneMarkAggregator | ||
| } | ||
|
|
||
| // New creates a new Linux Open vSwitch generic netlink client. | ||
| // | ||
| // If no OvS generic netlink families are available on this system, an | ||
| // error will be returned which can be checked using os.IsNotExist. | ||
| func New() (*Client, error) { | ||
| c, err := genetlink.Dial(nil) | ||
| c := &Client{} // Create client instance first | ||
|
|
||
| // Initialize the underlying genetlink connection. | ||
| conn, err := genetlink.Dial(nil) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| c.c = conn | ||
|
|
||
| return newClient(c) | ||
| } | ||
|
|
||
| // newClient is the internal Client constructor, used in tests. | ||
| func newClient(c *genetlink.Conn) (*Client, error) { | ||
| // Must ensure that the generic netlink connection is closed on any errors | ||
| // that occur before it is returned to the caller. | ||
|
|
||
| families, err := c.ListFamilies() | ||
| // Initialize services. | ||
| families, err := c.c.ListFamilies() | ||
| if err != nil { | ||
| _ = c.Close() | ||
| _ = c.c.Close() | ||
| return nil, err | ||
| } | ||
|
|
||
| client := &Client{c: c} | ||
| if err := client.init(families); err != nil { | ||
| _ = c.Close() | ||
| if err := c.init(families); err != nil { | ||
| _ = c.c.Close() | ||
| return nil, err | ||
| } | ||
|
|
||
| return client, nil | ||
| // Initialize aggregator as nil - will be created when needed | ||
| c.Agg = nil | ||
anitgandhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return c, nil | ||
| } | ||
|
|
||
| // Close closes the Client's generic netlink connection. | ||
| func (c *Client) Close() error { | ||
| return c.c.Close() | ||
| var errs []error | ||
|
|
||
| if c.Agg != nil { | ||
| c.Agg.Stop() | ||
| } | ||
|
|
||
| if c.c != nil { | ||
| if err := c.c.Close(); err != nil { | ||
| errs = append(errs, err) | ||
| } | ||
| } | ||
| if len(errs) > 0 { | ||
| return fmt.Errorf("errors closing client: %v", errs) | ||
| } | ||
|
||
| return nil | ||
shrouti1995 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // init initializes the generic netlink family service of Client. | ||
| func (c *Client) init(families []genetlink.Family) error { | ||
| var gotf int | ||
|
|
||
| for _, f := range families { | ||
| // Ignore any families without the OVS prefix. | ||
| if !strings.HasPrefix(f.Name, "ovs_") { | ||
| continue | ||
| } | ||
| // Ignore any families that might be unknown. | ||
| if err := c.initFamily(f); err != nil { | ||
| // Initialize OVS-specific families | ||
| if strings.HasPrefix(f.Name, "ovs_") { | ||
| if err := c.initFamily(f); err != nil { | ||
| // Log but continue if an OVS family fails to init | ||
| fmt.Printf("Warning: failed to initialize OVS family %q: %v\n", f.Name, err) | ||
shrouti1995 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| continue | ||
| } | ||
| } else if f.Name == "nf_conntrack" { // Explicitly initialize for Netfilter conntrack family | ||
| // Acknowledge that conntrack family exists - aggregator will handle conntrack operations | ||
| } else { | ||
| // Skip other non-OVS/non-conntrack families | ||
| continue | ||
| } | ||
| gotf++ | ||
| } | ||
|
|
||
| // No known families; return error for os.IsNotExist check. | ||
| if gotf == 0 { | ||
| return os.ErrNotExist | ||
| } | ||
|
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.