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

Refactor #51

Merged
merged 159 commits into from
May 18, 2023
Merged

Refactor #51

merged 159 commits into from
May 18, 2023

Conversation

carlcsaposs-canonical
Copy link
Contributor

@carlcsaposs-canonical carlcsaposs-canonical commented Apr 13, 2023

Issue

DPE-1519

Solution

  • Support multiple database provides relations
  • Remove all event deferrals
  • Avoid duplicating information from relation databags to peer databag; only use peer databag when necessary (i.e. single source of truth for state)
  • Handle database requires/provides events in a single handler
  • Bootstrap mysqlrouter independently of database provides relations
  • Encapsulate workload and mysql_shell to make future porting to VMs easier
  • Modify TLS implementation to fix a couple design flaws
  • Improve status messages & debug logging
  • Includes changes from Use charmed-mysql rock instead of the docker image #55 to use rock and remove run.sh script

@carlcsaposs-canonical
Copy link
Contributor Author

carlcsaposs-canonical commented Apr 13, 2023

With the exception of relations/tls.py, it may be easier to understand the changes by looking at the new files instead of the diff: https://github.com/canonical/mysql-router-k8s-operator/tree/refactor/src

Copy link
Collaborator

@paulomach paulomach left a comment

Choose a reason for hiding this comment

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

Looking nice. I like the thin relations code and usage of lib interface, definitely something to use more broadly.
Left some notes as a first pass

src/charm.py Outdated Show resolved Hide resolved
src/relations/database_provides.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/workload.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
Copy link
Contributor

@shayancanonical shayancanonical left a comment

Choose a reason for hiding this comment

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

I like the direction! - decoupling the relations and making the handlers idempotent like this PR does leads to cleaner code in my opinion

src/charm.py Show resolved Hide resolved
src/relations/database_provides.py Outdated Show resolved Hide resolved
src/workload.py Outdated Show resolved Hide resolved
@carlcsaposs-canonical
Copy link
Contributor Author

Added support for multiple relations

TODO:

  • switch mysql router user to limited permissions user
  • switch from mysql connector to mysqlsh, move mysqlsh methods to new Python module (so that database_provides doesn't import database_requires)

carlcsaposs-canonical added a commit to canonical/mysql-k8s-operator that referenced this pull request Apr 21, 2023
src/mysql_shell.py Show resolved Hide resolved
@delgod delgod requested a review from paulomach May 16, 2023 07:22
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
src/workload.py Show resolved Hide resolved
Copy link
Collaborator

@paulomach paulomach left a comment

Choose a reason for hiding this comment

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

IMO it's good to go once the test passes

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.

4 participants