karpenter icon indicating copy to clipboard operation
karpenter copied to clipboard

RFC: NodeOverlay

Open ellistarn opened this issue 1 year ago โ€ข 27 comments

Fixes:

  • https://github.com/aws/karpenter-provider-aws/issues/3860
  • https://github.com/aws/karpenter-provider-aws/pull/4697
  • https://github.com/kubernetes-sigs/karpenter/issues/751
  • https://github.com/kubernetes-sigs/karpenter/issues/729
  • https://github.com/aws/karpenter-provider-aws/issues/5161

Description

---
# Reduce on-demand prices to 90%
# https://github.com/aws/karpenter-provider-aws/issues/3860
# https://github.com/aws/karpenter-provider-aws/pull/4697
kind: NodeOverlay
metadata:
  name: discount
spec:
  selector:
    matchLabels:
      karpenter.sh/capacity-type: on-demand
  pricePercent: 90
---
# Support for extended resource types (e.g. smarter-devices/fuse)
# https://github.com/kubernetes-sigs/karpenter/issues/751
# https://github.com/kubernetes-sigs/karpenter/issues/729
kind: NodeOverlay
metadata:
  name: discount
spec:
  selector:
    matchLabels:
      karpenter.sh/capacity-type: on-demand
    matchExpressions:
    - key: node.kubernetes.io/instance-type
      operator: In
      values:
      - m5.large
      - m5.2xlarge
      - m5.4xlarge
      - m5.8xlarge
      - m5.12xlarge
  capacity:
    smarter-devices/fuse: 1
---
# Add memory overhead of 10Mi to all instances with 2Gi memory
# https://github.com/aws/karpenter-provider-aws/issues/5161
kind: NodeOverlay
metadata:
  name: discount
spec:
  selector:
    matchLabels:
      karpenter.k8s.aws/instance-memory: 2048
  overhead:
    memory: 10Mi
---

How was this change tested?

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

ellistarn avatar Jun 06 '24 22:06 ellistarn

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ellistarn

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

The pull request process is described 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 avatar Jun 06 '24 22:06 k8s-ci-robot

(nit) In the PR description, the NodeOverlays all have the same .metadata.name

sftim avatar Jun 10 '24 22:06 sftim

Is this an overlay for Nodes, or an overlay for NodePools (maybe more than one NodePool, if we support matching via a selector)?

sftim avatar Jun 10 '24 22:06 sftim

In a real scenario with a saving plan, there is a commitment to a consistent amount of usage. Once the committed usage is exhausted, the price will revert to the on-demand rate. Does this PR take that into consideration?

What I expect is:

  1. When there is remaining committed usage, Karpenter should continue to select on-demand instances(instance type) under the saving plan.
  2. When the committed usage is exhausted, Karpenter should choose spot instances.

jwcesign avatar Jun 11 '24 02:06 jwcesign

@ellistarn We redefined the value of topology.kubernetes.io/zone. However, the current zone value is provided by the CloudProvider. Is it possible to support custom topology.kubernetes.io/zone and other WellKnownLabel values?

daimaxiaxie avatar Jun 12 '24 03:06 daimaxiaxie

@ellistarn We redefined the value of topology.kubernetes.io/zone. However, the current zone value is provided by the CloudProvider. Is it possible to support custom topology.kubernetes.io/zone and other WellKnownLabel values?

It sounds like you don't agree with the zone naming used in an existing integration. You can:

  • use a different label
    • this is the easy and recommended option
  • replace the cloud provider integration code with your own (Karpenter, cloud controller manager, etc)

I don't think this PR would need to change to accommodate the ask.

sftim avatar Jun 12 '24 08:06 sftim

Thanks for trying to tackle this!

I wonder if there is a cleaner way to represent the overlays to reduce sprawl.

Thinking more generally, each dimension can be additive, adding a new custom resource, and/or adjustment, price changes or resource modification. (Assuming we aren't supporting deleting properties at this time).

Price is a slight outlier from resources so we can separate out. Would it make sense to have at the highest level price and resources. Then subsection of adjustment and additions. Adjustment would support +/- percent or values and additions would just be a dict of new custom resources and values?

GnatorX avatar Jun 12 '24 15:06 GnatorX

@sftim I mean nodeoverlay can provide more overlay options, not just resources. For example, Lables.

daimaxiaxie avatar Jun 14 '24 02:06 daimaxiaxie

Hi folks. Please comment inline in the docs w/ threads, so I can respond directly.

ellistarn avatar Jun 20 '24 22:06 ellistarn

For those watching. I just pushed a rev with an RFC document.

ellistarn avatar Jun 20 '24 22:06 ellistarn

Pull Request Test Coverage Report for Build 9605413160

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 80.062%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Files with Coverage Reduction New Missed Lines %
pkg/controllers/node/termination/controller.go 2 59.81%
<!-- Total: 2
Totals Coverage Status
Change from base Build 9589529985: -0.4%
Covered Lines: 8324
Relevant Lines: 10397

๐Ÿ’› - Coveralls

coveralls avatar Jun 20 '24 23:06 coveralls

Pull Request Test Coverage Report for Build 9649497449

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.6%) to 79.994%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Files with Coverage Reduction New Missed Lines %
pkg/controllers/node/termination/controller.go 2 59.81%
pkg/controllers/provisioning/scheduling/preferences.go 7 86.67%
<!-- Total: 9
Totals Coverage Status
Change from base Build 9639333499: -0.6%
Covered Lines: 8317
Relevant Lines: 10397

๐Ÿ’› - Coveralls

coveralls avatar Jun 24 '24 17:06 coveralls

