3 ICN_DIR=$(dirname "$(dirname "$PWD")")
5 source "$ICN_DIR/env/lib/common.sh"
6 source "$ICN_DIR/deploy/kud-plugin-addons/minio/lib/minio.sh"
10 cat <<- EOF > /tmp/sample_image
11 This is a dummy file for testing.
15 IMAGE_SIZE=$(ls -al /tmp/sample_image | awk '{print $5}')
18 cat <<- EOF > /tmp/sample.json
21 "cluster_name": "beta",
23 "image_name": "qwerty123",
24 "image_length": $IMAGE_SIZE,
26 "upload_complete": false,
30 "image_record_name": "iuysdi1234",
42 while [[ $cur_status != "Running" ]]; do
44 cur_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
45 if [[ $cur_status != "Running" ]]; then
46 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
48 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
52 if [[ $cur_status == "Err"* ]]; then
60 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
62 call_api -i -F "metadata=</tmp/sample.json;type=application/json" -F \
63 file=@/tmp/sample.json -X POST \
64 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images
67 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123
69 call_api --request PATCH --data-binary "@/tmp/sample_image" \
70 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123 \
71 --header "Upload-Offset: 0" --header "Expect:" -i
73 MINIO_IP=$(kubectl get services | grep minio-service | awk '{print $3}')
75 obj_size=$(get_object_size container qwerty123)
76 echo "Got obj size: $obj_size"
77 if [[ $obj_size != $IMAGE_SIZE ]]; then
81 call_api -i -X DELETE \
82 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123