Skip to content
Open
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
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ RUN arch="$(uname -m | sed -e s/x86_64/amd64/ -e s/aarch64/arm64/)" && \
RUN apt-get update && apt-get install -y --no-install-recommends \
gettext-base \
moreutils \
socat
socat ipset wget
ADD Dockerfile.d/etc_udev_rules.d_90-flannel.rules /etc/udev/rules.d/90-flannel.rules
ADD Dockerfile.d/etc_udev_rules.d_95-calico.rules /etc/udev/rules.d/95-calico.rules
ADD Dockerfile.d/u7s-entrypoint.sh /
# Calico
ENV FELIX_IGNORELOOSERPF=true
RUN wget https://github.com/projectcalico/calico/releases/download/v3.30.5/calicoctl-linux-amd64 -O /tmp/calicoctl && \
chmod +x /tmp/calicoctl && mv /tmp/calicoctl /usr/local/bin
ENTRYPOINT ["/u7s-entrypoint.sh", "/usr/local/bin/entrypoint", "/sbin/init"]
1 change: 1 addition & 0 deletions Dockerfile.d/etc_udev_rules.d_95-calico.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEM=="net", ACTION=="add|change|move", ENV{INTERFACE}=="vxlan.calico", RUN+="/usr/sbin/ethtool -K vxlan.calico tx-checksum-ip-generic off"
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export PORT_ETCD ?= 2379
export PORT_KUBELET ?= 10250
export PORT_FLANNEL ?= 8472
export PORT_KUBE_APISERVER ?= 6443
export PORT_CALICO ?= 5473

# HOSTNAME is the name of the physical host
export HOSTNAME ?= $(shell hostname)
Expand Down Expand Up @@ -35,6 +36,7 @@ NODE_SHELL := $(COMPOSE) exec \
-e NODE_IP=$(NODE_IP) \
-e PORT_KUBE_APISERVER=$(PORT_KUBE_APISERVER) \
-e PORT_FLANNEL=$(PORT_FLANNEL) \
-e PORT_CALICO=$(PORT_CALICO) \
-e PORT_KUBELET=$(PORT_KUBELET) \
-e PORT_ETCD=$(PORT_ETCD) \
$(NODE_SERVICE_NAME)
Expand Down Expand Up @@ -160,3 +162,18 @@ install-flannel:
# We don't actually need it there, just on the physical node, so we use newer K8s and older flannel
$(NODE_SHELL) kubectl apply -f https://github.com/flannel-io/flannel/releases/download/v0.25.1/kube-flannel.yml
#$(NODE_SHELL) /usernetes/Makefile.d/install-flannel.sh

.PHONY: install-calico
install-calico:
# Requires server side due to larger manifests
$(NODE_SHELL) kubectl apply --server-side -f /usernetes/Makefile.d/calico/calico-vxlan.yaml
# IP sets to autodetect, needs to be removed because will reset our change
$(NODE_SHELL) kubectl set env daemonset/calico-node IP- -n kube-system
# Allow pods to recreate
echo "Recreating calico pods..."
sleep 10
# Calico daemonset changes and node-level address changes
$(NODE_SHELL) /usernetes/Makefile.d/install-calico.sh
# applies ethtool -K vxlan.calico tx-checksum-ip-generic off
# check with: bridge fdb show dev vxlan.calico should have node address NOT 10.x address
$(NODE_SHELL) kubectl apply --server-side -f /usernetes/Makefile.d/calico/calico-ethtool.yaml
47 changes: 47 additions & 0 deletions Makefile.d/calico/calico-ethtool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: calico-checksum-fix
namespace: kube-system
labels:
k8s-app: calico-checksum-fix
spec:
selector:
matchLabels:
name: calico-checksum-fix
template:
metadata:
labels:
name: calico-checksum-fix
spec:
hostNetwork: true
hostPID: true
securityContext:
runAsUser: 0
initContainers:
- name: fix-checksum
image: ghcr.io/converged-computing/usernetes:alpine
# image: alpine:latest
command: ["/bin/sh", "-c"]
args:
- |
# nsenter -t 1 enters the init process's namespace (of the host)
# check if the interface exists before running ethtool
if [ -d /sys/class/net/vxlan.calico ]; then
echo "Applying ethtool fix to vxlan.calico..."
nsenter -t 1 -n -u -i -m -- ethtool -K vxlan.calico tx-checksum-ip-generic off
else
echo "vxlan.calico interface not found, skipping."
fi
iptables -I INPUT -p udp --dport 8472 -j ACCEPT
sysctl -w net.ipv4.conf.all.rp_filter=1
sysctl -w net.ipv4.conf.default.rp_filter=1
sysctl -w net.ipv4.conf.eth0.rp_filter=1
sysctl -w net.ipv4.conf.vxlan/calico.rp_filter=1
securityContext:
privileged: true
containers:
- name: pause
# image: registry.k8s.io/pause:3.9
image: ghcr.io/converged-computing/usernetes:pause
terminationGracePeriodSeconds: 0
Loading