Skip to content

Commit 216b7c1

Browse files
Add refresh v3 draft implementation
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
1 parent 6a0f540 commit 216b7c1

20 files changed

+308
-742
lines changed

actions.yaml

+48-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,59 @@
11
# Copyright 2023 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

4-
resume-upgrade:
5-
description: Upgrade remaining units (after you manually verified that upgraded units are healthy).
4+
pre-refresh-check:
5+
description: Check if charm is ready to refresh
6+
force-refresh-start:
7+
description: |
8+
Potential of data loss and downtime
9+
10+
Force refresh of first unit
11+
12+
Must run with at least one of the parameters `=false`
613
params:
7-
force:
14+
check-compatibility:
815
type: boolean
9-
default: false
16+
default: true
1017
description: |
11-
Potential of *data loss* and *downtime*
18+
Potential of data loss and downtime
1219
13-
Force upgrade of next unit.
20+
If `false`, force refresh if new version of PostgreSQL and/or charm is not compatible with previous version
21+
run-pre-refresh-checks:
22+
type: boolean
23+
default: true
24+
description: |
25+
Potential of data loss and downtime
26+
27+
If `false`, force refresh if app is unhealthy or not ready to refresh (and unit status shows "Pre-refresh check failed")
28+
check-workload-container:
29+
type: boolean
30+
default: true
31+
description: |
32+
Potential of data loss and downtime during and after refresh
33+
34+
If `false`, allow refresh to PostgreSQL container version that has not been validated to work with the charm revision
35+
required: []
36+
resume-refresh:
37+
description: |
38+
Refresh next unit(s) (after you have manually verified that refreshed units are healthy)
39+
40+
If the `pause_after_unit_refresh` config is set to `all`, this action will refresh the next unit.
41+
42+
If `pause_after_unit_refresh` is set to `first`, this action will refresh all remaining units.
43+
Exception: if automatic health checks fail after a unit has refreshed, the refresh will pause.
44+
45+
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`.
46+
params:
47+
check-health-of-refreshed-units:
48+
type: boolean
49+
default: true
50+
description: |
51+
Potential of data loss and downtime
52+
53+
If `false`, force refresh (of next unit) if 1 or more refreshed units are unhealthy
1454
15-
Use to
16-
- force incompatible upgrade and/or
17-
- continue upgrade if 1+ upgraded units have non-active status
55+
Warning: if first unit to refresh is unhealthy, consider running `force-refresh-start` action on that unit instead of using this parameter.
56+
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.
1857
required: []
1958

2059
set-tls-private-key:

charm_version

-1
This file was deleted.

charmcraft.yaml

+2-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ parts:
5151
source: .
5252
after:
5353
- poetry-deps
54-
poetry-export-extra-args: ['--only', 'main,charm-libs']
54+
poetry-export-extra-args: ['--only', 'main,charm-libs', '--without-hashes'] # TODO: re-enable hashes
5555
build-packages:
5656
- libffi-dev # Needed to build Python dependencies with Rust from source
5757
- libssl-dev # Needed to build Python dependencies with Rust from source
@@ -86,16 +86,9 @@ parts:
8686
build-packages:
8787
- git
8888
override-build: |
89-
# Workaround to add unique identifier (git hash) to charm version while specification
90-
# DA053 - Charm versioning
91-
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
92-
# is pending review.
93-
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}")'
94-
89+
# TODO: set charm version in refresh_versions.toml
9590
craftctl default
9691
stage:
9792
- LICENSE
98-
- charm_version
99-
- workload_version
10093
- scripts
10194
- templates

config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ options:
1515
and managed by the charm.
1616
type: string
1717
default: "{}"
18+
19+
pause_after_unit_refresh:
20+
description: |
21+
Wait for manual confirmation to resume refresh after these units refresh
22+
23+
Allowed values: "all", "first", "none"
24+
type: string
25+
default: first

metadata.yaml

+2-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ requires:
4646
peers:
4747
cos:
4848
interface: cos
49-
upgrade-version-a:
50-
# Relation versioning scheme:
51-
# DA056 - Upgrading in-place upgrade protocol
52-
# https://docs.google.com/document/d/1H7qy5SAwLiCOKO9xMQJbbQP5_-jGV6Lhi-mJOk4gZ08/edit
53-
interface: upgrade
49+
refresh-v-three:
50+
interface: refresh
5451
mysql-router-peers:
5552
interface: mysql_router_peers
5653
resources:

0 commit comments

Comments
 (0)