Skip to content

Commit

Permalink
chore!: drop support for ubuntu 18.04 and centos8 and add support for…
Browse files Browse the repository at this point in the history
… almalinux8

Signed-off-by: Peter Balogh <[email protected]>
  • Loading branch information
pbalogh-sa committed Jan 31, 2022
1 parent f14b9e4 commit d98508c
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 174 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In order to run PKE, you need to meet the following requirements.

#### Operating system

`pke` currently is available for CentOS 7.x, RHEL 7.x. and **Ubuntu 18.04 LTS**.
`pke` currently is available for CentOS 8.x, RHEL 8.x. and **Ubuntu 20.04 LTS**.

> We recommend using Ubuntu since it contains a much newer Kernel version. If you need support for an OS not listed above feel free to contact us.
Expand Down
93 changes: 14 additions & 79 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,18 @@ Vagrant.configure("2") do |config|

$num_instances = 4

# centos 8 nodes
# almalinux 8 nodes
(1..$num_instances).each do |n|
config.vm.define "centos#{n}" do |node|
node.vm.box = "centos/8"

# Monkey patch for https://github.com/dotless-de/vagrant-vbguest/issues/367
class Foo < VagrantVbguest::Installers::CentOS
def has_rel_repo?
unless instance_variable_defined?(:@has_rel_repo)
rel = release_version
@has_rel_repo = communicate.test("yum repolist")
end
@has_rel_repo
end
config.vm.define "almalinux#{n}" do |node|
node.vm.box = "boxomatic/almalinux-8"
node.vm.box_version = "20220116.0.1"

class Foo < VagrantVbguest::Installers::Linux
def install_kernel_devel(opts=nil, &block)
cmd = "yum update kernel -y"
cmd = "dnf update kernel -y"
communicate.sudo(cmd, opts, &block)

cmd = "yum install -y kernel-devel"
cmd = "dnf install -y kernel-devel"
communicate.sudo(cmd, opts, &block)

cmd = "shutdown -r now"
Expand All @@ -48,9 +40,9 @@ Vagrant.configure("2") do |config|
node.vbguest.installer = Foo

node.vm.network "private_network", ip: "192.168.64.#{n+10}"
node.vm.hostname = "centos#{n}"
node.vm.hostname = "almalinux#{n}"
node.vm.provider "virtualbox" do |vb|
vb.name = "centos#{n}"
vb.name = "almalinux#{n}"
vb.memory = "2048"
vb.cpus = "2"
vb.customize ["modifyvm", :id, "--audio", "none"]
Expand All @@ -68,14 +60,14 @@ Vagrant.configure("2") do |config|
echo 'ip_tables' >> /etc/modules-load.d/iptables.conf
echo 'set host name resolution'
cat >> /etc/hosts <<EOF
192.168.64.11 centos1
192.168.64.12 centos2
192.168.64.13 centos3
192.168.64.14 centos4
192.168.64.11 almalinux1
192.168.64.12 almalinux2
192.168.64.13 almalinux3
192.168.64.14 almalinux4
EOF
cat /etc/hosts
hostnamectl set-hostname centos#{n}
hostnamectl set-hostname almalinux#{n}
SHELL
end
Expand Down Expand Up @@ -123,63 +115,6 @@ EOF
end
end

config.vm.define "ubuntu-docker-bionic" do |node|
node.vm.box = "ubuntu/bionic64"
node.vm.network "private_network", ip: "192.168.64.30"
node.vm.hostname = "ubuntu-docker"

node.vm.provider "virtualbox" do |vb|
vb.name = "ubuntu-docker"
vb.memory = "2048"
vb.cpus = "2"
vb.customize ["modifyvm", :id, "--audio", "none"]
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end

node.vm.provision "shell" do |s|
s.inline = <<-SHELL
apt-get update
apt-get install -y ntp wget curl vim net-tools socat
echo 'sync time'
systemctl start ntp
systemctl enable ntp
echo 'set host name resolution'
cat >> /etc/hosts <<EOF
192.168.64.30 ubuntu-docker
EOF
cat /etc/hosts
hostnamectl set-hostname ubuntu-docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update && apt-get install -y \
containerd.io=1.2.13-1 \
docker-ce=5:19.03.8~3-0~ubuntu-$(lsb_release -cs) \
docker-ce-cli=5:19.03.8~3-0~ubuntu-$(lsb_release -cs)
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload
systemctl restart docker
SHELL
end
end

config.vm.define "ubuntu-docker-focal" do |node|
node.vm.box = "ubuntu/focal64"
node.vm.network "private_network", ip: "192.168.64.30"
Expand Down
29 changes: 29 additions & 0 deletions almalinux8-multi-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -e

# build latest pke tool
GOOS=linux make pke

KUBERNETES_VERSION="${1:-v1.21.0}"

# upgrade first master node
echo ""
echo "= almalinux1 ========================================================================"
vagrant ssh almalinux1 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION'"

# waiting 10 seconds because of apiserver
sleep 10

# upgrade second master node
echo ""
echo "= almalinux2 ========================================================================"
vagrant ssh almalinux2 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION' --kubernetes-additional-control-plane"

