Skip to content

Commit

Permalink
Rename iptables interface to match ipset
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebryant committed Jul 13, 2017
1 parent b8e7dd9 commit de594cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions npc/controller.go
Expand Up @@ -31,14 +31,14 @@ type controller struct {

nodeName string // my node name

ipt iptables.IPTables
ipt iptables.Interface
ips ipset.Interface

nss map[string]*ns // ns name -> ns struct
nsSelectors *selectorSet // selector string -> nsSelector
}

func New(nodeName string, ipt iptables.IPTables, ips ipset.Interface) NetworkPolicyController {
func New(nodeName string, ipt iptables.Interface, ips ipset.Interface) NetworkPolicyController {
c := &controller{
nodeName: nodeName,
ipt: ipt,
Expand Down
2 changes: 1 addition & 1 deletion npc/iptables/iptables.go
@@ -1,6 +1,6 @@
package iptables

type IPTables interface {
type Interface interface {
Append(table, chain string, rulespec ...string) error
Delete(table, chain string, rulespec ...string) error
Insert(table, chain string, pos int, rulespec ...string) error
Expand Down
6 changes: 3 additions & 3 deletions npc/namespace.go
Expand Up @@ -15,8 +15,8 @@ import (
)

type ns struct {
ipt iptables.IPTables // interface to iptables
ips ipset.Interface // interface to ipset
ipt iptables.Interface // interface to iptables
ips ipset.Interface // interface to ipset

name string // k8s Namespace name
nodeName string // my node name
Expand All @@ -32,7 +32,7 @@ type ns struct {
rules *ruleSet
}

func newNS(name, nodeName string, ipt iptables.IPTables, ips ipset.Interface, nsSelectors *selectorSet) (*ns, error) {
func newNS(name, nodeName string, ipt iptables.Interface, ips ipset.Interface, nsSelectors *selectorSet) (*ns, error) {
allPods, err := newSelectorSpec(&unversioned.LabelSelector{}, name, ipset.HashIP)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions npc/rule.go
Expand Up @@ -35,11 +35,11 @@ func newRuleSpec(proto *string, srcHost *selectorSpec, dstHost *selectorSpec, ds
}

type ruleSet struct {
ipt iptables.IPTables
ipt iptables.Interface
users map[string]map[types.UID]struct{}
}

func newRuleSet(ipt iptables.IPTables) *ruleSet {
func newRuleSet(ipt iptables.Interface) *ruleSet {
return &ruleSet{ipt, make(map[string]map[types.UID]struct{})}
}

Expand Down

0 comments on commit de594cf

Please sign in to comment.