From ce220836c38aefc3c23055643ef9da1dae373316 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Wed, 30 Mar 2016 13:37:26 +0100 Subject: [PATCH] Allow for local CNI binaries and configuration files with KUBERNETES_PROVIDER=vagrant. Files are taken from cluster/network-plugins/{bin,conf} to be consumed within a vagrant kube-up.sh environment. Paths used for configuration files and the 'cni' name of the network provider are all from the kubernetes documentation, but the actual implementation in the salt automation doesn't seem to exist. --- cluster/saltbase/salt/cni/init.sls | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cluster/saltbase/salt/cni/init.sls b/cluster/saltbase/salt/cni/init.sls index 544f33f522b..e9da08dc61a 100644 --- a/cluster/saltbase/salt/cni/init.sls +++ b/cluster/saltbase/salt/cni/init.sls @@ -5,6 +5,13 @@ - mode: 755 - makedirs: True +/etc/cni/net.d: + file.directory: + - user: root + - group: root + - mode: 755 + - makedirs: True + # These are all available CNI network plugins. cni-tar: archive: @@ -18,3 +25,17 @@ cni-tar: - archive_format: tar - if_missing: /opt/cni/bin +{% if grains['cloud'] is defined and grains.cloud in [ 'vagrant' ] %} +# Install local CNI network plugins in a Vagrant environment +cmd-local-cni-plugins: + cmd.run: + - name: | + cp -v /vagrant/cluster/network-plugins/cni/bin/* /opt/cni/bin/. + chmod +x /opt/cni/bin/* +cmd-local-cni-config: + cmd.run: + - name: | + cp -v /vagrant/cluster/network-plugins/cni/config/* /etc/cni/net.d/. + chown root:root /etc/cni/net.d/* + chmod 744 /etc/cni/net.d/* +{% endif -%}