mirror of https://github.com/k3s-io/k3s
Merge pull request #23312 from mikedanese/static-routes-salt
Auto commit by PR queue botpull/6/head
commit
3ec9f1e0a1
|
@ -24,7 +24,6 @@ Config | GCE | Vagrant | AWS |
|
|||
[kubelet](kubelet/) | M n | M n | M n |
|
||||
[logrotate](logrotate/) | M n | n | M n |
|
||||
[supervisord](supervisor/) | M n | M n | M n |
|
||||
[static-routes](static-routes/) (vsphere only) | | | |
|
||||
[base](base.sls) | M n | M n | M n |
|
||||
[kube-client-tools](kube-client-tools.sls) | M | M | M |
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
[ "$IFACE" == "eth0" ] || exit 0
|
||||
|
||||
{% for host, ip_addrs in salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', 'grain').items() %}
|
||||
{% set network_ipaddr = None %}
|
||||
{% if salt['network.ip_addrs']('eth0') is defined %}
|
||||
{% set network_ipaddr = salt['network.ip_addrs']('eth0')[0] %}
|
||||
{% elif salt['network.ip_addrs']('local') is defined %}
|
||||
{% set network_ipaddr = salt['network.ip_addrs']('local')[0] %}
|
||||
{% endif %}
|
||||
{% if network_ipaddr is defined and ip_addrs[0] != network_ipaddr %}
|
||||
{% set cidr = salt['mine.get'](host, 'grains.items')[host]['cbr-cidr'] %}
|
||||
route del -net {{ cidr }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
[ "$IFACE" == "eth0" ] || exit 0
|
||||
|
||||
{% for host, ip_addrs in salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', 'grain').items() %}
|
||||
{% set network_ipaddr = None %}
|
||||
{% if salt['network.ip_addrs']('eth0') %}
|
||||
{% set network_ipaddr = salt['network.ip_addrs']('eth0')[0] %}
|
||||
{% elif salt['network.ip_addrs']('local') %}
|
||||
{% set network_ipaddr = salt['network.ip_addrs']('local').first %}
|
||||
{% endif %}
|
||||
{% if network_ipaddr and ip_addrs[0] != network_ipaddr %}
|
||||
{% set cidr = salt['mine.get'](host, 'grains.items')[host]['cbr-cidr'] %}
|
||||
route add -net {{ cidr }} gw {{ ip_addrs[0] }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
|
@ -1,30 +0,0 @@
|
|||
# Add static routes to every minion to enable pods in the 10.244.x.x range to
|
||||
# reach each other. This is suboptimal, but necessary to let every pod have
|
||||
# its IP and have pods between minions be able to talk with each other.
|
||||
# This will be obsolete when we figure out the right way to make this work.
|
||||
|
||||
/etc/network/if-up.d/static-routes:
|
||||
file.managed:
|
||||
- source: salt://static-routes/if-up
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 755
|
||||
|
||||
/etc/network/if-down.d/static-routes:
|
||||
file.managed:
|
||||
- source: salt://static-routes/if-down
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 755
|
||||
|
||||
refresh-routes:
|
||||
cmd.wait_script:
|
||||
- source: salt://static-routes/refresh
|
||||
- cwd: /etc/network/
|
||||
- user: root
|
||||
- group: root
|
||||
- watch:
|
||||
- file: /etc/network/if-up.d/static-routes
|
||||
- file: /etc/network/if-down.d/static-routes
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Fake an ifup/ifdown event
|
||||
export IFACE=eth0
|
||||
|
||||
if-down.d/static-routes || true
|
||||
if-up.d/static-routes || true
|
Loading…
Reference in New Issue