diff --git a/config/schema.go b/config/schema.go index 09d71864..23ae4735 100644 --- a/config/schema.go +++ b/config/schema.go @@ -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"} } }, diff --git a/config/types.go b/config/types.go index cbf32c5d..b7fb4250 100644 --- a/config/types.go +++ b/config/types.go @@ -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"` } diff --git a/os-config.tpl.yml b/os-config.tpl.yml index 4ca42ec5..f1f8587a 100644 --- a/os-config.tpl.yml +++ b/os-config.tpl.yml @@ -1,5 +1,6 @@ rancher: shutdown_timeout: 60 + http_load_retries: 6 environment: VERSION: {{.VERSION}} SUFFIX: {{.SUFFIX}} diff --git a/pkg/util/network/network.go b/pkg/util/network/network.go index 1c65bb5f..7a5c0f35 100644 --- a/pkg/util/network/network.go +++ b/pkg/util/network/network.go @@ -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 {