Skip to content

Conversation

@rphillips
Copy link
Contributor

@rphillips rphillips commented Oct 24, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR is trivial though important. There is not a current way to individually select a service by a labelSelector. For instance, control-plane: controller-manager matches numerous components.

It becomes more important when wiring up Prometheus to a specific endpoint. Not all the services export a /metrics endpoint thus causing Prometheus to fail on requests to that endpoint, so matching on everything with control-plane: controller-manager does not work.

The PR adds a unique label - the same name as the service - so a labelSelector can be used to select a particular service.

I would like to request this patch be backported to 0.14.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Services: fix the setting of the `app.kubernetes.io/component` label to discriminate between different service components within Kueue as follows:
- controller-manager-metrics-service for kueue-controller-manager-metrics-service 
- visibility-service for kueue-visibility-server
- webhook-service for kueue-webhook-service

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Oct 24, 2025
@k8s-ci-robot k8s-ci-robot requested a review from kannon92 October 24, 2025 00:35
@netlify
Copy link

netlify bot commented Oct 24, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit d12fd59
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/69035ac719b26e00080937fc

@k8s-ci-robot k8s-ci-robot requested a review from PBundyra October 24, 2025 00:35
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 24, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @rphillips. Thanks for your PR.

I'm waiting for a github.com 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 24, 2025
@kannon92
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 24, 2025
@rphillips rphillips force-pushed the add_label_app_to_services branch from e86f8d7 to bf879bb Compare October 24, 2025 01:21
@mimowo
Copy link
Contributor

mimowo commented Oct 24, 2025

@rphillips have you had a chance to test end-to-end manually if this works well on upgrade?

Ideally we test it both for manifests-based version and Helm

@rphillips rphillips force-pushed the add_label_app_to_services branch from bf879bb to 8a9457e Compare October 24, 2025 16:32
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 24, 2025
@rphillips
Copy link
Contributor Author

@mimowo I had claude help me write two tests (which did find a bug, which I fixed). The gist has two test files and can be ran in the kueue repo. They install kueue 0.14.2 using kind, then upgrade to the local helm or kustomize charts. Then assert the services have the 'app' label.

Both tests pass.

@mimowo
Copy link
Contributor

mimowo commented Oct 27, 2025

This PR is trivial though important. There is not a current way to individually select a service by a labelSelector. For instance, control-plane: controller-manager matches numerous components.

I agree being able to select services of a specific application like Kueue is important, but I we already have the app.kubernetes.io/name label for this purpose. I tested locally installing Kueue both from manifest and Helm and got results.

after Helm installation:

❯ k get svc -nkueue-system --show-labels
NAME                                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE   LABELS
kueue-controller-manager-metrics-service   ClusterIP   10.96.227.177   <none>        8443/TCP   35m   app.kubernetes.io/component=metrics,app.kubernetes.io/instance=kueue,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=kueue,app.kubernetes.io/version=v0.14.2,control-plane=controller-manager,helm.sh/chart=kueue-0.14.2
kueue-visibility-server                    ClusterIP   10.96.7.227     <none>        443/TCP    35m   app.kubernetes.io/instance=kueue,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=kueue,app.kubernetes.io/version=v0.14.2,control-plane=controller-manager,helm.sh/chart=kueue-0.14.2
kueue-webhook-service                      ClusterIP   10.96.114.17    <none>        443/TCP    35m   app.kubernetes.io/instance=kueue,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=kueue,app.kubernetes.io/version=v0.14.2,control-plane=controller-manager,helm.sh/chart=kueue-0.14.2

after manifest installation:

❯ k get svc -nkueue-system --show-labels
NAME                                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE   LABELS
kueue-controller-manager-metrics-service   ClusterIP   10.96.128.161   <none>        8443/TCP   44s   app.kubernetes.io/component=controller,app.kubernetes.io/managed-by=kustomize,app.kubernetes.io/name=kueue,control-plane=controller-manager
kueue-visibility-server                    ClusterIP   10.96.204.159   <none>        443/TCP    44s   app.kubernetes.io/component=controller,app.kubernetes.io/name=kueue,control-plane=controller-manager
kueue-webhook-service                      ClusterIP   10.96.212.149   <none>        443/TCP    44s   app.kubernetes.io/component=controller,app.kubernetes.io/name=kueue,control-plane=controller-manager

I think what could be improved clearly is the use of the app.kubernetes.io/component label to say specificly which component of Kueue this is.

Also, instead of the generic "app" label I prefer to make sure the standard app.kubernetes.io/name is used well.

Let me know if I'm missing something, and let me hold until this is clarfied.
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2025
@rphillips rphillips force-pushed the add_label_app_to_services branch from 8a9457e to a5c43d2 Compare October 27, 2025 15:42
@rphillips
Copy link
Contributor Author

rphillips commented Oct 27, 2025

No problem.

I updated the helm chart to result in:

NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:controller-manager-metrics-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]

And the kustomize charts to:

NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:controller-manager-metrics-service app.kubernetes.io/managed-by:kustomize app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/name:kueue control-plane:controller-manager]

Are there any other changes you would like to see?

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 27, 2025
@mimowo
Copy link
Contributor

mimowo commented Oct 27, 2025

The output for Helm looks great. I just need another test if the upgrade works well, unfortunately we don't have automated upgrade tests and this change has a potential impact.

The output for installation from manifests contains app.kubernetes.io/managed-by:Helm so something looks off.

@rphillips rphillips force-pushed the add_label_app_to_services branch from a5c43d2 to 9743ab4 Compare October 27, 2025 16:30
@rphillips
Copy link
Contributor Author

Yep. Sorry. Copy and paste error on the kustomize output (fixed). I also updated the gist with the latest test scripts I used. Also fixed pull-kueue-verify-main.

@mimowo
Copy link
Contributor

mimowo commented Oct 29, 2025

@rphillips I think as we should update the release note as the PR changed.

Proposal:

/release-note-edit

Services: fix the setting of the `app.kubernetes.io/component` label to discriminate between different service components within Kueue as follows:
- controller-manager-metrics-service for kueue-controller-manager-metrics-service 
- visibility-service for kueue-visibility-server
- webhook-service for kueue-webhook-service

wdyt?

@rphillips
Copy link
Contributor Author

Works for me! Looks like the PR got updated.

@mimowo
Copy link
Contributor

mimowo commented Oct 29, 2025

Thank you 👍
/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.13, release-0.14 in new PRs and assign them to you.

In response to this:

Thank you 👍
/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

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 the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 35a11dd42e454ea9f895d2a39ff2b553b032b7aa

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 29, 2025
labels:
- pairs:
app.kubernetes.io/name: kueue
app.kubernetes.io/component: controller
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this drop the app.kubernetes.io/component label from the kueue-controller-manager deployment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to fix this slightly different. This specific spot adds app.kubernetes.io/component=controller to all the other components. I'll update the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed the fix.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks.

@mimowo
Copy link
Contributor

mimowo commented Oct 29, 2025

/hold
to verify #7371 (comment)

@rphillips rphillips force-pushed the add_label_app_to_services branch from 9743ab4 to e8542a4 Compare October 29, 2025 20:20
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2025
@k8s-ci-robot k8s-ci-robot requested a review from mimowo October 29, 2025 20:20
@rphillips
Copy link
Contributor Author

I don't see app.kubernetes.io/component set with 0.14.2 on controller-manager with Helm, but I'll fix that.

With this PR and helm:

kueue-controller-manager   1/1     1            1           38s   app.kubernetes.io/component=controller,app.kubernetes.io/instance=kueue,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=kueue,app.kubernetes.io/version=v0.14.2,control-plane=controller-manager,helm.sh/chart=kueue-0.14.2
NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:controller-manager-metrics-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]

With this PR and kustomize:

kueue-controller-manager   1/1     1            1           34s   app.kubernetes.io/component=controller,app.kubernetes.io/name=kueue,control-plane=controller-manager
NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:controller-manager-metrics-service app.kubernetes.io/managed-by:kustomize app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/name:kueue control-plane:controller-manager]

