Skip to content

Commit

Permalink
Fix test-failures.
Browse files Browse the repository at this point in the history
Updates fake.go to store the changes in Dump.

Hard-codes the masq-chain flag as it is getting set to empty string.
  • Loading branch information
Ramkumar-K committed May 15, 2023
1 parent eda6caa commit 58ec1a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions cmd/ip-masq-agent/ip-masq-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (

utilyaml "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/component-base/logs"
"k8s.io/component-base/version/verflag"
"k8s.io/ip-masq-agent/cmd/ip-masq-agent/testing/fakefs"
"k8s.io/ip-masq-agent/pkg/version"
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
"k8s.io/component-base/version/verflag"
utilexec "k8s.io/utils/exec"

"github.com/golang/glog"
Expand All @@ -47,10 +47,10 @@ const (

var (
// name of nat chain for iptables masquerade rules
masqChain utiliptables.Chain
masqChainFlag = flag.String("masq-chain", "IP-MASQ-AGENT", `Name of nat chain for iptables masquerade rules.`)
noMasqueradeAllReservedRangesFlag = flag.Bool("nomasq-all-reserved-ranges", false, "Whether to disable masquerade for all IPv4 ranges reserved by RFCs.")
enableIPv6 = flag.Bool("enable-ipv6", false, "Whether to enable IPv6.")
masqChain utiliptables.Chain = "IP-MASQ-AGENT"
masqChainFlag = flag.String("masq-chain", "IP-MASQ-AGENT", `Name of nat chain for iptables masquerade rules.`)
noMasqueradeAllReservedRangesFlag = flag.Bool("nomasq-all-reserved-ranges", false, "Whether to disable masquerade for all IPv4 ranges reserved by RFCs.")
enableIPv6 = flag.Bool("enable-ipv6", false, "Whether to enable IPv6.")
)

// MasqConfig object
Expand Down Expand Up @@ -271,6 +271,7 @@ func validateCIDR(cidr string) error {

func (m *MasqDaemon) syncMasqRules() error {
// make sure our custom chain for non-masquerade exists
glog.Infof("###### Got masqChain %s", string(masqChain))
m.iptables.EnsureChain(utiliptables.TableNAT, masqChain)

// ensure that any non-local in POSTROUTING jumps to masqChain
Expand Down
3 changes: 2 additions & 1 deletion cmd/ip-masq-agent/ip-masq-agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import (

// turn off glog logging during tests to avoid clutter in output
func TestMain(m *testing.M) {
flag.Set("logtostderr", "false")
flag.Set("logtostderr", "true")
flag.Set("masq-chain", "IP-MASQ-AGENT")
ec := m.Run()
os.Exit(ec)
}
Expand Down
1 change: 1 addition & 0 deletions vendor/k8s.io/kubernetes/pkg/util/iptables/testing/fake.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 58ec1a6

Please sign in to comment.