Pull Request Test Coverage Report for Build 9666238327

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.4%) to 80.042%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Files with Coverage Reduction New Missed Lines %
pkg/controllers/provisioning/scheduling/nodeclaim.go 2 89.13%
pkg/controllers/node/termination/controller.go 2 59.81%
<!-- Total: 4
Totals Coverage Status
Change from base Build 9653637355: -0.4%
Covered Lines: 8322
Relevant Lines: 10397

๐Ÿ’› - Coveralls

coveralls avatar Jun 25 '24 16:06 coveralls

Pull Request Test Coverage Report for Build 9667685247

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 80.067%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Files with Coverage Reduction New Missed Lines %
pkg/scheduling/requirements.go 2 98.01%
<!-- Total: 2
Totals Coverage Status
Change from base Build 9666563133: -0.4%
Covered Lines: 8327
Relevant Lines: 10400

๐Ÿ’› - Coveralls

coveralls avatar Jun 25 '24 18:06 coveralls

Pull Request Test Coverage Report for Build 9719413107

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 78.371%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Files with Coverage Reduction New Missed Lines %
pkg/controllers/node/termination/terminator/eviction.go 2 89.09%
<!-- Total: 2
Totals Coverage Status
Change from base Build 9719097361: -0.4%
Covered Lines: 8595
Relevant Lines: 10967

๐Ÿ’› - Coveralls

coveralls avatar Jun 28 '24 23:06 coveralls

Hi all! Do we have an estimation of when this feature will be publicly available? We have been waiting for it for over a year now..

Our use case is we run Circle CI runner jobs on a EKS cluster. And we have this limit for buildah to work:

resources:
  limits:
    github.com/fuse: 2

But we got the following error:

{
    "level": "ERROR",
    "logger": "controller.provisioner",
    "message": "Could not schedule pod, incompatible with nodepool \"default\", daemonset overhead={\"cpu\":\"180m\",\"memory\":\"120Mi\",\"pods\":\"8\"}, no instance type satisfied resources {\"cpu\":\"2180m\",\"github.com/fuse\":\"1\",\"memory\":\"8312Mi\",\"pods\":\"9\"} and requirements karpenter.k8s.aws/instance-category In [m t], karpenter.k8s.aws/instance-generation Exists >2, karpenter.sh/capacity-type In [on-demand], karpenter.sh/nodepool In [default], kubernetes.io/arch In [amd64], kubernetes.io/os In [linux] (no instance type has enough resources); incompatible with nodepool \"arm64\", daemonset overhead={\"cpu\":\"180m\",\"memory\":\"120Mi\",\"pods\":\"8\"}, no instance type satisfied resources {\"cpu\":\"2180m\",\"github.com/fuse\":\"1\",\"memory\":\"8312Mi\",\"pods\":\"9\"} and requirements karpenter.k8s.aws/instance-category In [c m t], karpenter.k8s.aws/instance-generation Exists >2, karpenter.sh/capacity-type In [on-demand], karpenter.sh/nodepool In [arm64], kubernetes.io/arch In [arm64], kubernetes.io/os In [linux] (no instance type has enough resources)"
}

rlindsberg avatar Jul 03 '24 08:07 rlindsberg

Pull Request Test Coverage Report for Build 9882748974

Details

  • 0 of 60 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 77.764%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/v1alpha1/zz_generated.deepcopy.go 0 60 0.0%
<!-- Total: 0 60
Totals Coverage Status
Change from base Build 9880691959: -0.4%
Covered Lines: 8750
Relevant Lines: 11252

๐Ÿ’› - Coveralls

coveralls avatar Jul 10 '24 23:07 coveralls

Hi All

I'm a bit confused about the relationship between kubernetes-sigs/karpenter and aws/karpenter-provider-aws.

The lack of support for custom resource requests/limits is blocking me from autocalling with xilinx devices.

I want to understand how to deploy this branch to EKS.

Any help or understanding would be appreciated.

dav3rin avatar Jul 18 '24 20:07 dav3rin

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

github-actions[bot] avatar Aug 02 '24 12:08 github-actions[bot]

I want to understand how to deploy this branch to EKS.

This branch adds a โ€œrequest for commentsโ€œ. @ellistarn should the RFC and implementation land as one commit? Seems unusual.

sftim avatar Aug 02 '24 12:08 sftim

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

github-actions[bot] avatar Aug 17 '24 12:08 github-actions[bot]

i think this shouldn't be closed.

zaafar avatar Sep 01 '24 23:09 zaafar

/lifecycle frozen

njtran avatar Sep 04 '24 20:09 njtran

@njtran: The lifecycle/frozen label cannot be applied to Pull Requests.

In response to this:

/lifecycle frozen

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 avatar Sep 04 '24 20:09 k8s-ci-robot

What is the progress now? Why does it seems not to be updated.

daimaxiaxie avatar Sep 14 '24 09:09 daimaxiaxie

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

github-actions[bot] avatar Sep 28 '24 12:09 github-actions[bot]

commenting to make it not stale. this is a very important feature that will take Karpenter to the next level.

zaafar avatar Oct 06 '24 19:10 zaafar

Is there any update on this?

abbas-square avatar Oct 24 '24 19:10 abbas-square

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

github-actions[bot] avatar Nov 08 '24 12:11 github-actions[bot]

Is this still planned for a future Karpenter release? Working on deploying in some clusters where I use hugepages, bumping up against this issue -- just trying to get a feel for whether I'll need a short-term workaround or if this is planned to be a long-term limitation.

devusb avatar Dec 12 '24 16:12 devusb