-
Notifications
You must be signed in to change notification settings - Fork 260
npm: enable debug feature parity for v2 #1324
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
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
abd49ff
pretty print
matmerr 0b49cfe
netpol files
matmerr bcbdeb2
parser type
matmerr 918acf2
cache/pod interface
matmerr b409a9c
cache interface
matmerr 5de4db7
retrieve cache common interface
matmerr 4d45146
Merge branch 'master' into npmcliv2
matmerr a6fdea9
cachev2 tuple
matmerr 061d768
set map retrieval
matmerr 7ef3678
add test files and start test
matmerr 90d8fb2
simplified rules
matmerr 12bd4da
remove log lines
matmerr 2adecf7
lint
matmerr d2ace83
lint
matmerr c38d471
Merge branch 'npmcliv2' of github.com:matmerr/azure-container-network…
matmerr 43a73f9
remove old tests
matmerr 742e468
remove log lines
matmerr cd3f01b
simplify
matmerr b373b64
jumps
matmerr 04b1063
nested chains
matmerr 0df7a4d
skip when prefix
matmerr eb64649
reorg
matmerr 0f68de7
bring back legacy cache behavior
matmerr ddbd75c
common ns
matmerr 37e432b
isolate cache
matmerr 28d87e7
uncomment tests
matmerr fce0c97
Merge branch 'master' into npmcliv2
matmerr 61a673a
linting
matmerr cd3d9db
linting
matmerr 7c3fd3f
fix npm tests
matmerr 37cacc7
Merge branch 'master' into npmcliv2
matmerr 214ba18
better match conditions
matmerr 2d4ada2
ipsm v1 hashing serversize for set+listmap
matmerr ab609af
replace old cache files
matmerr 180bc47
tests
matmerr fa51304
update controller tools for ci
matmerr da2be05
simplify generic cache signature
matmerr 912ebd0
parent string
matmerr 427c1d0
nestedlabel prefix
matmerr 92cef04
match keylabelns
matmerr 656c2ef
printing formatting
matmerr c96a6cb
update tests
matmerr b3602a0
lint
matmerr 0ea0170
Merge branch 'master' into npmcliv2
matmerr a9c74dd
Merge branch 'master' into npmcliv2
matmerr 7ea845e
nnc
matmerr a6a4346
build tools conflict
matmerr 56ddd95
fix crdgen
matmerr 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module github.com/Azure/azure-container-networking/hack/toolbox/server | ||
|
|
||
| go 1.17 |
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
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 |
|---|---|---|
|
|
@@ -3,9 +3,13 @@ package main | |
| import ( | ||
| "fmt" | ||
|
|
||
| dataplane "github.com/Azure/azure-container-networking/npm/pkg/dataplane/debug" | ||
| npmconfig "github.com/Azure/azure-container-networking/npm/config" | ||
| "github.com/Azure/azure-container-networking/npm/http/api" | ||
| "github.com/Azure/azure-container-networking/npm/pkg/controlplane/controllers/common" | ||
| "github.com/Azure/azure-container-networking/npm/pkg/dataplane/debug" | ||
| "github.com/Azure/azure-container-networking/npm/util/errors" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/viper" | ||
| ) | ||
|
|
||
| func newGetTuples() *cobra.Command { | ||
|
|
@@ -23,28 +27,46 @@ func newGetTuples() *cobra.Command { | |
| } | ||
| npmCacheF, _ := cmd.Flags().GetString("cache-file") | ||
| iptableSaveF, _ := cmd.Flags().GetString("iptables-file") | ||
| srcType := dataplane.GetInputType(src) | ||
| dstType := dataplane.GetInputType(dst) | ||
| srcInput := &dataplane.Input{Content: src, Type: srcType} | ||
| dstInput := &dataplane.Input{Content: dst, Type: dstType} | ||
| srcType := common.GetInputType(src) | ||
| dstType := common.GetInputType(dst) | ||
| srcInput := &common.Input{Content: src, Type: srcType} | ||
| dstInput := &common.Input{Content: dst, Type: dstType} | ||
|
|
||
| config := &npmconfig.Config{} | ||
| err := viper.Unmarshal(config) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load config with err %w", err) | ||
| } | ||
|
|
||
| switch { | ||
| case npmCacheF == "" && iptableSaveF == "": | ||
| _, tuples, err := dataplane.GetNetworkTuple(srcInput, dstInput) | ||
|
|
||
| c := &debug.Converter{ | ||
| NPMDebugEndpointHost: "http://localhost", | ||
| NPMDebugEndpointPort: api.DefaultHttpPort, | ||
| EnableV2NPM: config.Toggles.EnableV2NPM, // todo: pass this a different way than param to this | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any plans for the todo? |
||
| } | ||
|
|
||
| _, tuples, srcList, dstList, err := c.GetNetworkTuple(srcInput, dstInput, config) | ||
| if err != nil { | ||
| return fmt.Errorf("%w", err) | ||
| } | ||
| for _, tuple := range tuples { | ||
| fmt.Printf("%+v\n", tuple) | ||
| } | ||
|
|
||
| debug.PrettyPrintTuples(tuples, srcList, dstList) | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line |
||
| case npmCacheF != "" && iptableSaveF != "": | ||
| _, tuples, err := dataplane.GetNetworkTupleFile(srcInput, dstInput, npmCacheF, iptableSaveF) | ||
|
|
||
| c := &debug.Converter{ | ||
| EnableV2NPM: config.Toggles.EnableV2NPM, | ||
| } | ||
|
|
||
| _, tuples, srcList, dstList, err := c.GetNetworkTupleFile(srcInput, dstInput, npmCacheF, iptableSaveF) | ||
| if err != nil { | ||
| return fmt.Errorf("%w", err) | ||
| } | ||
| for _, tuple := range tuples { | ||
| fmt.Printf("%+v\n", tuple) | ||
| } | ||
|
|
||
| debug.PrettyPrintTuples(tuples, srcList, dstList) | ||
|
|
||
| default: | ||
| return errSpecifyBothFiles | ||
| } | ||
|
|
||
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
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.
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.
nit: do we want to have acnpublic here?