Skip to content

Commit

Permalink
add provider_settings master function
Browse files Browse the repository at this point in the history
  • Loading branch information
Erez Freiberger committed Aug 2, 2017
1 parent e19c61d commit 408f9a8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,67 @@ module ManageIQ::Providers::Kubernetes::ContainerManager::Options

def proxy_settings
{
:http_proxy => {
:label => N_('HTTP Proxy'),
:help_text => N_('HTTP Proxy to connect image inspector pods to the internet'),
},
:https_proxy => {
:label => N_('HTTPS Proxy'),
:help_text => N_('HTTPS Proxy to connect image inspector pods to the internet'),
},
:no_proxy => {
:label => N_('NO Proxy'),
:help_text => N_('NO Proxy lists urls that should\'nt be sent to any proxy'),
:http_proxy => {
:label => N_('HTTP Proxy'),
:help_text => N_('HTTP Proxy to connect ManageIQ to the provider'),
:global_default => VMDB::Util.http_proxy_uri,
},
}
end

def advanced_settings
{
:image_inspector_options => {
:http_proxy => {
:label => N_('HTTP Proxy'),
:help_text => N_('HTTP Proxy to connect image inspector pods to the internet'),
},
:https_proxy => {
:label => N_('HTTPS Proxy'),
:help_text => N_('HTTPS Proxy to connect image inspector pods to the internet'),
},
:no_proxy => {
:label => N_('NO Proxy'),
:help_text => N_('NO Proxy lists urls that should\'nt be sent to any proxy'),
},
:repository => {
:label => N_('Image-Inspector Repository'),
:help_text => N_('Image-Inspector Repository'),
:global_default => Settings.ems.ems_kubernetes.image_inspector_repository,
},
:registry => {
:label => N_('Image-Inspector Registry'),
:help_text => N_('Registry to provide the image inspector repository'),
:global_default => Settings.ems.ems_kubernetes.image_inspector_registry,
},
:image_tag => {
:label => N_('Image-Inspector Tag'),
:help_text => N_('Image-Inspector image tag'),
:global_default => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::INSPECTOR_IMAGE_TAG,
},
:cve_url => {
:label => N_('CVE location'),
:help_text => N_('Enables defining a URL for XCCDF file instead of accessing the Internet'),
},
:label => N_('Image Inspector Options'),
:help_text => N_('Settings for Image Inspector tool'),
:settings => {
:http_proxy => {
:label => N_('HTTP Proxy'),
:help_text => N_('HTTP Proxy to connect image inspector pods to the internet'),
},
:https_proxy => {
:label => N_('HTTPS Proxy'),
:help_text => N_('HTTPS Proxy to connect image inspector pods to the internet'),
},
:no_proxy => {
:label => N_('NO Proxy'),
:help_text => N_('NO Proxy lists urls that should\'nt be sent to any proxy'),
},
:repository => {
:label => N_('Image-Inspector Repository'),
:help_text => N_('Image-Inspector Repository'),
:global_default => Settings.ems.ems_kubernetes.image_inspector_repository,
},
:registry => {
:label => N_('Image-Inspector Registry'),
:help_text => N_('Registry to provide the image inspector repository'),
:global_default => Settings.ems.ems_kubernetes.image_inspector_registry,
},
:image_tag => {
:label => N_('Image-Inspector Tag'),
:help_text => N_('Image-Inspector image tag'),
:global_default => ManageIQ::Providers::Kubernetes::ContainerManager::Scanning::Job::INSPECTOR_IMAGE_TAG,
},
:cve_url => {
:label => N_('CVE location'),
:help_text => N_('Enables defining a URL for XCCDF file instead of accessing the Internet'),
},
}
}
}
end

def provider_settings
{
:proxy_settings => {
:label => N_('Proxy Settings'),
:help_text => N_('Proxy Settings for connection to the provider'),
:settings => proxy_settings,
},
:advanced_settings => {
:label => N_('Advanced Settings'),
:help_text => N_('Advanced Settings for provider configuration'),
:settings => advanced_settings,
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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 => options[:http_proxy] || 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
Expand Down Expand Up @@ -108,11 +108,12 @@ def ssl_cert_store(endpoint = default_endpoint)

def connect(options = {})
effective_options = options.merge(
:hostname => options[:hostname] || address,
:port => options[:port] || port,
:user => options[:user] || authentication_userid(options[:auth_type]),
:pass => options[:pass] || authentication_password(options[:auth_type]),
:bearer => options[:bearer] || authentication_token(options[:auth_type] || 'bearer'),
:hostname => options[:hostname] || address,
:port => options[:port] || port,
:user => options[:user] || authentication_userid(options[:auth_type]),
:pass => options[:pass] || authentication_password(options[:auth_type]),
:bearer => options[:bearer] || authentication_token(options[:auth_type] || 'bearer'),
:http_proxy => self.options.fetch_path(:proxy_settings, :http_proxy),
:ssl_options => options[:ssl_options] || {
:verify_ssl => verify_ssl_mode,
:cert_store => ssl_cert_store
Expand Down

0 comments on commit 408f9a8

Please sign in to comment.