Add support for Docker plugins (#4934)

* Add support for Docker plugins

* support multiple Docker plugins using looped include

* fix yamllint error
This commit is contained in:
rptaylor 2019-07-08 06:44:35 -07:00 committed by Kubernetes Prow Robot
parent c81b443d93
commit 324bc41097
4 changed files with 19 additions and 0 deletions

View file

@ -98,6 +98,7 @@ Stack](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/dns-stack.m
* *docker_options* - Commonly used to set * *docker_options* - Commonly used to set
``--insecure-registry=myregistry.mydomain:5000`` ``--insecure-registry=myregistry.mydomain:5000``
* *docker_plugins* - This list can be used to define [Docker plugins](https://docs.docker.com/engine/extend/) to install.
* *http_proxy/https_proxy/no_proxy* - Proxy variables for deploying behind a * *http_proxy/https_proxy/no_proxy* - Proxy variables for deploying behind a
proxy. Note that no_proxy defaults to all internal cluster IPs and hostnames proxy. Note that no_proxy defaults to all internal cluster IPs and hostnames
that correspond to each node. that correspond to each node.

View file

@ -0,0 +1,8 @@
---
- name: Install Docker plugin
command: docker plugin install --grant-all-permissions {{ docker_plugin | quote }}
when: docker_plugin is defined
register: docker_plugin_status
failed_when:
- docker_plugin_status.failed
- '"already exists" not in docker_plugin_status.stderr'

View file

@ -235,6 +235,12 @@
resolvconf_mode == 'docker_dns' and resolvconf_mode == 'docker_dns' and
installed_docker_version.stdout is version('1.12', '<') installed_docker_version.stdout is version('1.12', '<')
# Install each plugin using a looped include to make error handling in the included task simpler.
- include_tasks: docker_plugin.yml
loop: "{{ docker_plugins }}"
loop_control:
loop_var: docker_plugin
- name: Set docker systemd config - name: Set docker systemd config
import_tasks: systemd.yml import_tasks: systemd.yml

View file

@ -256,6 +256,10 @@ docker_options: >-
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current --signature-verification=false --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --signature-verification=false
{%- endif -%} {%- endif -%}
## A list of plugins to install using 'docker plugin install --grant-all-permissions'
## Empty by default so no plugins will be installed.
docker_plugins: []
# Experimental kubeadm etcd deployment mode. Available only for new deployment # Experimental kubeadm etcd deployment mode. Available only for new deployment
etcd_kubeadm_enabled: false etcd_kubeadm_enabled: false