Skip to content

Commit d4babff

Browse files
committed
document downgrade concerns for CRD rename migrate
Adds a section explaining rollback procedures to the guide for the v1.6 -> v1.7 migration that involves the rename of TemporalWorkerDeployment CRD to WorkerDeployment. Signed-off-by: Jay Pipes <jay.pipes@temporal.io>
1 parent bc58d64 commit d4babff

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

docs/migration-crd-rename.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,91 @@ If you delete a deprecated resource before creating its replacement, the resourc
119119
Ready=False reason=DeletingPendingMigration
120120
message: "This TemporalWorkerDeployment is marked for deletion. Create a WorkerDeployment with the same name and spec to complete migration; deletion will proceed automatically once migration is confirmed."
121121
```
122+
123+
## Downgrading from v1.7 to v1.6
124+
125+
There are some important things to consider if you want to roll back
126+
(downgrade) an installed version of Temporal Worker Controller.
127+
128+
> **Warning**: You **should not perform a rollback/downgrade of the Temporal
129+
> Worker Controller CRDs Helm Chart**. Doing so is a potentially
130+
> **destructive** operation that can cause your Temporal Worker Deployments to
131+
> be deleted.
132+
133+
To downgrade the Temporal Worker Controller itself, do:
134+
135+
```bash
136+
helm rollback <RELEASE_NAME> <REVISION_NUMBER>
137+
```
138+
139+
Where `<RELEASE_NAME>` is the Helm Release associated with the Temporal Worker
140+
Controller Helm Chart (**not** the CRDs Chart) and `<REVISION_NUMBER>` is the
141+
Helm release revision number to roll back to. You can get this information by
142+
doing:
143+
144+
```bash
145+
helm history -n <TWC_NAMESPACE> <TWC_RELEASE_NAME>
146+
```
147+
148+
Where `<TWC_NAMESPACE>` is the Kubernetes Namespace you installed Temporal
149+
Worker Controller in and `<TWC_RELEASE>` is the name of the Helm Release
150+
associated with the Temporal Worker Controller Helm Chart.
151+
152+
Once you have downgraded the Temporal Worker Controller, you will need to take
153+
some corrective actions depending on how far down the migration path you went
154+
when upgrading to the v1.7 Temporal Worker Controller release.
155+
156+
If you upgraded the Temporal Worker Controller to v1.7 -- i.e. you successfully
157+
completed Step 2 above -- but **did not** complete Step 3 (migrating your
158+
resources), execute the following `kubectl` command to remove the CRD rename
159+
validation guard on the old `TemporalWorkerDeployment` Custom Resource
160+
Definition:
161+
162+
```bash
163+
kubectl patch crd temporalworkerdeployments.temporal.io --type='json' -p='[{"op": "remove", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/x-kubernetes-validations"}]'
164+
```
165+
166+
If you upgraded the Temporal Worker Controller to v1.7 and completed Step 3
167+
above (i.e. you successfully migrated your resources), you will need to
168+
manually restore the OwnerReferences for your Kubernetes Deployments to point
169+
at the original `TemporalWorkerDeployment` resources.
170+
171+
To do so, first, get a list of all the original `TemporalWorkerDeployment`
172+
object names and UIDs:
173+
174+
```bash
175+
kubectl get -n <NAMESPACE> temporalworkerdeployments.temporal.io -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.uid}{"\n"}{end}'
176+
```
177+
178+
Then get a list of all the Kubernetes Deployments that are now owned by the new
179+
`WorkerDeployment` resources:
180+
181+
```bash
182+
kubectl get -n <NAMESPACE> deployments -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.ownerReferences[0].kind}{"/"}{.metadata.ownerReferences[0].name}{"\n"}{end}'
183+
```
184+
185+
Then, for each of the Kubernetes Deployments listed above, execute the
186+
following `kubectl` command to reset the OwnerReferences of Kubernetes
187+
Deployments back to the original `TemporalWorkerDeployment` custom resources:
188+
189+
```bash
190+
kubectl patch -n <NAMESPACE> deployment <DEPLOYMENT_NAME> --type='merge' -p '
191+
{
192+
"metadata": {
193+
"ownerReferences": [
194+
{
195+
"apiVersion": "v1alpha1",
196+
"kind": "TemporalWorkerDeployment",
197+
"name": "<TWD_NAME>",
198+
"uid": "<TWD_UID>",
199+
"controller": true,
200+
"blockOwnerDeletion": true
201+
}
202+
]
203+
}
204+
}'
205+
```
206+
207+
Replace `<TWD_NAME>` and `<TWD_UID>` with the correct
208+
`TemporalWorkerDeployment` custom resource's name and UID you printed out
209+
earlier.

0 commit comments

Comments
 (0)