Skip to content

cluster-api-provider-kairos: webhook Service and Deployment select other providers' pods in a shared namespace #5815

Open

Description

@lexfrei

The webhook Service and the manager Deployment select only control-plane: controller-manager. config/bootstrap/kustomization.yaml adds cluster.x-k8s.io/provider: bootstrap-kairos-io with includeSelectors: false, so the provider label is in neither selector and not on the pods.

A standalone install never sees this, because the provider has its namespace to itself. cluster-api-operator can install several providers into one namespace, and there the other managers carry control-plane: controller-manager too. The webhook EndpointSlice then lists their pods, and a mkairosconfig.kb.io call that lands on one of them fails with an x509 error, so MachineSets cannot create KairosConfigs. The Deployment selector matches those pods as well, and the Kubernetes docs warn that controllers with overlapping selectors can conflict.

The kubeadm and Talos bootstrap providers already put cluster.x-k8s.io/provider into the Service selector and the Deployment matchLabels. I propose the same here: the label on the pod template, in the Service selector and in matchLabels.

The matchLabels part breaks upgrades of existing installs. spec.selector is immutable, so the apply fails until the Deployment is deleted and recreated. The non-breaking option is the pod template and the Service selector only, which keeps the reason includeSelectors: false was chosen. That fixes the webhook and leaves the Deployment overlap. I can open a PR for either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions