Skip to content

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

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sumukha-radhakrishna
Copy link

Fixes #NA

Description

This PR extends Nodepool CRD to support static specific fields. Based on the RFC - #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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 1, 2025
@k8s-ci-robot k8s-ci-robot requested review from engedaam and tallaxes July 1, 2025 22:30
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sumukha-radhakrishna
Once this PR has been reviewed and has the lgtm label, please assign gjtempleton for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Hi @sumukha-radhakrishna. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 1, 2025
@jonathan-innis jonathan-innis marked this pull request as draft July 1, 2025 22:32
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2025
@coveralls
Copy link

coveralls commented Jul 1, 2025

Pull Request Test Coverage Report for Build 16032946829

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 32 of 36 (88.89%) changed or added relevant lines in 2 files are covered.
  • 34 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.04%) to 81.83%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1/zz_generated.deepcopy.go 6 10 60.0%
Files with Coverage Reduction New Missed Lines %
pkg/controllers/provisioning/scheduling/nodeclaim.go 3 89.66%
pkg/controllers/provisioning/scheduling/preferences.go 7 88.76%
pkg/controllers/disruption/queue.go 24 77.83%
Totals Coverage Status
Change from base Build 15989448170: -0.04%
Covered Lines: 10232
Relevant Lines: 12504

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants