'Determine list of ports to expose at the container level, and add to existing_ports'

@staticmethod
def add_container_ports(ports, existing_ports):

    def _port_exists(port, protocol):
        found = [p for p in existing_ports if ((p['containerPort'] == int(port)) and (p['protocol'] == protocol))]
        return (len(found) > 0)
    for port in ports:
        protocol = 'TCP'
        if (isinstance(port, string_types) and ('/' in port)):
            (port, protocol) = port.split('/')
        if (isinstance(port, string_types) and (':' in port)):
            (_, port) = port.split(':')
        if (not _port_exists(port, protocol)):
            existing_ports.append({'containerPort': int(port), 'protocol': protocol.upper()})
