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

Use CNI plugin #115

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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