-
Notifications
You must be signed in to change notification settings - Fork 260
fix: [NPM] Testing Changes and updates to Linux Policy Manager #1114
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
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
JungukCho
left a comment
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 you apply comments based on previous comments in the function (may need to slightly change for v2) when creating NewDataPlane - https://github.com/Azure/azure-container-networking/blob/master/npm/pkg/dataplane/dataplane.go#L70 ?
I am not sure how windows works, but for linux it is good to comment them.
| deleteErrCode, deleteErr := pMgr.runIPTablesCommand(util.IptablesDeletionFlag, jumpFromForwardToAzureChainArgs...) | ||
| hadDeleteError := deleteErr != nil && deleteErrCode != couldntLoadTargetErrorCode | ||
| // TODO check rule doesn't exist error code instead. The first call of dp.Reset() we will have exit code 2 (couldn't load target) since AZURE-NPM won't exist | ||
| hadDeleteError := deleteErr != nil && deleteErrCode != couldntLoadTargetErrorCode // couldntLoadTargetErrorCode happens when AZURE-NPM chain doesn't exist (and hence the jump rule doesn't exist too) |
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: slightly better to put comment above code?
// couldntLoadTargetErrorCode happens when AZURE-NPM chain doesn't exist (and hence the jump rule doesn't exist too)
hadDeleteError := deleteErr != nil && deleteErrCode != couldntLoadTargetErrorCode 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.
It is so tough to handle iptables and ipset errors.
Can we update comments which includes couldntLoadTargetErrorCode error can be ignorable?
But, what if the error is not couldntLoadTargetErrorCode? In the code, now the code sends log message.
So, I guess it is ok to proceed. It would be helpful to add comments about it.
It is not scope of this PR, but just bring it up.
I just realized couldntLoadTargetErrorCode is not easy to know this is global variable.
I looked for local variables. We had this approach of the codes in several places, but good to come up with some ideas to easily recognize it.
somehow
chainsErr.NoTargetExistwdyt?
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.
Will update comments. I agree that we can do something like chainsErr.NoTargetExist later
| ) | ||
|
|
||
| const reconcileChainTimeInMinutes = 5 | ||
| const reconcileTimeInMinutes = 5 |
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 for better management (e.g., naming or etc) of codes, we may sync how windows dataplane supports common functions. Now some of them are TODO in policymanager_windows.go, but would be helpful to put comments whether these are supported or not.
@vakalapa it would be nice if you walk through them and fille up them when you have time since I think you are the most knowledgeable in windows dataplane.
When we understand what reconcile in both side, we may change the name to better understand if it makes sense.
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.
Atm, there are no plans to introduce a reconcile loop in windows DP. We do not have periodic tasks like chain management in windows and the error signatures in windows are virtually unusable so we cannot build any reconcile failure loop on it.
So I see we should be resetting policy manager first, then ipset manager (I'll update this). Was there anything else the comment refers to? |
JungukCho
left a comment
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.
lgtm!
| azureChainGrepPattern string = "Chain AZURE-NPM" | ||
| minAzureChainStringLength int = len(azureChainGrepPattern) | ||
| azureChainStartIndex int = 6 | ||
| minLineNumberStringLength int = 3 // TODO transferred from iptm.go and not sure why this length is important, but will update the function its used in later anyways |
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: curious, is it idiomatic to put comment just next to code?
If not, if the comment is long, it would be nice to put above the line since I think it is more readable.
But we can update it since we need to resolve the question.
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.
just habit. I'll put comments on top now, but ya this variable will be deleted next PR anyways
There is dependency. We have to delete // It is important to keep order to clean-up iptables and ipset.
// IPtables should be cleaned first to avoid failures to clean-up iptables due to "ipset is using in kernel" error
// 1. clean-up NPM-related iptables information and then running periodic processes to keep iptables correct
if err := c.iptMgr.UninitNpmChains(); err != nil {
utilruntime.HandleError(fmt.Errorf("Failed to UninitNpmChains with err: %w", err))
}
// 2. then clean-up all NPM ipsets states
if err := c.ipsMgr.DestroyNpmIpsets(); err != nil {
utilruntime.HandleError(fmt.Errorf("Failed to DestroyNpmIpsets with err: %w", err))
} |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Linux DP wasn't working for integration tests before this PR. Now it does.
It will fail conformance tests though due to the first problem in the TODOs below.
TODO in followup PR:
Notes on Changes
Linux Policy Manager fixes (in chain-management_linux.go):
Fix DP:
Unit Testing:
Integration Testing: