Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1d962916b9 | ||
|
bda6668f00 | ||
|
0f828db9a3 | ||
|
5970000589 | ||
|
7870fa8c9d | ||
|
b4d45306b2 | ||
|
3c2b5e6636 | ||
|
bf743b3060 | ||
|
3b98be7788 | ||
|
746685023f |
@@ -76,4 +76,11 @@ coreos:
|
||||
etcd:
|
||||
addr: 203.0.113.29:4001
|
||||
peer-addr: 192.0.2.13:7001
|
||||
```
|
||||
```
|
||||
|
||||
## Bugs
|
||||
|
||||
Please use the [CoreOS issue tracker][bugs] to report all bugs, issues, and feature requests.
|
||||
|
||||
[bugs]: https://github.com/coreos/bugs/issues/new?labels=component/cloud-init
|
||||
|
||||
|
@@ -53,4 +53,5 @@ type Etcd2 struct {
|
||||
ProxyWriteTimeout int `yaml:"proxy_write_timeout" env:"ETCD_PROXY_WRITE_TIMEOUT"`
|
||||
SnapshotCount int `yaml:"snapshot_count" env:"ETCD_SNAPSHOT_COUNT"`
|
||||
TrustedCAFile string `yaml:"trusted_ca_file" env:"ETCD_TRUSTED_CA_FILE"`
|
||||
WalDir string `yaml:"wal_dir" env:"ETCD_WAL_DIR"`
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@ package config
|
||||
|
||||
type Fleet struct {
|
||||
AgentTTL string `yaml:"agent_ttl" env:"FLEET_AGENT_TTL"`
|
||||
AuthorizedKeysFile string `yaml:"authorized_keys_file" env:"FLEET_AUTHORIZED_KEYS_FILE"`
|
||||
DisableEngine bool `yaml:"disable_engine" env:"FLEET_DISABLE_ENGINE"`
|
||||
EngineReconcileInterval float64 `yaml:"engine_reconcile_interval" env:"FLEET_ENGINE_RECONCILE_INTERVAL"`
|
||||
EtcdCAFile string `yaml:"etcd_cafile" env:"FLEET_ETCD_CAFILE"`
|
||||
EtcdCertFile string `yaml:"etcd_certfile" env:"FLEET_ETCD_CERTFILE"`
|
||||
@@ -25,5 +27,7 @@ type Fleet struct {
|
||||
EtcdServers string `yaml:"etcd_servers" env:"FLEET_ETCD_SERVERS"`
|
||||
Metadata string `yaml:"metadata" env:"FLEET_METADATA"`
|
||||
PublicIP string `yaml:"public_ip" env:"FLEET_PUBLIC_IP"`
|
||||
TokenLimit int `yaml:"token_limit" env:"FLEET_TOKEN_LIMIT"`
|
||||
Verbosity int `yaml:"verbosity" env:"FLEET_VERBOSITY"`
|
||||
VerifyUnits bool `yaml:"verify_units" env:"FLEET_VERIFY_UNITS"`
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -129,6 +130,12 @@ var (
|
||||
func main() {
|
||||
failure := false
|
||||
|
||||
// Conservative Go 1.5 upgrade strategy:
|
||||
// keep GOMAXPROCS' default at 1 for now.
|
||||
if os.Getenv("GOMAXPROCS") == "" {
|
||||
runtime.GOMAXPROCS(1)
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if c, ok := oemConfigs[flags.oem]; ok {
|
||||
|
@@ -38,10 +38,11 @@ type Address struct {
|
||||
}
|
||||
|
||||
type Interface struct {
|
||||
IPv4 *Address `json:"ipv4"`
|
||||
IPv6 *Address `json:"ipv6"`
|
||||
MAC string `json:"mac"`
|
||||
Type string `json:"type"`
|
||||
IPv4 *Address `json:"ipv4"`
|
||||
IPv6 *Address `json:"ipv6"`
|
||||
AnchorIPv4 *Address `json:"anchor_ipv4"`
|
||||
MAC string `json:"mac"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type Interfaces struct {
|
||||
|
@@ -126,6 +126,32 @@ func parseInterface(iface digitalocean.Interface, nameservers []net.IP, useRoute
|
||||
})
|
||||
}
|
||||
}
|
||||
if iface.AnchorIPv4 != nil {
|
||||
var ip, mask, gateway net.IP
|
||||
if ip = net.ParseIP(iface.AnchorIPv4.IPAddress); ip == nil {
|
||||
return nil, fmt.Errorf("could not parse %q as anchor IPv4 address", iface.AnchorIPv4.IPAddress)
|
||||
}
|
||||
if mask = net.ParseIP(iface.AnchorIPv4.Netmask); mask == nil {
|
||||
return nil, fmt.Errorf("could not parse %q as anchor IPv4 mask", iface.AnchorIPv4.Netmask)
|
||||
}
|
||||
addresses = append(addresses, net.IPNet{
|
||||
IP: ip,
|
||||
Mask: net.IPMask(mask),
|
||||
})
|
||||
|
||||
if useRoute {
|
||||
if gateway = net.ParseIP(iface.AnchorIPv4.Gateway); gateway == nil {
|
||||
return nil, fmt.Errorf("could not parse %q as anchor IPv4 gateway", iface.AnchorIPv4.Gateway)
|
||||
}
|
||||
routes = append(routes, route{
|
||||
destination: net.IPNet{
|
||||
IP: net.IPv4zero,
|
||||
Mask: net.IPMask(net.IPv4zero),
|
||||
},
|
||||
gateway: gateway,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
hwaddr, err := net.ParseMAC(iface.MAC)
|
||||
if err != nil {
|
||||
|
@@ -258,6 +258,85 @@ func TestParseInterface(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
cfg: digitalocean.Interface{
|
||||
MAC: "01:23:45:67:89:AB",
|
||||
AnchorIPv4: &digitalocean.Address{
|
||||
IPAddress: "bad",
|
||||
Netmask: "255.255.0.0",
|
||||
},
|
||||
},
|
||||
nss: []net.IP{},
|
||||
err: errors.New("could not parse \"bad\" as anchor IPv4 address"),
|
||||
},
|
||||
{
|
||||
cfg: digitalocean.Interface{
|
||||
MAC: "01:23:45:67:89:AB",
|
||||
AnchorIPv4: &digitalocean.Address{
|
||||
IPAddress: "1.2.3.4",
|
||||
Netmask: "bad",
|
||||
},
|
||||
},
|
||||
nss: []net.IP{},
|
||||
err: errors.New("could not parse \"bad\" as anchor IPv4 mask"),
|
||||
},
|
||||
{
|
||||
cfg: digitalocean.Interface{
|
||||
MAC: "01:23:45:67:89:AB",
|
||||
AnchorIPv4: &digitalocean.Address{
|
||||
IPAddress: "1.2.3.4",
|
||||
Netmask: "255.255.0.0",
|
||||
Gateway: "bad",
|
||||
},
|
||||
},
|
||||
useRoute: true,
|
||||
nss: []net.IP{},
|
||||
err: errors.New("could not parse \"bad\" as anchor IPv4 gateway"),
|
||||
},
|
||||
{
|
||||
cfg: digitalocean.Interface{
|
||||
MAC: "01:23:45:67:89:AB",
|
||||
IPv4: &digitalocean.Address{
|
||||
IPAddress: "1.2.3.4",
|
||||
Netmask: "255.255.0.0",
|
||||
Gateway: "5.6.7.8",
|
||||
},
|
||||
AnchorIPv4: &digitalocean.Address{
|
||||
IPAddress: "7.8.9.10",
|
||||
Netmask: "255.255.0.0",
|
||||
Gateway: "11.12.13.14",
|
||||
},
|
||||
},
|
||||
useRoute: true,
|
||||
nss: []net.IP{},
|
||||
iface: &logicalInterface{
|
||||
hwaddr: net.HardwareAddr([]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab}),
|
||||
config: configMethodStatic{
|
||||
addresses: []net.IPNet{
|
||||
{
|
||||
IP: net.ParseIP("1.2.3.4"),
|
||||
Mask: net.IPMask(net.ParseIP("255.255.0.0")),
|
||||
},
|
||||
{
|
||||
IP: net.ParseIP("7.8.9.10"),
|
||||
Mask: net.IPMask(net.ParseIP("255.255.0.0")),
|
||||
},
|
||||
},
|
||||
nameservers: []net.IP{},
|
||||
routes: []route{
|
||||
{
|
||||
net.IPNet{IP: net.IPv4zero, Mask: net.IPMask(net.IPv4zero)},
|
||||
net.ParseIP("5.6.7.8"),
|
||||
},
|
||||
{
|
||||
net.IPNet{IP: net.IPv4zero, Mask: net.IPMask(net.IPv4zero)},
|
||||
net.ParseIP("11.12.13.14"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} {
|
||||
iface, err := parseInterface(tt.cfg, tt.nss, tt.useRoute)
|
||||
if !errorsEqual(tt.err, err) {
|
||||
|
Reference in New Issue
Block a user