Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to check if first OCP cluster network is IPv6 #596

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Comment on lines +71 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since both funcs now use a the same to get the networkConfig, could make a dedicated func for it and re-use it. but can do that in a follow up


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