kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.84k stars 917 forks source link

Provide a function that returns the limits and requests of active containers only in pods #1146

Closed chilanti closed 2 years ago

chilanti commented 2 years ago

What would you like to be added: We would like this module to provide a function such as ActiveContainersPodRequestsAndLimits (vs. just PodRequestsAndLimits) that returned the requests and limits only of the active containers, vs. returning the max(init_containers, active_containers).

Why is this needed: This function is being used by tools such as @robscott's kubecapacity and we noticed a discrepancy between the totals that it produces vs the actual totals of the running containers - it wasn't until we looked at the "fine print" of PodRequestsAndLimits that we realized that init containers are taken into account (when their requests/limits exceed those of running pods). See also this issue. Thanks. cc: @kmlefebv

k8s-ci-robot commented 2 years ago

@chilanti: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
eddiezane commented 2 years ago

I think we would take a PR that added such a function as long as it's not duplicated code.

@lauchokyip any thoughts? I know you just worked in this area.

lauchokyip commented 2 years ago

@eddiezane. I believe this is the same issue as this, https://github.com/kubernetes/kubectl/issues/1110 and this.

Would it make sense for @g1bl3t to take a look at this? @brianpursley might be able to chip in too

eddiezane commented 2 years ago

Following up here we decided that the requested changes are minimal enough that they can be reimplemented in the project that needs it.

/close

k8s-ci-robot commented 2 years ago

@eddiezane: Closing this issue.

In response to [this](https://github.com/kubernetes/kubectl/issues/1146#issuecomment-1005954313): >Following up here we decided that the requested changes are minimal enough that they can be reimplemented in the project that needs it. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.