# upgrade third master node
echo ""
echo "= almalinux3 ========================================================================"
vagrant ssh almalinux3 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION' --kubernetes-additional-control-plane"

# upgrade worker node
echo ""
echo "= almalinux4 ========================================================================"
vagrant ssh almalinux4 -c "sudo /banzaicloud/pke upgrade worker --kubernetes-version='$KUBERNETES_VERSION'"
53 changes: 53 additions & 0 deletions almalinux8-multi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash -e

# prerequisitesSkipping phase due to missing Pipeline API endpoint credentials
jq --version || (echo "Please install jq command line tool. https://stedolan.github.io/jq/" && exit 1)

# build latest pke tool
GOOS=linux make pke

KUBERNETES_VERSION="${1:-v1.20.6}"

# install first master node
echo ""
echo "= almalinux1 ========================================================================"
vagrant up almalinux1
vagrant ssh almalinux1 -c "sudo sh -c 'echo -n "LANG=en_US.utf-8\nLC_ALL=en_US.utf-8" > /etc/environment'"
vagrant ssh almalinux1 -c "sudo /scripts/pke-multi-master1.sh '$KUBERNETES_VERSION' '192.168.64.11:6443'"
vagrant ssh almalinux1 -c 'sudo cat /etc/kubernetes/admin.conf' > pke-multi-config.yaml
vagrant ssh almalinux1 -c "sudo /banzaicloud/pke token list -o json" > build/token.json


TOKEN=`jq -r '.tokens[] | select(.expired == false) | .token' build/token.json`
CERTHASH=`jq -r '.tokens[] | select(.expired == false) | .hash' build/token.json`

echo ""
echo "Using '$TOKEN' and '$CERTHASH' to join other nodes to the cluster"

# install second master node
echo ""
echo "= almalinux2 ========================================================================"
vagrant up almalinux2
vagrant ssh almalinux2 -c "sudo /scripts/pke-multi-mastern.sh '$KUBERNETES_VERSION' '192.168.64.11:6443' '$TOKEN' '$CERTHASH' 192.168.64.12"

# install third master node
echo ""
echo "= almalinux3 ========================================================================"
vagrant up almalinux3
vagrant ssh almalinux3 -c "sudo /scripts/pke-multi-mastern.sh '$KUBERNETES_VERSION' '192.168.64.11:6443' '$TOKEN' '$CERTHASH' 192.168.64.13"

# install worker node
echo ""
echo "= almalinux4 ========================================================================"
vagrant up almalinux4
vagrant ssh almalinux4 -c "sudo /scripts/pke-multi-worker.sh '$KUBERNETES_VERSION' '192.168.64.11:6443' '$TOKEN' '$CERTHASH'"

export KUBECONFIG=$PWD/pke-multi-config.yaml

echo ""
echo "You can access your PKE cluster either:"
echo "- from your host machine accessing the cluster via kubectl. Please run:"
echo "export KUBECONFIG=$PWD/pke-multi-config.yaml"
echo ""
echo "- or starting a shell in the virtual machine. Please run:"
echo "vagrant ssh almalinux1 -c 'sudo -s'"
8 changes: 8 additions & 0 deletions almalinux8-single-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -e

# build latest pke tool
GOOS=linux make pke

KUBERNETES_VERSION="${1:-v1.21.0}"

vagrant ssh almalinux1 -c "sudo /banzaicloud/pke upgrade master --kubernetes-version='$KUBERNETES_VERSION'"
8 changes: 4 additions & 4 deletions centos8-single.sh → almalinux8-single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ GOOS=linux make pke

KUBERNETES_VERSION="${1:-v1.20.6}"

vagrant up centos1
vagrant ssh centos1 -c "sudo /scripts/pke-single.sh '$KUBERNETES_VERSION' '192.168.64.11:6443' containerd cilium"
vagrant ssh centos1 -c 'sudo cat /etc/kubernetes/admin.conf' > pke-single-config.yaml
vagrant up almalinux1
vagrant ssh almalinux1 -c "sudo /scripts/pke-single.sh '$KUBERNETES_VERSION' '192.168.64.11:6443' containerd cilium"
vagrant ssh almalinux1 -c 'sudo cat /etc/kubernetes/admin.conf' > pke-single-config.yaml

export KUBECONFIG=$PWD/pke-single-config.yaml

Expand All @@ -17,4 +17,4 @@ echo "- from your host machine accessing the cluster via kubectl. Please run:"
echo "export KUBECONFIG=$PWD/pke-single-config.yaml"
echo ""
echo "- or starting a shell in the virtual machine. Please run:"
echo "vagrant ssh centos1 -c 'sudo -s'"
echo "vagrant ssh almalinux1 -c 'sudo -s'"
29 changes: 0 additions & 29 deletions centos8-multi-upgrade.sh

This file was deleted.

53 changes: 0 additions & 53 deletions centos8-multi.sh

This file was deleted.

8 changes: 0 additions & 8 deletions centos8-single-upgrade.sh

This file was deleted.

0 comments on commit d98508c

Please sign in to comment.