Last active
March 23, 2020 16:26
-
-
Save masayag/b9cec85fb2f312f5382ee70fc8955166 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Build CDI from source | |
| git clone git@github.com:kubevirt/containerized-data-importer.git | |
| cd containerized-data-importer/ | |
| make all | |
| # Replace $USER with quay, make sure images are public or provider a secret | |
| make manifests DOCKER_PREFIX=quay.io/$USER | |
| make push DOCKER_PREFIX=quay.io/$USER | |
| # Deploy CDI + CDI Operator on k8s cluster | |
| kubectl create -f _out/manifests/release/cdi-operator.yaml | |
| oc create -f _out/manifests/release/cdi-cr.yaml | |
| # Create StorageClass of local storage type | |
| cat <<EOF | kubectl create -f - | |
| kind: StorageClass | |
| apiVersion: storage.k8s.io/v1 | |
| metadata: | |
| name: local-storage | |
| provisioner: kubernetes.io/no-provisioner | |
| volumeBindingMode: WaitForFirstConsumer | |
| EOF | |
| # Define PV template | |
| template="apiVersion: v1 | |
| kind: PersistentVolume | |
| metadata: | |
| name: example-local-pv-XXX | |
| spec: | |
| capacity: | |
| storage: 2Gi | |
| accessModes: | |
| - ReadWriteOnce | |
| persistentVolumeReclaimPolicy: Retain | |
| storageClassName: local-storage | |
| local: | |
| path: /mnt/disks/volXXX | |
| nodeAffinity: | |
| required: | |
| nodeSelectorTerms: | |
| - matchExpressions: | |
| - key: kubernetes.io/hostname | |
| operator: In | |
| values: | |
| - kubevirt.example.com | |
| " | |
| # Creates 5 pvs based on the template above to allow binding of the PVC to a PV: | |
| for f in {1..5} | |
| do | |
| pv=$(echo "$template" | sed "s/XXX/$f/g") | |
| echo "$pv" | kubectl create -f - | |
| mkdir -p /mnt/disks/vol$f | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment