Skip to content

Commit

Permalink
🌱 Deprecate IP Family builtin variable (#10554)
Browse files Browse the repository at this point in the history
* Deprecate IP Family

* Address comments
  • Loading branch information
fabriziopandini authored May 6, 2024
1 parent 233ee68 commit 5726325
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,9 @@ func (c *Cluster) SetConditions(conditions Conditions) {
}

// GetIPFamily returns a ClusterIPFamily from the configuration provided.
// Note: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD.
// IPFamily may be dropped in a future release. More details at https://github.com/kubernetes-sigs/cluster-api/issues/7521
//
// Deprecated: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD.
// IPFamily will be dropped in a future release. More details at https://github.com/kubernetes-sigs/cluster-api/issues/7521
func (c *Cluster) GetIPFamily() (ClusterIPFamily, error) {
var podCIDRs, serviceCIDRs []string
if c.Spec.ClusterNetwork != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ referenced in patches:
- `builtin.cluster.{name,namespace}`
- `builtin.cluster.topology.{version,class}`
- `builtin.cluster.network.{serviceDomain,services,pods,ipFamily}`
- Note: ipFamily is deprecated and will be removed in a future release. see https://github.com/kubernetes-sigs/cluster-api/issues/7521.
- `builtin.controlPlane.{replicas,version,name}`
- Please note, these variables are only available when patching control plane or control plane
machine templates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ type ClusterNetworkBuiltins struct {
// Pods is the network ranges from which Pod networks are allocated.
Pods []string `json:"pods,omitempty"`
// IPFamily is the IPFamily the Cluster is operating in. One of Invalid, IPv4, IPv6, DualStack.
// Note: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD.
// IPFamily may be dropped in a future release. More details at https://github.com/kubernetes-sigs/cluster-api/issues/7521
//
// Deprecated: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD.
// IPFamily will be dropped in a future release. More details at https://github.com/kubernetes-sigs/cluster-api/issues/7521
IPFamily string `json:"ipFamily,omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion exp/runtime/hooks/api/v1alpha1/zz_generated.openapi.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Global(clusterTopology *clusterv1.Topology, cluster *clusterv1.Cluster, def
},
}
if cluster.Spec.ClusterNetwork != nil {
clusterNetworkIPFamily, _ := cluster.GetIPFamily()
clusterNetworkIPFamily, _ := cluster.GetIPFamily() //nolint:staticcheck // We tolerate this until removal. See https://github.com/kubernetes-sigs/cluster-api/issues/7521.
builtin.Cluster.Network = &runtimehooksv1.ClusterNetworkBuiltins{
IPFamily: ipFamilyToString(clusterNetworkIPFamily),
}
Expand Down
2 changes: 1 addition & 1 deletion test/infrastructure/docker/internal/docker/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewLoadBalancer(ctx context.Context, cluster *clusterv1.Cluster, dockerClus
return nil, err
}

ipFamily, err := cluster.GetIPFamily()
ipFamily, err := cluster.GetIPFamily() //nolint:staticcheck // We tolerate this until removal; after removal IPFamily will become an internal CAPD concept. See https://github.com/kubernetes-sigs/cluster-api/issues/7521.
if err != nil {
return nil, fmt.Errorf("create load balancer: %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/infrastructure/docker/internal/docker/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewMachine(ctx context.Context, cluster *clusterv1.Cluster, machine string,
return nil, err
}

ipFamily, err := cluster.GetIPFamily()
ipFamily, err := cluster.GetIPFamily() //nolint:staticcheck // We tolerate this until removal; after removal IPFamily will become an internal CAPD concept. See https://github.com/kubernetes-sigs/cluster-api/issues/7521.
if err != nil {
return nil, fmt.Errorf("create docker machine: %s", err)
}
Expand Down Expand Up @@ -126,7 +126,7 @@ func ListMachinesByCluster(ctx context.Context, cluster *clusterv1.Cluster, labe
return nil, err
}

ipFamily, err := cluster.GetIPFamily()
ipFamily, err := cluster.GetIPFamily() //nolint:staticcheck // We tolerate this until removal; after removal IPFamily will become an internal CAPD concept. See https://github.com/kubernetes-sigs/cluster-api/issues/7521.
if err != nil {
return nil, fmt.Errorf("list docker machines by cluster: %s", err)
}
Expand Down

0 comments on commit 5726325

Please sign in to comment.