You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// setExceptIPs sets all the destination ips// for which traffic should be blockedfunc (np*NetworkPolicy) setExceptIPs(experimentsDetails*experimentTypes.ExperimentDetails) error {
...ifips[i] !=""&&!isPresent&&!strings.Contains(ips[i], ":") {
uniqueIps=append(uniqueIps, ips[i]+"/32")
}
}
np.ExceptIPs=uniqueIpsreturnnil
}
Always adds /32 to IP addresses, unassuming that Destination IPs can be CIDR blocks. In fact, the documentation states so:
DESTINATION_IPS: It contains the IP addresses of the services or pods or the CIDR blocks(range of IPs), the accessibility to which is impacted.
What happened:
When adding a CIDR range to an except IPblock, which is supported like so intended:
egress:
- to:
- ipBlock:
cidr: 10.0.0.0/24/32 # <-- ERROR
This raises the following error:
{"errorCode":"CHAOS_INJECT_ERROR","phase":"ChaosInject","reason":"failed to create network policy: NetworkPolicy.networking.k8s.io \"pod-network-partition-np-glob6h\" is invalid: [spec.ingress[0].from[2].ipBlock.except[2]: Invalid value: \"X.X.X.X/30/32\": not a valid CIDR, spec.egress[0].to[2].ipBlock.except[2]: Invalid value: \"Y.Y.Y.Y/30/32\": not a valid CIDR]"}
What you expected to happen:
Work according to expected code block above.
How to reproduce it (as minimally and precisely as possible):
Create pod-network-partition-loss experiment with CIDR block destination IPs.
Anything else we need to know?:
Litmus Version: 3.11
I would like to contribute by providing a fix to this issue. :)
The text was updated successfully, but these errors were encountered:
Is this a BUG REPORT or FEATURE REQUEST?
BUG REPORT
The following function specifically in line
litmus-go/chaoslib/litmus/pod-network-partition/lib/network-policy.go
Line 201 in 0cd6c6f
Always adds
/32
to IP addresses, unassuming that Destination IPs can be CIDR blocks. In fact, the documentation states so:DESTINATION_IPS: It contains the IP addresses of the services or pods or the CIDR blocks(range of IPs), the accessibility to which is impacted.
What happened:
When adding a CIDR range to an except IPblock, which is supported like so intended:
It actually tries to create:
This raises the following error:
What you expected to happen:
Work according to expected code block above.
How to reproduce it (as minimally and precisely as possible):
Create pod-network-partition-loss experiment with CIDR block destination IPs.
Anything else we need to know?:
Litmus Version: 3.11
I would like to contribute by providing a fix to this issue. :)
The text was updated successfully, but these errors were encountered: