Skip to content

Commit d0ed152

Browse files
author
Tong Li
committed
[CE-407]Allow agent to deploy peer or orderer only
Currently the agent deploy both peers and orderers. but in some cases, users may only want to deploy just peers or just orderers, this patch set will provide that capability and give the users the capability. Change-Id: I762c474cdeb2f2cbb5b57b9124793f25230f84c8 Signed-off-by: Tong Li <litong01@us.ibm.com>
1 parent 589ea4c commit d0ed152

File tree

5 files changed

+168
-11
lines changed

5 files changed

+168
-11
lines changed

src/agent/ansible/roles/deploy_k8s/fabricsetup/tasks/apply.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
src: "{{ playbook_dir }}/../deploy_k8s/fabricsetup/templates/dochannel.j2"
2323
dest: "{{ fabricworkdir }}/keyfiles/dochannel.sh"
2424
mode: "u=rx,g=rx"
25-
when: allorderers | length > 0
25+
when: (allorderers | length > 0) and (allpeers | length > 0)
2626

2727
- name: Create persistent volume
2828
command: >-
@@ -107,14 +107,14 @@
107107
- "{{ playbook_dir }}/../deploy_k8s/fabricsetup/templates/firstcode.go"
108108
tags: "placecerts"
109109

110-
- name: Copy certs onto the persistent volume
110+
- name: Copy channel operation script onto the persistent volume
111111
command: >-
112112
./kubectl --kubeconfig kubeconfig cp {{ item }} fabriccertspod:/fabriccerts
113113
args:
114114
chdir: "{{ playbook_dir }}/../../vars/"
115115
with_items:
116116
- "{{ fabricworkdir }}/keyfiles/dochannel.sh"
117-
when: allorderers | length > 0
117+
when: (allorderers | length > 0) and (allpeers | length > 0)
118118
tags: "placecerts"
119119

120120
- name: Untar certs.tgz in the Persistent volume
@@ -177,11 +177,12 @@
177177
args:
178178
chdir: "{{ playbook_dir }}/../../vars/"
179179
with_items: "{{ dindpods.stdout_lines }}"
180+
when: allpeers | length > 0
180181
tags: "downloadccenv"
181182

182183
- name: Start channel operations
183184
command: "./kubectl --kubeconfig kubeconfig apply -f ../run/cli-k8s.yaml"
184185
args:
185186
chdir: "{{ playbook_dir }}/../../vars/"
186187
tags: "channeloperation"
187-
when: allorderers | length > 0
188+
when: (allorderers | length > 0) and (allpeers | length > 0)

src/agent/ansible/roles/deploy_k8s/fabricsetup/tasks/destroy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
./kubectl --kubeconfig='kubeconfig' delete -f ../run/cli-k8s.yaml
88
args:
99
chdir: "{{ playbook_dir }}/../../vars/"
10-
when: allorderers | length > 0
10+
when: (allorderers | length > 0) and (allpeers | length > 0)
1111
tags: "clientdown"
1212

1313
- name: Stop fabric pod and chaincode endpoint daemon set

src/agent/ansible/roles/env_flanneld/fastinitnode/tasks/apply.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@
6262
dest: "/opt"
6363
remote_src: True
6464

65-
- name: Fix up the search domain
66-
lineinfile:
67-
path: /etc/resolvconf/resolv.conf.d/base
68-
state: present
69-
line: search {{ cluster.domain | default('fabric') }}
70-
7165
- name: Setup golang profile
7266
template:
7367
src: "{{ playbook_dir }}/../env_flanneld/fastinitnode/templates/goroot.j2"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# The url to the fabric source repository
3+
GIT_URL: "http://gerrit.hyperledger.org/r/fabric"
4+
5+
# The gerrit patch set reference, should be automatically set by gerrit
6+
# GERRIT_REFSPEC: "refs/changes/23/11523/3" # 1.0.0
7+
# GERRIT_REFSPEC: "refs/changes/47/12047/3" # 1.0.1
8+
# GERRIT_REFSPEC: "refs/changes/13/13113/1"
9+
# GERRIT_REFSPEC: "refs/tags/v1.0.4" # 1.0.4
10+
GERRIT_REFSPEC: "" # 1.0.5
11+
12+
# This variable defines fabric network attributes
13+
fabric: {
14+
15+
# The user to connect to the server
16+
ssh_user: "ubuntu",
17+
18+
# options are "goleveldb", "CouchDB", default is goleveldb
19+
peer_db: "goleveldb",
20+
tls: false,
21+
logging_level: "ERROR",
22+
k8s: {
23+
exposeserviceport: True,
24+
storageclass: "default",
25+
storagecapacity: "2Gi",
26+
shared_storage: false,
27+
mem_req: "512Mi",
28+
mem_limit: "1024Mi",
29+
cpu_req: "0.1",
30+
cpu_limit: "0.2"
31+
},
32+
33+
# The following section defines how the fabric network is going to be made up
34+
# cas indicates certificate authority containers
35+
# peers indicates peer containers
36+
# orderers indicates orderer containers
37+
# kafka indicates kafka containers
38+
# all names must be in lower case. Numeric characters cannot be used to start
39+
# or end a name. Character dot (.) can only be used in names of peers and orderers.
40+
network: {
41+
fabric001: {
42+
cas: ["ca1st.orgc"],
43+
peers: [],
44+
orderers: ["orderer1st.orgc","orderer2nd.orgc","orderer3rd.orgc"],
45+
zookeepers: ["zookeeper1st","zookeeper2nd","zookeeper3rd"],
46+
kafkas: ["kafka1st","kafka2nd","kafka3rd"]
47+
}
48+
},
49+
50+
# the container tag for main fabric components such as orderer, peer,
51+
# tools and chaincode. If left blank, then fabric components will be built
52+
# from the latest fabric source code with the combination of the refspec
53+
# specified above. If it is not empty, then its values must be the full
54+
# container tag like the following:
55+
# x86_64-1.1.0-alpha # alpha release
56+
# DAILY_STABLE # daily stable
57+
# DEV_STABLE # dev stable
58+
# s390x-0.4.2 # release 0.4.2 for s390x
59+
# 048c91eb47812582f36665fbea3d7e0e68e396bf # commit build
60+
# x86_64-1.0.0-snapshot-8d3275f # snapshot build
61+
baseimage_tag: "amd64-1.1.0",
62+
63+
# The container tag for accessory fabric components such as ca, kafka,
64+
# zookeeper and couchdb. It has to be the full tag just like the
65+
# baseimage_tag
66+
helper_tag: "amd64-0.4.8",
67+
ca: { admin: "admin", adminpw: "adminpw", image_tag: "amd64-1.1.0" },
68+
69+
# Only use this field when you have a docker repository.
70+
repo: {
71+
# the url defines docker hub project access point
72+
# official hub - url: "hyperledger/",
73+
# fabric build hub - url: "nexus3.hyperledger.org:10001/hyperledger/",
74+
url: "hyperledger/",
75+
76+
# locations to download fabric binaries. This url should point to a
77+
# compressed such as tar or zip file which contains necessary binaries
78+
# such as configtxgen, configtxlator, cryptogen etc.
79+
bin: "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz"
80+
}
81+
}

src/agent/ansible/vars/peeronly.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# The url to the fabric source repository
3+
GIT_URL: "http://gerrit.hyperledger.org/r/fabric"
4+
5+
# The gerrit patch set reference, should be automatically set by gerrit
6+
# GERRIT_REFSPEC: "refs/changes/23/11523/3" # 1.0.0
7+
# GERRIT_REFSPEC: "refs/changes/47/12047/3" # 1.0.1
8+
# GERRIT_REFSPEC: "refs/changes/13/13113/1"
9+
# GERRIT_REFSPEC: "refs/tags/v1.0.4" # 1.0.4
10+
GERRIT_REFSPEC: "" # 1.0.5
11+
12+
# This variable defines fabric network attributes
13+
fabric: {
14+
15+
# The user to connect to the server
16+
ssh_user: "ubuntu",
17+
18+
# options are "goleveldb", "CouchDB", default is goleveldb
19+
peer_db: "goleveldb",
20+
tls: false,
21+
logging_level: "ERROR",
22+
k8s: {
23+
exposeserviceport: True,
24+
storageclass: "default",
25+
storagecapacity: "2Gi",
26+
shared_storage: false,
27+
mem_req: "512Mi",
28+
mem_limit: "1024Mi",
29+
cpu_req: "0.1",
30+
cpu_limit: "0.2"
31+
},
32+
33+
# The following section defines how the fabric network is going to be made up
34+
# cas indicates certificate authority containers
35+
# peers indicates peer containers
36+
# orderers indicates orderer containers
37+
# kafka indicates kafka containers
38+
# all names must be in lower case. Numeric characters cannot be used to start
39+
# or end a name. Character dot (.) can only be used in names of peers and orderers.
40+
network: {
41+
fabric001: {
42+
cas: ["ca1st.orgt"],
43+
peers: ["anchor@peer1st.orgt","worker@peer2nd.orgt","worker@peer3rd.orgt"],
44+
orderers: [],
45+
zookeepers: [],
46+
kafkas: []
47+
}
48+
},
49+
50+
# the container tag for main fabric components such as orderer, peer,
51+
# tools and chaincode. If left blank, then fabric components will be built
52+
# from the latest fabric source code with the combination of the refspec
53+
# specified above. If it is not empty, then its values must be the full
54+
# container tag like the following:
55+
# x86_64-1.1.0-alpha # alpha release
56+
# DAILY_STABLE # daily stable
57+
# DEV_STABLE # dev stable
58+
# s390x-0.4.2 # release 0.4.2 for s390x
59+
# 048c91eb47812582f36665fbea3d7e0e68e396bf # commit build
60+
# x86_64-1.0.0-snapshot-8d3275f # snapshot build
61+
baseimage_tag: "amd64-1.1.0",
62+
63+
# The container tag for accessory fabric components such as ca, kafka,
64+
# zookeeper and couchdb. It has to be the full tag just like the
65+
# baseimage_tag
66+
helper_tag: "amd64-0.4.8",
67+
ca: { admin: "admin", adminpw: "adminpw", image_tag: "amd64-1.1.0" },
68+
69+
# Only use this field when you have a docker repository.
70+
repo: {
71+
# the url defines docker hub project access point
72+
# official hub - url: "hyperledger/",
73+
# fabric build hub - url: "nexus3.hyperledger.org:10001/hyperledger/",
74+
url: "hyperledger/",
75+
76+
# locations to download fabric binaries. This url should point to a
77+
# compressed such as tar or zip file which contains necessary binaries
78+
# such as configtxgen, configtxlator, cryptogen etc.
79+
bin: "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/linux-amd64-1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz"
80+
}
81+
}

0 commit comments

Comments
 (0)