Skip to content

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

Discussed with @paulomach—we will merge this & release to edge to enable mysql-router monorepo migration, but we will not promote to beta/candidate/stable until the v2 to v3 migration is implemented (once a decision on specification DA202 is made)

Mostly the same as canonical/mysql-router-operator#241 (plus canonical/mysql-router-operator#279)

@github-actions github-actions bot added the Libraries: Out of sync The charm libs used are out-of-sync label Mar 20, 2025
@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

carlcsaposs-canonical commented Mar 20, 2025

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

  • 8.0/edge/test-refresh-v3-8.0.41
  • 8.0/edge/test-refresh-v3-8.0.42
  • 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

@paulomach
Copy link
Contributor

@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

@carlcsaposs-canonical carlcsaposs-canonical force-pushed the refresh-v3-draft branch 2 times, most recently from b8b5835 to b8ce54f Compare April 11, 2025 14:55
@taurus-forever taurus-forever removed their request for review June 10, 2025 15:44
@carlcsaposs-canonical carlcsaposs-canonical added the enhancement New feature, UI change, or workload upgrade label Aug 27, 2025
charmcraft.yaml Outdated
# 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.

a67093b will be reverted after tests pass & before merging

charm_major = 1
workload = "8.0.42"

charm = "8.0/1.0.0" # TODO remove
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a67093b will be reverted after tests pass & before merging

@carlcsaposs-canonical
Copy link
Contributor Author

all tests passed on fc9fa1d

@carlcsaposs-canonical carlcsaposs-canonical marked this pull request as ready for review August 28, 2025 08:07
@carlcsaposs-canonical carlcsaposs-canonical changed the title Add refresh v3 draft implementation Add refresh v3 implementation Aug 28, 2025
Copy link
Contributor

@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.

Looks good

# unit(s) tear down
self.unit.status = ops.MaintenanceStatus("Tearing down")
self._reconcile_allowed = False
except charm_refresh.KubernetesJujuAppNotTrusted:
Copy link
Contributor

Choose a reason for hiding this comment

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

If charm already deployed, can we just assumed trust is given or can it be revoked? Does this ever gets thrown

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

@reneradoi reneradoi left a comment

Choose a reason for hiding this comment

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

No concerns from my side, just a few questions and hints. Upgrade integration tests look good, too.

import pytest
import tenacity
import tomli
import tomli_w

Choose a reason for hiding this comment

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

Hint: Once you update Python to => 3.11, tomllib is available as standard lib.

stop=tenacity.stop_after_delay(SMALL_TIMEOUT),
wait=tenacity.wait_fixed(10),
logger.info("Wait for first unit to restart")
async with ops_test.fast_forward("60s"):

Choose a reason for hiding this comment

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

Why fast_forward here if you wait for the restart, not the update_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.

good point, will remove in a follow-up


mysql_router_leader_unit = await get_leader_unit(ops_test, MYSQL_ROUTER_APP_NAME)
logger.info("Wait for first unit to upgrade")
async with ops_test.fast_forward("60s"):

Choose a reason for hiding this comment

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

Same here: Why fast_forward here if you wait for the upgrade, not the update_status?

@carlcsaposs-canonical carlcsaposs-canonical merged commit abd5ebc into main Aug 29, 2025
10 of 13 checks passed
@carlcsaposs-canonical carlcsaposs-canonical deleted the refresh-v3-draft branch August 29, 2025 07:29
carlcsaposs-canonical added a commit to canonical/mysql-router-operators that referenced this pull request Sep 1, 2025
More frequent update-status events will not help these conditions be met faster

From canonical/mysql-router-k8s-operator#411 (comment)
carlcsaposs-canonical added a commit to canonical/mysql-router-operators that referenced this pull request Sep 1, 2025
More frequent update-status events will not help these conditions be met faster

From canonical/mysql-router-k8s-operator#411 (comment)
carlcsaposs-canonical added a commit to canonical/mysql-router-operators that referenced this pull request Sep 1, 2025
More frequent update-status events will not help these conditions be met faster

From canonical/mysql-router-k8s-operator#411 (comment)
carlcsaposs-canonical added a commit to canonical/mysql-router-operators that referenced this pull request Sep 2, 2025
More frequent update-status events will not help these conditions be met faster

From canonical/mysql-router-k8s-operator#411 (comment)
carlcsaposs-canonical added a commit to canonical/mysql-router-operators that referenced this pull request Sep 2, 2025
More frequent update-status events will not help these conditions be met
faster

From
canonical/mysql-router-k8s-operator#411 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, UI change, or workload upgrade Libraries: Out of sync The charm libs used are out-of-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants