clearlinux / cloud-native-setup

Automation around setting up the cloud-native content (kubernetes) on Clear Linux.
Apache License 2.0
61 stars 41 forks source link

Fix create_stack for version 1.25 #347

Closed pwmorreale closed 1 year ago

pwmorreale commented 2 years ago

kubernetes 1.25 changed the key for the NoSchedule taint to 'control-plane'.

Fix the script to handle both pre and post version 1.25

Signed-off-by: Peter W. Morreale pwmorreale@gmail.com

comjf commented 1 year ago

Ha I should have checked the PRs before attempting my own fix here. I ran into the same issue, here is my solution that does the same thing:

diff --git a/clr-k8s-examples/create_stack.sh b/clr-k8s-examples/create_stack.sh
index e0a999a..60f12e2 100755
--- a/clr-k8s-examples/create_stack.sh
+++ b/clr-k8s-examples/create_stack.sh
@@ -117,7 +117,13 @@ function cluster_init() {

        #Ensure single node k8s works
        if [ "$(kubectl get nodes | wc -l)" -eq 2 ]; then
-               kubectl taint nodes --all node-role.kubernetes.io/master-
+              if [[ -n "${K8S_VER}" && $(echo "${K8S_VER}" | awk -F. '{print $2}') -lt 24 ]]; then
+                  kubectl taint nodes --all node-role.kubernetes.io/master-
+              else
+                  kubectl taint nodes --all node-role.kubernetes.io/control-plane-
+              fi
                mode="standalone"
        fi
 }

I think yours is a little better. However, I think the version change happened in 1.24 no?

I get that impression from reading:

pwmorreale commented 1 year ago

That might be correct. IIUC it was introduced in 1.24 and ‘master’ was removed in 1.25.

Unsure whether that actual matters for this distro since it apparently jumped to 1.25??? Did CL ever release 1.24?

Unfortunately I’m unable to check atm

Best, -PWM

On Nov 12, 2022, at 2:31 PM, James Flowers @.***> wrote:

 Ha I should have checked the PRs before attempting my own fix here. I ran into the same issue, here is my solution that does the same thing:

diff --git a/clr-k8s-examples/create_stack.sh b/clr-k8s-examples/create_stack.sh index e0a999a..60f12e2 100755 --- a/clr-k8s-examples/create_stack.sh +++ b/clr-k8s-examples/create_stack.sh @@ -117,7 +117,13 @@ function cluster_init() {

    #Ensure single node k8s works
    if [ "$(kubectl get nodes | wc -l)" -eq 2 ]; then
  • kubectl taint nodes --all node-role.kubernetes.io/master-
  • if [[ -t 0 ]]; then
  • if [[ -n "${K8S_VER}" && $(echo "${K8S_VER}" | awk -F. '{print $2}') -lt 24 ]]; then
  • kubectl taint nodes --all node-role.kubernetes.io/master-
  • else
  • kubectl taint nodes --all node-role.kubernetes.io/control-plane-
  • fi
  • fi mode="standalone" fi } I think yours is a little better. However, I think the version change happened in 1.24 no?

I get that impression from reading:

kubernetes/kubeadm#2200 https://groups.google.com/g/kubernetes-sig-cluster-lifecycle/c/XJhn8bpvHac/m/ZP1sN_20BwAJ?pli=1 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

pwmorreale commented 1 year ago

AFAICT, 1.24 includes both taints for new clusters, 1.25 only contains the 'control-plane' taint, and everything prior to 1.24 contains the 'master' taint.

https://github.com/kubernetes/kubernetes/pull/107533