Skip to content

Deploying to a non-existent namespace on another infra cluster fails with a misleading proto: integer overflow error #369

@eromanova

Description

@eromanova

What steps did you take and what happened:

  1. Prepare an infrastructure cluster and install KubeVirt on it
  2. Create a secret with the infra cluster kubeconfig (in this case, kcm-system/kubevirt-infra-kubeconfig)
  3. Deploy a KubeVirt cluster with external infra (https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/blob/v0.11.1/templates/cluster-template-ext-infra.yaml) (kcm-system namespace does not exist on the infrastructure cluster) but change the spec.type to LoadBalancer, for example:
  apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
  kind: KubevirtCluster
  metadata:
    name: kubevirt-ekaz-2
    namespace: kcm-system
  spec:
    controlPlaneServiceTemplate:
      metadata:
        namespace: kcm-system
      spec:
        type: LoadBalancer
    infraClusterSecretRef:
      apiVersion: v1
      kind: Secret
      name: kubevirt-infra-kubeconfig
      namespace: kcm-system
  1. The capk-controller fails with failed to create load balancer: proto: integer overflow error:
E0126 13:41:19.622971       1 controller.go:474] "Reconciler error" err="failed to create load balancer: proto: integer overflow" controller="kubevirtcluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="KubevirtCluster" KubevirtCluster="kcm-system/kubevirt-ekaz-2" namespace="kcm-system" name="kubevirt-ekaz-2" reconcileID="2074dadd-23e8-4d64-bf87-b7da2905f347"

What did you expect to happen:
The LoadBalancer service is successfully created.

Anything else you would like to add:

The root cause is that my infra cluster didn't have the kcm-system namespace yet. Once I created it, the deployment continued.

By checking the code, I noticed that the LoadBalancer Create function always returns corev1.ErrIntOverflowGenerated error: https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/blob/v0.11.1/pkg/loadbalancer/loadbalancer.go#L118, ignoring the actual err value that the ctrlutil.CreateOrUpdate returns.

Should the CAPK controller automatically create the target namespace on the infrastructure cluster, or is that the user’s responsibility?

Environment:

  • Cluster-api version: v1.12.2
  • Cluster-api-provider-kubevirt version: v1.11.1
  • Kubernetes version: (use kubectl version): v1.34.1
  • KubeVirt version: v1.7.0
  • OS (e.g. from /etc/os-release):
    ✗ sw_vers
    ProductName: macOS
    ProductVersion: 15.7.2
    BuildVersion: 24G325

/kind bug
[One or more /area label. See https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt/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.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions