-
Couldn't load subscription status.
- Fork 1.4k
Description
This issue is for discussion on whether an "IPFamily" concept and restriction is useful and concretely definable in a way that works across Cluster API providers.
Since the introduction of dual stack networking in Cluster API - in particular its use in tests in CAPD - Cluster API has a definition of a valid "IPFamily" for a Cluster. This is an indication of whether the Pod and Service CIDR blocks are compatible with one another.
This concept is used in the Cluster Topology controller as "IPFamily" is available as a variable. It can be one of IPv4, IPv6 or Dualstack.
Cluster API calculates this value here:
cluster-api/api/v1beta1/cluster_types.go
Line 420 in 82257b1
| func (c *Cluster) GetIPFamily() (ClusterIPFamily, error) { |
It comes down to:
- If both pods and service CIDR blocks are
IPv4, the Cluster IPFamily isIPv4 - If both pods and service CIDR blocks are
IPv6, the Cluster IPFamily isIPv6 - If both pods CIDR entry is
Dualstack, the Cluster IPFamily isDualstack - Otherwise if the pods and service CIDR blocks are not identical the IPFamily is invalid.
Case 4. causes the Cluster Topology controller to throw a reconciliation error today.
As far as I understand this check was introduced because this is the validation that the DockerLoadBalancer does today, but I'm not sure this is the correct concept for a Cluster IPFamily, or if such a concept is definable across infrastructure providers.
Kubernetes does not AFAIK have any such concept today, and you can create clusters with Kubeadm that violate the rules for Cluster API.
Some additional context and conversation around this can be found in: #7420. This change also (at time of writing) adds strict validation that the Cluster IP family must be valid in line with Cluster API's definition.
Is it necessary to define an "IPFamily" for CAPI Clusters? Is it useful to expose it e.g. as a variable for ClusterClass-based clusters?