Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Use CNI plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Zajaczkowski authored and Lukasz Zajaczkowski committed Jul 28, 2016
1 parent 341492e commit 43b3b8c
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 207 deletions.
47 changes: 47 additions & 0 deletions docker-multinode/cni-plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Utility functions for Kubernetes in docker setup and for cni network plugin.

kube::cni::ensure_docker_settings(){

if kube::helpers::command_exists systemctl; then
local restart=false
DOCKER_CONF=$(systemctl cat docker | head -1 | awk '{print $2}')

# Clear mtu and bip when previously started in docker-bootstrap mode
if [[ ! -z $(grep "mtu=" ${DOCKER_CONF}) && ! -z $(grep "bip=" ${DOCKER_CONF}) ]]; then
sed -i 's/--mtu=.* --bip=.*//g' ${DOCKER_CONF}
restart=true
kube::log::status "The mtu and bip parameters removed"
fi

# If we can find MountFlags but not MountFlags=shared, set MountFlags to shared
if [[ ! -z $(grep "MountFlags" ${DOCKER_CONF}) && -z $(grep "MountFlags=shared" ${DOCKER_CONF}) ]]; then
sed -i.bak 's/^\(MountFlags=\).*/\1shared/' ${DOCKER_CONF}
restart=true
kube::log::status "The MountFlags set for shared"
fi

# Check if restart needed
if [[ ${restart} == true ]]; then
systemctl daemon-reload
systemctl restart docker
kube::log::status "Restarted docker with service file modification"
fi

fi
}
Loading

0 comments on commit 43b3b8c

Please sign in to comment.