作者 yangfu

Merge branch 'yishujia-local-master' of http://gitlab.fjmaimaimai.com/mmm-go/ope…

…napi into yishujia-local-master
1 #FROM 192.168.0.243:5000/mmm/mmmopp:20200110 as builder 1 #FROM 192.168.0.243:5000/mmm/mmmopp:20200110 as builder
  2 +#FROM 192.168.0.243:5000/mmm/mmm-open-api:base
2 FROM golang:1.13 as builder 3 FROM golang:1.13 as builder
3 ENV GOPROXY https://goproxy.cn 4 ENV GOPROXY https://goproxy.cn
4 ENV GO111MODULE on 5 ENV GO111MODULE on
1 #!/bin/bash 1 #!/bin/bash
2 export PATH=/root/local/bin:$PATH 2 export PATH=/root/local/bin:$PATH
3 -kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api 3 +kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
4 if [ "$?" == "1" ];then 4 if [ "$?" == "1" ];then
5 - kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record  
6 - kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api 5 + kubectl create -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml --record
  6 + kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
7 if [ "$?" == "0" ];then 7 if [ "$?" == "0" ];then
8 - echo "mmm-open-api service install success!" 8 + echo "yishujia-open-api service install success!"
9 else 9 else
10 - echo "mmm-open-api service install fail!" 10 + echo "yishujia-open-api service install fail!"
11 fi 11 fi
12 - kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api 12 + kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
13 if [ "$?" == "0" ];then 13 if [ "$?" == "0" ];then
14 - echo "mmm-open-api deployment install success!" 14 + echo "yishujia-open-api deployment install success!"
15 else 15 else
16 - echo "mmm-open-api deployment install fail!" 16 + echo "yishujia-open-api deployment install fail!"
17 fi 17 fi
18 else 18 else
19 - kubectl delete -f /tmp/prd/mmm-open-api/mmm-open-api.yaml  
20 - kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api 19 + kubectl delete -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml
  20 + kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
21 while [ "$?" == "0" ] 21 while [ "$?" == "0" ]
22 do 22 do
23 - kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api 23 + kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
24 done 24 done
25 - kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api 25 + kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
26 while [ "$?" == "0" ] 26 while [ "$?" == "0" ]
27 do 27 do
28 - kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api 28 + kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
29 done 29 done
30 - kubectl create -f /tmp/prd/mmm-open-api/mmm-open-api.yaml --record  
31 - kubectl -n mmm-suplus-prd get svc | grep -q mmm-open-api 30 + kubectl create -f /tmp/prd/yishujia-open-api/yishujia-open-api.yaml --record
  31 + kubectl -n mmm-suplus-prd get svc | grep -q yishujia-open-api
32 if [ "$?" == "0" ];then 32 if [ "$?" == "0" ];then
33 - echo "mmm-open-api service update success!" 33 + echo "yishujia-open-api service update success!"
34 else 34 else
35 - echo "mmm-open-api service update fail!" 35 + echo "yishujia-open-api service update fail!"
36 fi 36 fi
37 - kubectl -n mmm-suplus-prd get pods | grep -q mmm-open-api 37 + kubectl -n mmm-suplus-prd get pods | grep -q yishujia-open-api
38 if [ "$?" == "0" ];then 38 if [ "$?" == "0" ];then
39 - echo "mmm-open-api deployment update success!" 39 + echo "yishujia-open-api deployment update success!"
40 else 40 else
41 - echo "mmm-open-api deployment update fail!" 41 + echo "yishujia-open-api deployment update fail!"
42 fi 42 fi
43 fi 43 fi
1 apiVersion: v1 1 apiVersion: v1
2 kind: Service 2 kind: Service
3 metadata: 3 metadata:
4 - name: mmm-open-api 4 + name: yishujia-open-api
5 namespace: mmm-suplus-prd 5 namespace: mmm-suplus-prd
6 labels: 6 labels:
7 - k8s-app: mmm-open-api 7 + k8s-app: yishujia-open-api
8 spec: 8 spec:
9 ports: 9 ports:
10 - name: "http" 10 - name: "http"
@@ -14,21 +14,21 @@ spec: @@ -14,21 +14,21 @@ spec:
14 port: 443 14 port: 443
15 targetPort: 443 15 targetPort: 443
16 selector: 16 selector:
17 - k8s-app: mmm-open-api 17 + k8s-app: yishujia-open-api
18 --- 18 ---
19 apiVersion: extensions/v1beta1 19 apiVersion: extensions/v1beta1
20 kind: Deployment 20 kind: Deployment
21 metadata: 21 metadata:
22 - name: mmm-open-api 22 + name: yishujia-open-api
23 namespace: mmm-suplus-prd 23 namespace: mmm-suplus-prd
24 labels: 24 labels:
25 - k8s-app: mmm-open-api 25 + k8s-app: yishujia-open-api
26 spec: 26 spec:
27 replicas: 1 27 replicas: 1
28 template: 28 template:
29 metadata: 29 metadata:
30 labels: 30 labels:
31 - k8s-app: mmm-open-api 31 + k8s-app: yishujia-open-api
32 spec: 32 spec:
33 affinity: 33 affinity:
34 nodeAffinity: 34 nodeAffinity:
@@ -41,13 +41,10 @@ spec: @@ -41,13 +41,10 @@ spec:
41 - key: kubernetes.io/hostname 41 - key: kubernetes.io/hostname
42 operator: In 42 operator: In
43 values: 43 values:
44 - - cn-hangzhou.i-bp1djh1xn7taumbue1ze  
45 - - cn-hangzhou.i-bp1djh1xn7taumbue1zd  
46 - - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb  
47 - - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy 44 + - cn-hangzhou.i-bp1inovcdp9uwwfusslx
48 containers: 45 containers:
49 - - name: mmm-open-api  
50 - image: 192.168.0.243:5000/mmm/mmm-open-api:master 46 + - name: yishujia-open-api
  47 + image: 192.168.0.243:5000/mmm/yishujia-open-api:master
