Skip to content

Conversation

@DerekFrank
Copy link
Contributor

Fixes #N/A

Description

Separating this out from #2626 for ease of review.

How was this change tested?

make presubmit

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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DerekFrank

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

The pull request process is described here

Details 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 k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 22, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 22, 2025
if errors.IsNotFound(err) {
// notify cluster state of the node deletion
c.cluster.DeletePod(req.NamespacedName)
c.podResources.DeletePod(pod)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving @ellistarn's comment over:

Would this be better encapsulated by cluster state?

We could write this into cluster.go, the reason it was made a separate object was for mutex contention purposes. We've been trying to separate cluster state out into different data stores where it make sense. I think this is one of those cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. FWIW I really meant "state" controllers in general. I see them as a bunch of efficient indexes, and strongly agree with factoring them into multiple modules.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, we could optionally do all of that delegation in the cluster object -- might be able to help us coordinate mutexes. Informers are also a reasonable place to do this. I don't have a mental model of this entire state gomod right now, but I suspect we may need to refactor at some point.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 20438554973

Details

  • 69 of 88 (78.41%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.005%) to 80.325%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/metrics/cluster/controller.go 9 11 81.82%
pkg/controllers/controllers.go 0 4 0.0%
pkg/utils/resources/resources.go 9 15 60.0%
pkg/state/podresources/podresources.go 44 51 86.27%
Totals Coverage Status
Change from base Build 20384548641: -0.005%
Covered Lines: 12027
Relevant Lines: 14973

💛 - Coveralls

[]string{resourceType},
)
// Stage: alpha
PodCount = opmetrics.NewPrometheusGauge(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do want to be daemonset aware. WDYT about a label that includes the first ownerreference gvk?

Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DerekFrank
Copy link
Contributor Author

Why not use https://github.com/ellistarn/karpenter/blob/72387e317dd1868733631e34f7919611f08ce77f/pkg/controllers/metrics/node/controller.go#L74 ?

Fair point, I must have missed that when I was looking for this metric. That metric does only include bound pods, but I think that is fine for now.

For #2626, I can surface the information through cluster.go to the decision tracker, but the node controller will need to still recompute the information to get it to have the correct labels.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 1, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

4 participants