You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: migration/README.md
+48-17Lines changed: 48 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,32 +10,63 @@ This directory contains the upgrade and migration steps for each major and minor
10
10
Notice to developers on writing migration steps:
11
11
12
12
- Migration steps:
13
-
- are written per minor version and placed in a subdirectory of the migration directory with the name `vX.Y/`,
14
-
- are written to be idempotent and usable no matter which patch version you are upgrading from and to,
15
-
- are documented in this document to be able to run them manually,
16
-
- are divided into prepare and apply steps:
17
-
- Prepare steps:
18
-
- are placed in the `prepare/` directory,
19
-
- may **only** modify the configuration of the environment,
20
-
- may **not** modify the state of the environment,
21
-
- steps are run in order of their names use two digit prefixes.
22
-
- Apply steps:
23
-
- are placed in the `apply/` directory,
24
-
- may **only** modify the state of the environment,
25
-
- may **not** modify the configuration of the environment,
26
-
- are run in order of their names use two digit prefixes,
27
-
- are run with the argument `execute` on upgrade and should return 1 on failure and 2 on successful internal rollback,
28
-
- are rerun with the argument `rollback` on execute failure and should return 1 on failure.
13
+
- are written per major and minor version and placed in a subdirectory of the migration directory with the name`main/`, during release this is promoted to the next release series`vX.Y/`,
14
+
- are written to be idempotent and usable no matter which patch version you are upgrading from and to,
15
+
- are documented in `main/README.md` to be able to run them manually,
16
+
- are divided into prepare and apply steps:
17
+
- Prepare steps:
18
+
- are placed in the `prepare/` directory,
19
+
- may **only** modify the configuration of the environment,
20
+
- may **not** modify the state of the environment,
21
+
- steps are run in order of their names using two digit prefixes.
22
+
- Apply steps:
23
+
- are placed in the `apply/` directory,
24
+
- may **only** modify the state of the environment,
25
+
- may **not** modify the configuration of the environment,
26
+
- are run in order of their names using two digit prefixes,
27
+
- are run with the argument `execute` on upgrade and should return 1 on failure and 2 on successful internal rollback,
28
+
- are rerun with the argument `rollback` on execute failure and should return 1 on failure.
29
29
30
30
For prepare the init step is given.
31
-
For apply the bootstrap and the apply steps are given, it is expected that releases upgraded in custom steps are excluded from the apply step.
31
+
For apply the apply step is given, it is expected that releases upgraded in custom steps are excluded from the apply step.
32
+
33
+
> [tip]
34
+
> This can be done by adding label expression of releases into the `skipped*` arrays of the `80-apply.sh` snippet:
Upgrades of components that are dependent on each other should be done within the same snippet to easily manage the upgrade to a working state and to be able to rollback to a working state.
34
60
35
61
Steps should use the `scripts/migration/lib.sh` which will provide helper functions, see the file for available helper functions.
36
62
This script expects the `ROOT` environment variable to be set pointing to the root of the repository.
37
63
As with all scripts in this repository `CK8S_CONFIG_PATH` is expected to be set.
38
64
65
+
> [!important]
66
+
> Since the migration snippets should be idempotent, and usable from and to any patch version, it is important that they only perform actions when needed, especially in the case of destructive actions!
67
+
>
68
+
> Example: if a major upgrade of a component requires that another component is temporarily removed, then it should **only** remove the component if there is a major upgrade in the first place, if there is a minor upgrade then it should be applied without removing the component.
69
+
39
70
## Preparing migration steps for releases
40
71
41
72
When releasing new major or minor versions of Welkin Apps the current upgrade and migration directory should be promoted to the one for the release.
0 commit comments