Skip to content

Commit 433822b

Browse files
committed
[CE-466] Genesis block not found in Orderer
When creating Fabric cluster on Kubernetes agent with kafka consensus type, the orderer pod will throw out an error about "genesis.block not found", because the genesis block is called "orderer.genesis.block", this patch is meant to correct that name. This patch also disable the Explorer setup too. CE-466 # done Change-Id: I267d020a41fac28156bf5461563dca0554efcb1d Signed-off-by: luke <jiahaochen1993@gmail.com>
1 parent 042637f commit 433822b

File tree

2 files changed

+12
-47
lines changed

2 files changed

+12
-47
lines changed

src/agent/k8s/cluster_operations.py

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ def _get_node_ip(self, node_name):
166166
def _get_node_ip_of_service(self, service_name):
167167
ret = self.corev1client.list_pod_for_all_namespaces(watch=False)
168168

169-
# The fabric-explorer service_name is different with it's pod
170-
if "fabric-explorer" in service_name:
171-
service_name = "fabric-explorer"
172-
173169
for i in ret.items:
174170
if i.metadata.name.startswith(service_name):
175171
return self._get_node_ip(i.spec.node_name)
@@ -214,13 +210,6 @@ def _get_service_external_port(self, namespace, ip):
214210
value = r_template.format(_port)
215211
results[name] = value
216212

217-
elif i.metadata.name.startswith("fabric-explorer"):
218-
name = "dashboard"
219-
for port in i.spec.ports:
220-
_port = port.node_port
221-
value = r_template.format(_port)
222-
results[name] = value
223-
224213
else:
225214
continue
226215

@@ -499,11 +488,12 @@ def _deploy_cluster_resource(self, cluster_name,
499488
cluster_ports,
500489
nfsServer_ip)
501490
else:
502-
file_data = self._render_config_file("orderer0.ordererorg-kafka\
503-
.tpl",
504-
cluster_name,
505-
cluster_ports,
506-
nfsServer_ip)
491+
file_data = self \
492+
._render_config_file("orderer0.ordererorg-kafka.tpl",
493+
cluster_name,
494+
cluster_ports,
495+
nfsServer_ip)
496+
507497
yaml_data = yaml.load_all(file_data)
508498
self._deploy_k8s_resource(yaml_data)
509499

@@ -548,31 +538,13 @@ def deploy_cluster(self, cluster_name, ports_index,
548538

549539
time.sleep(3)
550540

551-
# Disable explorer
552-
# fabric explorer at last
553-
# file_data = self._render_config_file("fabric-1-0-explorer.tpl",
554-
# cluster_name, cluster_ports,
555-
# nfsServer_ip)
556-
# yaml_data = yaml.load_all(file_data)
557-
# self._deploy_k8s_resource(yaml_data)
558-
559-
time.sleep(3)
560-
561541
return self._get_cluster_pods(cluster_name)
562542

563543
def _delete_cluster_resource(self, cluster_name,
564544
cluster_ports, nfsServer_ip, consensus):
565545
""" The order to delete the cluster is reverse to
566546
create except for namespace
567547
"""
568-
file_data = self._render_config_file("fabric-1-0-explorer.tpl",
569-
cluster_name, cluster_ports,
570-
nfsServer_ip)
571-
yaml_data = yaml.load_all(file_data)
572-
self._delete_k8s_resource(yaml_data)
573-
574-
time.sleep(3)
575-
576548
current_path = os.path.dirname(__file__)
577549
templates_path = os.path.join(current_path, "templates")
578550
for (dir_path, dir_name, file_list) in os.walk(templates_path):
@@ -610,10 +582,11 @@ def _delete_cluster_resource(self, cluster_name,
610582
cluster_ports,
611583
nfsServer_ip)
612584
else:
613-
file_data = self._render_config_file("orderer0.ordererorg-kafka\
614-
.tpl", cluster_name,
615-
cluster_ports,
616-
nfsServer_ip)
585+
file_data = self. \
586+
_render_config_file("orderer0.ordererorg-kafka.tpl",
587+
cluster_name,
588+
cluster_ports,
589+
nfsServer_ip)
617590

618591
time.sleep(3)
619592

@@ -652,12 +625,4 @@ def start_cluster(self, cluster_name, ports_index, nfsServer_ip,
652625
self._deploy_cluster_resource(cluster_name, cluster_ports,
653626
nfsServer_ip, consensus)
654627
time.sleep(2)
655-
# fabric explorer at last
656-
file_data = self._render_config_file("fabric-1-0-explorer.tpl",
657-
cluster_name,
658-
cluster_ports,
659-
nfsServer_ip)
660-
yaml_data = yaml.load_all(file_data)
661-
self._deploy_k8s_resource(yaml_data)
662-
time.sleep(2)
663628
return self._get_cluster_pods(cluster_name)

src/agent/k8s/templates/orderer0.ordererorg-kafka.tpl

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ spec:
6262
subPath: orderers/orderer.example.com/tls
6363
- mountPath: /var/hyperledger/orderer/orderer.genesis.block
6464
name: certificate
65-
subPath: genesis.block
65+
subPath: orderer.genesis.block
6666
- mountPath: /var/hyperledger/production
6767
name: certificate
6868
subPath: orderers/orderer.example.com/production

0 commit comments

Comments
 (0)