-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from AkihiroSuda/fix-296
Remove `ip addr add "${U7S_HOST_IP}" dev eth0`
- Loading branch information
Showing
15 changed files
with
94 additions
and
274 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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
ARG BASE_IMAGE=docker.io/kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144 | ||
ARG CNI_PLUGINS_VERSION=v1.4.0 | ||
ARG BASE_IMAGE=docker.io/kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245 | ||
ARG CNI_PLUGINS_VERSION=v1.4.1 | ||
FROM ${BASE_IMAGE} | ||
# TODO: check SHA256SUMS of cni-plugins | ||
COPY Dockerfile.d/SHA256SUMS.d/ /tmp/SHA256SUMS.d | ||
ARG CNI_PLUGINS_VERSION | ||
RUN arch="$(uname -m | sed -e s/x86_64/amd64/ -e s/aarch64/arm64/)" && \ | ||
curl -fsSL https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${arch}-${CNI_PLUGINS_VERSION}.tgz \ | ||
| tar Cxzv /opt/cni/bin | ||
fname="cni-plugins-linux-${arch}-${CNI_PLUGINS_VERSION}.tgz" && \ | ||
curl -o "${fname}" -fSL "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/${fname}" && \ | ||
grep "${fname}" "/tmp/SHA256SUMS.d/cni-plugins-${CNI_PLUGINS_VERSION}" | sha256sum -c && \ | ||
mkdir -p /opt/cni/bin && \ | ||
tar xzf "${fname}" -C /opt/cni/bin && \ | ||
rm -f "${fname}" | ||
# gettext-base: for `envsubst` | ||
# moreutils: for `sponge` | ||
# socat: for `socat` (to silence "[WARNING FileExisting-socat]" from kubeadm) | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
gettext-base \ | ||
moreutils \ | ||
socat | ||
ADD Dockerfile.d/etc_udev_rules.d_90-flannel.rules /etc/udev/rules.d/90-flannel.rules | ||
ADD Dockerfile.d/u7s-entrypoint.sh / | ||
ENTRYPOINT ["/u7s-entrypoint.sh", "/usr/local/bin/entrypoint", "/sbin/init"] |
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,2 @@ | ||
1511f6c003ace805eafeb1132727791326283cff88a923d76329e1892bba7a10 cni-plugins-linux-amd64-v1.4.1.tgz | ||
72644e13557cda8a5b39baf97fc5e93d23fdf7baba7700000e7e9efd8bdf9234 cni-plugins-linux-arm64-v1.4.1.tgz |
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,5 @@ | ||
# Correct UDP checksums for VXLAN behind NAT | ||
# https://github.com/flannel-io/flannel/issues/1279 | ||
# https://github.com/kubernetes/kops/pull/9074 | ||
# https://github.com/karmab/kcli/commit/b1a8eff658d17cf4e28162f0fa2c8b2b10e5ad00 | ||
SUBSYSTEM=="net", ACTION=="add|change|move", ENV{INTERFACE}=="flannel.1", RUN+="/usr/sbin/ethtool -K flannel.1 tx-checksum-ip-generic off" |
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 |
---|---|---|
@@ -1,20 +1,10 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
|
||
# Append "---node-ip=${U7S_HOST_IP}" to "KUBELET_EXTRA_ARGS=..." in /etc/default/kubelet | ||
sed -e "s/\(^KUBELET_EXTRA_ARGS=.*\)/\\1 --node-ip=${U7S_HOST_IP}/" </etc/default/kubelet | sponge /etc/default/kubelet | ||
# Append "KUBELET_EXTRA_ARGS=..." in /etc/default/kubelet | ||
sed -e "s!\(^KUBELET_EXTRA_ARGS=.*\)!\\1 --cloud-provider=external --node-labels=usernetes/host-ip=${U7S_HOST_IP}!" </etc/default/kubelet | sponge /etc/default/kubelet | ||
|
||
# Let kubelet recognize ${U7S_HOST_IP} as its IP: | ||
# https://github.com/kubernetes/kubernetes/issues/54337#issuecomment-363597985 | ||
ip addr add "${U7S_HOST_IP}" dev eth0 | ||
|
||
cat <<EOF >/u7s-flanneld-wrapper.sh | ||
#!/bin/sh | ||
# Usage: /u7s-flanneld-wrapper.sh /opt/bin/flanneld --ip-masq --kube-subnet-mgr ... | ||
# This script is expected to be mounted inside a "docker.io/flannel/flannel" container. | ||
set -eux | ||
"\$@" --public-ip="${U7S_HOST_IP}" | ||
EOF | ||
chmod +x /u7s-flanneld-wrapper.sh | ||
# Import control plane hosts from previous boot | ||
[ -e /etc/hosts.u7s ] && cat /etc/hosts.u7s >>/etc/hosts | ||
|
||
exec "$@" |
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
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
File renamed without changes.
File renamed without changes.
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,19 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
for node in $(kubectl get nodes -o name); do | ||
# Set ExternalIP | ||
host_ip="$(kubectl get "${node}" -o jsonpath='{.metadata.labels.usernetes/host-ip}')" | ||
kubectl patch "${node}" --type=merge --subresource status --patch \ | ||
"\"status\": {\"addresses\": [{\"type\":\"ExternalIP\", \"address\": \"${host_ip}\"}]}" | ||
|
||
# Propagate ExternalIP to flannel | ||
# https://github.com/flannel-io/flannel/blob/v0.24.4/Documentation/kubernetes.md#annotations | ||
kubectl annotate "${node}" flannel.alpha.coreos.com/public-ip-overwrite=${host_ip} | ||
|
||
# Remove taints | ||
taints="$(kubectl get "${node}" -o jsonpath='{.spec.taints}')" | ||
if echo "${taints}" | grep -q node.cloudprovider.kubernetes.io/uninitialized; then | ||
kubectl taint nodes "${node}" node.cloudprovider.kubernetes.io/uninitialized- | ||
fi | ||
done |
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
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
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
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
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
Oops, something went wrong.