1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Fix problems loading external services on boot (like ubuntu-console or kernel-headers)

On arm64 external services would not load on boot because of DNS i/o timeouts or valid TLS certificates appearing expired or not issued yet (I know that sounds weird).
This commit is contained in:
Ivan Mikushin
2016-03-31 11:07:35 -07:00
parent 95d24ac67d
commit 60e5ff7ede
4 changed files with 15 additions and 4 deletions

View File

@@ -177,7 +177,7 @@ func newCoreServiceProject(cfg *config.CloudConfig, network bool) (*project.Proj
go func() { go func() {
for event := range projectEvents { for event := range projectEvents {
if event.EventType == project.EventContainerStarted && event.ServiceName == "network" { if event.EventType == project.EventContainerStarted && event.ServiceName == "ntp" {
network = true network = true
} }
} }

View File

@@ -105,7 +105,7 @@ rancher:
io.rancher.os.detach: "false" io.rancher.os.detach: "false"
io.rancher.os.reloadconfig: "true" io.rancher.os.reloadconfig: "true"
io.rancher.os.scope: system io.rancher.os.scope: system
io.rancher.os.after: cloud-init-pre, wait-for-network io.rancher.os.after: cloud-init-pre, wait-for-network, ntp
net: host net: host
uts: host uts: host
privileged: true privileged: true
@@ -207,7 +207,7 @@ rancher:
image: {{.OS_IMAGES_ROOT}}/os-ntp:{{.VERSION}}{{.SUFFIX}} image: {{.OS_IMAGES_ROOT}}/os-ntp:{{.VERSION}}{{.SUFFIX}}
labels: labels:
io.rancher.os.scope: system io.rancher.os.scope: system
io.rancher.os.after: cloud-init, wait-for-network io.rancher.os.after: wait-for-network
net: host net: host
uts: host uts: host
privileged: true privileged: true

View File

@@ -196,6 +196,7 @@ if [ "$QEMU" == "1" ]; then
CPU="-cpu host" CPU="-cpu host"
fi fi
exec qemu-system-${QEMUARCH} -serial stdio \ exec qemu-system-${QEMUARCH} -serial stdio \
-rtc base=utc,clock=host \
${KVM_ENABLE} \ ${KVM_ENABLE} \
${CPU} \ ${CPU} \
${machine["$ARCH"]} \ ${machine["$ARCH"]} \

View File

@@ -274,6 +274,16 @@ func DirLs(dir string) ([]interface{}, error) {
return result, nil return result, nil
} }
func retryHttp(f func() (*http.Response, error), times int) (resp *http.Response, err error) {
for i := 0; i < times; i++ {
if resp, err = f(); err == nil {
return
}
log.Warnf("Error making HTTP request: %s. Retrying", err)
}
return
}
func LoadResource(location string, network bool, urls []string) ([]byte, error) { func LoadResource(location string, network bool, urls []string) ([]byte, error) {
var bytes []byte var bytes []byte
err := ErrNotFound err := ErrNotFound
@@ -282,7 +292,7 @@ func LoadResource(location string, network bool, urls []string) ([]byte, error)
if !network { if !network {
return nil, ErrNoNetwork return nil, ErrNoNetwork
} }
resp, err := http.Get(location) resp, err := retryHttp(func() (*http.Response, error) { return http.Get(location) }, 8)
if err != nil { if err != nil {
return nil, err return nil, err
} }