zfs-localpv/upgrade/cleanup.sh
Pawan Prakash Sharma 8a9ac43ab5
feat(crd): scripts to help migrating to new CRDs (#73)
The CRDs have changed from being under openebs.io to zfs.openebs.io. 

The scripts in this commit and the following steps will help users migrate existing CRDs to new CRDs and clean up older CRDs. 

# upgrade to new CRD
1. apply the crd yaml
    `$ kubectl apply -f upgrade/crd.yaml`

2. run upgrade.sh
    `$ upgrade/upgrade.sh`

3. upgrade the driver to v0.6
    `$ kubectl apply -f https://github.com/openebs/zfs-localpv/blob/v0.6.x/deploy/zfs-operator.yaml`

4. if everything looks good run the cleanup.sh, it will clean old CRs and delete the CRD
    `$ upgrade/cleanup.sh`

Signed-off-by: Pawan <pawan@mayadata.io>
2020-04-01 13:53:13 +05:30

28 lines
655 B
Bash

#!/bin/bash
set -e
kubectl get zfsvolumes.openebs.io -n openebs -oyaml > volumes.yaml
# remove the finalizer from the old CR
sed -i "/zfs.openebs.io\/finalizer/d" volumes.yaml
kubectl apply -f volumes.yaml
# delete the old CR
kubectl delete -f volumes.yaml
# delete the CRD definition
kubectl delete crd zfsvolumes.openebs.io
kubectl get zfssnapshots.openebs.io -n openebs -oyaml > snapshots.yaml
# remove the finalizer from the old CR
sed -i "/zfs.openebs.io\/finalizer/d" snapshots.yaml
kubectl apply -f snapshots.yaml
# delete the old CR
kubectl delete -f snapshots.yaml
# delete the CRD definition
kubectl delete crd zfssnapshots.openebs.io