#!/bin/bash

export name_space=uavcloud-demo
export new_tag=5.1.0
export deployment_name=cmii-uav-tower

image_prefix=$(kubectl -n ${name_space} get deployment ${deployment_name} -o=jsonpath='{.spec.template.spec.containers[*].image}' | cut -d":" -f1)

echo "image grep is => ${image_prefix}"

kubectl -n ${name_space} patch deployment ${deployment_name} -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"${deployment_name}\",\"image\": \"${image_prefix}:${new_tag}\"}]}}}}"

