Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fac805dc11 | ||
|
94ea0b99ea | ||
|
56a80d84cf | ||
|
00c9174da4 | ||
|
ec8742c9ba | ||
|
b3b09aeb19 | ||
|
481d98c0b5 | ||
|
f30727a675 | ||
|
e1305937e6 | ||
|
20c4653ecf | ||
|
43c6da06a5 | ||
|
7ab84601c3 | ||
|
a24b23663c | ||
|
91fe744bd2 | ||
|
eb8fc045ee | ||
|
ba83b2871f |
@@ -169,6 +169,7 @@ List of flannel configuration parameters:
|
|||||||
- **ip_masq**: Install IP masquerade rules for traffic outside of flannel subnet
|
- **ip_masq**: Install IP masquerade rules for traffic outside of flannel subnet
|
||||||
- **subnet_file**: Path to flannel subnet file to write out
|
- **subnet_file**: Path to flannel subnet file to write out
|
||||||
- **interface**: Interface (name or IP) that should be used for inter-host communication
|
- **interface**: Interface (name or IP) that should be used for inter-host communication
|
||||||
|
- **public_ip**: IP accessible by other nodes for inter-host communication
|
||||||
|
|
||||||
[flannel-readme]: https://github.com/coreos/flannel/blob/master/README.md
|
[flannel-readme]: https://github.com/coreos/flannel/blob/master/README.md
|
||||||
|
|
||||||
|
@@ -21,6 +21,12 @@ mkisofs -R -V config-2 -o configdrive.iso /tmp/new-drive
|
|||||||
rm -r /tmp/new-drive
|
rm -r /tmp/new-drive
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If on OS X, replace the `mkisofs` invocation with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
hdiutil makehybrid -iso -joliet -default-volume-name config-2 -o configdrive.iso /tmp/new-drive
|
||||||
|
```
|
||||||
|
|
||||||
## QEMU virtfs
|
## QEMU virtfs
|
||||||
|
|
||||||
One exception to the above, when using QEMU it is possible to skip creating an
|
One exception to the above, when using QEMU it is possible to skip creating an
|
||||||
|
7
build
7
build
@@ -1,7 +1,10 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
NAME="coreos-cloudinit"
|
||||||
ORG_PATH="github.com/coreos"
|
ORG_PATH="github.com/coreos"
|
||||||
REPO_PATH="${ORG_PATH}/coreos-cloudinit"
|
REPO_PATH="${ORG_PATH}/${NAME}"
|
||||||
|
VERSION=$(git describe --dirty --tags)
|
||||||
|
GLDFLAGS="-X main.version \"${VERSION}\""
|
||||||
|
|
||||||
if [ ! -h gopath/src/${REPO_PATH} ]; then
|
if [ ! -h gopath/src/${REPO_PATH} ]; then
|
||||||
mkdir -p gopath/src/${ORG_PATH}
|
mkdir -p gopath/src/${ORG_PATH}
|
||||||
@@ -11,4 +14,4 @@ fi
|
|||||||
export GOBIN=${PWD}/bin
|
export GOBIN=${PWD}/bin
|
||||||
export GOPATH=${PWD}/gopath
|
export GOPATH=${PWD}/gopath
|
||||||
|
|
||||||
go build -o bin/coreos-cloudinit ${REPO_PATH}
|
go build -ldflags "${GLDFLAGS}" -o ${GOBIN}/${NAME} ${REPO_PATH}
|
||||||
|
@@ -16,15 +16,18 @@ package config
|
|||||||
|
|
||||||
type Etcd2 struct {
|
type Etcd2 struct {
|
||||||
AdvertiseClientURLs string `yaml:"advertise_client_urls" env:"ETCD_ADVERTISE_CLIENT_URLS"`
|
AdvertiseClientURLs string `yaml:"advertise_client_urls" env:"ETCD_ADVERTISE_CLIENT_URLS"`
|
||||||
CAFile string `yaml:"ca_file" env:"ETCD_CA_FILE"`
|
CAFile string `yaml:"ca_file" env:"ETCD_CA_FILE" deprecated:"ca_file obsoleted by trusted_ca_file and client_cert_auth"`
|
||||||
CertFile string `yaml:"cert_file" env:"ETCD_CERT_FILE"`
|
CertFile string `yaml:"cert_file" env:"ETCD_CERT_FILE"`
|
||||||
|
ClientCertAuth bool `yaml:"client_cert_auth" env:"ETCD_CLIENT_CERT_AUTH"`
|
||||||
CorsOrigins string `yaml:"cors" env:"ETCD_CORS"`
|
CorsOrigins string `yaml:"cors" env:"ETCD_CORS"`
|
||||||
DataDir string `yaml:"data_dir" env:"ETCD_DATA_DIR"`
|
DataDir string `yaml:"data_dir" env:"ETCD_DATA_DIR"`
|
||||||
|
Debug bool `yaml:"debug" env:"ETCD_DEBUG"`
|
||||||
Discovery string `yaml:"discovery" env:"ETCD_DISCOVERY"`
|
Discovery string `yaml:"discovery" env:"ETCD_DISCOVERY"`
|
||||||
DiscoveryFallback string `yaml:"discovery_fallback" env:"ETCD_DISCOVERY_FALLBACK"`
|
DiscoveryFallback string `yaml:"discovery_fallback" env:"ETCD_DISCOVERY_FALLBACK"`
|
||||||
DiscoverySRV string `yaml:"discovery_srv" env:"ETCD_DISCOVERY_SRV"`
|
DiscoverySRV string `yaml:"discovery_srv" env:"ETCD_DISCOVERY_SRV"`
|
||||||
DiscoveryProxy string `yaml:"discovery_proxy" env:"ETCD_DISCOVERY_PROXY"`
|
DiscoveryProxy string `yaml:"discovery_proxy" env:"ETCD_DISCOVERY_PROXY"`
|
||||||
ElectionTimeout int `yaml:"election_timeout" env:"ETCD_ELECTION_TIMEOUT"`
|
ElectionTimeout int `yaml:"election_timeout" env:"ETCD_ELECTION_TIMEOUT"`
|
||||||
|
ForceNewCluster bool `yaml:"force_new_cluster" env:"ETCD_FORCE_NEW_CLUSTER"`
|
||||||
HeartbeatInterval int `yaml:"heartbeat_interval" env:"ETCD_HEARTBEAT_INTERVAL"`
|
HeartbeatInterval int `yaml:"heartbeat_interval" env:"ETCD_HEARTBEAT_INTERVAL"`
|
||||||
InitialAdvertisePeerURLs string `yaml:"initial_advertise_peer_urls" env:"ETCD_INITIAL_ADVERTISE_PEER_URLS"`
|
InitialAdvertisePeerURLs string `yaml:"initial_advertise_peer_urls" env:"ETCD_INITIAL_ADVERTISE_PEER_URLS"`
|
||||||
InitialCluster string `yaml:"initial_cluster" env:"ETCD_INITIAL_CLUSTER"`
|
InitialCluster string `yaml:"initial_cluster" env:"ETCD_INITIAL_CLUSTER"`
|
||||||
@@ -33,12 +36,21 @@ type Etcd2 struct {
|
|||||||
KeyFile string `yaml:"key_file" env:"ETCD_KEY_FILE"`
|
KeyFile string `yaml:"key_file" env:"ETCD_KEY_FILE"`
|
||||||
ListenClientURLs string `yaml:"listen_client_urls" env:"ETCD_LISTEN_CLIENT_URLS"`
|
ListenClientURLs string `yaml:"listen_client_urls" env:"ETCD_LISTEN_CLIENT_URLS"`
|
||||||
ListenPeerURLs string `yaml:"listen_peer_urls" env:"ETCD_LISTEN_PEER_URLS"`
|
ListenPeerURLs string `yaml:"listen_peer_urls" env:"ETCD_LISTEN_PEER_URLS"`
|
||||||
|
LogPackageLevels string `yaml:"log_package_levels" env:"ETCD_LOG_PACKAGE_LEVELS"`
|
||||||
MaxSnapshots int `yaml:"max_snapshots" env:"ETCD_MAX_SNAPSHOTS"`
|
MaxSnapshots int `yaml:"max_snapshots" env:"ETCD_MAX_SNAPSHOTS"`
|
||||||
MaxWALs int `yaml:"max_wals" env:"ETCD_MAX_WALS"`
|
MaxWALs int `yaml:"max_wals" env:"ETCD_MAX_WALS"`
|
||||||
Name string `yaml:"name" env:"ETCD_NAME"`
|
Name string `yaml:"name" env:"ETCD_NAME"`
|
||||||
PeerCAFile string `yaml:"peer_ca_file" env:"ETCD_PEER_CA_FILE"`
|
PeerCAFile string `yaml:"peer_ca_file" env:"ETCD_PEER_CA_FILE" deprecated:"peer_ca_file obsoleted peer_trusted_ca_file and peer_client_cert_auth"`
|
||||||
PeerCertFile string `yaml:"peer_cert_file" env:"ETCD_PEER_CERT_FILE"`
|
PeerCertFile string `yaml:"peer_cert_file" env:"ETCD_PEER_CERT_FILE"`
|
||||||
PeerKeyFile string `yaml:"peer_key_file" env:"ETCD_PEER_KEY_FILE"`
|
PeerKeyFile string `yaml:"peer_key_file" env:"ETCD_PEER_KEY_FILE"`
|
||||||
Proxy string `yaml:"proxy" env:"ETCD_PROXY"`
|
PeerClientCertAuth bool `yaml:"peer_client_cert_auth" env:"ETCD_PEER_CLIENT_CERT_AUTH"`
|
||||||
SnapshotCount int `yaml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
|
PeerTrustedCAFile string `yaml:"peer_trusted_ca_file" env:"ETCD_PEER_TRUSTED_CA_FILE"`
|
||||||
|
Proxy string `yaml:"proxy" env:"ETCD_PROXY" valid:"^(on|off|readonly)$"`
|
||||||
|
ProxyDialTimeout int `yaml:"proxy_dial_timeout" env:"ETCD_PROXY_DIAL_TIMEOUT"`
|
||||||
|
ProxyFailureWait int `yaml:"proxy_failure_wait" env:"ETCD_PROXY_FAILURE_WAIT"`
|
||||||
|
ProxyReadTimeout int `yaml:"proxy_read_timeout" env:"ETCD_PROXY_READ_TIMEOUT"`
|
||||||
|
ProxyRefreshInterval int `yaml:"proxy_refresh_interval" env:"ETCD_PROXY_REFRESH_INTERVAL"`
|
||||||
|
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"`
|
||||||
}
|
}
|
||||||
|
@@ -23,4 +23,5 @@ type Flannel struct {
|
|||||||
IPMasq string `yaml:"ip_masq" env:"FLANNELD_IP_MASQ"`
|
IPMasq string `yaml:"ip_masq" env:"FLANNELD_IP_MASQ"`
|
||||||
SubnetFile string `yaml:"subnet_file" env:"FLANNELD_SUBNET_FILE"`
|
SubnetFile string `yaml:"subnet_file" env:"FLANNELD_SUBNET_FILE"`
|
||||||
Iface string `yaml:"interface" env:"FLANNELD_IFACE"`
|
Iface string `yaml:"interface" env:"FLANNELD_IFACE"`
|
||||||
|
PublicIP string `yaml:"public_ip" env:"FLANNELD_PUBLIC_IP"`
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "1.5.0"
|
|
||||||
datasourceInterval = 100 * time.Millisecond
|
datasourceInterval = 100 * time.Millisecond
|
||||||
datasourceMaxInterval = 30 * time.Second
|
datasourceMaxInterval = 30 * time.Second
|
||||||
datasourceTimeout = 5 * time.Minute
|
datasourceTimeout = 5 * time.Minute
|
||||||
@@ -68,6 +67,7 @@ var (
|
|||||||
oem string
|
oem string
|
||||||
validate bool
|
validate bool
|
||||||
}{}
|
}{}
|
||||||
|
version = "was not built properly"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -138,7 +138,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flags.printVersion == true {
|
if flags.printVersion == true {
|
||||||
fmt.Printf("coreos-cloudinit version %s\n", version)
|
fmt.Printf("coreos-cloudinit %s\n", version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,12 +15,10 @@
|
|||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
neturl "net/url"
|
neturl "net/url"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -55,16 +53,15 @@ type ErrNetwork struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HttpClient struct {
|
type HttpClient struct {
|
||||||
|
// Initial backoff duration. Defaults to 50 milliseconds
|
||||||
|
InitialBackoff time.Duration
|
||||||
|
|
||||||
// Maximum exp backoff duration. Defaults to 5 seconds
|
// Maximum exp backoff duration. Defaults to 5 seconds
|
||||||
MaxBackoff time.Duration
|
MaxBackoff time.Duration
|
||||||
|
|
||||||
// Maximum number of connection retries. Defaults to 15
|
// Maximum number of connection retries. Defaults to 15
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
|
|
||||||
// HTTP client timeout, this is suggested to be low since exponential
|
|
||||||
// backoff will kick off too. Defaults to 2 seconds
|
|
||||||
Timeout time.Duration
|
|
||||||
|
|
||||||
// Whether or not to skip TLS verification. Defaults to false
|
// Whether or not to skip TLS verification. Defaults to false
|
||||||
SkipTLS bool
|
SkipTLS bool
|
||||||
|
|
||||||
@@ -78,29 +75,12 @@ type Getter interface {
|
|||||||
|
|
||||||
func NewHttpClient() *HttpClient {
|
func NewHttpClient() *HttpClient {
|
||||||
hc := &HttpClient{
|
hc := &HttpClient{
|
||||||
|
InitialBackoff: 50 * time.Millisecond,
|
||||||
MaxBackoff: time.Second * 5,
|
MaxBackoff: time.Second * 5,
|
||||||
MaxRetries: 15,
|
MaxRetries: 15,
|
||||||
Timeout: time.Duration(2) * time.Second,
|
|
||||||
SkipTLS: false,
|
SkipTLS: false,
|
||||||
}
|
client: &http.Client{
|
||||||
|
Timeout: 10 * time.Second,
|
||||||
// We need to create our own client in order to add timeout support.
|
|
||||||
// TODO(c4milo) Replace it once Go 1.3 is officially used by CoreOS
|
|
||||||
// More info: https://code.google.com/p/go/source/detail?r=ada6f2d5f99f
|
|
||||||
hc.client = &http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
TLSClientConfig: &tls.Config{
|
|
||||||
InsecureSkipVerify: hc.SkipTLS,
|
|
||||||
},
|
|
||||||
Dial: func(network, addr string) (net.Conn, error) {
|
|
||||||
deadline := time.Now().Add(hc.Timeout)
|
|
||||||
c, err := net.DialTimeout(network, addr, hc.Timeout)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
c.SetDeadline(deadline)
|
|
||||||
return c, nil
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +114,7 @@ func (h *HttpClient) GetRetry(rawurl string) ([]byte, error) {
|
|||||||
|
|
||||||
dataURL := url.String()
|
dataURL := url.String()
|
||||||
|
|
||||||
duration := 50 * time.Millisecond
|
duration := h.InitialBackoff
|
||||||
for retry := 1; retry <= h.MaxRetries; retry++ {
|
for retry := 1; retry <= h.MaxRetries; retry++ {
|
||||||
log.Printf("Fetching data from %s. Attempt #%d", dataURL, retry)
|
log.Printf("Fetching data from %s. Attempt #%d", dataURL, retry)
|
||||||
|
|
||||||
|
51
test
51
test
@@ -1,19 +1,8 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
#
|
|
||||||
# Run all coreos-cloudinit tests
|
|
||||||
# ./test
|
|
||||||
# ./test -v
|
|
||||||
#
|
|
||||||
# Run tests for one package
|
|
||||||
# PKG=initialize ./test
|
|
||||||
#
|
|
||||||
|
|
||||||
# Invoke ./cover for HTML output
|
|
||||||
COVER=${COVER:-"-cover"}
|
|
||||||
|
|
||||||
source ./build
|
source ./build
|
||||||
|
|
||||||
declare -a TESTPKGS=(
|
SRC="
|
||||||
config
|
config
|
||||||
config/validate
|
config/validate
|
||||||
datasource
|
datasource
|
||||||
@@ -31,36 +20,22 @@ declare -a TESTPKGS=(
|
|||||||
network
|
network
|
||||||
pkg
|
pkg
|
||||||
system
|
system
|
||||||
)
|
"
|
||||||
|
|
||||||
if [ -z "$PKG" ]; then
|
echo "Checking gofix..."
|
||||||
GOFMTPATH="${TESTPKGS[*]} *.go"
|
go tool fix -diff $SRC
|
||||||
# prepend repo path to each package
|
|
||||||
TESTPKGS="${TESTPKGS[*]/#/${REPO_PATH}/} ./"
|
|
||||||
else
|
|
||||||
GOFMTPATH="$TESTPKGS"
|
|
||||||
# strip out slashes and dots from PKG=./foo/
|
|
||||||
TESTPKGS=${PKG//\//}
|
|
||||||
TESTPKGS=${TESTPKGS//./}
|
|
||||||
TESTPKGS=${TESTPKGS/#/${REPO_PATH}/}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running tests..."
|
|
||||||
go test -i ${TESTPKGS}
|
|
||||||
go test ${COVER} $@ ${TESTPKGS}
|
|
||||||
|
|
||||||
echo "Checking gofmt..."
|
echo "Checking gofmt..."
|
||||||
fmtRes=$(gofmt -l $GOFMTPATH)
|
gofmt -d -e $SRC
|
||||||
if [ -n "$fmtRes" ]; then
|
|
||||||
echo "$fmtRes"
|
# split SRC into an array and prepend REPO_PATH to each local package for go vet
|
||||||
exit 1
|
split_vet=(${SRC// / })
|
||||||
fi
|
VET_TEST=${split_vet[@]/#/${REPO_PATH}/}
|
||||||
|
|
||||||
echo "Checking govet..."
|
echo "Checking govet..."
|
||||||
vetRes=$(go vet $TESTPKGS)
|
go vet $VET_TEST
|
||||||
if [ -n "${vetRes}" ]; then
|
|
||||||
echo -e "govet checking failed:\n${vetRes}"
|
echo "Running tests..."
|
||||||
exit 255
|
go test -timeout 60s -cover $@ ${VET_TEST} --race
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Success"
|
echo "Success"
|
||||||
|
Reference in New Issue
Block a user