Commit 4df276df by 据说甜蜜呢

添加自动缩放脚本

parent cce7722c
Pipeline #4333 passed with stage
in 20 seconds
#!/bin/bash
set -e
# Import external functions
chmod +x ./devops/PipeLines/Functions.deploy.sh
source ./devops/PipeLines/Functions.deploy.sh
# global variable
RollEnvironmentOf Environment
GetAppName appName
echo "[${Environment}]Auto scaling for ${appName} starting..."
GetCiCdSettings allPublishable noPublishable
if [ "${noPublishable}" == "1" ] ;
then
echo ""
echo "Tips: No services need to be cded."
else
GetNameSpace namespace
GetReplicas replicas
for servicePrefix in `ls ./src/Services|xargs -d '/'`
do
IsPublishableOf ${servicePrefix} isPublishable
GetServiceName ${servicePrefix} serviceName
if [ "${isPublishable}" == "1" ];
then
echo ""
echo "Tips: ${serviceName} begin deployment to K8S!!!"
AutoScaling ${namespace} ${serviceName} ${replicas}
else
echo ""
echo "Tips: ${serviceName} will not be deploymented to K8S!!!"
fi
done
fi
echo ""
echo "[${Environment}]Auto scaling for ${appName} has been successful."
\ No newline at end of file
......@@ -50,4 +50,17 @@ function CD()
kubectl -n ${namespace} scale deploy ${appNameOfK8s} --replicas=1;
fi
echo "Deployment[${Environment}] for ${appName}:${version} has been successful."
}
function AutoScaling()
{
declare namespace=$1
declare serviceName=$2
declare replicas=$3
Replace ${serviceName} '.' '-' appName
# repository name must be lowercase
ToLower ${appName} appNameOfK8s
kubectl -n ${namespace} scale deploy ${appNameOfK8s} --replicas=${replicas};
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment