-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 Replace disable-grouping with grouping option in clusterctl describe command #5550
Conversation
Hi @DiptoChakrabarty. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/rename 🌱 Replace disable-grouping with grouping option in clusterctl describe command |
/cc |
@DiptoChakrabarty Thanks for the PR!! 🚀 Two PR clean up items:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DiptoChakrabarty Can you also please update the tests to use the new Grouping
field. The tests seem to still be using DisableGrouping
.
@@ -58,7 +58,7 @@ type describeClusterOptions struct { | |||
showOtherConditions string | |||
showMachineSets bool | |||
disableNoEcho bool | |||
disableGrouping bool | |||
Grouping bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouping bool | |
grouping bool |
The field can remain private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with this
@@ -110,7 +110,7 @@ func init() { | |||
|
|||
describeClusterClusterCmd.Flags().BoolVar(&dc.disableNoEcho, "disable-no-echo", false, ""+ | |||
"Disable hiding of a MachineInfrastructure and BootstrapConfig when ready condition is true or it has the Status, Severity and Reason of the machine's object.") | |||
describeClusterClusterCmd.Flags().BoolVar(&dc.disableGrouping, "disable-grouping", false, | |||
describeClusterClusterCmd.Flags().BoolVar(&dc.Grouping, "grouping", true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describeClusterClusterCmd.Flags().BoolVar(&dc.Grouping, "grouping", true, | |
describeClusterClusterCmd.Flags().BoolVar(&dc.grouping, "grouping", true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -138,7 +138,7 @@ func runDescribeCluster(name string) error { | |||
ShowOtherConditions: dc.showOtherConditions, | |||
ShowMachineSets: dc.showMachineSets, | |||
DisableNoEcho: dc.disableNoEcho, | |||
DisableGrouping: dc.disableGrouping, | |||
Grouping: dc.Grouping, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouping: dc.Grouping, | |
Grouping: dc.grouping, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cmd/clusterctl/client/tree/tree.go
Outdated
// DisableGrouping disables grouping sibling objects in case the ready condition | ||
// has the same Status, Severity and Reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as the other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cmd/clusterctl/client/tree/tree.go
Outdated
@@ -140,7 +140,7 @@ func (od ObjectTree) Add(parent, obj client.Object, opts ...AddObjectOption) (ad | |||
// If it is requested that the child of this node should be grouped in case the ready condition | |||
// has the same Status, Severity and Reason, add the GroupingObjectAnnotation to signal | |||
// this to the presentation layer. | |||
if addOpts.GroupingObject && !od.options.DisableGrouping { | |||
if addOpts.GroupingObject && !od.options.Grouping { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if addOpts.GroupingObject && !od.options.Grouping { | |
if addOpts.GroupingObject && od.options.Grouping { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
58c991a
to
3b7bf28
Compare
Done both |
/ok-to-test |
@@ -110,6 +111,9 @@ func init() { | |||
|
|||
describeClusterClusterCmd.Flags().BoolVar(&dc.disableNoEcho, "disable-no-echo", false, ""+ | |||
"Disable hiding of a MachineInfrastructure and BootstrapConfig when ready condition is true or it has the Status, Severity and Reason of the machine's object.") | |||
describeClusterClusterCmd.Flags().BoolVar(&dc.grouping, "grouping", true, | |||
"Disable grouping machines when ready condition has the same Status, Severity and Reason.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Disable grouping machines when ready condition has the same Status, Severity and Reason.") | |
"Groups machines when ready condition has the same Status, Severity and Reason.") |
Note. |
Okay so if I am understanding correctly instead of having the DisableGrouping option it is fine to use the Grouping option in the DescribeClusterOptions( cluster-api/cmd/clusterctl/client/describe.go Lines 26 to 50 in 0f347df
however in case of the So when disable-grouping option is provided grouping will not occur , however when grouping option is provided the output is grouped(all managed by the Grouping option in the DescribeClusterOptions) am I thinking correctly |
yes, or in other words |
Okay working on it |
@@ -138,7 +140,7 @@ func runDescribeCluster(name string) error { | |||
ShowOtherConditions: dc.showOtherConditions, | |||
ShowMachineSets: dc.showMachineSets, | |||
DisableNoEcho: dc.disableNoEcho, | |||
DisableGrouping: dc.disableGrouping, | |||
Grouping: dc.grouping, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be
Grouping: dc.grouping, | |
Grouping: dc.grouping && !dc.disableGrouping, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it
describeClusterClusterCmd.Flags().BoolVar(&dc.disableGrouping, "disable-grouping", false, | ||
describeClusterClusterCmd.Flags().BoolVar(&dc.grouping, "grouping", true, | ||
"Groups machines when ready condition has the same Status, Severity and Reason.") | ||
describeClusterClusterCmd.Flags().BoolVar(&dc.grouping, "disable-grouping", false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't have two flags using the same variable
describeClusterClusterCmd.Flags().BoolVar(&dc.grouping, "disable-grouping", false, | |
describeClusterClusterCmd.Flags().BoolVar(&dc.disableGrouping, "disable-grouping", false, |
Also the flag should be deprecated as per https://pkg.go.dev/github.com/spf13/pflag#readme-deprecating-a-flag-or-its-shorthand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes marked it as deprecated
@DiptoChakrabarty After addressing @fabriziopandini comments, please swash all the commits into a single commit. :) |
Hey I am not sure why the test is failing in the control plane grouping check case in this line
I tried checking the condition which enables the grouping annotation based on here cluster-api/cmd/clusterctl/client/tree/tree.go Lines 143 to 145 in 4b858f6
I tried printing them while running it |
I will try to get a look at the error asap |
@DiptoChakrabarty The "Discovery with default discovery settings" test is failing because it was written under the assumption that grouping should be disabled by default. With the changes introduced by this PR to achieve the default configuration in this change you now have to change
into
Also, please note that the flag deprecation is not yet properly implemented. cluster-api/cmd/clusterctl/cmd/describe_cluster.go Lines 115 to 116 in 4042172
Into
If you don't mind, the last two nits:
should be changed into
And
Is missing the --disable-no-echo flag, so it should be modified into
With this changes everything should be ok (tested locally), so please squash commits |
okay sure doing it |
4042172
to
303d77d
Compare
Updated them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DiptoChakrabarty thanks!
@ykakarap PTAL
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
Just some minor nits.
cmd/clusterctl/client/describe.go
Outdated
// has the same Status, Severity and Reason | ||
DisableGrouping bool | ||
// Grouping groups machines objects in case the ready conditions | ||
// have the same Status, Severity and Reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
// have the same Status, Severity and Reason | |
// have the same Status, Severity and Reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// has the same Status, Severity and Reason | ||
DisableGrouping bool | ||
// Grouping groups machine objects in case the ready conditions | ||
// have the same Status, Severity and Reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
// have the same Status, Severity and Reason | |
// have the same Status, Severity and Reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -442,15 +442,15 @@ func Test_Add_setsGroupingObjectAnnotation(t *testing.T) { | |||
{ | |||
name: "should add the annotation if requested to", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
name: "should add the annotation if requested to", | |
name: "should add the annotation if requested to and grouping is enabled", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
303d77d
to
e333b97
Compare
/retest |
@DiptoChakrabarty: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the fixes :)
/lgtm
@fabriziopandini Out of curiosity: When we want to replace public functions we deprecate the old function and add a new one. Do we also have to do the same for public fields in public types? |
We provide guarantees for API and CLI surface, while instead of for code we are allowed to do breaking changes between minor releases. more in https://github.com/kubernetes-sigs/cluster-api/blob/main/CONTRIBUTING.md |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
🌱
What this PR does / why we need it: This deprecates the
disable-grouping(false)
option in the clusterctl describe and uses thegrouping(true)
option as per the issueWhich issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #5346 (working on)
Comments in the files haven't been updated yet , wanted to know if I am taking the right approach for this