Skip to content

Support max-size annotation for per-MachineDeployment node limits #77

@parthyadav3105

Description

@parthyadav3105

Description

What
Add support for cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size annotation to enforce per-MachineDeployment node limits.

Why
It is not something that is part of the core Karpenter contract, but it can be useful in case of CAPI providers where the user wants to enforce per-MachineDeployment node limits.

Especially, when they group multiple MachineDeployments under one NodePool as instance types for cost effective scheduling. While NodePool do offer spec.limits on the NodePool level, it does not control how much a particular MachineDeployment can be scaled.

The max-size annotation can help in putting a cap on the number of nodes per MachineDeployment. Same as cluster-api-autoscaler does.

Proposed Changes
The change will require reading the annotation and comparing it against the MachineDeployment's spec.replicas. If spec.replicas >= max-size, then set Available: false in the offering.

This will plug seamlessly with Available flag while support for capacity-types (reserved, on-demand, spot) and pricing is added in the offering in the future.

If this looks good, I can open a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions