Skip to content

Commit

Permalink
Merge pull request #106 from platform9/private/vjoshi/v1.0/AIR-952
Browse files Browse the repository at this point in the history
AIR-952 Installing el8 keepalived for RHEL8.6
  • Loading branch information
vedantjoshi84 authored Apr 11, 2023
2 parents 94b306b + 398cdad commit 4621365
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,15 @@ nerdctl:
KEEPALIVED_DEB_U20 := https://github.com/hnakamur/keepalived-deb/releases/download/debian%2F1%252.1.3-1ubuntu1ppa1-focal/keepalived_2.1.3-1ubuntu1ppa1.focal_amd64.deb
KEEPALIVED_DEB_U18 := https://github.com/hnakamur/keepalived-deb/releases/download/debian%2F1%252.1.3-1ubuntu1ppa1-bionic/keepalived_2.1.3-1ubuntu1ppa1.bionic_amd64.deb
KEEPALIVED_RPM_CENTOS7 := https://github.com/hnakamur/keepalived-rpm/releases/download/2.1.3-1/keepalived-2.1.3-1.el7.x86_64.rpm
KEEPALIVED_RPM_RHEL86 := https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/keepalived-2.1.5-9.el8.x86_64.rpm

keepalived:
echo "Downloading Keepalived packages"
mkdir -p $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/keepalived_2.1.3-1ubuntu1ppa1.focal_amd64.deb -L ${KEEPALIVED_DEB_U20}
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/keepalived_2.1.3-1ubuntu1ppa1.bionic_amd64.deb -L ${KEEPALIVED_DEB_U18}
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/keepalived-2.1.3-1.el7.x86_64.rpm -L ${KEEPALIVED_RPM_CENTOS7}
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/keepalived-2.1.5-9.el8.x86_64.rpm -L ${KEEPALIVED_RPM_RHEL86}
# Download Ubuntu 18.04 dependency packages as well
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/libjansson4_2.11-1_amd64.deb -L http://archive.ubuntu.com/ubuntu/pool/main/j/jansson/libjansson4_2.11-1_amd64.deb
curl --output $(COMMON_SRC_ROOT)${KUBERNETES_EXECUTABLES}/keepalived_packages/libnftnl7_1.0.9-2_amd64.deb -L http://archive.ubuntu.com/ubuntu/pool/universe/libn/libnftnl/libnftnl7_1.0.9-2_amd64.deb
Expand Down Expand Up @@ -534,7 +536,7 @@ virtctl:
-include $(ROOT_DIR)/ip_type/Makefile
-include $(ROOT_DIR)/addr_conv/Makefile

jq:
jq:
echo "Downloading jq"
cd ${KUBERNETES_DIR} && \
${WGET_CMD} -O jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \
Expand Down Expand Up @@ -790,4 +792,3 @@ update-supported-version:
echo "promoting to $$s3_roles_root"; \
aws s3 cp --acl public-read $(BUILD_DIR)/artifacts/$(PF9_KUBE_VERSION) $${s3_roles_root}/$(PF9_KUBE_VERSION); \
done

4 changes: 3 additions & 1 deletion nodelet/pkg/pf9kube/pf9/pf9-kube/defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ ETCD_VERSION=3.4.14
ETCD_CONTAINER_IMG="gcr.io/etcd-development/etcd:v${ETCD_VERSION}"

# KEEPALIVED config directory
KEEPALIVED_VERSION="v2.1.3"
MASTER_VIP_KEEPALIVED_CONF_FILE="/etc/keepalived/keepalived.conf"
KEEPALIVED_VERSION_UBUNTU="v2.1.3"
KEEPALIVED_VERSION_RHEL7="v2.1.3"
KEEPALIVED_VERSION_RHEL8="v2.1.5"

#VRRP configs
VRRP_HEALTH_CHECK_INTERVAL=10
Expand Down
7 changes: 4 additions & 3 deletions nodelet/pkg/pf9kube/pf9/pf9-kube/os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,13 @@ function check_keepalived_installed()
echo "Keepalived found, checking version"
local keepalived_version_installed=$(keepalived --version 2>&1 >/dev/null | head -1 | cut -d " " -f 2)
echo "keepalived installed version = ${keepalived_version_installed}"
if [ ${keepalived_version_installed} == ${KEEPALIVED_VERSION} ]; then
echo "Expected Keepalived version is installed"
local keepalived_version_expected=$(get_expected_keepalived_version)
if [ ${keepalived_version_installed} == ${keepalived_version_expected} ]; then
echo "Expected Keepalived version ${keepalived_version_expected} is installed"
IS_KEEPALIVED_INSTALLED=1
return
fi
echo "Keepalived version ${KEEPALIVED_VERSION} expected but ${keepalived_version_installed} is found"
echo "Keepalived version ${keepalived_version_expected} expected but ${keepalived_version_installed} is found"
IS_KEEPALIVED_INSTALLED=0
return
fi
Expand Down
32 changes: 24 additions & 8 deletions nodelet/pkg/pf9kube/pf9/pf9-kube/os_centos.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source defaults.env
source runtime.sh
source /etc/os-release

PWD=$(pwd)
PF9_TE_FILE="$PWD/pf9.te"
Expand Down Expand Up @@ -385,21 +386,36 @@ function configure_containerd_http_proxy()
mkdir -p "$CONTAINERD_DROPIN_DIR"
cat > "$override_cfg" <<EOF
[Service]
Environment="HTTP_PROXY=${HTTP_PROXY}"
Environment="HTTP_PROXY=${HTTP_PROXY}"
Environment="HTTPS_PROXY=${HTTPS_PROXY}"
Environment="NO_PROXY=${NO_PROXY}"
EOF
systemctl daemon-reload
systemctl restart containerd
}

function install_keepalived()
function get_expected_keepalived_version()
{
echo "Removing keepalived"
# remove keepalived
yum erase -y keepalived
if [[ "$VERSION_ID" =~ ^8.* ]]; then
echo ${KEEPALIVED_VERSION_RHEL8}
else
# Assume it is 7.x
echo ${KEEPALIVED_VERSION_RHEL7}
fi
}

echo "Installing keepalived"
# install keepalived
yum install -y $KEEPALIVED_PACKAGE_DIR/keepalived-2.1.3-1.el7.x86_64.rpm
function install_keepalived()
{
echo "Removing keepalived"
# remove keepalived
yum erase -y keepalived

echo "Installing keepalived"
# install keepalived
if [[ "$VERSION_ID" =~ ^8.* ]]; then
yum install -y $KEEPALIVED_PACKAGE_DIR/keepalived-2.1.5-9.el8.x86_64.rpm
else
# Assume it is 7.x
yum install -y $KEEPALIVED_PACKAGE_DIR/keepalived-2.1.3-1.el7.x86_64.rpm
fi
}
11 changes: 8 additions & 3 deletions nodelet/pkg/pf9kube/pf9/pf9-kube/os_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function runtime_repo_installed()
{
if [ "$DOCKER_UBUNTU_REPO_URL" ]; then
apt-cache policy | grep -q "$DOCKER_UBUNTU_REPO_URL"
else
else
apt-cache policy | grep -q "https://download.docker.com/linux/ubuntu $(lsb_release -cs)/stable"
fi
}
Expand All @@ -67,7 +67,7 @@ function install_runtime_repo()

# Install the repository
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list

# if the upstream repo is not available use the updated repo
if [ "$DOCKER_UBUNTU_REPO_URL" ]; then
echo "deb $DOCKER_UBUNTU_REPO_URL" >> /etc/apt/sources.list.d/docker.list
Expand Down Expand Up @@ -263,14 +263,19 @@ function configure_containerd_http_proxy()
mkdir -p "$CONTAINERD_DROPIN_DIR"
cat > "$override_cfg" <<EOF
[Service]
Environment="HTTP_PROXY=${HTTP_PROXY}"
Environment="HTTP_PROXY=${HTTP_PROXY}"
Environment="HTTPS_PROXY=${HTTPS_PROXY}"
Environment="NO_PROXY=${NO_PROXY}"
EOF
systemctl daemon-reload
systemctl restart containerd
}

function get_expected_keepalived_version()
{
echo ${KEEPALIVED_VERSION_UBUNTU}
}

function install_keepalived()
{
# remove keepalived
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ fi
[ "$DEBUG" == "true" ] && set -x

function start() {
local config_dir="/etc/pf9/kube.d/kubeconfigs"
if [ "$ROLE" == "master" ]; then
kustomize_config
prepare_conf_files
Expand All @@ -26,9 +25,6 @@ function start() {
if [ "$ROLE" == "master" ]; then
prepare_rolebindings
fi

# Allow read, write on the config dir by owner but not by group, others
chmod -R 0600 $config_dir
}

function stop() {
Expand Down

0 comments on commit 4621365

Please sign in to comment.