Example #1
0
def partition_agent(host):
    """ Partition a node from all network traffic except for SSH and loopback

        :param hostname: host or IP of the machine to partition from the cluster
    """

    network.save_iptables(host)
    network.flush_all_rules(host)
    network.allow_all_traffic(host)
    network.run_iptables(host, ALLOW_SSH)
    network.run_iptables(host, ALLOW_PING)
    network.run_iptables(host, DISALLOW_MESOS)
    network.run_iptables(host, DISALLOW_INPUT)
Example #2
0
def partition_agent(host):
    """ Partition a node from all network traffic except for SSH and loopback

        :param hostname: host or IP of the machine to partition from the cluster
    """

    network.save_iptables(host)
    network.flush_all_rules(host)
    network.allow_all_traffic(host)
    network.run_iptables(host, ALLOW_SSH)
    network.run_iptables(host, ALLOW_PING)
    network.run_iptables(host, DISALLOW_MESOS)
    network.run_iptables(host, DISALLOW_INPUT)
Example #3
0
def partition_master(incoming=True, outgoing=True):
    """ Partition master's port alone. To keep DC/OS cluster running.

    :param incoming: Partition incoming traffic to master process. Default True.
    :param outgoing: Partition outgoing traffic from master process. Default True.
    """

    echo('Partitioning master. Incoming:{} | Outgoing:{}'.format(incoming, outgoing))

    network.save_iptables(shakedown.master_ip())
    network.flush_all_rules(shakedown.master_ip())
    network.allow_all_traffic(shakedown.master_ip())

    if incoming and outgoing:
        network.run_iptables(shakedown.master_ip(), DISABLE_MASTER_INCOMING)
        network.run_iptables(shakedown.master_ip(), DISABLE_MASTER_OUTGOING)
    elif incoming:
        network.run_iptables(shakedown.master_ip(), DISABLE_MASTER_INCOMING)
    elif outgoing:
        network.run_iptables(shakedown.master_ip(), DISABLE_MASTER_OUTGOING)
    else:
        pass