Skip to content

Unexpected rollout when using KCP and updating to v1.11 #13017

@chrischdi

Description

@chrischdi

What steps did you take and what happened?

make kind-cluster
export CLUSTER_TOPOLOGY=true
clusterctl init --wait-providers --core cluster-api:v1.10.8 --bootstrap kubeadm:v1.10.8 --control-plane kubeadm:v1.10.8 --infrastructure docker:v1.10.8

clusterctl-v1.10.5 generate cluster capi-quickstart --flavor development --kubernetes-version v1.32.8 --control-plane-machine-count=1 --worker-machine-count=1 > cluster.yaml

# pre-create custom KubeadmControlPlaneTemplate
cat <<EOF | kubectl create -f -
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
metadata:
  name: quick-start-control-plane
  namespace: default
spec:
  template:
    spec:
      kubeadmConfigSpec:
        clusterConfiguration:
          apiServer:
            timeoutForControlPlane: 20m
            certSANs:
            - localhost
            - 127.0.0.1
            - 0.0.0.0
            - host.docker.internal
        initConfiguration:
          nodeRegistration:
            kubeletExtraArgs:
              v: "4"
        joinConfiguration:
          nodeRegistration:
            kubeletExtraArgs:
              v: "4"
EOF

# Use `kubectl create` to not replace the above created template
kubectl create -f cluster.yaml

# remove mhc
kubectl edit clusterclass quick-start

kubectl wait --timeout=5m --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' cluster/capi-quickstart

kind get kubeconfig --name capi-quickstart > quickstart.kubeconfig
kubectl apply -f test/e2e/data/cni/kindnet/kindnet.yaml --kubeconfig quickstart.kubeconfig


# This command triggers a rollout for KCP.
clusterctl upgrade apply --wait-providers --contract v1beta2

What did you expect to happen?

No rollout to happen

Cluster API version

Update from v1.10.8 to v1.11.3

Kubernetes version

No response

Anything else you would like to add?

The diff happens because the v1beta1 version of KCP (before the upgrade):

  • has a value set at spec.kubeadmConfigSpec.clusterConfiguration.apiServer.timeoutForControlPlane

Conversion seems to lead that in v1beta2 it then detects a diff, because in the joinConfiguration there is nothing set for .timeouts.controlPlaneComponentsHealthCheckSeconds.

diff happening:

I1120 13:08:35.689312       1 controller.go:477] "Rolling out Control Plane machines: Machine capi-quickstart-shntc-8c4xj needs rollout: Machine KubeadmConfig InitConfiguration or JoinConfiguration are outdated: diff: &v1beta2.KubeadmConfigSpec{\n    ClusterConfiguration: {},\n    InitConfiguration: v1beta2.InitConfiguration{\n      BootstrapTokens: nil,\n      NodeRegistration: v1beta2.NodeRegistrationOptions{\n        Name:                  \"\",\n        CRISocket:             \"\",\n        Taints:                nil,\n-       KubeletExtraArgs:      []v1beta2.Arg{{Name: \"v\", Value: &\"4\"}},\n+       KubeletExtraArgs:      nil,\n        IgnorePreflightErrors: nil,\n        ImagePullPolicy:       \"IfNotPresent\",\n        ImagePullSerial:       nil,\n      },\n      LocalAPIEndpoint: {},\n      SkipPhases:       nil,\n      Patches:          {},\n      Timeouts: v1beta2.Timeouts{\n-       ControlPlaneComponentHealthCheckSeconds: &1200,\n+       ControlPlaneComponentHealthCheckSeconds: nil,\n        KubeletHealthCheckSeconds:               nil,\n        KubernetesAPICallSeconds:                nil,\n        ... // 3 identical fields\n      },\n    },\n    JoinConfiguration: v1beta2.JoinConfiguration{\n      NodeRegistration: v1beta2.NodeRegistrationOptions{\n        Name:                  \"\",\n        CRISocket:             \"\",\n        Taints:                nil,\n-       KubeletExtraArgs:      nil,\n+       KubeletExtraArgs:      []v1beta2.Arg{{Name: \"v\", Value: &\"4\"}},\n        IgnorePreflightErrors: nil,\n        ImagePullPolicy:       \"IfNotPresent\",\n        ImagePullSerial:       nil,\n      },\n      CACertPath: \"\",\n      Discovery:  {},\n      ... // 4 identical fields\n    },\n    Files:     {{Path: \"/etc/kubernetes/kube-apiserver-admission-pss.yaml\", Content: \"apiVersion: apiserver.config.k8s.io/v1\\nkind: AdmissionConfigurat\"...}},\n    DiskSetup: {},\n    ... // 9 identical fields\n  }" controller="kubeadmcontrolplane" controllerGroup="controlplane.cluster.x-k8s.io" controllerKind="KubeadmControlPlane" KubeadmControlPlane="default/capi-quickstart-shntc" namespace="default" name="capi-quickstart-shntc" reconcileID="b267a0d5-e02c-4d65-ab36-c1009ce59c53" Cluster="default/capi-quickstart" machinesNeedingRollout=["capi-quickstart-shntc-8c4xj"]

