CIDR validation does not catch overlap
Description
Gravity fails to catch overlap of pod and service subnet. This is possible when one of the CIDR ranges is provided in the cluster configuration resource and overlaps with the default.
What you expected to happen: Gravity should fail to install with an error stating subnets should not overlap.
How to reproduce it (as minimally and precisely as possible):
- Create config file and specify podCIDR to be the same value as the default serviceCIDR.
// config.yaml
kind: ClusterConfiguration
spec:
global:
podCIDR: "100.100.0.0/16"
- Install cluster with
gravity install --config config.yaml.
// gravity resource get clusterconfiguration
Configuration
=============
Pod IP Range: 100.100.0.0/16
Service IP Range: 100.100.0.0/16
...
Gravity verifies the subnet configuration from flags and cluster configuration separately. This can allow edges cases like this to slip through.
@bernardjkim this looks completed, can this be closed?
@a-palchikov I'm not sure if anyone got around to addressing this issue. I created this issue as a TODO while testing #2297.