Skip to content

Commit

Permalink
-- push portalnet to zebra
Browse files Browse the repository at this point in the history
  • Loading branch information
Marian Schwarz committed Aug 23, 2015
1 parent a1ad09c commit 3a649c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -ex

# generate zebra conf
./k8s-quagga zebra
./k8s-quagga zebra --PortalNet ${K8S_QUAGGA_PORTALNET} --PortalGw ${K8S_QUAGGA_PORTALGW}

# generate ospfd conf
./k8s-quagga ospfd --Interface ${K8S_QUAGGA_INTERFACE} --RouterId ${K8S_QUAGGA_ROUTERID} --HomeNet ${K8S_QUAGGA_HOMENET} --PortalNet ${K8S_QUAGGA_PORTALNET} --ContainerNet ${K8S_QUAGGA_CONTAINERNET}
./k8s-quagga ospfd --Interface ${K8S_QUAGGA_INTERFACE} --RouterId ${K8S_QUAGGA_ROUTERID} --HomeNet ${K8S_QUAGGA_HOMENET} --ContainerNet ${K8S_QUAGGA_CONTAINERNET}

exec /usr/bin/supervisord -c /etc/supervisord.conf
31 changes: 22 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ type ospfconfig struct {
Interface string
RouterId string
HomeNet string
PortalNet string
ContainerNet string
}

type zebraconfig struct {
Password string
PortalNet string
PortalGw string
}

const zebraTemplate = `password {{.Password}}
log stdout
ip route {{.PortalNet}} {{.PortalGw}}
`

const ospfdTemplate = `
Expand All @@ -37,7 +41,6 @@ router ospf
log-adjacency-changes detail
default-information originate
network {{.HomeNet}} area 0.0.0.0
network {{.PortalNet}} area 0.0.0.0
network {{.ContainerNet}} area 0.0.0.0
`

Expand Down Expand Up @@ -79,11 +82,6 @@ func main() {
Value: "10.0.0.1",
Usage: "Router ID to announce",
},
cli.StringFlag{
Name: "PortalNet",
Value: "10.2.1.0/24",
Usage: "Portal Network CIDR",
},
cli.StringFlag{
Name: "ContainerNet",
Value: "10.2.0.0/24",
Expand All @@ -101,7 +99,6 @@ func main() {
Interface: c.String("Interface"),
RouterId: c.String("RouterId"),
HomeNet: c.String("HomeNet"),
PortalNet: c.String("PortalNet"),
ContainerNet: c.String("ContainerNet"),
}
f, err := os.Create(path.Join(c.GlobalString("output"), "ospfd.conf"))
Expand All @@ -116,8 +113,24 @@ func main() {
{
Name: "zebra",
Usage: "output zebra config",
Flags: []cli.Flag {
cli.StringFlag{
Name: "PortalNet",
Value: "10.2.0.0/24",
Usage: "Portal Network CIDR",
},
cli.StringFlag{
Name: "PortalGw",
Value: "10.0.1.4",
Usage: "Portal Network Gateway",
},
},
Action: func(c *cli.Context) {
config := zebraconfig{Password: c.GlobalString("password")}
config := zebraconfig{
Password: c.GlobalString("password"),
PortalNet: c.String("PortalNet"),
PortalGw: c.String("PortalGw"),
}
f, err := os.Create(path.Join(c.GlobalString("output"), "zebra.conf"))
check(err)
defer f.Close()
Expand Down

0 comments on commit 3a649c4

Please sign in to comment.