Skip to content

kubernetes_nodes: expose maxUnavailable so a pool without spare capacity can drain first #79

Open

Description

@mattia-eleuteri

cozystack/cozystack#5153 adds maxUnavailable to the KubernetesNodes spec (packages/apps/kubernetes-nodes), and to each worker pool of a ComputePlane, which forwards it to the pool chart. Unset, it is 0: a rollout (instance type, image or version change) brings up each replacement worker before it drains an old one. A pool with no room for one extra VM, short of quota or capacity, then stalls with the new Machine Pending, and the documented way out is to set maxUnavailable: 1, which drains first.

cozystack_kubernetes_nodes cannot set it. internal/provider/kubernetes_nodes_schema.go has no attribute for it, and since an update replaces the whole spec, a value set outside Terraform is dropped on the next apply. A Terraform-managed pool that needs to drain first therefore has no way to express it.

What is needed:

  • a max_unavailable attribute on the cozystack_kubernetes_nodes resource and data source, Optional, Int64, between 0 and 2147483647 (the bounds the API schema enforces);
  • no provider-side default: left unset it must not be sent, so the chart keeps choosing 0, or 1 on a pool with gpus;
  • the field in the model and the expand/flatten pair.

The provider has no ComputePlane resource, so nothing is needed there yet; whoever adds one should carry the per-pool maxUnavailable too.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions