Support for kubernetes version >1.24.

Starting from 1.24 kubernetes started to use different registry for it's
images. That results with inability for kuryr to use the newer versions.
In this commit support for both registry is added.

Closes-Bug: #1991757
Change-Id: I3576159e5afbeb788369519fee12788260b0555f
This commit is contained in:
Roman Dobosz 2022-10-14 11:42:51 +02:00
parent d300cb65e6
commit 45d8b5fbad
3 changed files with 19 additions and 15 deletions

View File

@ -1,5 +1,18 @@
#!/bin/bash
# Ugly hack for the image repository. Kubernetes team switched to new registry
# starting from 1.25 version.
# TODO(gryf): Remove this when kubernetes version will be bumped beyond 1.24.
MINOR=${KURYR_KUBERNETES_VERSION#*.}
MINOR=${MINOR%.*}
if [[ $MINOR -gt 23 ]]; then
KURYR_KUBEADMIN_IMAGE_REPOSITORY="registry.k8s.io"
else
KURYR_KUBEADMIN_IMAGE_REPOSITORY="k8s.gcr.io"
PULLARGS="--image-repository=${KURYR_KUBEADMIN_IMAGE_REPOSITORY}"
fi
function get_k8s_log_level {
if [[ ${ENABLE_DEBUG_LOG_LEVEL} == "True" ]]; then
echo "4"
@ -107,8 +120,6 @@ localAPIEndpoint:
nodeRegistration:
criSocket: "$cri_socket"
kubeletExtraArgs:
cni-bin-dir: "$CNI_PLUGIN_DIR"
cni-conf-dir: "$CNI_CONF_DIR"
enable-server: "true"
taints:
[]
@ -120,7 +131,7 @@ address: "0.0.0.0"
enableServer: true
cgroupDriver: $cgroup_driver
EOF
sudo kubeadm config images pull --image-repository=${KURYR_KUBEADMIN_IMAGE_REPOSITORY}
sudo kubeadm config images pull ${PULLARGS}
args="--config ${output_dir}/kubeadm-init.yaml"
# NOTE(gryf): skip installing kube proxy, kuryr will handle services.
args+=" --skip-phases=addon/kube-proxy"
@ -177,8 +188,6 @@ kind: JoinConfiguration
nodeRegistration:
criSocket: "$cri_socket"
kubeletExtraArgs:
cni-bin-dir: "$CNI_PLUGIN_DIR"
cni-conf-dir: "$CNI_CONF_DIR"
enable-server: "true"
taints:
[]

View File

@ -607,8 +607,6 @@ EOF
function generate_cni_daemon_set {
output_dir=$1
cni_health_server_port=$2
cni_bin_dir=${3:-/opt/cni/bin}
cni_conf_dir=${4:-/etc/cni/net.d}
local var_run=${VAR_RUN_PATH:-/var/run}
mkdir -p "$output_dir"
rm -f "${output_dir}/cni_ds.yml"
@ -704,10 +702,10 @@ EOF
volumes:
- name: bin
hostPath:
path: ${cni_bin_dir}
path: ${CNI_PLUGIN_DIR}
- name: net-conf
hostPath:
path: ${cni_conf_dir}
path: ${CNI_CONF_DIR}
- name: config-volume
configMap:
name: kuryr-config
@ -1101,7 +1099,7 @@ function _generate_containerized_kuryr_resources {
generate_kuryr_certificates_secret $output_dir $SSL_BUNDLE_FILE
generate_kuryr_service_account $output_dir
generate_controller_deployment $output_dir $KURYR_HEALTH_SERVER_PORT $KURYR_CONTROLLER_HA
generate_cni_daemon_set $output_dir $KURYR_CNI_HEALTH_SERVER_PORT $CNI_PLUGIN_DIR $CNI_CONF_DIR
generate_cni_daemon_set $output_dir $KURYR_CNI_HEALTH_SERVER_PORT
}
function run_containerized_kuryr_resources {

View File

@ -1,6 +1,6 @@
KURYR_HOME=${KURYR_HOME:-$DEST/kuryr-kubernetes}
CNI_PLUGIN_DIR=${CNI_PLUGIN_DIR:-${CNI_BIN_DIR:-/opt/cni/bin}}
CNI_CONF_DIR=${CNI_CONF_DIR:-$DEST/cni/conf}
CNI_PLUGIN_DIR=${CNI_PLUGIN_DIR:-/opt/cni/bin}
CNI_CONF_DIR=${CNI_CONF_DIR:-/etc/cni/net.d}
KURYR_CONFIG_DIR=${KURYR_CONFIG_DIR:-/etc/kuryr}
KURYR_CONFIG=${KURYR_CONFIG:-${KURYR_CONFIG_DIR}/kuryr.conf}
@ -96,6 +96,3 @@ KURYR_OVERCLOUD_VM_PORT=${KURYR_OVERCLOUD_VM_PORT:-port0}
KURYR_IPV6=${KURYR_IPV6:-False}
KURYR_DUAL_STACK=${KURYR_DUAL_STACK:-False}
SUBNETPOOL_KURYR_NAME_V6=${SUBNETPOOL_KURYR_NAME_V6:-"shared-kuryr-subnetpool-v6"}
# Kubeadmin
KURYR_KUBEADMIN_IMAGE_REPOSITORY=${KURYR_KUBEADMIN_IMAGE_REPOSITORY:-"k8s.gcr.io"}