Skip to content

🐛 Fix multiline Ready condition in clusterctl describe for v1beta2 #11781

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

Conversation

tobiasgiese
Copy link
Member

@tobiasgiese tobiasgiese commented Feb 1, 2025

The multiline feature in clusterctl has a bug in the multiline conditions.
If the Ready condition message has multipile lines the multiline prefix is not calculated properly.
To fix this we have to add a new logic to determine the multiline prefix for objects.

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #11782

/area clusterctl

@k8s-ci-robot k8s-ci-robot added the area/clusterctl Issues or PRs related to clusterctl label Feb 1, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 1, 2025
Comment on lines 338 to 334
"Object/root",
"│ 2",
"├─Object/child1",
"│ 2",
"└─Object/child2",
Copy link
Member Author

@tobiasgiese tobiasgiese Feb 1, 2025

Choose a reason for hiding this comment

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

Without the fix (where ? is no prefix)

Object/root              Available: False  NotAvailable  292y  1  
?                                                              2  
├─Object/child1          Available: False  NotAvailable  292y  1  
│                                                              2  
└─Object/child2          Available: False  NotAvailable  292y  1  
                                                               2  

Comment on lines 382 to 373
"Object/root",
"├─Object/child1",
"└─Object/child2",
" │ 2",
" └─Object/child2.1",
Copy link
Member Author

@tobiasgiese tobiasgiese Feb 1, 2025

Choose a reason for hiding this comment

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

Without the fix

Object/root                  Available: True   Available     292y     
├─Object/child1              Available: True   Available     292y     
└─Object/child2              Available: False  NotAvailable  292y  1  
                                                                   2  
  └─Object/child2.1

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch 4 times, most recently from 7f71cbc to 79b13f5 Compare February 1, 2025 11:17
@tobiasgiese tobiasgiese changed the title 🐛 Fix multiline Ready condition in clusterctl describe 🐛 Fix multiline Ready condition in clusterctl describe for v1beta2 Feb 1, 2025
@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch 5 times, most recently from c8bfa74 to 8c38475 Compare February 2, 2025 10:52
Comment on lines 451 to 511
"Object/root",
"├─Object/child1",
"├─Object/child2",
"│ │ 2",
"│ └─Object/child2.1",
"│ 2",
"└─Object/child3",
" │ 2",
" └─Object/child3.1",
" 2",
Copy link
Member Author

Choose a reason for hiding this comment

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

Without the fix

Object/root                  Available: True   Available     292y     
├─Object/child1              Available: True   Available     292y     
├─Object/child2              Available: False  NotAvailable  292y  1  
│                                                                  2  
│ └─Object/child2.1          Available: False  NotAvailable  292y  1  
│                                                                  2  
└─Object/child3              Available: False  NotAvailable  292y  1  
                                                                   2  
  └─Object/child3.1          Available: False  NotAvailable  292y  1  
                                                                   2 

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch 4 times, most recently from ac341c5 to 3aa0b3b Compare February 2, 2025 11:32
@sbueringer
Copy link
Member

/assign @fabriziopandini

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from 3aa0b3b to eac73ac Compare February 5, 2025 08:21
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Made a first quick pass, really appreciated the test with the example of the output before the change

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from eac73ac to 3c489c9 Compare February 5, 2025 10:28
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

@tobiasgiese sorry for the delay in the review, there is one last comment to be addressed, otherwise lgtm

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch 2 times, most recently from dcc6b19 to b7e974d Compare February 24, 2025 14:48
@fabriziopandini
Copy link
Member

/lgtm
@chrischdi @sbueringer if you can make a quick pass (looking at unit tests explains a lot of this PR)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f8a357a7703d2c8f38dad47ea1671b365373f10e

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from cc6f12f to a47ec12 Compare March 4, 2025 15:45
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2025
@fabriziopandini
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 5ed2ac4eff00984cb871692cb7c3e22daffda18a

@tobiasgiese
Copy link
Member Author

Found a bug in the ensureLastObjectInTree(), had to push a fix. Now the annotation is read from the root object correctly 👍🏻

@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from a47ec12 to bae3138 Compare March 5, 2025 11:25
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 5, 2025
@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch 4 times, most recently from 8bd5cc1 to f7cad30 Compare March 5, 2025 12:29
@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from f7cad30 to 9cabfd2 Compare March 5, 2025 12:38
The multiline feature in clusterctl has a bug in the multiline conditions.
If the Ready condition message has multipile lines the multiline prefix is not calculated properly.
To fix this we have to add a new logic to determine the multiline prefix for objects.

Signed-off-by: Tobias Giese <[email protected]>
Co-authored-by: fabriziopandini <[email protected]>
@tobiasgiese tobiasgiese force-pushed the fix-multiline-parent-conditions-tests branch from 9cabfd2 to 4470114 Compare March 5, 2025 12:39
@sbueringer
Copy link
Member

Thank you very much!!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 5, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 4849170499ad48901da0346ea3078999813c756a

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 5, 2025
@k8s-ci-robot k8s-ci-robot merged commit d9c2199 into kubernetes-sigs:main Mar 5, 2025
18 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.10 milestone Mar 5, 2025
@tobiasgiese tobiasgiese deleted the fix-multiline-parent-conditions-tests branch March 5, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V1beta2 clusterctl describe and multiline conditions not printed correctly
4 participants