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

Fix upgrade with no label_selector_include (#6778) #703

Merged

Conversation

sylvainOL
Copy link
Contributor

@sylvainOL sylvainOL commented Oct 25, 2023

fixes: kiali/kiali#6778

When label_selector_include is not set in Kiali CR, upgrade still tries to patch some namespaces as variable used to retrieve it has empty string as value.

Make sure it's not the case anymore

@jmazzitelli
Copy link
Contributor

@sylvainOL this looks good! Thanks!

@jmazzitelli jmazzitelli self-requested a review October 25, 2023 17:06
@jmazzitelli
Copy link
Contributor

I'm going to look more closely at the code and test this manually to make sure there isn't something else wrong here that is being missed. I'll merge this when I'm confident nothing else is wrong.

Copy link
Contributor

@jmazzitelli jmazzitelli left a comment

Choose a reason for hiding this comment

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

One addition is needed. If we get this in now, we can merge this and get it into the release that will be published this Monday.

@@ -884,6 +884,7 @@
when:
- no_longer_accessible_namespaces is defined
- current_label_selector_include is defined
- current_label_selector_include != ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make this same change after line 790 as well? That is the only thing I see missing that would make this PR complete. So this:

line 789:  - current_cluster_wide_access|bool == False
line 790:  - current_label_selector_include is defined
           - current_label_selector_include != ""          <<<===== add this line
line 791:  - kiali_vars.api.namespaces.label_selector_include is defined

I'd add that as a github suggestion, but github won't let me add a comment on a line that isn't changed in the PR.

Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can make this change (I actually thought about it) but this will change the behavior of how it's done today (which may not be what the behavior you should want):

Today, I you set a label_selector_include and then remove it, the task Do not allow user to change label_selector_include will fail.

If we add current_label_selector_include != "" at the list of conditions, it won't be the case.

in case label_selector_include is not set and it is on kiali_vars.api.namespaces.label_selector_include, the it will fail (comparison between empty string and a string) and if kiali_vars.api.namespaces.label_selector_include` is not set, line 791 will do the trick.

So if you think it's the way to go, I'm OK to add the line but I just wanted you to understand that the behavior will change when label_selector_include was set and is removed (before it'll fail, after it'll pass).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is OK. The reason I think that is that it is more likely a person will not have set that value at first, and then decide later they want their own label. I think the reverse is less-likely (it is less likely a person will set their own label but then later decide they don't want it and remove it to pick up the default Kiali label). So let's code this up for the most likely scenario.

If it really happens that a person does the less likely scenario, the workaround is simply to delete the Kiali CR, let the operator uninstall Kiali fully, and then install the new Kiali CR. That's the basic workaround for this bug anyway. So that person isn't dead in the water, they can workaround it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, so I add the line too!

thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sylvainOL sylvainOL changed the title Fix upgrade with no label_selector_exclude (#6778) Fix upgrade with no label_selector_include (#6778) Oct 26, 2023
@sylvainOL
Copy link
Contributor Author

I've also change the title because I mixed label_selector_include and label_selector_exclude sorry

@sylvainOL sylvainOL force-pushed the fix-current_label_selector_include-empty branch from 66dda30 to 7915a75 Compare October 26, 2023 06:51
When `label_selector_include` is not set in Kiali CR, upgrade
still tries to patch some namespaces as variable used to retrieve it has
empty string as value.
Make sure it's not the case anymore.

Signed-off-by: Sylvain Desbureaux <[email protected]>
@sylvainOL sylvainOL force-pushed the fix-current_label_selector_include-empty branch from 7915a75 to 307af3c Compare October 26, 2023 11:54
@jmazzitelli jmazzitelli merged commit b732a25 into kiali:master Oct 26, 2023
1 check passed
@jmazzitelli
Copy link
Contributor

Thanks, @sylvainOL !

jmazzitelli pushed a commit to jmazzitelli/kiali-operator that referenced this pull request Oct 26, 2023
When `label_selector_include` is not set in Kiali CR, upgrade
still tries to patch some namespaces as variable used to retrieve it has
empty string as value.
Make sure it's not the case anymore.

Signed-off-by: Sylvain Desbureaux <[email protected]>
@sylvainOL
Copy link
Contributor Author

no problem, I should have done sooner :)

jmazzitelli added a commit that referenced this pull request Oct 26, 2023
* Fix upgrade with no label_selector_include (#6778) (#703)

When `label_selector_include` is not set in Kiali CR, upgrade
still tries to patch some namespaces as variable used to retrieve it has
empty string as value.
Make sure it's not the case anymore.

Signed-off-by: Sylvain Desbureaux <[email protected]>

* part of backporting the fix to the label include processing
part of kiali/kiali#6778

---------

Signed-off-by: Sylvain Desbureaux <[email protected]>
Co-authored-by: Sylvain Desbureaux <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

failed to update kiali since v1.67 if current_label_selector_include is not set
2 participants