4 ICN_DIR=$(dirname "$(dirname "$PWD")")
6 source "$ICN_DIR/env/lib/common.sh"
7 source "$ICN_DIR/deploy/kud-plugin-addons/minio/lib/minio.sh"
11 cat <<- EOF > /tmp/sample_image
12 This is a dummy file for testing.
16 IMAGE_SIZE=$(ls -al /tmp/sample_image | awk '{print $5}')
19 cat <<- EOF > /tmp/sample.json
22 "cluster_name": "beta",
24 "image_name": "qwerty123",
25 "image_length": $IMAGE_SIZE,
27 "upload_complete": false,
31 "image_record_name": "iuysdi1234",
43 while [[ $cur_status != "Running" ]]; do
45 cur_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
46 if [[ $cur_status != "Running" ]]; then
47 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
49 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
53 if [[ $cur_status == "Err"* ]]; then
62 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
64 call_api -i -F "metadata=</tmp/sample.json;type=application/json" -F \
65 file=@/tmp/sample.json -X POST \
66 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images
69 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123
71 call_api --request PATCH --data-binary "@/tmp/sample_image" \
72 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123 \
73 --header "Upload-Offset: 0" --header "Expect:" -i
75 MINIO_IP=$(kubectl get services | grep minio-service | awk '{print $3}')
77 obj_size=$(get_object_size container qwerty123)
78 echo "Got obj size: $obj_size"
79 if [[ $obj_size != $IMAGE_SIZE ]]; then
83 call_api -i -X DELETE \
84 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123