Commit 1ae107c5 by tingweiwang

fix

1 parent 93bc8423
#!/bin/bash #!/bin/bash
#wangtingwei #wangtingwei
image_list=( dev_host=192.168.1.42
192.168.1.32:5000/k8s/nginx:latest fu_host=192.168.1.36
) test_host=192.168.51
IMAGE=hub.kce.ksyun.com/kpl_k8s/nginx:latest
DOCKER_REGISTRY=hub.kce.ksyun.com
#########################################
sed_yaml() {
echo "修改image名字"
sed -i s@DOCKER_REGISTRY@$DOCKER_REGISTRY@g
sed -i s@IMAGE@$IMAGE@g
}
################################
recover_yaml() {
echo "恢复yaml模板"
sed -i s@$DOCKER_REGISTRY@hub.kce.ksyun.com@g
sed -i s@$IMAGE@nginx:latestg
}
###################################
delt_all() {
kubectl delete -f k8s_yaml
}
############################################
create_all() {
kubectl apply -f k8s_yaml
}
##########################################
deploy_test ()
{
pwd
}
:<<!
if[[ $DEPLOY_ENV = "dev" ]]
then
echo "当前部署环境是开发环境"
elif [[ $DEPLOY_ENV = "test" ]]
then
echo "当前部署环境是测试环境"
else
echo "你没有选择环境 && exit 111"
fi
!
case $1 in
test)
deploy_test
;;
dev)
deploy_dev
;;
*)
echo "please input (test|dev)"
esac
...@@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1 ...@@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: CICD--frontend name: CICD--frontend
namespace: kpl namespace: test
spec: spec:
replicas: 1 replicas: 1
template: template:
...@@ -13,8 +13,8 @@ spec: ...@@ -13,8 +13,8 @@ spec:
nodeSelector: nodeSelector:
internal_service_node: "true" internal_service_node: "true"
containers: containers:
- name: kpl--frontend - name: CICD--frontend
image: DOCKER_REGISTRY/kpl--frontend:latest image: $DOCKER_REGISTRY/$IMAGE
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 80 - containerPort: 80
......
...@@ -2,7 +2,7 @@ apiVersion: v1 ...@@ -2,7 +2,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: CICD--frontend name: CICD--frontend
namespace: kpl namespace: test
spec: spec:
type: NodePort type: NodePort
selector: selector:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!