name: controller-manager-metrics-service
namespace: system
labels:
app.kubernetes.io/component: controller-manager-metrics-service
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
app.kubernetes.io/component: controller-manager-metrics-service
app.kubernetes.io/component: metrics-service

I want to propose simpler name here. We don't need to rename the service name in this PR, just the label. The name of the labels does not need to match the service name exactly anyway as the service names have the "kueue-" prefix anyway. wdyt? cc @tenzen-y

Copy link
Member

Choose a reason for hiding this comment

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

I think that we should have a prefix since users typically deploy the external manager including job controller implementing jobframework and external dispatchers to the same namespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

by prefix do you mean controller-manager- or kueue-?

In any case I don't think this is needed, because we have another standard app.kubernetes.io/name label which sets the context. So users who write label selectors can use both app.kubernetes.io/name: kueue and app.kubernetes.io/component: metrics-service.

I think this is the intention of the app.kubernetes.io/component is not to repeat the app name, see examples here: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels

# This is an excerpt
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/name: mysql
    app.kubernetes.io/instance: mysql-abcxyz
    app.kubernetes.io/version: "5.7.21"
    app.kubernetes.io/component: database
    app.kubernetes.io/part-of: wordpress
    app.kubernetes.io/managed-by: Helm

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense.
In that case, the service for keueu external-controller-manager could have app.kubernetes.io/name: kueue-external-manager and app.kubernetes.io/instance: metrics-service label.

Copy link
Contributor

@mimowo mimowo Oct 30, 2025

Choose a reason for hiding this comment

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

what is kueue external-controller-manager ? TBH I think the app name is simply "kueue".

Copy link
Member

Choose a reason for hiding this comment

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

Kueue Controller Manager is hosted in this repository.
Kueue External Controller Manager is served in users's respotisoty which has custom JobFramework controller and external dispatchers.

In this repository, we use just app.kubernetes.io/instance: metrics-service and app.kubernetes.io/name: kueue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thank you for clarifying 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll commit this and squash the commits. Thank you for the feedback.

@rphillips
Copy link
Contributor Author

rphillips commented Oct 30, 2025

Updated.

With this PR and helm:

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE   LABELS
kueue-controller-manager   1/1     1            1           38s   app.kubernetes.io/component=controller,app.kubernetes.io/instance=kueue,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=kueue,app.kubernetes.io/version=v0.14.2,control-plane=controller-manager,helm.sh/chart=kueue-0.14.2
NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:metrics-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/instance:kueue app.kubernetes.io/managed-by:Helm app.kubernetes.io/name:kueue app.kubernetes.io/version:v0.14.2 control-plane:controller-manager helm.sh/chart:kueue-0.14.2]

With this PR and kustomize:

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE   LABELS
kueue-controller-manager   1/1     1            1           34s   app.kubernetes.io/component=controller,app.kubernetes.io/name=kueue,control-plane=controller-manager
NAME                                       LABELS
kueue-controller-manager-metrics-service   map[app.kubernetes.io/component:metrics-service app.kubernetes.io/managed-by:kustomize app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-visibility-server                    map[app.kubernetes.io/component:visibility-service app.kubernetes.io/name:kueue control-plane:controller-manager]
kueue-webhook-service                      map[app.kubernetes.io/component:webhook-service app.kubernetes.io/name:kueue control-plane:controller-manager]

@rphillips rphillips force-pushed the add_label_app_to_services branch from e8542a4 to d12fd59 Compare October 30, 2025 12:32
@mimowo
Copy link
Contributor

mimowo commented Oct 30, 2025

/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.13, release-0.14 in new PRs and assign them to you.

In response to this:

/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

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 the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2d7ac314faa9078832209e45c068b7704cb0f8ce

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mimowo, rphillips

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

@rphillips
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 30, 2025
@k8s-ci-robot k8s-ci-robot merged commit 0290088 into kubernetes-sigs:main Oct 30, 2025
23 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.15 milestone Oct 30, 2025
@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: new pull request created: #7450

In response to this:

/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

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-infra-cherrypick-robot
Copy link
Contributor

@mimowo: new pull request created: #7451

In response to this:

/lgtm
/approve
/cherrypick release-0.14
/cherrypick release-0.13

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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants