Skip to content

Add refresh v3 draft implementation #411

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

carlcsaposs-canonical
Copy link
Contributor

@carlcsaposs-canonical carlcsaposs-canonical commented Mar 20, 2025

Does not include migration for refreshing from v2 (currently on stable)

This PR branch only supports refreshing to/from mysql-router-k8s charm code with refresh v3

Uses charm-refresh Python package: https://github.com/canonical/charm-refresh/tree/draft

Does not include migration for refreshing from v2 (currently on stable)

This PR branch only supports refreshing to/from mysql-router-k8s charm code with refresh v3
@carlcsaposs-canonical carlcsaposs-canonical force-pushed the refresh-v3-draft branch 2 times, most recently from b4ac782 to 6a76b3f Compare March 20, 2025 14:13
@carlcsaposs-canonical
Copy link
Contributor Author

You can test the refresh with these charmhub branches (built on #412):

  • 8.0/edge/test-refresh-v3-8.0.40
  • 8.0/edge/test-refresh-v3-8.0.41
  • 8.0/edge/test-refresh-v3-incompat - simulates incompatible workload or charm version
  • 8.0/edge/test-refresh-v3-precheckfail - simulates failed pre check
  • 8.0/edge/test-refresh-v3-uncaught - simulates uncaught exception (e.g. bug, incorrect arch, etc.)

or modify the branch locally & re-pack the charm

# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'

# TODO: set charm version in refresh_versions.toml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

added to spec sync sheet

Comment on lines +4 to +5
# autogenerated
charm = "8.0/1.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

once https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?tab=t.0 is approved, this part will not be included in the git respository & will be auto-generated at pack time using the git tag

src/charm.py Outdated
Comment on lines 77 to 78
# TODO: check workload version—prevent downgrade?
return True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we want to warn incompatible if user tries to downgrade router?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's just a warning, yes. No otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'

# TODO: set charm version in refresh_versions.toml
Copy link
Collaborator

Choose a reason for hiding this comment

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

added to spec sync sheet

@@ -14,6 +14,7 @@ tenacity = "^8.5.0"
jinja2 = "^3.1.4"
poetry-core = "^1.9.0"
requests = "^2.32.3"
charm-refresh = {git = "https://github.com/canonical/charm-refresh", rev = "draft"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

what are you waiting for before tagging this?

# only in machine charms
if self._ha_cluster:
statuses.append(self._ha_cluster.get_unit_juju_status())
statuses.append(workload_status)
if status := self._ha_cluster.get_unit_juju_status():
Copy link
Collaborator

Choose a reason for hiding this comment

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

why append HA status only when workload_.status ?

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 don't see the dependency on workload_.status

@paulomach
Copy link
Collaborator

@carlcsaposs-canonical What's the plan for integration testing the refresh?

@carlcsaposs-canonical
Copy link
Contributor Author

@carlcsaposs-canonical What's the plan for integration testing the refresh?

use existing integration tests

in the future, I think we could improve the coverage of the refresh tests, but I don't think we have enough time allocated to do that now

@taurus-forever taurus-forever removed their request for review June 10, 2025 15:44
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.

2 participants