in deployment/clusterObjectModel/mainParser/machine.py [0:0]
def validation_host_properties(self):
cluster_cfg = self.cluster_configuration
etcd_id_visited = dict()
ip_visited = dict()
dashboard_count = 0
for host in cluster_cfg["machine-list"]:
if "hostip" not in host:
return False, "hostip is miss in the host [{0}]".format(str(host))
if pai_k8s_common.ipv4_address_validation(host["hostip"]) is False:
return False, "Please ensure the hostip is right, in the host [{0}]".format(str(host))
if host["hostip"] in ip_visited:
return False, "Duplicated IP address in machine-list. IP address is [{0}]".format(str(host["hostip"]))
ip_visited[host["hostip"]] = True
if "machine-type" not in host:
return False, "machine-type is miss in the host [{0}]".format(str(host))
if host["machine-type"] not in cluster_cfg["machine-sku"]:
return False, "machine-type [{0}] is not in machine-sku."
if "k8s-role" not in host:
return False, "k8s-role is miss in the host [{0}]".format(str(host))
if "k8s-role" is "master":
if "etcdid" not in host:
return False, "etcdid is miss in one of the host with the [k8s-role: master]."
if host["etcdid"] in etcd_id_visited:
return False, "Duplicated etcdid [{0}]. etcdid of each k8s master node shoule be unique.".format(host["etcdid"])
if "pai-master" in host and "zkid" not in host:
return False, "zkid is miss in one of the host with the [pai-master: true]"
if "dashboard" in host and host["dashboard"] == "true":
dashboard_count = dashboard_count + 1
if dashboard_count == 0:
return False, "dashboard label is miss."
return True, None