Page MenuHomeSoftware Heritage

Refactor profile::network to be more extensible
ClosedPublic

Authored by olasd on Tue, Sep 15, 11:18 AM.

Details

Summary
  • Make explicit routes on the private network configurable properly
  • Switch the networks dict to be keyed by the interface name
  • Enable other methods (than statics) of setting up the network interfaces
  • network: Add support for mtu value
  • network: Add support for extra settings
Test Plan

octocatalog-diff run on a few hosts that have a network configuration
shows only a change to the azure subnet (which is a /21 not a /24).

$ bin/octocatalog-diff -t current pergamon worker01        
Found host pergamon.softwareheritage.org
Found host worker01.softwareheritage.org
*** Running octocatalog-diff on host pergamon.softwareheritage.org
I, [2020-09-15T11:16:39.148902 #19998]  INFO -- : Catalogs compiled for pergamon.softwareheritage.org
I, [2020-09-15T11:16:40.182046 #19998]  INFO -- : Diffs computed for pergamon.softwareheritage.org
diff origin/production/pergamon.softwareheritage.org current/pergamon.softwareheritage.org
*******************************************
  Concat::Fragment[eth1_stanza] =>
   parameters =>
     content =>
      @@ -15,5 +15,5 @@
         down ip rule del from 192.168.100.29 table private
         down ip route del 192.168.128.0/24 via 192.168.100.125
      -  down ip route del 192.168.200.0/24 via 192.168.100.1
      +  down ip route del 192.168.200.0/21 via 192.168.100.1
         down ip route del 192.168.101.0/24 via 192.168.100.1
         down ip route flush cache
*******************************************
  Concat_fragment[eth1_stanza] =>
   parameters =>
     content =>
      @@ -15,5 +15,5 @@
         down ip rule del from 192.168.100.29 table private
         down ip route del 192.168.128.0/24 via 192.168.100.125
      -  down ip route del 192.168.200.0/24 via 192.168.100.1
      +  down ip route del 192.168.200.0/21 via 192.168.100.1
         down ip route del 192.168.101.0/24 via 192.168.100.1
         down ip route flush cache
*******************************************
  Debnet::Iface[eth1] =>
   parameters =>
     downs =>
      - ["ip route del default via 192.168.100.1 dev eth1 table private", "ip route del 192.168.100.0/24 src 192.168.100.29 dev eth1 table private", "ip rule del from 192.168.100.29 table private", "ip route del 192.168.128.0/24 via 192.168.100.125", "ip route del 192.168.200.0/24 via 192.168.100.1", "ip route del 192.168.101.0/24 via 192.168.100.1", "ip route flush cache"]
      + ["ip route del default via 192.168.100.1 dev eth1 table private", "ip route del 192.168.100.0/24 src 192.168.100.29 dev eth1 table private", "ip rule del from 192.168.100.29 table private", "ip route del 192.168.128.0/24 via 192.168.100.125", "ip route del 192.168.200.0/21 via 192.168.100.1", "ip route del 192.168.101.0/24 via 192.168.100.1", "ip route flush cache"]
*******************************************
*** End octocatalog-diff on pergamon.softwareheritage.org
*** Running octocatalog-diff on host worker01.softwareheritage.org
I, [2020-09-15T11:16:44.248318 #20055]  INFO -- : Catalogs compiled for worker01.softwareheritage.org
I, [2020-09-15T11:16:44.489755 #20055]  INFO -- : Diffs computed for worker01.softwareheritage.org
diff origin/production/worker01.softwareheritage.org current/worker01.softwareheritage.org
*******************************************
  Concat::Fragment[ens19_stanza] =>
   parameters =>
     content =>
      @@ -13,5 +13,5 @@
         down ip route del 192.168.100.0/24 src 192.168.100.21 dev ens19 table private
         down ip rule del from 192.168.100.21 table private
      -  down ip route del 192.168.200.0/24 via 192.168.100.1
      +  down ip route del 192.168.200.0/21 via 192.168.100.1
         down ip route del 192.168.101.0/24 via 192.168.100.1
         down ip route flush cache
*******************************************
  Concat_fragment[ens19_stanza] =>
   parameters =>
     content =>
      @@ -13,5 +13,5 @@
         down ip route del 192.168.100.0/24 src 192.168.100.21 dev ens19 table private
         down ip rule del from 192.168.100.21 table private
      -  down ip route del 192.168.200.0/24 via 192.168.100.1
      +  down ip route del 192.168.200.0/21 via 192.168.100.1
         down ip route del 192.168.101.0/24 via 192.168.100.1
         down ip route flush cache
*******************************************
  Debnet::Iface[ens19] =>
   parameters =>
     downs =>
      - ["ip route del default via 192.168.100.1 dev ens19 table private", "ip route del 192.168.100.0/24 src 192.168.100.21 dev ens19 table private", "ip rule del from 192.168.100.21 table private", "ip route del 192.168.200.0/24 via 192.168.100.1", "ip route del 192.168.101.0/24 via 192.168.100.1", "ip route flush cache"]
      + ["ip route del default via 192.168.100.1 dev ens19 table private", "ip route del 192.168.100.0/24 src 192.168.100.21 dev ens19 table private", "ip rule del from 192.168.100.21 table private", "ip route del 192.168.200.0/21 via 192.168.100.1", "ip route del 192.168.101.0/24 via 192.168.100.1", "ip route flush cache"]
*******************************************
*** End octocatalog-diff on worker01.softwareheritage.org

Diff Detail

Repository
rSPSITE puppet-swh-site
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

olasd created this revision.Tue, Sep 15, 11:18 AM
ardumont added inline comments.
site-modules/profile/manifests/network.pp
7

a dict of key interface (eth0, eth1, ...)

10
- type: private or none
14–15

instructions

lgtm

site-modules/profile/manifests/network.pp
21

i read this as the pick the value of key "type" if defined, else fallback to "static", am I correct?

ardumont accepted this revision.Tue, Sep 15, 1:40 PM
This revision is now accepted and ready to land.Tue, Sep 15, 1:40 PM
olasd added inline comments.Tue, Sep 15, 2:11 PM
site-modules/profile/manifests/network.pp
10

Not exactly, but yeah, I'll improve this comment

21

that is correct.

olasd updated this revision to Diff 13914.Tue, Sep 15, 5:41 PM
  • Improve networks profile module documentation
olasd marked 4 inline comments as done.Tue, Sep 15, 5:41 PM
ardumont accepted this revision.Tue, Sep 15, 5:43 PM
ardumont added inline comments.
site-modules/profile/manifests/network.pp
10

thx!