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

[DPE-4062] Improve displayed error message if charm was deployed without --trust flag #319

Merged
merged 8 commits into from
Jun 26, 2024

Conversation

lucasgameiroborges
Copy link
Member

@lucasgameiroborges lucasgameiroborges commented Jun 24, 2024

Issue

K8s charms that create resources in a RBAC enabled environment need to be deployed with the --trust flag, otherwise they don't work. If a user deploys PGB k8s charm without that flag, there is no clear message indicating the issue.

Solution

  • Adds a integration test to see if charm enters blocked status if not deployed with --trust.
  • Adds a check in K8s resource creation functions to catch for 403 forbidden errors. ==> This check was added everywhere lightkube.Client().get is used. Maybe overkill, but better safe than sorry, I think?
  • Adds unit tests

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 70.63%. Comparing base (c36b92b) to head (e01dd08).

Files Patch % Lines
src/charm.py 80.00% 1 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #319      +/-   ##
==========================================
+ Coverage   70.35%   70.63%   +0.28%     
==========================================
  Files           8        8              
  Lines        1167     1192      +25     
  Branches      213      218       +5     
==========================================
+ Hits          821      842      +21     
+ Misses        269      268       -1     
- Partials       77       82       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add unit tests for the changes. We should try to keep Codecov happy.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep I will, I'm still not done with the changes tho. It's still in draft!! :P You are too fast!

@lucasgameiroborges lucasgameiroborges marked this pull request as ready for review June 25, 2024 21:13
Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

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

LGTM!

@lucasgameiroborges lucasgameiroborges merged commit a962691 into main Jun 26, 2024
50 checks passed
@lucasgameiroborges lucasgameiroborges deleted the lucas/add-trust-verification branch June 26, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants