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

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a1e0fb1
Add refresh v3 draft implementation
carlcsaposs-canonical Apr 2, 2025
299cb22
Simplify reconcile
carlcsaposs-canonical Apr 4, 2025
db4ec41
Add `self._reconcile_allowed` instead of exiting
carlcsaposs-canonical Apr 7, 2025
2d73aae
Sync with K8s
carlcsaposs-canonical Apr 10, 2025
dc6eae6
Remove workload version set
carlcsaposs-canonical Apr 11, 2025
1485d04
Include logger name in logs
carlcsaposs-canonical Apr 15, 2025
129a9ff
Update charm-refresh
carlcsaposs-canonical Apr 17, 2025
4f96e5b
Update charm_refresh
carlcsaposs-canonical Apr 24, 2025
c7bdb38
Use JSON schema
carlcsaposs-canonical May 7, 2025
b02ca17
Use released charm-refresh
carlcsaposs-canonical May 7, 2025
6115899
Update comment
carlcsaposs-canonical May 7, 2025
b25329e
Check workload version
carlcsaposs-canonical May 7, 2025
78683ef
Update data-platform-workflows to v32.0.0
carlcsaposs-canonical May 7, 2025
7d5e84b
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 7, 2025
063bd7b
Format
carlcsaposs-canonical May 7, 2025
b83f971
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 7, 2025
937e692
Fix unit test mocks
carlcsaposs-canonical May 7, 2025
c28652c
Remove 20.04 base
carlcsaposs-canonical May 7, 2025
2799d04
Format
carlcsaposs-canonical May 7, 2025
a30516e
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
62d746a
Increase numprocesses to workaround memory leak
carlcsaposs-canonical May 7, 2025
fb9d59a
Set charm refresh compatibility version from git tag
carlcsaposs-canonical May 8, 2025
5ec51eb
Revert (for testing) "Set charm refresh compatibility version from gi…
carlcsaposs-canonical May 8, 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
6 changes: 3 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 @@ -24,9 +24,9 @@ jobs:
name: Release charm
needs:
- 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: 'dpe'
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.

12 changes: 3 additions & 9 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

type: charm
platforms:
[email protected]:amd64:
# [email protected]:amd64: # TODO re-add after https://github.com/canonical/charmcraft/commit/65d01ed598a607eea9e2368da738117507e8024a lands in charmcraft stable
[email protected]:amd64:
[email protected]:arm64:
# Files implicitly created by charmcraft without a part:
Expand Down Expand Up @@ -87,15 +87,9 @@ 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
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