Better formatted:

I1120 13:08:35.689312       1 controller.go:477] "Rolling out Control Plane machines: Machine capi-quickstart-shntc-8c4xj needs rollout: Machine KubeadmConfig InitConfiguration or JoinConfiguration are outdated: diff:
&v1beta2.KubeadmConfigSpec{
    ClusterConfiguration: {},
    InitConfiguration: v1beta2.InitConfiguration{
      BootstrapTokens: nil,
      NodeRegistration: v1beta2.NodeRegistrationOptions{
        Name:                  \"\",
        CRISocket:             \"\",
        Taints:                nil,
-       KubeletExtraArgs:      []v1beta2.Arg{{Name: \"v\", Value: &\"4\"}},
+       KubeletExtraArgs:      nil,
        IgnorePreflightErrors: nil,
        ImagePullPolicy:       \"IfNotPresent\",
        ImagePullSerial:       nil,
      },
      LocalAPIEndpoint: {},
      SkipPhases:       nil,
      Patches:          {},
      Timeouts: v1beta2.Timeouts{
-       ControlPlaneComponentHealthCheckSeconds: &1200,
+       ControlPlaneComponentHealthCheckSeconds: nil,
        KubeletHealthCheckSeconds:               nil,
        KubernetesAPICallSeconds:                nil,
        ... // 3 identical fields
      },
    },
    JoinConfiguration: v1beta2.JoinConfiguration{
      NodeRegistration: v1beta2.NodeRegistrationOptions{
        Name:                  \"\",
        CRISocket:             \"\",
        Taints:                nil,
-       KubeletExtraArgs:      nil,
+       KubeletExtraArgs:      []v1beta2.Arg{{Name: \"v\", Value: &\"4\"}},
        IgnorePreflightErrors: nil,
        ImagePullPolicy:       \"IfNotPresent\",
        ImagePullSerial:       nil,
      },
      CACertPath: \"\",
      Discovery:  {},
      ... // 4 identical fields
    },
    Files:     {{Path: \"/etc/kubernetes/kube-apiserver-admission-pss.yaml\", Content: \"apiVersion: apiserver.config.k8s.io/v1\
kind: AdmissionConfigurat\"...}},
    DiskSetup: {},
    ... // 9 identical fields
  }" controller="kubeadmcontrolplane" controllerGroup="controlplane.cluster.x-k8s.io" controllerKind="KubeadmControlPlane" KubeadmControlPlane="default/capi-quickstart-shntc" namespace="default" name="capi-quickstart-shntc" reconcileID="b267a0d5-e02c-4d65-ab36-c1009ce59c53" Cluster="default/capi-quickstart" machinesNeedingRollout=["capi-quickstart-shntc-8c4xj"]

Label(s) to be applied

/kind bug
One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-priorityIndicates an issue lacks a `priority/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions