This repository has been archived by the owner on May 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lukasz Zajaczkowski
authored and
Lukasz Zajaczkowski
committed
Jul 28, 2016
1 parent
341492e
commit 43b3b8c
Showing
5 changed files
with
308 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.