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

Merged
merged 51 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
faf70a4
Add refresh v3 draft implementation
carlcsaposs-canonical Apr 2, 2025
db9b897
Simplify reconcile
carlcsaposs-canonical Apr 4, 2025
85b1a1b
Add `self._reconcile_allowed` instead of exiting
carlcsaposs-canonical Apr 7, 2025
4461680
Sync with K8s
carlcsaposs-canonical Apr 10, 2025
461d501
Remove workload version set
carlcsaposs-canonical Apr 11, 2025
26868e2
Include logger name in logs
carlcsaposs-canonical Apr 15, 2025
1ee0c39
Update charm-refresh
carlcsaposs-canonical Apr 17, 2025
20c5b45
Update charm_refresh
carlcsaposs-canonical Apr 24, 2025
4ea0037
Use JSON schema
carlcsaposs-canonical May 7, 2025
a605bd4
Use released charm-refresh
carlcsaposs-canonical May 7, 2025
858aa81
Update comment
carlcsaposs-canonical May 7, 2025
bc6c590
Check workload version
carlcsaposs-canonical May 7, 2025
4d1c20e
Update data-platform-workflows to v32.0.0
carlcsaposs-canonical May 7, 2025
197452c
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 7, 2025
d4de70b
Format
carlcsaposs-canonical May 7, 2025
18c5292
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 7, 2025
2d5630d
Fix unit test mocks
carlcsaposs-canonical May 7, 2025
8a06355
Format
carlcsaposs-canonical May 7, 2025
ba3dc3d
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
8b6e123
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
ede703a
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 8, 2025
b8182a2
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 8, 2025
0b5e374
Revert testing changes
sinclert-canonical Jun 5, 2025
25eb1eb
Fix unit tests
sinclert-canonical Jun 6, 2025
b3b182c
Fix unit tests [alternative]
sinclert-canonical Jun 6, 2025
68208fe
Fix integration tests
sinclert-canonical Jun 6, 2025
c9708ad
[Temp] Disable charmcraft version build
sinclert-canonical Jun 6, 2025
fbafe74
[Temp] Hard-code charm version
sinclert-canonical Jun 6, 2025
855a7bc
[Temp] Point to a refresh v3 channel
sinclert-canonical Jun 9, 2025
01eebb1
update snap.py
carlcsaposs-canonical Jul 11, 2025
8d4ee79
python min version for 22.04
carlcsaposs-canonical Jul 11, 2025
307c520
simplify mock to not use charm-refresh private api
carlcsaposs-canonical Jul 11, 2025
fe6f7c8
Revert "[Temp] Hard-code charm version"
carlcsaposs-canonical Jul 11, 2025
96b2365
Revert "[Temp] Disable charmcraft version build"
carlcsaposs-canonical Jul 11, 2025
eebc14a
Revert "Revert testing changes"
carlcsaposs-canonical Jul 11, 2025
3d0a8fb
fix integration test
carlcsaposs-canonical Jul 11, 2025
f4e09c5
re-enable arm
carlcsaposs-canonical Jul 11, 2025
5b9ea38
format
carlcsaposs-canonical Jul 11, 2025
92bc960
actions.yaml
carlcsaposs-canonical Jul 11, 2025
c684fc3
bump charm-refresh
carlcsaposs-canonical Jul 11, 2025
683c4ee
try reverting unit test and snap.py changes
carlcsaposs-canonical Jul 11, 2025
101570d
test 8.0.41 branch
carlcsaposs-canonical Jul 11, 2025
8ed68c3
temp debug
carlcsaposs-canonical Jul 14, 2025
b1a475f
Revert "temp debug"
carlcsaposs-canonical Jul 14, 2025
c41c284
Revert "try reverting unit test and snap.py changes"
carlcsaposs-canonical Jul 14, 2025
1b6185c
Add missing mock
carlcsaposs-canonical Jul 14, 2025
ff5604e
Fix test timeout
carlcsaposs-canonical Jul 14, 2025
16a3cbb
Format
carlcsaposs-canonical Jul 14, 2025
ef71408
Revert "Revert (for testing) "Set charm refresh compatibility version…
carlcsaposs-canonical Jul 14, 2025
e329db6
update comment
carlcsaposs-canonical Jul 15, 2025
c041ae6
Replace "upgrade" with "refresh"
carlcsaposs-canonical Jul 15, 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
19 changes: 15 additions & 4 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/tag_charm_edge.yaml@v32.0.0
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,12 +33,13 @@ 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 }}
permissions:
contents: write # Needed to create GitHub release
contents: write # Needed to create git tags
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 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 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

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
Loading