Added support for rke2 kubeadm and containerd packages (#4)

This commit is contained in:
Venkat Srinivasan 2022-08-17 22:24:57 +05:30 committed by GitHub
parent 05cac9bf7e
commit 2b0b57bf8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 291 additions and 0 deletions

View File

@ -0,0 +1,26 @@
requires:
- name: "toolchain-ubuntu"
category: "development"
version: ">=0"
prelude:
{{$arch:=(default .Values.arch "amd64")}}
{{ if eq $arch "arm" }}
{{$arch:="arm64"}}
{{end}}
steps:
- curl -o containerd.tar.gz -L ${CONTAINERD_URL} && tar Cxzvf / containerd.tar.gz --absolute-names --transform 's@usr@opt@' --transform 's@sbin@bin@' --transform 's@opt/local@opt@' && rm containerd.tar.gz
- cp files/etc/systemd/system/containerd.service /etc/systemd/system
- mkdir /etc/systemd/system/containerd.service.d
- cp files/etc/systemd/system/containerd.service.d/*.conf /etc/systemd/system/containerd.service.d
- systemctl enable containerd
- mkdir /etc/containerd
- cp files/etc/containerd/config.toml /etc/containerd
- cp files/etc/modules-load.d/*.conf /etc/modules-load.d/
- cp files/etc/sysctl.d/*.conf /etc/sysctl.d
env:
- DEBIAN_FRONTEND=noninteractive
- CONTAINERD_TGZ="cri-containerd-{{.Values.containerd_version }}-linux-{{$arch}}.tar.gz"
- CONTAINERD_URL="https://github.com/containerd/containerd/releases/download/v{{.Values.containerd_version}}/${CONTAINERD_TGZ}"
excludes:
- /etc/crictl.yaml
- /opt/bin/crictl

View File

@ -0,0 +1,12 @@
packages:
- name: containerd
arch: amd64
category: container-runtime
version: 1.6.4
pause_image: "k8s.gcr.io/pause:3.6"
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.20.0"
containerd_version: "1.6.4"
runc_version: "1.1.2"
cni_version: "1.1.1"
containerd_cri_socket: "/var/run/containerd/containerd.sock"

View File

@ -0,0 +1,10 @@
name: containerd
category: container-runtime
version: "1.6.4"
pause_image: "k8s.gcr.io/pause:3.6"
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.20.0"
containerd_version: "1.6.4"
runc_version: "1.1.2"
cni_version: "1.1.1"
containerd_cri_socket: "/var/run/containerd/containerd.sock"

View File

@ -0,0 +1,11 @@
version = 2
imports = ["/etc/containerd/conf.d/*.toml"]
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "k8s.gcr.io/pause:3.6"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true

View File

@ -0,0 +1 @@
runtime-endpoint: unix:///var/run/containerd/containerd.sock

View File

@ -0,0 +1,2 @@
overlay
br_netfilter

View File

@ -0,0 +1,3 @@
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1

View File

@ -0,0 +1,40 @@
# Copyright The containerd Authors.
#
# 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.
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/opt/bin/containerd
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,6 @@
[Service]
Environment=PATH=/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
ExecStartPre=mkdir -p /run/docker/libcontainerd
ExecStartPre=ln -fs /run/containerd/containerd.sock /run/docker/libcontainerd/docker-containerd.sock
ExecStart=
ExecStart=/opt/bin/containerd --config /etc/containerd/config.toml

View File

@ -0,0 +1,3 @@
[Service]
# Do not limit the number of tasks that can be spawned by containerd
TasksMax=infinity

View File

@ -0,0 +1,8 @@
[Service]
# Decreases the likelihood that containerd is killed due to memory
# pressure.
#
# Please see the following link for more information about the
# OOMScoreAdjust configuration property:
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#OOMScoreAdjust=
OOMScoreAdjust=-999

View File

@ -0,0 +1,14 @@
{{ define "config" }}
version = 2
imports = ["/etc/containerd/conf.d/*.toml"]
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "{{.}}"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
{{ end }}

View File

@ -0,0 +1,14 @@
requires:
- name: "toolchain-ubuntu"
category: "development"
version: ">=0"
steps:
- mkdir /opt/bin
- curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{.Values.crictl_version}}/crictl-v{{.Values.crictl_version}}-linux-{{.Values.arch}}.tar.gz --output crictl-v{{.Values.crictl_version}}-linux-{{.Values.arch}}.tar.gz
- tar zxvf crictl-v{{.Values.crictl_version}}-linux-{{.Values.arch}}.tar.gz -C /opt/bin && rm -f crictl-v{{.Values.crictl_version}}-linux-{{.Values.arch}}.tar.gz
- cp files/etc/crictl.yaml /etc/crictl.yaml
- ./install-k8s.sh v{{ .Values.version }} {{ .Values.kubernetes_install_bin}} {{.Values.arch}}
env:
- DEBIAN_FRONTEND=noninteractive
- CNI_URL="https://github.com/containernetworking/plugins/releases/download/v{{.Values.cni_version}}/cni-plugins-linux-{{.Values.arch}}-v{{.Values.cni_version}}.tgz"

View File

@ -0,0 +1,33 @@
packages:
- name: kubeadm
arch: amd64
category: k8s
version: 1.23.8
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.22.0"
cni_version: "1.1.1"
kubernetes_install_bin : "/usr/bin"
- name: kubeadm
arch: amd64
category: k8s
version: 1.22.11
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.22.0"
cni_version: "1.1.1"
kubernetes_install_bin : "/usr/bin"
- name: kubeadm
arch: amd64
category: k8s
version: 1.22.9
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.22.0"
cni_version: "1.1.1"
kubernetes_install_bin : "/usr/bin"
- name: kubeadm
arch: amd64
category: k8s
version: 1.21.12
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.22.0"
cni_version: "1.1.1"
kubernetes_install_bin : "/usr/bin"

View File

@ -0,0 +1,7 @@
name: kubeadm
category: k8s
version: 1.22.9
kubernetes_http_source: "https://dl.k8s.io/release"
crictl_version: "1.22.0"
cni_version: "1.1.1"
kubernetes_install_bin : "/usr/bin"

View File

@ -0,0 +1 @@
runtime-endpoint: unix:///var/run/containerd/containerd.sock

View File

@ -0,0 +1 @@
KUBELET_EXTRA_ARGS="--pod-infra-container-image=k8s.gcr.io/pause:3.6"

View File

@ -0,0 +1,14 @@
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/home/
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS

View File

@ -0,0 +1,17 @@
#!/bin/bash
set -euxo pipefail
RELEASE=$1
DOWNLOAD_DIR=$2
ARCH=$3
cd $DOWNLOAD_DIR
sudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet,kubectl}
sudo chmod +x {kubeadm,kubelet,kubectl}
cd -
cat files/etc/systemd/system/kubelet.service | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service
sudo mkdir -p /etc/systemd/system/kubelet.service.d
cat files/etc/systemd/system/kubelet.service.d/10-kubeadm.conf | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
mkdir -p /etc/default
cp files/etc/default/kubelet /etc/default
systemctl enable kubelet

View File

@ -0,0 +1,19 @@
requires:
- name: "toolchain-ubuntu"
category: "development"
version: ">=0"
env:
- INSTALL_RKE2_VERSION=v{{.Values.version}}+{{.Values.rke2_release}}
- INSTALL_RKE2_TAR_PREFIX={{.Values.rke2_install_dir}}
- DEBIAN_FRONTEND=noninteractive
prelude:
- apt-get update && apt-get install -y curl systemd sudo
steps:
- curl -sfL {{.Values.rke2_http_source}} > installer.sh
- sed -i 's/systemctl daemon-reload//g' installer.sh
- sh installer.sh
- rm -rf installer.sh
- systemctl disable rke2-server rke2-agent
- curl -LO https://dl.k8s.io/release/v{{.Values.version}}/bin/linux/{{.Values.arch}}/kubectl && chmod +x kubectl && mv kubectl /usr/bin

View File

@ -0,0 +1,29 @@
packages:
- name: rke2
arch: amd64
category: k8s
version: 1.23.8
rke2_http_source: "https://get.rke2.io"
rke2_install_dir : "/opt/rke2"
rke2_release : "rke2r1"
- name: rke2
arch: amd64
category: k8s
version: 1.22.11
rke2_http_source: "https://get.rke2.io"
rke2_install_dir : "/opt/rke2"
rke2_release : "rke2r1"
- name: rke2
arch: amd64
category: k8s
version: 1.22.9
rke2_http_source: "https://get.rke2.io"
rke2_install_dir : "/opt/rke2"
rke2_release : "rke2r2"
- name: rke2
arch: amd64
category: k8s
version: 1.21.12
rke2_http_source: "https://get.rke2.io"
rke2_install_dir : "/opt/rke2"
rke2_release : "rke2r2"

View File

@ -0,0 +1,2 @@
mylist:
- 1.21.12-5

View File

@ -0,0 +1,3 @@
image: "ubuntu:20.04"
prelude:
- apt-get update && apt-get install -y curl systemd sudo

View File

@ -0,0 +1,4 @@
name: toolchain-ubuntu
category: development
version: "0.1"
hidden: true