Skip to content

Instantly share code, notes, and snippets.

@miticojo
Created December 13, 2016 09:52
Show Gist options
  • Save miticojo/710007eeeb2456b008a7ce696c88fc66 to your computer and use it in GitHub Desktop.
Save miticojo/710007eeeb2456b008a7ce696c88fc66 to your computer and use it in GitHub Desktop.
script per generazione pv
SERVER=`hostname`
COUNT=50
mkdir -p /exports
chmod 770 /exports
chown nfsnobody:nfsnobody /exports
oc project default
for i in $(seq 1 $COUNT); do
PV=$(cat <<EOF
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv$(printf %04d $i)
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
nfs:
server: $SERVER
path: /exports/pv$(printf %04d $i)
EOF
)
echo "$PV" | oc create -f -
mkdir -p /exports/pv$(printf %04d $i)
chown nfsnobody:nfsnobody /exports/pv$(printf %04d $i)
chmod 770 /exports/pv$(printf %04d $i)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment