Skip to content

Instantly share code, notes, and snippets.

@danajp
Last active May 24, 2017 17:28
Show Gist options
  • Save danajp/4c0476319b6fc8794aacbb091079fe06 to your computer and use it in GitHub Desktop.
Save danajp/4c0476319b6fc8794aacbb091079fe06 to your computer and use it in GitHub Desktop.
[net http blog] monkey patch kubeclient client
module MonkeyPatches
module KubeclientClientMixin
def create_rest_client(path = nil)
path ||= @api_endpoint.path
options = {
:ssl_ca_file => @ssl_options[:ca_file],
:ssl_cert_store => @ssl_options[:cert_store],
:verify_ssl => @ssl_options[:verify_ssl],
:ssl_client_cert => @ssl_options[:client_cert],
:ssl_client_key => @ssl_options[:client_key],
# pass extra_chain_cert to rest-client
:ssl_extra_chain_cert => @ssl_options.fetch(:extra_chain_cert, []),
:proxy => @http_proxy_uri,
:user => @auth_options[:username],
:password => @auth_options[:password]
}
RestClient::Resource.new(@api_endpoint.merge(path).to_s, options)
end
end
end
Kubeclient::Client.send(:prepend, MonkeyPatches::KubeclientClientMixin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment