Skip to content

feat(api): Extend Nodepool to support replicas for static capacity #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

sumukha-radhakrishna
Copy link
Owner

@sumukha-radhakrishna sumukha-radhakrishna commented Jul 1, 2025

Fixes #NA

Description

This PR extends Nodepool CRD to support static specific fields. Based on the RFC - kubernetes-sigs#2309

Changes

  • Addition of replicas field to nodepool
  • If replicas are specified the dynamic only fields cannot be specified
  • disruption fields (consolidateAfter and consolidationPolicy) have default value so values other than default is rejected and fields itself is ignored
  • Added scale Subresource to the CRD

Example

apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
  name: static-nodepool
spec:
  replicas: 5
  template:
    spec:
      requirements:
        - key: kubernetes.io/arch
          operator: In
          values: ["amd64"]
        - key: kubernetes.io/os
          operator: In
          values: ["linux"]
        - key: karpenter.sh/capacity-type
          operator: In
          values: ["on-demand"]
        - key: karpenter.k8s.aws/instance-category
          operator: In
          values: ["c", "m", "r"]
        - key: karpenter.k8s.aws/instance-generation
          operator: Gt
          values: ["2"]
      nodeClassRef:
        group: karpenter.k8s.aws
        kind: EC2NodeClass
        name: default
      expireAfter: 720h # 30 * 24h = 720h

How was this change tested?
ran make presubmit successfully. Applied latest CRDs on the cluster and ensured replicas can be added to Nodepool and ensured static only fields cannot be added when replicas exist.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant