-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iptables-helper: Use iptables-restore to maintain rules.
Replace usage in cloud-agent Signed-off-by: Zhen Tang <[email protected]>
- Loading branch information
1 parent
389308b
commit 27a370c
Showing
4 changed files
with
264 additions
and
37 deletions.
There are no files selected for viewing
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,30 @@ | ||
package iptables | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestGenerateCloudAgentRules(t *testing.T) { | ||
ipt, err := NewIPTablesHelper() | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
// Sync forward | ||
ipsetName := "FABEDGE-REMOTE-POD-CIDR" | ||
ipt.CreateFabEdgeForwardChain() | ||
ipt.NewMaintainForwardRulesForIPSet([]string{ipsetName}) | ||
|
||
// Sync PostRouting | ||
ipt.NewPreparePostRoutingChain() | ||
ipt.NewAddPostRoutingRuleForKubernetes() | ||
ipt.NewAddPostRoutingRulesForIPSet(ipsetName) | ||
|
||
str := ipt.GenerateInputFromRuleSet() | ||
println(str) | ||
|
||
//err = ipt.ReplaceRules() | ||
//if err != nil { | ||
// t.Error(err) | ||
//} | ||
} |
Oops, something went wrong.