1
0
mirror of https://github.com/rancher/os.git synced 2025-04-27 11:10:56 +00:00

Make loading service retries configurable

This commit is contained in:
niusmallnan 2019-12-19 15:03:05 +08:00 committed by niusmallnan
parent 88c5b5ef14
commit 29aaadd88c
4 changed files with 5 additions and 1 deletions

View File

@ -55,6 +55,7 @@ var schema = `{
"restart_services": {"type": "array"},
"hypervisor_service": {"type": "boolean"},
"shutdown_timeout": {"type": "integer"},
"http_load_retries": {"type": "integer"},
"preload_wait": {"type": "boolean"}
}
},

View File

@ -152,6 +152,7 @@ type RancherConfig struct {
RestartServices []string `yaml:"restart_services,omitempty"`
HypervisorService bool `yaml:"hypervisor_service,omitempty"`
ShutdownTimeout int `yaml:"shutdown_timeout,omitempty"`
HTTPLoadRetries int `yaml:"http_load_retries,omitempty"`
PreloadWait bool `yaml:"preload_wait,omitempty"`
}

View File

@ -1,5 +1,6 @@
rancher:
shutdown_timeout: 60
http_load_retries: 6
environment:
VERSION: {{.VERSION}}
SUFFIX: {{.SUFFIX}}

View File

@ -108,8 +108,9 @@ func LoadFromNetwork(location string) ([]byte, error) {
}
SetProxyEnvironmentVariables()
cfg := config.LoadConfig()
client := httpRetry.NewHTTPClient()
client.MaxRetries = 3
client.MaxRetries = cfg.Rancher.HTTPLoadRetries
log.Debugf("start trying LoadFromNetwork(%s)", location)
bytes, err := client.GetRetry(location)
if err != nil {