Guest User

bird_ipam.cfg.template and toml

a guest
Dec 6th, 2019
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. r.gogunskiy@nb0267  r.gogunskiy/Desktop  diff bird_ipam.cfg.template.orig bird_ipam.cfg.template.my
  2. 3a4
  3. > {{- $block_key := printf "/ipam/v2/host/%s/ipv4/block" (getenv "NODENAME")}}
  4. 11c12
  5. <   if ( net ~ {{$cidr}} ) then { accept; }
  6. ---
  7. >   if ( net = {{$cidr}} ) then { accept; }
  8. 14,15c15,19
  9. < {{range ls "/v1/ipam/v4/pool"}}{{$data := json (getv (printf "/v1/ipam/v4/pool/%s" .))}}
  10. <   if ( net ~ {{$data.cidr}} ) then {
  11. ---
  12. > {{- if ls $block_key}}
  13. > {{- range ls $block_key}}
  14. > {{- $parts := split . "-"}}
  15. > {{- $cidr := join $parts "/"}}
  16. >   if ( net = {{$cidr}} ) then {
  17. 18a23
  18. > {{- end}}
  19.  
  20.  
  21.  
  22. ==================================================
  23. # cat bird_ipam.toml
  24. [template]
  25. src = "bird_ipam.cfg.template"
  26. dest = "/etc/calico/confd/config/bird_ipam.cfg"
  27. prefix = "/calico"
  28. keys = [
  29.     "/v1/ipam/v4/pool",
  30.     "/bgp/v1/host//NODENAME",
  31.     # added next:
  32.     "/ipam/v2/host//NODENAME/ipv4/block",
  33.     "/staticroutes",
  34.     "/rejectcidrs",
  35. ]
  36. reload_cmd = "pkill -HUP bird || true"
RAW Paste Data