Skip to content

Commit

Permalink
CASMPET-7377 remove Prepare_kubeadm stage from prerequisites.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
leliasen-hpe committed Feb 10, 2025
1 parent 724732b commit de95bf0
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions upgrade/scripts/upgrade/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1042,70 +1042,6 @@ else
echo "====> ${state_name} has been completed" | tee -a "${LOG_FILE}"
fi

state_name="PREPARE_KUBEADM"
state_recorded=$(is_state_recorded "${state_name}" "$(hostname)")
if [[ ${state_recorded} == "0" ]]; then
echo "====> ${state_name} ..." | tee -a "${LOG_FILE}"
{
tmpdir=$(mktemp -d)

echo "Patching ConfigMap kubeadm-config ..."
kubectl -n kube-system get configmap kubeadm-config -o go-template --template '{{ .data.ClusterConfiguration }}' \
| yq4 e '.kubernetesVersion="1.24.17"' \
| yq4 e '.dns.imageRepository="artifactory.algol60.net/csm-docker/stable/registry.k8s.io/coredns"' \
| yq4 e '.imageRepository="artifactory.algol60.net/csm-docker/stable/registry.k8s.io"' \
| yq4 e '.apiServer.extraArgs.profiling="false"' \
| yq4 e '.controllerManager.extraArgs.terminated-pod-gc-threshold="250"' \
| yq4 e '.controllerManager.extraArgs.profiling="false"' \
> "${tmpdir}/kubeadm-config.yaml"
patch=$(jq -c -n --rawfile text "${tmpdir}/kubeadm-config.yaml" '.data["ClusterConfiguration"]=$text')
kubectl -n kube-system patch configmap kubeadm-config --type merge --patch "${patch}"

if kubectl -n kube-system get configmap -o custom-columns=name:.metadata.name --no-headers | grep -x -q -F kubelet-config-1.22; then
echo "Creating ConfigMap kubelet-config-1.24 ..."
kubectl -n kube-system get configmap kubelet-config-1.22 -o yaml \
| yq4 e '.metadata.name="kubelet-config-1.24"' \
| yq4 e 'del .metadata.creationTimestamp' \
| yq4 e 'del .metadata.resourceVersion' \
| yq4 e 'del .metadata.uid' \
| kubectl apply -f -
else
echo "ConfigMap kubelet-config-1.22 not found, assuming kubelet-config or kubelet-config-1.24 is already in place."
fi

if kubectl -n kube-system get role -o custom-columns=name:.metadata.name --no-headers | grep -x -q -F kubeadm:kubelet-config-1.22; then
echo "Creating Role kubeadm:kubelet-config-1.24 ..."
kubectl -n kube-system get role kubeadm:kubelet-config-1.22 -o yaml \
| yq4 e '.metadata.name="kubeadm:kubelet-config-1.24"' \
| yq4 e '.rules[0].resourceNames[0]="kubelet-config-1.24"' \
| yq4 e 'del .metadata.creationTimestamp' \
| yq4 e 'del .metadata.resourceVersion' \
| yq4 e 'del .metadata.uid' \
| kubectl apply -f -
else
echo "Role kubeadm:kubelet-config-1.22 not found, assuming kubeadm:kubelet-config or kubeadm:kubelet-config-1.24 is already in place."
fi

if kubectl -n kube-system get rolebinding -o custom-columns=name:.metadata.name --no-headers | grep -x -q -F kubeadm:kubelet-config-1.22; then
echo "Creating RoleBinding kubeadm:kubelet-config-1.24 ..."
kubectl -n kube-system get rolebinding kubeadm:kubelet-config-1.22 -o yaml \
| yq4 e '.metadata.name="kubeadm:kubelet-config-1.24"' \
| yq4 e '.roleRef.name="kubeadm:kubelet-config-1.24"' \
| yq4 e 'del .metadata.creationTimestamp' \
| yq4 e 'del .metadata.resourceVersion' \
| yq4 e 'del .metadata.uid' \
| kubectl apply -f -
else
echo "RoleBinding kubeadm:kubelet-config-1.22 not found, assuming kubeadm:kubelet-config or kubeadm:kubelet-config-1.24 is already in place."
fi

rm -rf "${tmpdir}"
} >> "${LOG_FILE}" 2>&1
record_state "${state_name}" "$(hostname)" | tee -a "${LOG_FILE}"
else
echo "====> ${state_name} has been completed" | tee -a "${LOG_FILE}"
fi

state_name="PREFLIGHT_CHECK"
state_recorded=$(is_state_recorded "${state_name}" "$(hostname)")
if [[ ${state_recorded} == "0" ]]; then
Expand Down

0 comments on commit de95bf0

Please sign in to comment.