Skip to content

Commit 70969a3

Browse files
bazuchanmurali-reddy
authored andcommitted
Add iptables rules for accessing tunneled services from node (#682)
1 parent 42997cb commit 70969a3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/controllers/proxy/network_services_controller.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,10 @@ func setupMangleTableRule(ip string, protocol string, port string, fwmark string
20262026
if err != nil {
20272027
return errors.New("Failed to run iptables command to set up FWMARK due to " + err.Error())
20282028
}
2029+
err = iptablesCmdHandler.AppendUnique("mangle", "OUTPUT", args...)
2030+
if err != nil {
2031+
return errors.New("Failed to run iptables command to set up FWMARK due to " + err.Error())
2032+
}
20292033
return nil
20302034
}
20312035

@@ -2045,6 +2049,16 @@ func (ln *linuxNetworking) cleanupMangleTableRule(ip string, protocol string, po
20452049
return errors.New("Failed to cleanup iptables command to set up FWMARK due to " + err.Error())
20462050
}
20472051
}
2052+
exists, err = iptablesCmdHandler.Exists("mangle", "OUTPUT", args...)
2053+
if err != nil {
2054+
return errors.New("Failed to cleanup iptables command to set up FWMARK due to " + err.Error())
2055+
}
2056+
if exists {
2057+
err = iptablesCmdHandler.Delete("mangle", "OUTPUT", args...)
2058+
if err != nil {
2059+
return errors.New("Failed to cleanup iptables command to set up FWMARK due to " + err.Error())
2060+
}
2061+
}
20482062

20492063
return nil
20502064
}

0 commit comments

Comments
 (0)