51 imagePullPolicy: Always 48 imagePullPolicy: Always
52 ports: 49 ports:
53 - containerPort: 8080 50 - containerPort: 8080
  1 +apiVersion: v1
  2 +kind: Service
  3 +metadata:
  4 + name: yishujia-open-api
  5 + namespace: mmm-suplus-prd
  6 + labels:
  7 + k8s-app: yishujia-open-api
  8 +spec:
  9 + ports:
  10 + - name: "http"
  11 + port: 80
  12 + targetPort: 8080
  13 + - name: "https"
  14 + port: 443
  15 + targetPort: 443
  16 + selector:
  17 + k8s-app: yishujia-open-api
  18 +---
  19 +apiVersion: extensions/v1beta1
  20 +kind: Deployment
  21 +metadata:
  22 + name: yishujia-open-api
  23 + namespace: mmm-suplus-prd
  24 + labels:
  25 + k8s-app: yishujia-open-api
  26 +spec:
  27 + replicas: 1
  28 + template:
  29 + metadata:
  30 + labels:
  31 + k8s-app: yishujia-open-api
  32 + spec:
  33 + affinity:
  34 + nodeAffinity:
  35 + preferredDuringSchedulingIgnoredDuringExecution:
  36 + - preference: {}
  37 + weight: 100
  38 + requiredDuringSchedulingIgnoredDuringExecution:
  39 + nodeSelectorTerms:
  40 + - matchExpressions:
  41 + - key: kubernetes.io/hostname
  42 + operator: In
  43 + values:
  44 + - cn-hangzhou.i-bp1inovcdp9uwwfusslx
  45 + containers:
  46 + - name: yishujia-open-api
  47 + image: 192.168.0.243:5000/mmm/yishujia-open-api:master
  48 + imagePullPolicy: Always
  49 + ports:
  50 + - containerPort: 8080
  51 + - containerPort: 443
  52 + env:
  53 + - name: MYSQL_HOST
  54 + valueFrom:
  55 + configMapKeyRef:
  56 + name: suplus-config
  57 + key: mysql.host
  58 + - name: MYSQL_PORT
  59 + valueFrom:
  60 + configMapKeyRef:
  61 + name: suplus-config
  62 + key: mysql.port
  63 + - name: REDIS_HOST
  64 + valueFrom:
  65 + configMapKeyRef:
  66 + name: suplus-config
  67 + key: redis.ip
  68 + - name: REDIS_PORT
  69 + valueFrom:
  70 + configMapKeyRef:
  71 + name: suplus-config
  72 + key: redis.port
  73 + - name: MYSQL_USER
  74 + valueFrom:
  75 + configMapKeyRef:
  76 + name: suplus-config
  77 + key: mysql.user
  78 + - name: MYSQL_PASSWORD
  79 + valueFrom:
  80 + configMapKeyRef:
  81 + name: suplus-config
  82 + key: mysql.password
  83 + - name: MYSQL_DB_NAME
  84 + value: "mmm_open"
  85 + - name: RUN_MODE
  86 + value: "prod"
  87 + - name: LOG_LEVEL
  88 + value: "debug"
  89 + - name: aliyun_logs_suplusfile
  90 + value: "stdout"
  91 + - name: aliyun_logs_access
  92 + value: " /opt/logs/app.log"