Merge "Add docker proxy configuration for kubernetes"

This commit is contained in:
Zuul
2019-01-30 14:39:08 +00:00
committed by Gerrit Code Review
2 changed files with 28 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
class platform::docker::params (
$package_name = 'docker-ce',
$package_name = 'docker-ce',
$http_proxy = undef,
$https_proxy = undef,
$no_proxy = undef,
) { }
class platform::docker::config
@@ -9,6 +12,22 @@ class platform::docker::config
if $::platform::kubernetes::params::enabled {
if $http_proxy or $https_proxy {
file { '/etc/systemd/system/docker.service.d':
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
}
-> file { '/etc/systemd/system/docker.service.d/http-proxy.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('platform/dockerproxy.conf.erb'),
}
}
Class['::platform::filesystem::docker'] ~> Class[$name]
service { 'docker':

View File

@@ -0,0 +1,8 @@
[Service]
<%- if @http_proxy -%>
Environment="HTTP_PROXY=<%= @http_proxy %>"
<%- end -%>
<%- if @https_proxy -%>
Environment="HTTPS_PROXY=<%= @https_proxy %>"
<%- end -%>
Environment="NO_PROXY=<%= @no_proxy %>"