Skip to content

feat: add more support for different workload types #1052

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 42 commits into
base: master
Choose a base branch
from

Conversation

sleepyfoodie
Copy link
Contributor

@sleepyfoodie sleepyfoodie commented Apr 23, 2025

Update workload recording rules to support more workload type

New recording rules tested have good health status:
Screenshot 2025-04-29 at 23 13 48

@sleepyfoodie sleepyfoodie changed the title feat: add more support for different workload tpes feat: add more support for different workload types Apr 24, 2025
@sleepyfoodie sleepyfoodie requested a review from skl April 24, 2025 20:17
Copy link
Collaborator

@skl skl left a comment

Choose a reason for hiding this comment

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

There is another non-standard workload rule missing for workloads you would see from the following query:

group by (owner_kind) (kube_pod_owner{owner_kind!="ReplicaSet", owner_kind!="DaemonSet", owner_kind!="StatefulSet", owner_kind!="Job", owner_kind!="Node", owner_kind!=""})

That should capture workload types that are directly controlled via CRDs like StrimziPodSet for example.

No join is required for this additional rule as the pods are created directly rather than via ReplicaSets.

sleepyfoodie and others added 6 commits May 1, 2025 09:06
Co-authored-by: Stephen Lang <skl@users.noreply.github.com>
Co-authored-by: Stephen Lang <skl@users.noreply.github.com>
Co-authored-by: Stephen Lang <skl@users.noreply.github.com>
@sleepyfoodie sleepyfoodie requested a review from skl May 15, 2025 17:04
{
record: 'namespace_workload_pod:kube_pod_owner:relabel',
expr: |||
max by (%(clusterLabel)s, namespace, workload, pod) (
group by(%(clusterLabel)s, namespace, workload, workload_type, pod) (
Copy link
Collaborator

Choose a reason for hiding this comment

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

workload_type is added as an external label so should not be present in the query, it also means the extra label_replace can be removed

Suggested change
group by(%(clusterLabel)s, namespace, workload, workload_type, pod) (
group by(%(clusterLabel)s, namespace, workload, pod) (

)
* on (%(clusterLabel)s, namespace, job_name) group_left(owner_kind, owner_name)
group by (%(clusterLabel)s, namespace, job_name, owner_kind, owner_name) (
kube_job_owner{%(kubeStateMetricsSelector)s, owner_kind!="Pod", owner_kind!=""}
Copy link
Collaborator

@skl skl May 16, 2025

Choose a reason for hiding this comment

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

Jobs with owner_kind="Pod" would always be excluded by both this rule and the job rule.

What should we do with kube_job_owner{owner_kind="Pod"} series so that they're not excluded? These appear to be jobs created by pods...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants