Skip to content

Commit

Permalink
remove whole storageClassName field in pvc on ROKs env (#2167)
Browse files Browse the repository at this point in the history
* remove whole storageClassName field in pvc on ROKs env

Signed-off-by: Allen Li <[email protected]>

* change tmp file position

Signed-off-by: Allen Li <[email protected]>

---------

Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ authored Aug 29, 2024
1 parent 5026687 commit bb9ba4a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions preload_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,26 @@ function swapmongopvc() {
if [[ -z $stgclass ]]; then
error "Cannnot get storage class name from PVC mongodbdir-icp-mongodb-0 in $FROM_NAMESPACE"
fi

cat <<EOF >$TEMPFILE
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cs-mongodump
namespace: $TO_NAMESPACE
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: "$stgclass"
volumeMode: Filesystem
volumeName: $VOL
EOF

else
debug1 "Preload run on ROKS, not setting storageclass name"
stgclass=""
deprecated_region='{.metadata.labels.failure-domain\.beta\.kubernetes\.io\/region}'
deprecated_zone='{.metadata.labels.failure-domain\.beta\.kubernetes\.io\/zone}'

Expand All @@ -609,9 +626,8 @@ function swapmongopvc() {
debug1 "Replacing depracated PV labels"
"${OC}" label pv $VOL $not_deprecated_region_label=$region $deprecated_region_label- $not_deprecated_zone_label=$zone $deprecated_zone_label- --overwrite
fi
fi

cat <<EOF >$TEMPFILE
cat <<EOF >$TEMPFILE
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -623,10 +639,11 @@ spec:
resources:
requests:
storage: 20Gi
storageClassName: "$stgclass"
volumeMode: Filesystem
volumeName: $VOL
EOF
fi


${OC} create -f $TEMPFILE

Expand Down

0 comments on commit bb9ba4a

Please sign in to comment.