Skip to content

Add refresh v3 implementation #241

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6abcf4f
Add refresh v3 draft implementation
carlcsaposs-canonical Apr 2, 2025
5b72ce3
Simplify reconcile
carlcsaposs-canonical Apr 4, 2025
8399f67
Add `self._reconcile_allowed` instead of exiting
carlcsaposs-canonical Apr 7, 2025
bbc4cff
Sync with K8s
carlcsaposs-canonical Apr 10, 2025
25755c6
Remove workload version set
carlcsaposs-canonical Apr 11, 2025
b843d69
Include logger name in logs
carlcsaposs-canonical Apr 15, 2025
2bca452
Update charm-refresh
carlcsaposs-canonical Apr 17, 2025
654e049
Update charm_refresh
carlcsaposs-canonical Apr 24, 2025
25ef8fb
Use JSON schema
carlcsaposs-canonical May 7, 2025
4a0ded3
Use released charm-refresh
carlcsaposs-canonical May 7, 2025
da2fd87
Update comment
carlcsaposs-canonical May 7, 2025
0096070
Check workload version
carlcsaposs-canonical May 7, 2025
f6e3fac
Update data-platform-workflows to v32.0.0
carlcsaposs-canonical May 7, 2025
a9a895e
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 7, 2025
53598ba
Format
carlcsaposs-canonical May 7, 2025
6db28d2
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 7, 2025
a92f321
Fix unit test mocks
carlcsaposs-canonical May 7, 2025
3f004cb
Format
carlcsaposs-canonical May 7, 2025
fae5951
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
34634b5
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
d0dda6a
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 8, 2025
c94991e
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 8, 2025
b512ca5
Revert testing changes
sinclert-canonical Jun 5, 2025
ebce78a
Fix unit tests
sinclert-canonical Jun 6, 2025
a03211f
Fix unit tests [alternative]
sinclert-canonical Jun 6, 2025
faf1dda
Fix integration tests
sinclert-canonical Jun 6, 2025
61b16a8
[Temp] Disable charmcraft version build
sinclert-canonical Jun 6, 2025
76505d4
[Temp] Hard-code charm version
sinclert-canonical Jun 6, 2025
86fceca
[Temp] Point to a refresh v3 channel
sinclert-canonical Jun 9, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/approve_renovate_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ on:
jobs:
approve-pr:
name: Approve Renovate pull request
uses: canonical/data-platform-workflows/.github/workflows/approve_renovate_pr.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/approve_renovate_pr.yaml@v32.0.0
permissions:
pull-requests: write # Needed to approve PR
2 changes: 1 addition & 1 deletion .github/workflows/check_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ on:
jobs:
check-pr:
name: Check pull request
uses: canonical/data-platform-workflows/.github/workflows/check_charm_pr.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/check_charm_pr.yaml@v32.0.0
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v32.0.0

integration-test:
name: Integration test charm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
jobs:
promote:
name: Promote charm
uses: canonical/data-platform-workflows/.github/workflows/_promote_charm.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/_promote_charm.yaml@v32.0.0
with:
track: 'dpe'
from-risk: ${{ inputs.from-risk }}
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to Charmhub
name: Release to Charmhub edge

on:
push:
Expand All @@ -13,8 +13,18 @@ on:
- '.github/workflows/sync_docs.yaml'

jobs:
tag:
name: Create charm refresh compatibility version git tag
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
track: 'dpe'
permissions:
contents: write # Needed to create git tag

ci-tests:
name: Tests
needs:
- tag
uses: ./.github/workflows/ci.yaml
secrets: inherit
permissions:
Expand All @@ -23,10 +33,11 @@ jobs:
release:
name: Release charm
needs:
- tag
- ci-tests
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/release_charm_edge.yaml@v32.0.0
with:
channel: dpe/edge
track: ${{ needs.tag.outputs.track }}
artifact-prefix: ${{ needs.ci-tests.outputs.artifact-prefix }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
sync-docs:
name: Sync docs from Discourse
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v31.0.1
uses: canonical/data-platform-workflows/.github/workflows/sync_docs.yaml@v32.0.0
with:
reviewers: a-velasco
permissions:
Expand Down
61 changes: 52 additions & 9 deletions actions.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
# 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).

force-upgrade:
pre-refresh-check:
description: Check if charm is ready to refresh
additionalProperties: false
force-refresh-start:
description: |
Potential of *data loss* and *downtime*
Potential of data loss and downtime

Force refresh of first unit

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

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

Force upgrade of this unit.
If `false`, allow refresh to MySQL Router container version that has not been validated to work with the charm revision
additionalProperties: false
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.

Use to
- force incompatible upgrade and/or
- continue upgrade if 1+ upgraded units have non-active status
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

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.
additionalProperties: false

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

This file was deleted.

16 changes: 9 additions & 7 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,20 @@ parts:
files:
plugin: dump
source: .
after:
- poetry-deps # Ensure poetry is installed
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}")'
# Set `charm_version` in refresh_versions.toml from git tag
# Create venv in `..` so that git working tree is not dirty
# python3 -m venv ../refresh-version-venv
# source ../refresh-version-venv/bin/activate
# poetry install --only build-refresh-version
# write-charm-version
Comment on lines +92 to +96
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
# Create venv in `..` so that git working tree is not dirty
# python3 -m venv ../refresh-version-venv
# source ../refresh-version-venv/bin/activate
# poetry install --only build-refresh-version
# write-charm-version
# Create venv in `..` so that git working tree is not dirty
python3 -m venv ../refresh-version-venv
source ../refresh-version-venv/bin/activate
poetry install --only build-refresh-version
write-charm-version

this needs to be applied before merge


craftctl default
stage:
- LICENSE
- charm_version
- workload_version
- refresh_versions.toml
- templates
8 changes: 7 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
# See LICENSE file for licensing details.

options:

vip:
description: |
Virtual IP to use to front mysql router units. Used only in case of external node connection.
type: string
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
Comment on lines +9 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

Finally! THANK YOU!

7 changes: 2 additions & 5 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ peers:
interface: tls
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
# DEPRECATED shared-db: Workaround for legacy "mysql-shared" interface using unit databags instead of app databag
deprecated-shared-db-credentials:
interface: _deprecated_shared_db_peers
Loading