-
Notifications
You must be signed in to change notification settings - Fork 23
docs(upgrade): add step to protect namespace before upgrading #435
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -196,7 +196,22 @@ If any releases are not `Ready`, resolve those issues before proceeding. | |||||||||||
|
|
||||||||||||
| ## Upgrade Steps | ||||||||||||
|
|
||||||||||||
| ### Step 1. Install the Cozystack Operator | ||||||||||||
| ### Step 1. Protect critical resources | ||||||||||||
|
|
||||||||||||
| Annotate the `cozy-system` namespace and the `cozystack-version` ConfigMap to prevent | ||||||||||||
| Helm from deleting them when the installer release is upgraded: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| kubectl annotate namespace cozy-system helm.sh/resource-policy=keep --overwrite | ||||||||||||
| kubectl annotate configmap -n cozy-system cozystack-version helm.sh/resource-policy=keep --overwrite | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make the upgrade steps more robust, it's better to check if the
Suggested change
|
||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| {{% alert color="warning" %}} | ||||||||||||
| **This step is required.** Without these annotations, upgrading the Helm installer release | ||||||||||||
| could delete the `cozy-system` namespace and all resources within it. | ||||||||||||
| {{% /alert %}} | ||||||||||||
|
|
||||||||||||
| ### Step 2. Install the Cozystack Operator | ||||||||||||
|
|
||||||||||||
| Install the new operator using Helm from the OCI registry. | ||||||||||||
| This deploys the `cozystack-operator`, installs two new CRDs (`Package` and `PackageSource`), | ||||||||||||
|
|
@@ -218,7 +233,7 @@ Verify the operator is running: | |||||||||||
| kubectl get pods -n cozy-system -l app=cozystack-operator | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ### Step 2. Generate the Platform Package | ||||||||||||
| ### Step 3. Generate the Platform Package | ||||||||||||
|
|
||||||||||||
| The migration script reads your existing ConfigMaps (`cozystack`, `cozystack-branding`, `cozystack-scheduling`) | ||||||||||||
| from the `cozy-system` namespace and converts them into a `Package` resource with the new values structure. | ||||||||||||
|
|
@@ -247,7 +262,7 @@ chmod +x migrate-to-version-1.0.sh | |||||||||||
| ``` | ||||||||||||
| {{% /alert %}} | ||||||||||||
|
|
||||||||||||
| ### Step 3. Monitor the Migration | ||||||||||||
| ### Step 4. Monitor the Migration | ||||||||||||
|
|
||||||||||||
| As soon as the Platform Package is applied, the operator starts the migration process. | ||||||||||||
| Migrations remove the old installer deployment and assets server, transform existing manifests | ||||||||||||
|
|
@@ -261,7 +276,7 @@ kubectl get hr -A | |||||||||||
|
|
||||||||||||
| Wait until all releases show `READY: True`. | ||||||||||||
|
|
||||||||||||
| ### Step 4. Clean Up Old ConfigMaps | ||||||||||||
| ### Step 5. Clean Up Old ConfigMaps | ||||||||||||
|
|
||||||||||||
| After verifying that all components are healthy, delete the old ConfigMaps | ||||||||||||
| that are no longer used: | ||||||||||||
|
|
@@ -270,7 +285,7 @@ that are no longer used: | |||||||||||
| kubectl delete configmap -n cozy-system cozystack cozystack-branding cozystack-scheduling | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ### Step 5. Verify the Migration | ||||||||||||
| ### Step 6. Verify the Migration | ||||||||||||
|
|
||||||||||||
| Check that the Platform Package is reconciled: | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve the robustness of the upgrade script, it's a good practice to check for the existence of the
cozystack-versionConfigMap before attempting to annotate it. This prevents the command from failing if the ConfigMap is not present, which could confuse users and halt their upgrade process. The suggested change wraps the annotation command in anifblock that first verifies the ConfigMap exists.