-
Notifications
You must be signed in to change notification settings - Fork 60
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 #350 from AkihiroSuda/dev
CI: shrink test matrix, etc.
- Loading branch information
Showing
7 changed files
with
66 additions
and
133 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
ARG BASE_IMAGE=docker.io/kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e | ||
ARG CNI_PLUGINS_VERSION=v1.6.1 | ||
ARG HELM_VERSION=v3.16.3 | ||
ARG FLANNEL_VERSION=v0.26.1 | ||
FROM ${BASE_IMAGE} | ||
COPY Dockerfile.d/SHA256SUMS.d/ /tmp/SHA256SUMS.d | ||
ARG CNI_PLUGINS_VERSION | ||
ARG HELM_VERSION | ||
ARG FLANNEL_VERSION | ||
RUN arch="$(uname -m | sed -e s/x86_64/amd64/ -e s/aarch64/arm64/)" && \ | ||
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}" && \ | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \ | ||
chmod 700 get_helm.sh && ./get_helm.sh && rm -f get_helm.sh | ||
fname="helm-${HELM_VERSION}-linux-${arch}.tar.gz" && \ | ||
curl -o "${fname}" -fSL "https://get.helm.sh/${fname}" && \ | ||
grep "${fname}" "/tmp/SHA256SUMS.d/helm-${HELM_VERSION}" | sha256sum -c && \ | ||
tar xzf "${fname}" -C /usr/local/bin --strip-components=1 -- "linux-${arch}/helm" && \ | ||
rm -f "${fname}" && \ | ||
fname="flannel.tgz" && \ | ||
curl -o "${fname}" -fSL "https://github.com/flannel-io/flannel/releases/download/${FLANNEL_VERSION}/${fname}" && \ | ||
grep "${fname}" "/tmp/SHA256SUMS.d/flannel-${FLANNEL_VERSION}" | sha256sum -c && \ | ||
tar xzf "${fname}" -C / && \ | ||
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 \ | ||
git | ||
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 @@ | ||
0289f15fb91b4a14bf5c66d34f8d0ac2aebc6e68e450dbecef4af9871884202b flannel.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,2 @@ | ||
f5355c79190951eed23c5432a3b920e071f4c00a64f75e077de0dd4cb7b294ea helm-v3.16.3-linux-amd64.tar.gz | ||
5bd34ed774df6914b323ff84a0a156ea6ff2ba1eaf0113962fa773f3f9def798 helm-v3.16.3-linux-arm64.tar.gz |
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,92 +1,12 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
function INFO() { | ||
echo >&2 -e "\e[104m\e[97m[INFO]\e[49m\e[39m $@" | ||
} | ||
function WARNING() { | ||
echo >&2 -e "\e[101m\e[97m[WARNING]\e[49m\e[39m $@" | ||
} | ||
|
||
function ERROR() { | ||
echo >&2 -e "\e[101m\e[97m[ERROR]\e[49m\e[39m $@" | ||
} | ||
|
||
# See chart values, 0 indicates default for platform | ||
# https://github.com/flannel-io/flannel/blob/v0.26.1/chart/kube-flannel/values.yaml | ||
: "${U7S_PORT_FLANNEL:='0'}" | ||
: "${U7S_PORT_ETCD:='2379'}" | ||
|
||
INFO "Flannel port: ${U7S_PORT_FLANNEL}" | ||
INFO "ETCD port: ${U7S_PORT_ETCD}" | ||
|
||
# Check hard dependency commands | ||
for cmd in helm kubectl git; do | ||
if ! command -v "${cmd}" >/dev/null 2>&1; then | ||
ERROR "Command \"${cmd}\" is not installed" | ||
exit 1 | ||
fi | ||
done | ||
|
||
# We need to customize the values.yaml to expose the backendPort and args | ||
flannel_root=$(mktemp -d -u -t flannel-XXXXXXX) | ||
git clone --quiet --depth 1 --branch v0.26.1 https://github.com/flannel-io/flannel $flannel_root | ||
cd $flannel_root/chart | ||
|
||
# Write a new values.yaml that exposes what we need | ||
cat <<EOF > ./new-values.yaml | ||
--- | ||
global: | ||
imagePullSecrets: | ||
# - name: "a-secret-name" | ||
# The IPv4 cidr pool to create on startup if none exists. Pod IPs will be | ||
# chosen from this range. | ||
podCidr: "10.244.0.0/16" | ||
podCidrv6: "" | ||
flannel: | ||
# kube-flannel image | ||
image: | ||
repository: docker.io/flannel/flannel | ||
tag: v0.26.1 | ||
image_cni: | ||
repository: docker.io/flannel/flannel-cni-plugin | ||
tag: v1.5.1-flannel2 | ||
# flannel command arguments | ||
enableNFTables: false | ||
args: | ||
- "--ip-masq" | ||
- "--kube-subnet-mgr" | ||
# Disabled, but left here for awareness that it can be set. | ||
# It is not used as kube-subnet-mgr is enabled: | ||
# https://github.com/flannel-io/flannel/blob/v0.26.1/Documentation/configuration.md | ||
# - "--etcd-endpoints=\"http://127.0.0.1:4001,https://${U7S_HOST_IP}:${U7S_PORT_ETCD},http://127.0.0.1:${U7S_PORT_ETCD}\"" | ||
# Backend for kube-flannel. Backend should not be changed | ||
# at runtime. (vxlan, host-gw, wireguard, udp) | ||
# Documentation at https://github.com/flannel-io/flannel/blob/master/Documentation/backends.md | ||
backend: "vxlan" | ||
# Port used by the backend 0 means default value (VXLAN: 8472, Wireguard: 51821, UDP: 8285) | ||
backendPort: ${U7S_PORT_FLANNEL} | ||
tolerations: | ||
- effect: NoExecute | ||
operator: Exists | ||
- effect: NoSchedule | ||
operator: Exists | ||
netpol: | ||
enabled: false | ||
EOF | ||
|
||
mv ./new-values.yaml ./kube-flannel/values.yaml | ||
|
||
# Run this first in case a failure with kubectl | ||
kubectl get pods -n kube-flannel | ||
# Fall back to warning so a re-install does not fail | ||
kubectl create namespace kube-flannel || WARNING "kube-flannel namespace might have been already created" | ||
kubectl label --overwrite namespace kube-flannel pod-security.kubernetes.io/enforce=privileged || true | ||
# If the command is issued again, this cleanup is needed | ||
helm delete flannel --namespace kube-flannel kube-flannel || true | ||
# We could also do --set flannel.backendPort=<value> but it's the same to set as the default | ||
helm install flannel --namespace kube-flannel kube-flannel | ||
cd - | ||
rm -rf $flannel_root | ||
if ! helm -n kube-flannel list -q | grep flannel; then | ||
kubectl create namespace kube-flannel | ||
kubectl label --overwrite namespace kube-flannel pod-security.kubernetes.io/enforce=privileged | ||
helm install flannel --namespace kube-flannel --set-json flannel.backendPort=${U7S_PORT_FLANNEL} /flannel | ||
fi |