Skip to content

Commit

Permalink
refact(doc): add steps to upgrade cstor-pool and volumes from 0.8.2 t…
Browse files Browse the repository at this point in the history
…o 0.9.0 version (openebs#2576)

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
  • Loading branch information
sai chaithanya authored and Amit Kumar Das committed May 19, 2019
1 parent 77d3012 commit 19df166
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 79 deletions.
63 changes: 34 additions & 29 deletions k8s/upgrades/0.8.2-0.9.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,45 +81,50 @@ Limitations:
- in the process of running the below steps, if you run into issues, you can always reach us on slack


### Upgrade the Jiva based OpenEBS PV
# OpenEBS Upgrade Via CAS Templates From 0.8.2 to 0.9.0
**NOTE: Upgrade via these CAS Templates is ony supported for OpenEBS in version 0.8.2.**
**NOTE: Trying to upgrade a OpenEBS version other than 0.8.2 to 0.9.0 using these CAS templates can result in undesired behaviours.**
**NOTE: If you are having any OpenEBS version lower than 0.8.2, first upgrade it ot 0.8.2 and then these CAS templates can be used safely for 0.9.0 upgrade.**

Extract the PV name using `kubectl get pv`
### Upgrade the Jiva based OpenEBS PV

```
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-48fb36a2-947f-11e8-b1f3-42010a800004 5G RWO Delete Bound percona-test/demo-vol1-claim openebs-percona 8m
```
If your `pwd` is openebs/k8s/upgrades/0.8.2-0.9.0/

```
1. cd jiva
2. Update the `volume-upgrade-job.yaml` with corresponding jiva pv name and volume namespace
3. kubectl apply -f rbac.yaml
4. kubectl apply -f upgrade-job.yaml
5. kubectl apply -f jiva_upgrade_runtask.yaml
6. kubectl apply -f volume-upgrade-job.yaml
```
After applying volume-upgrade-job.yaml job will be triggered upon successfull
job status will be updated to completed else job status will be error.
If error occured then check the logs of pod(volume-upgrade job) and desribe of
upgraderesult
To get logs of job `kubectl logs -f volume-upgrade-22331`
To get describe upgrade result output `kubectl describe upgraderesults`
# Steps Before Upgrade:
- cd jiva
- Apply cr.yaml which installs a custom resource definition for UpgradeResult custom reource. This custom resource is used to capture upgrade related information for success or failure case.
- Apply rbac.yaml for permission stuff.

# Steps For OpenEBS jiva Volume Upgrade:

- Apply jiva_upgrade_runtask.yaml
- Open volume-upgrade-job.yaml and put the name of volume resource which you want to upgrade. Some comments itself is written in the yaml for clarity.
- After you are done editing volume-upgrade-job.yaml, save it and apply.
- You can see logs for your upgrade in a pod which is launched by upgrade job. Do a `kubectl get pod` and hence use kubectl command to see the log of the upgrade job pod.
- You can also do a `kubectl get upgraderesult -o yaml` to see the status of upgrade of each item.

### Upgrade cStor Pools

##TODO: Update the file with steps to upgrade cstro-pools from 0.8.2 to 0.9.0
If your `pwd` is openebs/k8s/upgrades/0.8.2-0.9.0/

Make sure that this step completes successfully before proceeding to next step.
# Steps Before Upgrade:

- cd cstor
- Apply cr.yaml which installs a custom resource definition for UpgradeResult custom reource. This custom resource is used to capture upgrade related information for success or failure case.
- Apply rbac.yaml for permission stuff.

### Upgrade cStor Volumes
# Steps For OpenEBS cStor Volume Upgrade:

Extract the PV name using `kubectl get pv`
- Apply cstor-pool-update-082-090.yaml
- Open pool-upgrade-job.yaml and put the name of cstorpool resource which you want to upgrade. Some comments itself is written in the yaml for clarity.
- After you are done editing pool-upgrade-job.yaml, save it and apply.
- You can see logs for your upgrade in a pod which is launched by upgrade job. Do a `kubectl get pod` and hence use kubectl command to see the log of the upgrade job pod.
- You can also do a `kubectl get upgraderesult -o yaml` to see the status of upgrade of each item.

```
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-1085415d-f84c-11e8-aadf-42010a8000bb 5G RWO Delete Bound default/demo-cstor-sparse-vol1-claim openebs-cstor-sparse 22m
```
# Steps For OpenEBS cStor Volume Upgrade:

##TODO: Update the file with steps to upgrade cstro-volumes from 0.8.2 to 0.9.0
- Apply cstor-volume-update-082-090.yaml
- Open volume-upgrade-job.yaml and put the name of cstorvolume resource which you want to upgrade. Some comments itself is written in the yaml for clarity.
- After you are done editing volume-upgrade-job.yaml, save it and apply.
- You can see logs for your upgrade in a pod which is launched by upgrade job. Do a `kubectl get pod` and hence use kubectl command to see the log of the upgrade job pod.
- You can also do a `kubectl get upgraderesult -o yaml` to see the status of upgrade of each item.
94 changes: 47 additions & 47 deletions k8s/upgrades/0.8.2-0.9.0/cstor/cstor-pool-update-082-090.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ spec:
- upgrade-cstor-pool-082-090-get-cstorpool

# Runtask #2
# This runtask gets the cstorpool deployment and verifies it.
# This runtask gets the cstorpool deployment and verifies it.
- upgrade-cstor-pool-082-090-get-deployment

# Runtask #3
# This runtask gets the storagepool custom resource and verifies it.
# This runtask gets the storagepool custom resource and verifies it.
- upgrade-cstor-pool-082-090-get-storagepool

# Runtask #4
Expand All @@ -44,7 +44,7 @@ spec:
# Runtask #5
# This runtask patches pool deployment with target version.
- upgrade-cstor-pool-082-090-patch-deployment-image

# Runtask #6
# This runtask verifies whether the deployment has rolled out successfully or not
# after the patch.
Expand All @@ -55,18 +55,18 @@ spec:
- upgrade-cstor-pool-082-090-post-check-patch-deployment-image

# Runtask #8
# Tis runtask patches the storagepool custom resource with the
# target version label.
# Tis runtask patches the storagepool custom resource with the
# target version label.
- upgrade-cstor-pool-082-090-patch-sp-version

# Runtask #9
# This runtask checks whether the target version label patch
# for storagepool is successful or not.
- upgrade-cstor-pool-082-090-patch-sp-version-post-check

# Runtask #10
# Tis runtask patches the cstorpool custom resource with the
# target version label.
# Tis runtask patches the cstorpool custom resource with the
# target version label.
- upgrade-cstor-pool-082-090-patch-csp-version

# Runtask #11
Expand All @@ -75,15 +75,15 @@ spec:
- upgrade-cstor-pool-082-090-patch-csp-version-post-check

# Runtask #12
# Tis runtask patches the cstorpool deployment with the
# target version label.
# Tis runtask patches the cstorpool deployment with the
# target version label.
- upgrade-cstor-pool-082-090-patch-deployment-version

# Runtask #13
# This runtask checks whether the target version label patch
# for cstorpool deployment is successful or not.
- upgrade-cstor-pool-082-090-patch-deployment-version-post-check

# Runtask #14
# This runtask list all the replicaset of the the cstorpool deployment.
- upgrade-cstor-pool-082-090-list-replicaset
Expand All @@ -99,7 +99,7 @@ spec:
- upgrade-cstor-pool-082-090-delete-replicaset
taskNamespace: default
---
# Runtask #1
# Runtask #1
apiVersion: openebs.io/v1alpha1
kind: RunTask
metadata:
Expand All @@ -126,7 +126,7 @@ spec:
{{- if or $isBaseVersion $isTargetVersion -}}
{{- $status =.Config.successStatus.value }}
{{- $message = $successMessage -}}
{{- else }}
{{- $status =.Config.failStatus.value }}
{{- $message = $errMessageInvalidVersion -}}
Expand All @@ -140,12 +140,12 @@ spec:
{{- $taskStartTime := upgradeResultWithTaskStartTime now -}}
{{- $taskEndTime := upgradeResultWithTaskEndTime now -}}
{{- upgradeResultUpdateTasks $taskStartTime $URName $URNamespace $taskName $taskStatus $taskMessage $taskEndTime -}}
{{- if eq $status .Config.failStatus.value }}
{{- verifyErr $errMessageInvalidVersion true | saveAs "CStorPool.verifyErr" .TaskResult | noop -}}
{{- end }}
---
# Runtask #2
# Runtask #2
apiVersion: openebs.io/v1alpha1
kind: RunTask
metadata:
Expand All @@ -164,11 +164,11 @@ spec:
{{- jsonpath .JsonResult "{.spec.template.spec.containers[?(@.name=='cstor-pool-mgmt')].image}" | trim | saveAs "poolDeployment.cstorpoolmgmtimage" .TaskResult | noop -}}
{{- jsonpath .JsonResult "{.metadata.labels.openebs\\.io/version}" | trim | saveAs "poolDeployment.version" .TaskResult | noop -}}
{{- $message :="" }}
{{- $message :="" }}
{{- $status :="" }}
{{- $successMessage := printf "Successfully got details of CStorPool deployment {%s}." .UpgradeItem.name -}}
{{- $errMessageInvalidVersion := printf "CStorPool deployment {%s}, version is not in {%s}." .UpgradeItem.name .Config.baseVersion.value -}}
{{- $isBaseVersion := eq .TaskResult.poolDeployment.version .Config.baseVersion.value }}
{{- $isTargetVersion := eq .TaskResult.poolDeployment.version .Config.targetVersion.value }}
{{- if or $isBaseVersion $isTargetVersion -}}
Expand All @@ -188,12 +188,12 @@ spec:
{{- $taskStartTime := upgradeResultWithTaskStartTime now -}}
{{- $taskEndTime := upgradeResultWithTaskEndTime now -}}
{{- upgradeResultUpdateTasks $taskStartTime $URName $URNamespace $taskName $taskStatus $taskMessage $taskEndTime -}}
{{- if eq $status .Config.failStatus.value }}
{{- verifyErr $errMessageInvalidVersion true | saveAs "poolDeployment.verifyErr" .TaskResult | noop -}}
{{- end }}
---
# Runtask #3
# Runtask #3
apiVersion: openebs.io/v1alpha1
kind: RunTask
metadata:
Expand All @@ -213,13 +213,13 @@ spec:
{{- $status :="" }}
{{- $successMessage := printf "Successfully got details of StoragePool {%s}." .UpgradeItem.name -}}
{{- $errMessageInvalidVersion := printf "StoragePool {%s}, version is not in {%s}." .UpgradeItem.name .Config.baseVersion.value -}}
{{- $isBaseVersion := eq .TaskResult.StoragePool.labels .Config.baseVersion.value }}
{{- $isTargetVersion := eq .TaskResult.StoragePool.labels .Config.targetVersion.value }}
{{- if or $isBaseVersion $isTargetVersion -}}
{{- $status =.Config.successStatus.value }}
{{- $message = $successMessage -}}
{{- else }}
{{- $status =.Config.failStatus.value }}
{{- $message = $errMessageInvalidVersion -}}
Expand All @@ -233,7 +233,7 @@ spec:
{{- $taskStartTime := upgradeResultWithTaskStartTime now -}}
{{- $taskEndTime := upgradeResultWithTaskEndTime now -}}
{{- upgradeResultUpdateTasks $taskStartTime $URName $URNamespace $taskName $taskStatus $taskMessage $taskEndTime -}}
{{- if eq $status .Config.failStatus.value }}
{{- verifyErr $errMessageInvalidVersion true | saveAs "StoragePool.verifyErr" .TaskResult | noop -}}
{{- end }}
Expand Down Expand Up @@ -287,7 +287,7 @@ spec:
metadata:
labels:
openebs.io/version: {{ .Config.targetVersion.value }}
openebs.io/cstor-pool: {{ .UpgradeItem.name }}
openebs.io/cstor-pool: {{ .UpgradeItem.name }}
spec:
containers:
- name: cstor-pool
Expand Down Expand Up @@ -370,10 +370,10 @@ spec:
{{- $message :="" -}}
{{- $verifyErrMessage := "Pool deployment rollout not successfull" -}}
{{- $rolloutStatusMessage := printf "rollout status: {%s} name: {%s} namespace: {%s}" .TaskResult.patchDeploymentImageStatus.rolloutStatus .UpgradeItem.name .UpgradeItem.namespace -}}
{{- if eq .TaskResult.patchDeploymentImageStatus.isRolledout "true" }}
{{- $status = .Config.successStatus.value -}}
{{- else }}
{{- "waiting for deployment rollout" | saveAs "patchDeploymentImageStatus.verifyErr" .TaskResult | noop -}}
{{- $status = .Config.failStatus.value -}}
Expand All @@ -388,7 +388,7 @@ spec:
{{- $URNamespace := upgradeResultWithTaskOwnerNamespace .UpgradeItem.upgradeResultNamespace -}}
{{- $taskStartTime := upgradeResultWithTaskStartTime now -}}
{{- $taskEndTime := upgradeResultWithTaskEndTime now -}}
{{- if eq $status .Config.failStatus.value }}
{{- verifyErr $verifyErrMessage true | saveAs "patchDeploymentImageStatus.verifyErr" .TaskResult | noop -}}
{{- end }}
Expand Down Expand Up @@ -422,14 +422,14 @@ spec:
{{ $isNewMayaExporter := contains .Config.targetVersion.value .TaskResult.postCheckDeploymentImagePatch.mayaexporterimage }}
{{- $status := "" -}}
{{- if and $isNewCStorPool $isNewCStorPoolMGMT $isNewMayaExporter }}
{{- $status = .Config.successStatus.value -}}
{{- else }}
{{- $status = .Config.failStatus.value -}}
{{- end }}
{{- $taskName := "upgrade-cstor-pool-082-090-post-check-patch-deployment-image" -}}
{{- $message := printf "pool image :{%s} pool mgmt image :{%s} maya-exporter image : {%s}" .TaskResult.postCheckDeploymentImagePatch.cstorpoolimage .TaskResult.postCheckDeploymentImagePatch.cstorpoolmgmtimage .TaskResult.postCheckDeploymentImagePatch.mayaexporterimage -}}
Expand All @@ -455,7 +455,7 @@ spec:
openebs.io/version: {{ .Config.targetVersion.value }}
post: |-
{{- $message := printf "version label successfully patched StoragePool {%s}." .UpgradeItem.name -}}
{{- $status := .Config.successStatus.value -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
Expand Down Expand Up @@ -484,16 +484,16 @@ spec:
{{- jsonpath .JsonResult "{.metadata.labels.openebs\\.io/version}" | trim | saveAs "postCheckStoragePoolVersionPatch.version" .TaskResult | noop -}}
{{- $status := "" -}}
{{- if ne .TaskResult.postCheckStoragePoolVersionPatch.version .Config.targetVersion.value }}
{{- $status = .Config.failStatus.value -}}
{{- else }}
{{- $status = .Config.successStatus.value -}}
{{- end }}
{{- $message := printf "version label value - {%s}" .TaskResult.postCheckStoragePoolVersionPatch.version -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
{{- $taskName := upgradeResultWithTaskName "upgrade-cstor-pool-082-090-patch-sp-version-post-check" -}}
Expand Down Expand Up @@ -524,7 +524,7 @@ spec:
openebs.io/version: {{ .Config.targetVersion.value }}
post: |-
{{- $message := printf "version label successfully patched CStorPool {%s}." .UpgradeItem.name -}}
{{- $status := .Config.successStatus.value -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
Expand Down Expand Up @@ -554,16 +554,16 @@ spec:
{{- $taskName := "upgrade-cstor-pool-082-090-patch-csp-version-post-check" -}}
{{- $status := "" -}}
{{- if ne .TaskResult.postCheckCStorPoolVersionPatch.version .Config.targetVersion.value }}
{{- $status = .Config.failStatus.value -}}
{{- else }}
{{- $status = .Config.successStatus.value -}}
{{- end }}
{{- $message := printf "version label value - {%s}" .TaskResult.postCheckCStorPoolVersionPatch.version -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
{{- $taskName := upgradeResultWithTaskName "upgrade-cstor-pool-082-090-patch-sp-version-post-check" -}}
Expand Down Expand Up @@ -595,7 +595,7 @@ spec:
openebs.io/version: {{ .Config.targetVersion.value }}
post: |-
{{- $message := printf "version label successfully patched Pool Deployment {%s} in {%s} namespace." .UpgradeItem.name .UpgradeItem.namespace -}}
{{- $status := .Config.successStatus.value -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
Expand Down Expand Up @@ -625,16 +625,16 @@ spec:
{{- jsonpath .JsonResult "{.metadata.labels.openebs\\.io/version}" | trim | saveAs "postCheckDeploymentVersionPatch.version" .TaskResult | noop -}}
{{- $status := "" -}}
{{- if ne .TaskResult.postCheckDeploymentVersionPatch.version .Config.targetVersion.value }}
{{- $status = .Config.failStatus.value -}}
{{- else }}
{{- $status = .Config.successStatus.value -}}
{{- end }}
{{- $message := printf "version label value - {%s}" .TaskResult.postCheckDeploymentVersionPatch.version -}}
{{- $status := .Config.successStatus.value -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
Expand Down Expand Up @@ -666,7 +666,7 @@ spec:
{{- $status := .Config.successStatus.value -}}
{{- $message := printf "ReplicaSet list {%s}" .TaskResult.replicaSetList.list -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
{{- $taskName := upgradeResultWithTaskName "upgrade-cstor-pool-082-090-list-replicaset" -}}
Expand Down Expand Up @@ -728,7 +728,7 @@ spec:
{{- $staleReplicaset | saveAs "podList.staleReplicaset" .TaskResult -}}
{{- $message := printf "pool Pod-ReplicaSet map: {%s}\nstale ReplicaSet list: {%s}" .TaskResult.podList.map .TaskResult.podList.staleReplicaset -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
{{- $taskName := upgradeResultWithTaskName "upgrade-cstor-pool-082-090-list-pod" -}}
Expand Down Expand Up @@ -756,7 +756,7 @@ spec:
post: |
{{- $message := printf "stale replicaset {%s} successfully deleted in {%s} namespace." .TaskResult.podList.staleReplicaset .UpgradeItem.namespace -}}
{{- $status := .Config.successStatus.value -}}
{{- $taskMessage := upgradeResultWithTaskMessage $message -}}
{{- $taskStatus := upgradeResultWithTaskStatus $status -}}
{{- $taskName := upgradeResultWithTaskName "upgrade-cstor-pool-082-090-delete-replicaset" -}}
Expand Down
Loading

0 comments on commit 19df166

Please sign in to comment.