Skip to content

Commit ce3d170

Browse files
BON4Zvirovyi
andauthored
[DPE-8884] Add charm refresh (#39)
* [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * [DPE-8884] Implement charm refreshing * fix lint * fix tests * fix lint * fix build * Fixes * Improvements. * Improvements. * Unit tests * fix unit * fix CI build * Rebase. * Improve refresh scaling capabilities. * Fix tests * fix lint * Remove unused code. * logger fixes * fixes * fixes --------- Co-authored-by: Vladyslav Tarasenko <vladyslav.tarasenko@canonical.com>
1 parent 9e62f1a commit ce3d170

File tree

24 files changed

+844
-28
lines changed

24 files changed

+844
-28
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- .
6868
- tests/integration/application-charm
6969
name: Build charm
70-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v29.0.0
70+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v32.1.0
7171
with:
7272
path-to-charm-directory: ${{ matrix.path }}
7373
cache: false

actions.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,57 @@
11
# Copyright 2025 Canonical Ltd.
22
# See LICENSE file for licensing details.
3+
pre-refresh-check:
4+
description: Check if charm is ready to refresh
5+
additionalProperties: false
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`
13+
params:
14+
check-compatibility:
15+
type: boolean
16+
default: true
17+
description: |
18+
Potential of data loss and downtime
19+
20+
If `false`, force refresh if new version of Cassandra 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 Cassandra container version that has not been validated to work with the charm revision
35+
additionalProperties: false
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
54+
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.
57+
additionalProperties: false

charmcraft.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,22 @@ parts:
7474
# Include requirements.txt in *.charm artifact for easier debugging
7575
cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt"
7676
77-
# "files" part name is arbitrary; use for consistency
7877
files:
7978
plugin: dump
8079
source: .
80+
after:
81+
- poetry-deps # Ensure poetry is installed
82+
build-packages:
83+
- git
84+
override-build: |
85+
# Set `charm_version` in refresh_versions.toml from git tag
86+
# Create venv in `..` so that git working tree is not dirty
87+
python3 -m venv ../refresh-version-venv
88+
source ../refresh-version-venv/bin/activate
89+
poetry install --only build-refresh-version
90+
write-charm-version
91+
92+
craftctl default
8193
stage:
8294
- LICENSE
95+
- refresh_versions.toml

config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ options:
1717
Configure the internal system user password. The password will be auto-generated
1818
if this option is not set. This needs to be a Juju Secret URI pointing to an
1919
accessible secret that contains the following content: `operator: <password>`.
20+
21+
pause-after-unit-refresh:
22+
description: |
23+
Wait for manual confirmation to resume refresh after these units refresh
24+
25+
Allowed values: "all", "first", "none"
26+
type: string
27+
default: first

metadata.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ peers:
3434
interface: cassandra_peers
3535
bootstrap:
3636
interface: rolling_op
37+
refresh-v-three:
38+
interface: refresh
3739

3840
requires:
3941
client-certificates:

0 commit comments

Comments
 (0)