Skip to content

Commit

Permalink
Merge pull request #57 from ijc/various-fixes
Browse files Browse the repository at this point in the history
Metadata, duplicate binds and find fixes
  • Loading branch information
ijc authored Jan 31, 2018
2 parents d987e85 + 270086d commit 049cf07
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions pkg/kubelet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ RUN apk add --no-cache --initdb -p /out \
curl \
ebtables \
ethtool \
findutils \
iproute2 \
iptables \
musl \
Expand Down
9 changes: 0 additions & 9 deletions pkg/kubelet/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,3 @@ config:
- /var/lib/cni/bin
- /var/lib/kubelet-plugins
- /var/lib/nfs/statd/sm
mounts:
- type: bind
source: /var/lib/cni/bin
destination: /opt/cni/bin
options: ["rw","bind"]
- type: bind
source: /var/lib/cni/conf
destination: /etc/cni/net.d
options: ["rw","bind"]
4 changes: 2 additions & 2 deletions pkg/kubelet/kubeadm-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else
fi

# sorting by basename relies on the dirnames having the same number of directories
YAML=$(ls -1 /var/config/kube-system.init/*.yaml /etc/kubeadm/kube-system.init/*.yaml 2>/dev/null | sort --field-separator=/ --key=5)
YAML=$(ls -1 /run/config/kube-system.init/*.yaml /etc/kubeadm/kube-system.init/*.yaml 2>/dev/null | sort --field-separator=/ --key=5)
for i in ${YAML}; do
n=$(basename "$i")
if [ -e "$i" ] ; then
Expand All @@ -29,7 +29,7 @@ for i in ${YAML}; do
fi
fi
done
if [ -f /var/config/kubeadm/untaint-master ] ; then
if [ -f /run/config/kubeadm/untaint-master ] ; then
echo "Removing \"node-role.kubernetes.io/master\" taint from all nodes"
kubectl taint nodes --all node-role.kubernetes.io/master-
fi
Expand Down
28 changes: 14 additions & 14 deletions pkg/kubelet/kubelet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ if [ -e /etc/kubelet.sh.conf ] ; then
. /etc/kubelet.sh.conf
fi

if [ -f /var/config/kubelet/disabled ] ; then
echo "kubelet.sh: /var/config/kubelet/disabled file is present, exiting"
if [ -f /run/config/kubelet/disabled ] ; then
echo "kubelet.sh: /run/config/kubelet/disabled file is present, exiting"
exit 0
fi
if [ -n "$KUBELET_DISABLED" ] ; then
Expand All @@ -21,30 +21,30 @@ if [ ! -e /var/lib/cni/.opt.defaults-extracted ] ; then
touch /var/lib/cni/.opt.defaults-extracted
fi

if [ ! -e /var/lib/cni/.cni.conf-extracted ] && [ -d /var/config/cni ] ; then
if [ ! -e /var/lib/cni/.cni.conf-extracted ] && [ -d /run/config/cni ] ; then
mkdir -p /var/lib/cni/conf
cp /var/config/cni/* /var/lib/cni/conf/
cp /run/config/cni/* /var/lib/cni/conf/
touch /var/lib/cni/.cni.configs-extracted
fi

await=/etc/kubernetes/kubelet.conf

if [ -f "/etc/kubernetes/kubelet.conf" ] ; then
echo "kubelet.sh: kubelet already configured"
elif [ -d /var/config/kubeadm ] ; then
if [ -f /var/config/kubeadm/init ] ; then
echo "kubelet.sh: init cluster with metadata \"$(cat /var/config/kubeadm/init)\""
elif [ -d /run/config/kubeadm ] ; then
if [ -f /run/config/kubeadm/init ] ; then
echo "kubelet.sh: init cluster with metadata \"$(cat /run/config/kubeadm/init)\""
# This needs to be in the background since it waits for kubelet to start.
# We skip printing the token so it is not persisted in the log.
kubeadm-init.sh --skip-token-print $(cat /var/config/kubeadm/init) &
elif [ -e /var/config/kubeadm/join ] ; then
echo "kubelet.sh: joining cluster with metadata \"$(cat /var/config/kubeadm/join)\""
kubeadm join --ignore-preflight-errors=all $(cat /var/config/kubeadm/join)
kubeadm-init.sh --skip-token-print $(cat /run/config/kubeadm/init) &
elif [ -e /run/config/kubeadm/join ] ; then
echo "kubelet.sh: joining cluster with metadata \"$(cat /run/config/kubeadm/join)\""
kubeadm join --ignore-preflight-errors=all $(cat /run/config/kubeadm/join)
await=/etc/kubernetes/bootstrap-kubelet.conf
fi
elif [ -e /var/config/userdata ] ; then
echo "kubelet.sh: joining cluster with metadata \"$(cat /var/config/userdata)\""
kubeadm join --ignore-preflight-errors=all $(cat /var/config/userdata)
elif [ -e /run/config/userdata ] ; then
echo "kubelet.sh: joining cluster with metadata \"$(cat /run/config/userdata)\""
kubeadm join --ignore-preflight-errors=all $(cat /run/config/userdata)
await=/etc/kubernetes/bootstrap-kubelet.conf
fi

Expand Down
2 changes: 1 addition & 1 deletion yml/kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
image: linuxkit/sshd:4f403fe5ae53dc3e45c8f6972dced9dddf900ae6
cgroupsPath: systemreserved/sshd
- name: kubelet
image: linuxkit/kubelet:32dd112401be77a3590a50caf0410aa0ce4d21a9
image: linuxkit/kubelet:0513947feba7c6cdf5d8d815fb776a99011307ff
cgroupsPath: podruntime/kubelet
files:
- path: etc/linuxkit.yml
Expand Down

0 comments on commit 049cf07

Please sign in to comment.