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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 48 additions & 9 deletions actions.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,59 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

resume-upgrade:
description: Upgrade remaining units (after you manually verified that upgraded units are healthy).
pre-refresh-check:
description: Check if charm is ready to refresh
force-refresh-start:
description: |
Potential of data loss and downtime

Force refresh of first unit

Must run with at least one of the parameters `=false`
params:
force:
check-compatibility:
type: boolean
default: false
default: true
description: |
Potential of *data loss* and *downtime*
Potential of data loss and downtime

Force upgrade of next unit.
If `false`, force refresh if new version of MySQL Router and/or charm is not compatible with previous version
run-pre-refresh-checks:
type: boolean
default: true
description: |
Potential of data loss and downtime

If `false`, force refresh if app is unhealthy or not ready to refresh (and unit status shows "Pre-refresh check failed")
check-workload-container:
type: boolean
default: true
description: |
Potential of data loss and downtime during and after refresh

If `false`, allow refresh to MySQL Router container version that has not been validated to work with the charm revision
required: []
resume-refresh:
description: |
Refresh next unit(s) (after you have manually verified that refreshed units are healthy)

If the `pause_after_unit_refresh` config is set to `all`, this action will refresh the next unit.

If `pause_after_unit_refresh` is set to `first`, this action will refresh all remaining units.
Exception: if automatic health checks fail after a unit has refreshed, the refresh will pause.

If `pause_after_unit_refresh` is set to `none`, this action will have no effect unless it is called with `check-health-of-refreshed-units` as `false`.
params:
check-health-of-refreshed-units:
type: boolean
default: true
description: |
Potential of data loss and downtime

If `false`, force refresh (of next unit) if 1 or more refreshed units are unhealthy

Use to
- force incompatible upgrade and/or
- continue upgrade if 1+ upgraded units have non-active status
Warning: if first unit to refresh is unhealthy, consider running `force-refresh-start` action on that unit instead of using this parameter.
If first unit to refresh is unhealthy because compatibility checks, pre-refresh checks, or workload container checks are failing, this parameter is more destructive than the `force-refresh-start` action.
required: []

set-tls-private-key:
Expand Down
1 change: 0 additions & 1 deletion charm_version

This file was deleted.

12 changes: 3 additions & 9 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ parts:
source: .
after:
- poetry-deps
poetry-export-extra-args: ['--only', 'main,charm-libs']
poetry-export-extra-args: ['--only', 'main,charm-libs', '--without-hashes'] # TODO: re-enable hashes
build-packages:
- libffi-dev # Needed to build Python dependencies with Rust from source
- libssl-dev # Needed to build Python dependencies with Rust from source
Expand Down Expand Up @@ -86,16 +86,10 @@ parts:
build-packages:
- git
override-build: |
# Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# 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

craftctl default
stage:
- LICENSE
- charm_version
- workload_version
- refresh_versions.toml
- scripts
- templates
8 changes: 8 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ options:
and managed by the charm.
type: string
default: "{}"

pause_after_unit_refresh:
description: |
Wait for manual confirmation to resume refresh after these units refresh

Allowed values: "all", "first", "none"
type: string
default: first
7 changes: 2 additions & 5 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ requires:
peers:
cos:
interface: cos
upgrade-version-a:
# Relation versioning scheme:
# DA056 - Upgrading in-place upgrade protocol
# https://docs.google.com/document/d/1H7qy5SAwLiCOKO9xMQJbbQP5_-jGV6Lhi-mJOk4gZ08/edit
interface: upgrade
refresh-v-three:
interface: refresh
mysql-router-peers:
interface: mysql_router_peers
resources:
Expand Down
Loading
Loading