正在显示
6 个修改的文件
包含
417 行增加
和
0 行删除
deploy/k8s/dev/install.sh
0 → 100644
1 | +#!/bin/bash | ||
2 | +export PATH=/root/local/bin:$PATH | ||
3 | +kubectl -n mmm-suplus-dev get pods | grep -q opp | ||
4 | +if [ "$?" == "1" ];then | ||
5 | + kubectl create -f /tmp/dev/opp/opp.yaml --record | ||
6 | + kubectl -n mmm-suplus-dev get svc | grep -q opp | ||
7 | + if [ "$?" == "0" ];then | ||
8 | + echo "opp service install success!" | ||
9 | + else | ||
10 | + echo "opp service install fail!" | ||
11 | + fi | ||
12 | + kubectl -n mmm-suplus-dev get pods | grep -q opp | ||
13 | + if [ "$?" == "0" ];then | ||
14 | + echo "opp deployment install success!" | ||
15 | + else | ||
16 | + echo "opp deployment install fail!" | ||
17 | + fi | ||
18 | +else | ||
19 | + kubectl delete -f /tmp/dev/opp/opp.yaml | ||
20 | + kubectl -n mmm-suplus-dev get svc | grep -q opp | ||
21 | + while [ "$?" == "0" ] | ||
22 | + do | ||
23 | + kubectl -n mmm-suplus-dev get svc | grep -q opp | ||
24 | + done | ||
25 | + kubectl -n mmm-suplus-dev get pods | grep -q opp | ||
26 | + while [ "$?" == "0" ] | ||
27 | + do | ||
28 | + kubectl -n mmm-suplus-dev get pods | grep -q opp | ||
29 | + done | ||
30 | + kubectl create -f /tmp/dev/opp/opp.yaml --record | ||
31 | + kubectl -n mmm-suplus-dev get svc | grep -q opp | ||
32 | + if [ "$?" == "0" ];then | ||
33 | + echo "opp service update success!" | ||
34 | + else | ||
35 | + echo "opp service update fail!" | ||
36 | + fi | ||
37 | + kubectl -n mmm-suplus-dev get pods | grep -q opp | ||
38 | + if [ "$?" == "0" ];then | ||
39 | + echo "opp deployment update success!" | ||
40 | + else | ||
41 | + echo "opp deployment update fail!" | ||
42 | + fi | ||
43 | +fi |
deploy/k8s/dev/opp.yaml
0 → 100644
1 | +apiVersion: v1 | ||
2 | +kind: Service | ||
3 | +metadata: | ||
4 | + name: opp | ||
5 | + namespace: mmm-suplus-dev | ||
6 | + labels: | ||
7 | + k8s-app: opp | ||
8 | +spec: | ||
9 | + ports: | ||
10 | + - name: "http" | ||
11 | + port: 80 | ||
12 | + targetPort: 8082 | ||
13 | + selector: | ||
14 | + k8s-app: opp | ||
15 | +--- | ||
16 | +apiVersion: extensions/v1beta1 | ||
17 | +kind: Deployment | ||
18 | +metadata: | ||
19 | + name: opp | ||
20 | + namespace: mmm-suplus-dev | ||
21 | + labels: | ||
22 | + k8s-app: opp | ||
23 | +spec: | ||
24 | + replicas: 1 | ||
25 | + template: | ||
26 | + metadata: | ||
27 | + labels: | ||
28 | + k8s-app: opp | ||
29 | + spec: | ||
30 | + affinity: | ||
31 | + nodeAffinity: | ||
32 | + preferredDuringSchedulingIgnoredDuringExecution: | ||
33 | + - preference: {} | ||
34 | + weight: 100 | ||
35 | + requiredDuringSchedulingIgnoredDuringExecution: | ||
36 | + nodeSelectorTerms: | ||
37 | + - matchExpressions: | ||
38 | + - key: kubernetes.io/hostname | ||
39 | + operator: In | ||
40 | + values: | ||
41 | + - cn-hangzhou.i-bp1djh1xn7taumbue1ze | ||
42 | + - cn-hangzhou.i-bp1djh1xn7taumbue1zd | ||
43 | + - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb | ||
44 | + - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy | ||
45 | + containers: | ||
46 | + - name: opp | ||
47 | + image: 192.168.0.243:5000/mmm/opp:dev | ||
48 | + imagePullPolicy: Always | ||
49 | + ports: | ||
50 | + - containerPort: 8082 | ||
51 | + volumeMounts: | ||
52 | + - mountPath: /opt/logs | ||
53 | + name: accesslogs | ||
54 | + env: | ||
55 | + - name: ENTERPRISE_SERVICE_HOST | ||
56 | + valueFrom: | ||
57 | + configMapKeyRef: | ||
58 | + name: suplus-config | ||
59 | + key: service.enterprise | ||
60 | + - name: MYSQL_HOST | ||
61 | + valueFrom: | ||
62 | + configMapKeyRef: | ||
63 | + name: suplus-config | ||
64 | + key: mysql.host | ||
65 | + - name: MYSQL_PORT | ||
66 | + valueFrom: | ||
67 | + configMapKeyRef: | ||
68 | + name: suplus-config | ||
69 | + key: mysql.port | ||
70 | + - name: MYSQL_USER | ||
71 | + valueFrom: | ||
72 | + configMapKeyRef: | ||
73 | + name: suplus-config | ||
74 | + key: mysql.user | ||
75 | + - name: MYSQL_PASSWORD | ||
76 | + valueFrom: | ||
77 | + configMapKeyRef: | ||
78 | + name: suplus-config | ||
79 | + key: mysql.password | ||
80 | + - name: MYSQL_DB_NAME | ||
81 | + value: "opportunity_dev" | ||
82 | + - name: LOG_LEVEL | ||
83 | + value: "debug" | ||
84 | + - name: ERROR_BASE_CODE | ||
85 | + value: "9" | ||
86 | + - name: ERROR_BASE_CODE_MULTIPLE | ||
87 | + value: "1000" | ||
88 | + - name: RUN_MODE | ||
89 | + value: "prod" | ||
90 | + - name: aliyun_logs_suplus | ||
91 | + value: "stdout" | ||
92 | + - name: aliyun_logs_access | ||
93 | + value: "/opt/logs/app.log" | ||
94 | + volumes: | ||
95 | + - name: accesslogs | ||
96 | + emptyDir: {} |
deploy/k8s/prd/install.sh
0 → 100644
1 | +#!/bin/bash | ||
2 | +export PATH=/root/local/bin:$PATH | ||
3 | +kubectl -n mmm-suplus-prd get pods | grep -q opp | ||
4 | +if [ "$?" == "1" ];then | ||
5 | + kubectl create -f /tmp/prd/opp/opp.yaml --record | ||
6 | + kubectl -n mmm-suplus-prd get svc | grep -q opp | ||
7 | + if [ "$?" == "0" ];then | ||
8 | + echo "opp service install success!" | ||
9 | + else | ||
10 | + echo "opp service install fail!" | ||
11 | + fi | ||
12 | + kubectl -n mmm-suplus-prd get pods | grep -q opp | ||
13 | + if [ "$?" == "0" ];then | ||
14 | + echo "opp deployment install success!" | ||
15 | + else | ||
16 | + echo "opp deployment install fail!" | ||
17 | + fi | ||
18 | +else | ||
19 | + kubectl delete -f /tmp/prd/opp/opp.yaml | ||
20 | + kubectl -n mmm-suplus-prd get svc | grep -q opp | ||
21 | + while [ "$?" == "0" ] | ||
22 | + do | ||
23 | + kubectl -n mmm-suplus-prd get svc | grep -q opp | ||
24 | + done | ||
25 | + kubectl -n mmm-suplus-prd get pods | grep -q opp | ||
26 | + while [ "$?" == "0" ] | ||
27 | + do | ||
28 | + kubectl -n mmm-suplus-prd get pods | grep -q opp | ||
29 | + done | ||
30 | + kubectl create -f /tmp/prd/opp/opp.yaml --record | ||
31 | + kubectl -n mmm-suplus-prd get svc | grep -q opp | ||
32 | + if [ "$?" == "0" ];then | ||
33 | + echo "opp service update success!" | ||
34 | + else | ||
35 | + echo "opp service update fail!" | ||
36 | + fi | ||
37 | + kubectl -n mmm-suplus-prd get pods | grep -q opp | ||
38 | + if [ "$?" == "0" ];then | ||
39 | + echo "opp deployment update success!" | ||
40 | + else | ||
41 | + echo "opp deployment update fail!" | ||
42 | + fi | ||
43 | +fi |
deploy/k8s/prd/opp.yaml
0 → 100644
1 | +apiVersion: v1 | ||
2 | +kind: Service | ||
3 | +metadata: | ||
4 | + name: opp | ||
5 | + namespace: mmm-suplus-prd | ||
6 | + labels: | ||
7 | + k8s-app: opp | ||
8 | +spec: | ||
9 | + ports: | ||
10 | + - name: "http" | ||
11 | + port: 80 | ||
12 | + targetPort: 8082 | ||
13 | + selector: | ||
14 | + k8s-app: opp | ||
15 | +--- | ||
16 | +apiVersion: extensions/v1beta1 | ||
17 | +kind: Deployment | ||
18 | +metadata: | ||
19 | + name: opp | ||
20 | + namespace: mmm-suplus-prd | ||
21 | + labels: | ||
22 | + k8s-app: opp | ||
23 | +spec: | ||
24 | + replicas: 1 | ||
25 | + template: | ||
26 | + metadata: | ||
27 | + labels: | ||
28 | + k8s-app: opp | ||
29 | + spec: | ||
30 | + affinity: | ||
31 | + nodeAffinity: | ||
32 | + preferredDuringSchedulingIgnoredDuringExecution: | ||
33 | + - preference: {} | ||
34 | + weight: 100 | ||
35 | + requiredDuringSchedulingIgnoredDuringExecution: | ||
36 | + nodeSelectorTerms: | ||
37 | + - matchExpressions: | ||
38 | + - key: kubernetes.io/hostname | ||
39 | + operator: In | ||
40 | + values: | ||
41 | + - cn-hangzhou.i-bp1djh1xn7taumbue1ze | ||
42 | + - cn-hangzhou.i-bp1djh1xn7taumbue1zd | ||
43 | + - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb | ||
44 | + - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy | ||
45 | + containers: | ||
46 | + - name: opp | ||
47 | + image: 192.168.0.243:5000/mmm/opp:master | ||
48 | + imagePullPolicy: Always | ||
49 | + ports: | ||
50 | + - containerPort: 8082 | ||
51 | + volumeMounts: | ||
52 | + - mountPath: /opt/logs | ||
53 | + name: accesslogs | ||
54 | + env: | ||
55 | + - name: ENTERPRISE_SERVICE_HOST | ||
56 | + valueFrom: | ||
57 | + configMapKeyRef: | ||
58 | + name: suplus-config | ||
59 | + key: service.enterprise | ||
60 | + - name: MYSQL_HOST | ||
61 | + valueFrom: | ||
62 | + configMapKeyRef: | ||
63 | + name: suplus-config | ||
64 | + key: mysql.host | ||
65 | + - name: MYSQL_PORT | ||
66 | + valueFrom: | ||
67 | + configMapKeyRef: | ||
68 | + name: suplus-config | ||
69 | + key: mysql.port | ||
70 | + - name: MYSQL_USER | ||
71 | + valueFrom: | ||
72 | + configMapKeyRef: | ||
73 | + name: suplus-config | ||
74 | + key: mysql.user | ||
75 | + - name: MYSQL_PASSWORD | ||
76 | + valueFrom: | ||
77 | + configMapKeyRef: | ||
78 | + name: suplus-config | ||
79 | + key: mysql.password | ||
80 | + - name: MYSQL_DB_NAME | ||
81 | + value: "opp" | ||
82 | + - name: LOG_LEVEL | ||
83 | + value: "debug" | ||
84 | + - name: ERROR_BASE_CODE | ||
85 | + value: "9" | ||
86 | + - name: ERROR_BASE_CODE_MULTIPLE | ||
87 | + value: "1000" | ||
88 | + - name: RUN_MODE | ||
89 | + value: "prod" | ||
90 | + - name: aliyun_logs_suplus | ||
91 | + value: "stdout" | ||
92 | + - name: aliyun_logs_access | ||
93 | + value: "/opt/logs/app.log" | ||
94 | + volumes: | ||
95 | + - name: accesslogs | ||
96 | + emptyDir: {} |
deploy/k8s/test/install.sh
0 → 100644
1 | +#!/bin/bash | ||
2 | +export PATH=/root/local/bin:$PATH | ||
3 | +kubectl -n mmm-suplus-test get pods | grep -q opp | ||
4 | +if [ "$?" == "1" ];then | ||
5 | + kubectl create -f /tmp/test/opp/opp.yaml --record | ||
6 | + kubectl -n mmm-suplus-test get svc | grep -q opp | ||
7 | + if [ "$?" == "0" ];then | ||
8 | + echo "opp service install success!" | ||
9 | + else | ||
10 | + echo "opp service install fail!" | ||
11 | + fi | ||
12 | + kubectl -n mmm-suplus-test get pods | grep -q opp | ||
13 | + if [ "$?" == "0" ];then | ||
14 | + echo "opp deployment install success!" | ||
15 | + else | ||
16 | + echo "opp deployment install fail!" | ||
17 | + fi | ||
18 | +else | ||
19 | + kubectl delete -f /tmp/test/opp/opp.yaml | ||
20 | + kubectl -n mmm-suplus-test get svc | grep -q opp | ||
21 | + while [ "$?" == "0" ] | ||
22 | + do | ||
23 | + kubectl -n mmm-suplus-test get svc | grep -q opp | ||
24 | + done | ||
25 | + kubectl -n mmm-suplus-test get pods | grep -q opp | ||
26 | + while [ "$?" == "0" ] | ||
27 | + do | ||
28 | + kubectl -n mmm-suplus-test get pods | grep -q opp | ||
29 | + done | ||
30 | + kubectl create -f /tmp/test/opp/opp.yaml --record | ||
31 | + kubectl -n mmm-suplus-test get svc | grep -q opp | ||
32 | + if [ "$?" == "0" ];then | ||
33 | + echo "opp service update success!" | ||
34 | + else | ||
35 | + echo "opp service update fail!" | ||
36 | + fi | ||
37 | + kubectl -n mmm-suplus-test get pods | grep -q opp | ||
38 | + if [ "$?" == "0" ];then | ||
39 | + echo "opp deployment update success!" | ||
40 | + else | ||
41 | + echo "opp deployment update fail!" | ||
42 | + fi | ||
43 | +fi |
deploy/k8s/test/opp.yaml
0 → 100644
1 | +apiVersion: v1 | ||
2 | +kind: Service | ||
3 | +metadata: | ||
4 | + name: opp | ||
5 | + namespace: mmm-suplus-test | ||
6 | + labels: | ||
7 | + k8s-app: opp | ||
8 | +spec: | ||
9 | + ports: | ||
10 | + - name: "http" | ||
11 | + port: 80 | ||
12 | + targetPort: 8082 | ||
13 | + selector: | ||
14 | + k8s-app: opp | ||
15 | +--- | ||
16 | +apiVersion: extensions/v1beta1 | ||
17 | +kind: Deployment | ||
18 | +metadata: | ||
19 | + name: opp | ||
20 | + namespace: mmm-suplus-test | ||
21 | + labels: | ||
22 | + k8s-app: opp | ||
23 | +spec: | ||
24 | + replicas: 1 | ||
25 | + template: | ||
26 | + metadata: | ||
27 | + labels: | ||
28 | + k8s-app: opp | ||
29 | + spec: | ||
30 | + affinity: | ||
31 | + nodeAffinity: | ||
32 | + preferredDuringSchedulingIgnoredDuringExecution: | ||
33 | + - preference: {} | ||
34 | + weight: 100 | ||
35 | + requiredDuringSchedulingIgnoredDuringExecution: | ||
36 | + nodeSelectorTerms: | ||
37 | + - matchExpressions: | ||
38 | + - key: kubernetes.io/hostname | ||
39 | + operator: In | ||
40 | + values: | ||
41 | + - cn-hangzhou.i-bp1djh1xn7taumbue1ze | ||
42 | + - cn-hangzhou.i-bp1djh1xn7taumbue1zd | ||
43 | + - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb | ||
44 | + - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy | ||
45 | + containers: | ||
46 | + - name: opp | ||
47 | + image: 192.168.0.243:5000/mmm/opp:test | ||
48 | + imagePullPolicy: Always | ||
49 | + ports: | ||
50 | + - containerPort: 8082 | ||
51 | + volumeMounts: | ||
52 | + - mountPath: /opt/logs | ||
53 | + name: accesslogs | ||
54 | + env: | ||
55 | + - name: ENTERPRISE_SERVICE_HOST | ||
56 | + valueFrom: | ||
57 | + configMapKeyRef: | ||
58 | + name: suplus-config | ||
59 | + key: service.enterprise | ||
60 | + - name: MYSQL_HOST | ||
61 | + valueFrom: | ||
62 | + configMapKeyRef: | ||
63 | + name: suplus-config | ||
64 | + key: mysql.host | ||
65 | + - name: MYSQL_PORT | ||
66 | + valueFrom: | ||
67 | + configMapKeyRef: | ||
68 | + name: suplus-config | ||
69 | + key: mysql.port | ||
70 | + - name: MYSQL_USER | ||
71 | + valueFrom: | ||
72 | + configMapKeyRef: | ||
73 | + name: suplus-config | ||
74 | + key: mysql.user | ||
75 | + - name: MYSQL_PASSWORD | ||
76 | + valueFrom: | ||
77 | + configMapKeyRef: | ||
78 | + name: suplus-config | ||
79 | + key: mysql.password | ||
80 | + - name: MYSQL_DB_NAME | ||
81 | + value: "opp_test" | ||
82 | + - name: LOG_LEVEL | ||
83 | + value: "debug" | ||
84 | + - name: ERROR_BASE_CODE | ||
85 | + value: "9" | ||
86 | + - name: ERROR_BASE_CODE_MULTIPLE | ||
87 | + value: "1000" | ||
88 | + - name: RUN_MODE | ||
89 | + value: "prod" | ||
90 | + - name: aliyun_logs_suplus | ||
91 | + value: "stdout" | ||
92 | + - name: aliyun_logs_access | ||
93 | + value: "/opt/logs/app.log" | ||
94 | + volumes: | ||
95 | + - name: accesslogs | ||
96 | + emptyDir: {} |
-
请 注册 或 登录 后发表评论