MitchDrage opened a new pull request, #14583:
URL: https://github.com/apache/cloudstack/pull/14583
### Description
This PR adds a `network.usage.exempt.cidrs` setting so operators can leave
chosen addresses out of virtual router network usage. A typical use is a
provider's own S3 or backup endpoint, where VM traffic shouldn't be billed as
egress.
- The setting is global and zone-scoped. It takes comma-separated IPv4
addresses or CIDRs.
- Traffic between guest networks and these addresses isn't counted, in
either direction.
- The router sends forwarded traffic through a new `<chain>_EXEMPT` chain.
This chain skips the counters for exempt sources and destinations. The counting
chains are unchanged, so existing usage collection reads them as before.
- Invalid entries and `/0` are rejected when the setting is saved.
- A router picks up the value when it starts, so existing routers need a
restart.
- With the setting empty, routers get exactly the same rules as today.
- Private gateway interfaces also get the exempt chain. Their counters are
never read, since private gateway networks aren't billed, so this is harmless.
- IPv4 only. Virtual routers don't count IPv6 traffic in network usage
today. IPv6 counting and exemptions need a separate feature request.
This covers isolated networks and VPCs. Shared networks will follow in a
separate PR as it's entirely different code.
Part of #14578
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [x] Minor
### Screenshots (if appropriate):
### How Has This Been Tested?
- Unit tests for the setting parser, save-time validation and router rule
generation (`VirtualNetworkApplianceManagerImplTest`,
`ConfigurationManagerImplTest`, `TestCsConfig`, `TestCsAddress`).
- Router scripts from 4.22.1.1 with this change applied, run in a Debian 12
container with network namespaces for the guest and public sides. This was done
for both an isolated router and a VPC router.
- Traffic to and from an exempt address left the counters at zero.
- Other traffic was counted as normal, read through `netusage.sh` and
`vpc_netusage.sh`.
- The management server change on 4.22.1.1 with the simulator.
- A zone value reached the boot args of isolated and VPC routers,
normalised.
- A global value applied when the zone value was cleared.
- An empty setting added no boot arg.
#### How did you try to break this feature and the system with this change?
- Saved invalid entries (`bogus`, `192.0.2.300`, IPv6) and `0.0.0.0/0`. Each
was rejected with an error naming the entry.
- Re-ran the router configuration repeatedly. The rule set stayed the same.
- Added and cleared exempt CIDRs on a running router. The rules followed
each change.
- With the setting empty, compared the router rules against stock 4.22.1.1.
They were identical.
- Applied, changed and removed VPC network ACLs with an exempt CIDR set.
- The usage rules stayed untouched.
- ACLs still allowed and blocked traffic as configured.
- An ACL deny on an exempt address still blocked it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]