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

OCM-3801 | Feat | Added default values for CIDRs and host prefix #552

Merged
merged 3 commits into from
Sep 25, 2023

Conversation

tirthct
Copy link
Contributor

@tirthct tirthct commented Sep 20, 2023

Changed

  • Fetched default values from flavour endpoint
  • Set the values for CIDRs and host prefix

Tested

  • CIDR and host prefix should have the default values auto populated in case of no other input : tested

@@ -595,6 +623,11 @@ func preRun(cmd *cobra.Command, argv []string) error {
return err
}

if args.interactive {
machineCIDR, serviceCIDR, podCIDR, hostPrefix := GetDefaultClusterFlavors(connection, args.flavour)
Copy link
Contributor

Choose a reason for hiding this comment

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

is the order of variables/matching the return values? serviceCIDR and podCIDR seem inverted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 298 to 301
// If the default value is nil, set the value as a default value
if flag.DefValue == "<nil>" {
flag.DefValue = flag.Value.String()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear to me why we need to set the flag default value here, can you explain, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We set the default value so that it is set (and shown) on the console when the user does not input any values. When we set the value in https://github.com/openshift-online/ocm-cli/pull/552/files#diff-2f19822c49dc0bec88a73920ea0f04a30b7047b5a827c90447e02b7378744f97R627, it sets the "value" attribute and not the defValue attribute.

Copy link
Contributor

@cristianoveiga cristianoveiga Sep 22, 2023

Choose a reason for hiding this comment

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

This is the implementation of the // TODO below, right? You can probably move that comment here - it will be more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved

prompt := &survey.Input{
Message: getQuestion(flag),
Help: flag.Usage,
// TODO respect flag default, if set
// (awkward because https://github.com/golang/go/issues/39516).
Copy link
Contributor

Choose a reason for hiding this comment

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

I would keep the comment with the link to this issue which explains the nil issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back

Copy link
Contributor

@cristianoveiga cristianoveiga left a comment

Choose a reason for hiding this comment

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

LGTM

@gdbranco gdbranco merged commit 55cf5e9 into openshift-online:main Sep 25, 2023
@tirthct tirthct deleted the ocm-3801 branch September 25, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants