Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPDEV-110491] - Add new Kubernetes version v1.32 #711

Merged
merged 16 commits into from
Feb 3, 2025
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ca-key.pem
kubernetes.csr
kubernetes.pem
kubernetes-key.pem
/cluster.yaml
/cluster*.yaml
/additional.yaml
/procedure.yaml
venv/
Expand Down
39 changes: 31 additions & 8 deletions kubemarine/kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import math
import os
import time
import re
import json
from contextlib import contextmanager
from typing import List, Dict, Iterator, Any, Optional

Expand Down Expand Up @@ -531,13 +533,34 @@ def init_first_control_plane(group: NodeGroup) -> None:
# Remove default resolvConf from kubelet-config ConfigMap for debian OS family
first_control_plane.call(components.patch_kubelet_configmap)

# Preparing join_dict to init other nodes
control_plane_lines = list(result.values())[0].stdout. \
split("You can now join any number of the control-plane")[1].splitlines()[2:5]
worker_lines = list(result.values())[0].stdout. \
split("Then you can join any number of worker")[1].splitlines()[2:4]
control_plane_join_command = " ".join([x.replace("\\", "").strip() for x in control_plane_lines])
worker_join_command = " ".join([x.replace("\\", "").strip() for x in worker_lines])
stdout_output = list(result.values())[0].stdout

# regex patterns for variations in msg for kubeadm init command
control_plane_pattern = (
r"You can now join any number of (?:the )?control-plane node[s]?.*?"
r"(\n\s+kubeadm join[^\n]+(?:\n\s+--[^\n]+)*)"
)
worker_pattern = r"Then you can join any number of worker nodes.*?(\n\s+kubeadm join[^\n]+(?:\n\s+--[^\n]+)*)"

control_plane_match = re.search(control_plane_pattern, stdout_output, re.DOTALL)
if control_plane_match:
control_plane_lines = control_plane_match.group(1).splitlines()
control_plane_lines = [line.strip() for line in control_plane_lines if line.strip()]
if not control_plane_lines:
raise ValueError("Extracted control-plane join command block is empty")
control_plane_join_command = " ".join(control_plane_lines).replace("\\", "").strip()
else:
raise ValueError("Failed to extract control-plane join command from kubeadm output")

worker_match = re.search(worker_pattern, stdout_output, re.DOTALL)
if worker_match:
worker_lines = worker_match.group(1).splitlines()
worker_lines = [line.strip() for line in worker_lines if line.strip()]
if not worker_lines:
raise ValueError("Extracted worker join command block is empty")
worker_join_command = " ".join(worker_lines).replace("\\", "").strip()
else:
raise ValueError("Failed to extract worker join command from kubeadm output")

# TODO: Get rid of this code and use get_join_dict() method
args = control_plane_join_command.split("--")
Expand Down Expand Up @@ -1267,4 +1290,4 @@ def prepare_audit_policy(group: NodeGroup) -> None:
policy_config_file = yaml.dump(policy_config)
utils.dump_file(cluster, policy_config_file, 'audit-policy.yaml')
# upload rules on cluster
group.put(io.StringIO(policy_config_file), audit_file_name, sudo=True, backup=True)
group.put(io.StringIO(policy_config_file), audit_file_name, sudo=True, backup=True)
24 changes: 16 additions & 8 deletions kubemarine/procedures/check_paas.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,22 @@ def kubelet_config(cluster: KubernetesCluster) -> None:
if failed_nodes:
messages.append(f"/var/lib/kubelet/config.yaml is not consistent with patches from inventory "
f"on nodes {', '.join(failed_nodes)}")

cluster.log.debug("Checking kubelet-config ConfigMap consistency with services.kubeadm_kubelet section")
diff = components.compare_configmap(cluster, 'kubelet-config')
if diff is not None:
msg = "kubelet-config ConfigMap is not consistent with services.kubeadm_kubelet section"
messages.append(msg)
cluster.log.debug(msg)
cluster.log.debug(diff + '\n')

k8s_version = cluster.inventory['services']['kubeadm']['kubernetesVersion']
minor_version = int(k8s_version.lstrip('v').split('.')[1])
# If minor version > 31, skip checking kubelet-config ConfigMap consistency with services.kubeadm_kubelet section
if minor_version < 32:
cluster.log.debug("Checking kubelet-config ConfigMap consistency with services.kubeadm_kubelet section")
diff = components.compare_configmap(cluster, 'kubelet-config')
if diff is not None:
msg = "kubelet-config ConfigMap is not consistent with services.kubeadm_kubelet section"
messages.append(msg)
cluster.log.debug(msg)
cluster.log.debug(diff + '\n')
else:
raise TestWarn("Skipping kubelet-config ConfigMap consistency check",
hint="Kubernetes version is >= v1.32.0. The consistency check is no longer performed as the "\
"kubelet configuration is managed differently in newer versions. Verify manually if required.")

if not messages:
tc.success(results='valid')
pranavcracker marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ kube-apiserver:
version: v1.30.3
v1.31.1:
version: v1.31.1
v1.32.0:
version: v1.32.0
kube-controller-manager:
v1.27.1:
version: v1.27.1
Expand Down Expand Up @@ -70,6 +72,8 @@ kube-controller-manager:
version: v1.30.3
v1.31.1:
version: v1.31.1
v1.32.0:
version: v1.32.0
kube-scheduler:
v1.27.1:
version: v1.27.1
Expand Down Expand Up @@ -105,6 +109,8 @@ kube-scheduler:
version: v1.30.3
v1.31.1:
version: v1.31.1
v1.32.0:
version: v1.32.0
kube-proxy:
v1.27.1:
version: v1.27.1
Expand Down Expand Up @@ -140,6 +146,8 @@ kube-proxy:
version: v1.30.3
v1.31.1:
version: v1.31.1
v1.32.0:
version: v1.32.0
pause:
v1.27.1:
version: '3.9'
Expand Down Expand Up @@ -175,6 +183,8 @@ pause:
version: '3.9'
v1.31.1:
version: '3.10'
v1.32.0:
version: '3.10'
etcd:
v1.27.1:
version: 3.5.7-0
Expand Down Expand Up @@ -210,6 +220,8 @@ etcd:
version: 3.5.12-0
v1.31.1:
version: 3.5.15-0
v1.32.0:
version: 3.5.16-0
coredns/coredns:
v1.27.1:
version: v1.10.1
Expand Down Expand Up @@ -245,3 +257,5 @@ coredns/coredns:
version: v1.11.1
v1.31.1:
version: v1.11.3
v1.32.0:
version: v1.11.3
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ containerd:
version_debian: 1.7.*
v1.31.1:
version_debian: 1.7.*
v1.32.0:
version_debian: 1.7.*
containerdio:
v1.27.1:
version_rhel: 1.6*
Expand Down Expand Up @@ -108,6 +110,10 @@ containerdio:
version_rhel: 1.6*
version_rhel8: 1.6*
version_rhel9: 1.6*
v1.32.0:
version_rhel: 1.6*
version_rhel8: 1.6*
version_rhel9: 1.6*
haproxy:
version_rhel: 1.8*
version_rhel8: 1.8*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ calico:
version: v3.29.1
v1.31.1:
version: v3.29.1
v1.32.0:
version: v3.29.1
nginx-ingress-controller:
v1.27.1:
version: v1.8.4
Expand Down Expand Up @@ -91,6 +93,9 @@ nginx-ingress-controller:
v1.31.1:
version: v1.11.1
webhook-version: v1.4.1
v1.32.0:
version: v1.11.1
webhook-version: v1.4.1
kubernetes-dashboard:
v1.27.1:
version: v2.7.0
Expand Down Expand Up @@ -143,6 +148,9 @@ kubernetes-dashboard:
v1.31.1:
version: v2.7.0
metrics-scraper-version: v1.0.8
v1.32.0:
version: v2.7.0
metrics-scraper-version: v1.0.8
local-path-provisioner:
v1.27.1:
version: v0.0.25
Expand Down Expand Up @@ -195,3 +203,6 @@ local-path-provisioner:
v1.31.1:
version: v0.0.27
busybox-version: 1.34.1
v1.32.0:
version: v0.0.27
busybox-version: 1.34.1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ kubeadm:
sha1: f840e75f5dc1001ebdd7e286c0e87e1090df011b
v1.31.1:
sha1: 0a682af6436ce4e7188f93ddeebff5c2f3be1592
v1.32.0:
sha1: 981cdd31d4072fe65fb251c1158090f511d34610
kubelet:
v1.27.1:
sha1: 43cb7231a889c01cfd88bd3f27441134e3d1cbff
Expand Down Expand Up @@ -71,6 +73,8 @@ kubelet:
sha1: fbae53efc43ec715a45b05415294ab991ea087a2
v1.31.1:
sha1: fc7d0a9859c97ec2a2a4ac9ec1814b131e8d875f
v1.32.0:
sha1: e81e622c57721ddb31b92e09e2f2f0fc9f58562b
kubectl:
v1.27.1:
sha1: 0c3f1e262a6c37719ba4d66885df6715f58b60e5
Expand Down Expand Up @@ -106,6 +110,8 @@ kubectl:
sha1: 097d6b02fabb284418a9c95ea81fa86fc3c85bb7
v1.31.1:
sha1: a0fd9dc942f533e2bdeaa4b2691fc408e334f922
v1.32.0:
sha1: 0bc860f7bc83b991ee3b099e21504a60c515cfd7
calicoctl:
# calicoctl version is duplicated from kubemarine/resources/configurations/compatibility/kubernetes_versions.yaml
# It also corresponds to the plugin version in kubemarine/resources/configurations/compatibility/internal/plugins.yaml
Expand Down Expand Up @@ -160,6 +166,9 @@ calicoctl:
v1.31.1:
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.32.0:
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
crictl:
# crictl version is duplicated from kubemarine/resources/configurations/compatibility/kubernetes_versions.yaml
# for backward compatibility with clusters in a private environment.
Expand Down Expand Up @@ -214,3 +223,6 @@ crictl:
v1.31.1:
version: v1.30.0
sha1: c81e76d5d4bf64d6b513485490722d2fc0a9a83b
v1.32.0:
version: v1.32.0
sha1: c503051cf6e809a691f776ddf544abfc2a15e790
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ kubernetes_versions:
supported: true
v1.31:
supported: true
v1.32:
supported: true
compatibility_map:
# This section should be changed manually.
v1.27.1:
Expand Down Expand Up @@ -114,6 +116,12 @@ compatibility_map:
kubernetes-dashboard: v2.7.0
local-path-provisioner: v0.0.27
crictl: v1.30.0
v1.32.0:
calico: v3.29.1
nginx-ingress-controller: v1.11.1
kubernetes-dashboard: v2.7.0
local-path-provisioner: v0.0.27
crictl: v1.32.0
# After any change, please run scripts/thirdparties/sync.py

# The following optional keys are supported in addition to the 5 required software keys:
Expand Down