-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
67 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# do not provision/deprovision anything while running the upgrade script. | ||
|
||
set -e | ||
|
||
# ZFSVolumes: create the new CR with apiVersion as zfs.openebs.io and kind as Volume | ||
if [ -z $1 ]; then | ||
# default namespace is openebs when all the custom resources are created | ||
ZFSPV_NAMESPACE="openebs" | ||
else | ||
ZFSPV_NAMESPACE=$1 | ||
fi | ||
|
||
numVol=`kubectl get zfsvolumes.openebs.io -n openebs | wc -l` | ||
|
||
kubectl get zfsvolumes.openebs.io -n openebs -oyaml > volumes.yaml | ||
if [ $numVol -gt 1 ]; then | ||
# ZFSVolumes: create the new CR with apiVersion as zfs.openebs.io and kind as Volume | ||
|
||
kubectl get zfsvolumes.openebs.io -n $ZFSPV_NAMESPACE -oyaml > volumes.yaml | ||
|
||
# update the group name to zfs.openebs.io | ||
sed -i "s/apiVersion: openebs.io/apiVersion: zfs.openebs.io/g" volumes.yaml | ||
# create the new CR | ||
kubectl apply -f volumes.yaml | ||
# update the group name to zfs.openebs.io | ||
sed -i "s/apiVersion: openebs.io/apiVersion: zfs.openebs.io/g" volumes.yaml | ||
# create the new CR | ||
kubectl apply -f volumes.yaml | ||
|
||
rm volumes.yaml | ||
rm volumes.yaml | ||
fi | ||
|
||
numSnap=`kubectl get zfssnapshots.openebs.io -n openebs | wc -l` | ||
|
||
# ZFSSnapshots: create the new CR with apiVersion as zfs.openebs.io and kind as Snapshot | ||
if [ $numSnap -gt 1 ]; then | ||
# 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 | ||
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 | ||
# create the new CR | ||
kubectl apply -f snapshots.yaml | ||
# update the group name to zfs.openebs.io | ||
sed -i "s/apiVersion: openebs.io/apiVersion: zfs.openebs.io/g" snapshots.yaml | ||
# create the new CR | ||
kubectl apply -f snapshots.yaml | ||
|
||
rm snapshots.yaml | ||
rm snapshots.yaml | ||
fi |