Skip to content

Commit

Permalink
Add function to check if first OCP cluster network is IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
olliewalsh committed Jan 23, 2025
1 parent 4bcef17 commit 3c3a670
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/common/ocp/ocp.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,17 @@ func HasIPv6ClusterNetwork(ctx context.Context, h *helper.Helper) (bool, error)
}
return false, nil
}

// FirstClusterNetworkIsIPv6 - Check if first OCP cluster network is IPv6
func FirstClusterNetworkIsIPv6(ctx context.Context, h *helper.Helper) (bool, error) {
networkConfig := &ocp_config.Network{}
err := h.GetClient().Get(ctx, types.NamespacedName{Name: "cluster", Namespace: ""}, networkConfig)
if err != nil {
return false, err
}

for _, clusterNetwork := range networkConfig.Status.ClusterNetwork {
return k8s_utils.IsIPv6CIDRString(clusterNetwork.CIDR), nil
}
return false, nil
}

0 comments on commit 3c3a670

Please sign in to comment.