Skip to content

Commit

Permalink
feat(crd): upgrade script for refactoring the CRD
Browse files Browse the repository at this point in the history
steps to upgrade :-

1. run pre-upgrade.sh
2. upgrade the driver t0 v0.6
3. run post-upgrade.sh

Signed-off-by: Pawan <pawan@mayadata.io>
  • Loading branch information
pawanpraka1 committed Mar 27, 2020
1 parent 27517c6 commit 710cf3b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
28 changes: 28 additions & 0 deletions upgrade/post-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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
32 changes: 32 additions & 0 deletions upgrade/pre-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

# ZFSVolumes: create the new CR with apiVersion as zfs.openebs.io and kind as Volume

kubectl get zfsvolumes.openebs.io -n openebs -oyaml > volumes.yaml


# update the group name to zfs.openebs.io
sed -i "s/apiVersion: openebs.io/apiVersion: zfs.openebs.io/g" volumes.yaml
# update the kind to Volume
sed -i "s/kind: ZFSVolume/kind: Volume/g" volumes.yaml
# create the new CR
kubectl apply -f volumes.yaml

rm volumes.yaml


# ZFSSnapshots: create the new CR with apiVersion as zfs.openebs.io and kind as Snapshot

kubectl get zfssnapshots.openebs.io -n openebs -oyaml > snapshots.yaml


# update the group name to zfs.openebs.io
sed -i "s/apiVersion: openebs.io/apiVersion: zfs.openebs.io/g" snapshots.yaml
# update the kind to Snapshot
sed -i "s/kind: ZFSSnapshot/kind: Snapshot/g" snapshots.yaml
# create the new CR
kubectl apply -f snapshots.yaml

rm snapshots.yaml

0 comments on commit 710cf3b

Please sign in to comment.