-
Notifications
You must be signed in to change notification settings - Fork 2
/
manifest-generator-dubbo.sh
executable file
·61 lines (54 loc) · 1.36 KB
/
manifest-generator-dubbo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
generate_yaml() {
local module=$1
local version=${2:-v1}
local registry_type=$3
local tag=$4
# Determine the deployment name and app label
local deploy_name=$module
local app_label=$module
if [[ $module == "bookstore-v2" ]]; then
app_label="bookstore"
fi
cat <<EOF > manifests/$registry_type/$deploy_name-$registry_type.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: $deploy_name
labels:
version: $version
spec:
replicas: 1
selector:
matchLabels:
app: $app_label
version: $version
template:
metadata:
labels:
app: $app_label
version: $version
spec:
containers:
- name: $app_label
image: addozhang/${app_label}-$registry_type:$tag
imagePullPolicy: Always
ports:
- containerPort: 20880
env:
- name: SPRING_PROFILES_ACTIVE
value: '$registry_type,prod'
- name: IDENTITY
value: $deploy_name
# - name: DUBBO_REGISTRY_ADDRESS
# value: 'zookeeper.default'
EOF
}
# Remove existing manifests
rm -f manifests/*/book*.yaml
# For each module, generate the yaml
for module in bookwarehouse bookstore bookbuyer bookthief; do
generate_yaml "$module" v1 dubbo 0.3
done
generate_yaml "bookstore-v2" v2 dubbo 0.3