Skip to content

Commit

Permalink
Merge pull request #10 from cben/kubeclient-timeout
Browse files Browse the repository at this point in the history
kubernetes_connect: add timeout settings
  • Loading branch information
simon3z authored May 15, 2017
2 parents 43d1d2d + e74b251 commit 1ee90b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def kubernetes_connect(hostname, port, options)
options[:version] || kubernetes_version,
:ssl_options => Kubeclient::Client::DEFAULT_SSL_OPTIONS.merge(options[:ssl_options] || {}),
:auth_options => kubernetes_auth_options(options),
:http_proxy_uri => VMDB::Util.http_proxy_uri
:http_proxy_uri => VMDB::Util.http_proxy_uri,
:timeouts => {
:open => Settings.ems.ems_kubernetes.open_timeout.to_f_with_method,
:read => Settings.ems.ems_kubernetes.read_timeout.to_f_with_method
}
)
end

Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
:network:
:critical:
- POD_HOSTPORTCONFLICT
:open_timeout: 60.seconds
:read_timeout: 60.seconds
:http_proxy:
:kubernetes:
:host:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
require 'kubeclient'
expect(Kubeclient::Client).to receive(:new).with(
instance_of(URI::HTTPS), 'v1',
hash_including(:http_proxy_uri => VMDB::Util.http_proxy_uri)
hash_including(:http_proxy_uri => VMDB::Util.http_proxy_uri,
:timeouts => match(:open => be > 0, :read => be > 0))
)
described_class.raw_connect(hostname, port, options)
end
Expand Down

0 comments on commit 1ee90b5

Please sign in to comment.