Skip to content

Commit f604bec

Browse files
authored
Merge pull request #596 from olliewalsh/rabbitmqdualstack
Add function to check if first OCP cluster network is IPv6
2 parents 4bcef17 + 3c3a670 commit f604bec

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

modules/common/ocp/ocp.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,17 @@ func HasIPv6ClusterNetwork(ctx context.Context, h *helper.Helper) (bool, error)
6565
}
6666
return false, nil
6767
}
68+
69+
// FirstClusterNetworkIsIPv6 - Check if first OCP cluster network is IPv6
70+
func FirstClusterNetworkIsIPv6(ctx context.Context, h *helper.Helper) (bool, error) {
71+
networkConfig := &ocp_config.Network{}
72+
err := h.GetClient().Get(ctx, types.NamespacedName{Name: "cluster", Namespace: ""}, networkConfig)
73+
if err != nil {
74+
return false, err
75+
}
76+
77+
for _, clusterNetwork := range networkConfig.Status.ClusterNetwork {
78+
return k8s_utils.IsIPv6CIDRString(clusterNetwork.CIDR), nil
79+
}
80+
return false, nil
81+
}

0 commit comments

Comments
 (0)