Check if nodePort exists

Change-Id: Iec64aea75ac6d0afdf2943855227e2b8c2230d2a
This commit is contained in:
Andrey Pavlov 2017-03-07 18:38:46 +04:00
parent 66198b52ae
commit 24ebafb214
1 changed files with 4 additions and 3 deletions

View File

@ -81,9 +81,10 @@ def get_pod_states(components=None):
continue
states.setdefault(svc_name, copy.deepcopy(STATE_TEMPLATE))
for port in svc.obj["spec"]["ports"]:
states[svc_name]["links"].append(EXT_LINK_TEMPLATE.format(
ext_ip=ext_ip,
port=port["nodePort"]))
if port.get('nodePort'):
states[svc_name]["links"].append(EXT_LINK_TEMPLATE.format(
ext_ip=ext_ip,
port=port["nodePort"]))
return states