Commit e114cb10 by 据说甜蜜呢

添加token

parent 139b9cea
Pipeline #4154 passed with stage
in 18 seconds
...@@ -13,12 +13,13 @@ echo "Begin creating ${appName}'s settings to the configmap of k8s..." ...@@ -13,12 +13,13 @@ echo "Begin creating ${appName}'s settings to the configmap of k8s..."
GetNameSpace namespace GetNameSpace namespace
kubectl create namespace ${namespace} kubectl create namespace ${namespace}
GetAccessTokenOf accessToken # global variable
GetAccessTokenOf AccessToken
for servicePrefix in `ls ./src/Services|xargs -d '/'` for servicePrefix in `ls ./src/Services|xargs -d '/'`
do do
GetServiceName ${servicePrefix} serviceName GetServiceName ${servicePrefix} serviceName
GetServiceDir ${servicePrefix} ${serviceName} serviceDir GetServiceDir ${servicePrefix} ${serviceName} serviceDir
Create ${Environment} ${namespace} ${K8sApiServer} ${serviceDir} ${servicePrefix} ${accessToken} Create ${Environment} ${namespace} ${K8sApiServer} ${serviceDir} ${servicePrefix}
done done
echo "" echo ""
......
...@@ -6,7 +6,7 @@ set -e ...@@ -6,7 +6,7 @@ set -e
chmod +x ./devops/PipeLines/Functions.core.sh chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh source ./devops/PipeLines/Functions.core.sh
function Create() function CreateConfig()
{ {
declare createUrl="$3/api/v1/namespaces/$2/configmaps?pretty=true" declare createUrl="$3/api/v1/namespaces/$2/configmaps?pretty=true"
echo "[environment: $1, namespace: $2]" echo "[environment: $1, namespace: $2]"
...@@ -16,10 +16,10 @@ function Create() ...@@ -16,10 +16,10 @@ function Create()
set +e set +e
declare deleteUrl="${3}/api/v1/namespaces/${2}/configmaps/$5" declare deleteUrl="${3}/api/v1/namespaces/${2}/configmaps/$5"
echo ${AccessToken}
curl -X DELETE $deleteUrl -k \ curl -X DELETE $deleteUrl -k \
--connect-timeout $2 --max-time $3 --retry $4 \ --connect-timeout $2 --max-time $3 --retry $4 \
-H 'Authorization: Bearer '${6}'' -H 'Authorization: Bearer '${AccessToken}''
set -e set -e
...@@ -29,7 +29,7 @@ function Create() ...@@ -29,7 +29,7 @@ function Create()
--connect-timeout $2 --max-time $3 --retry $4 \ --connect-timeout $2 --max-time $3 --retry $4 \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \ -H 'cache-control: no-cache' \
-H 'Authorization: Bearer '${6}'' \ -H 'Authorization: Bearer '${AccessToken}'' \
-d '{ -d '{
"kind": "ConfigMap", "kind": "ConfigMap",
"apiVersion": "v1", "apiVersion": "v1",
...@@ -38,7 +38,7 @@ function Create() ...@@ -38,7 +38,7 @@ function Create()
"namespace": "'${namespace}'" "namespace": "'${namespace}'"
}, },
"data": { "data": {
"'$6'":'"$configInfo"' "'$6'":'"${configInfo}"'
} }
}' }'
} }
......
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