This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Avoid "already initialized constant" warnings | |
ssl_option_list = RestClient::Request::SSLOptionList | |
ssl_option_list << 'extra_chain_cert' | |
RestClient::Request.send(:remove_const, 'SSLOptionList') | |
RestClient::Request.const_set('SSLOptionList', ssl_option_list) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MonkeyPatches | |
module RestClientRequest | |
def net_http_object(hostname, port) | |
net = super(hostname, port) | |
extra_chain_cert = @ssl_opts[:extra_chain_cert] | |
net.extra_chain_cert = extra_chain_cert if extra_chain_cert | |
net | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MonkeyPatches | |
module KubeclientConfigMixin | |
def context(context_name = nil) | |
old = super(context_name) | |
new_ssl_options = old.ssl_options.merge( | |
:extra_chain_cert => client_certificate_intermediate_chain(context_name) | |
) | |
Context.new(old.api_endpoint, old.api_version, new_ssl_options, old.auth_options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require "kubeclient" | |
=> true | |
irb(main):002:0> config = Kubeclient::Config.read("/home/dana/.kube/config") | |
=> #<Kubeclient::Config:0x00560ede0bc528 ...> | |
irb(main):003:0> client = Kubeclient::Client.new( | |
irb(main):004:1* config.context.api_endpoint, | |
irb(main):005:1* config.context.api_version, | |
irb(main):006:1* { | |
irb(main):007:2* :ssl_options => config.context.ssl_options, | |
irb(main):008:2* :auth_options => config.context.auth_options |
OlderNewer