#!/bin/bash

[ "$IFACE" == "eth0" ] || exit 0

{% for host, ip_addrs in salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', 'grain').items() %}
{% if ip_addrs[0] != salt['network.ip_addrs']('eth0')[0] %}
{% set cidr = salt['mine.get'](host, 'grains.items')[host]['cbr-cidr'] %}
route add -net {{ cidr }} gw {{ ip_addrs[0] }}
{% endif %}
{% endfor %}
