Skip to content

Filter only relevant workloads that are supported by Kruize.#1922

Draft
kusumachalasani wants to merge 2 commits into
kruize:mvp_demofrom
kusumachalasani:metadata
Draft

Filter only relevant workloads that are supported by Kruize.#1922
kusumachalasani wants to merge 2 commits into
kruize:mvp_demofrom
kusumachalasani:metadata

Conversation

@kusumachalasani
Copy link
Copy Markdown
Contributor

@kusumachalasani kusumachalasani commented May 21, 2026

Description

Filter only relevant workloads that are supported by Kruize.
Currently Kruize imports all the available workloads in the cluster irrespective of the type.

Here is the table of workloads that are considered / not considered.
Considered the workload types that are supported by native.
No third party workload type (like Argo, Knative etc) are considered.

Resource Name Category Consider for Kruize Description
deployment Native Kubernetes YES Standard stateless application controller (Web apps, APIs).
statefulset Native Kubernetes YES Stateful application controller with sticky storage (Databases).
daemonset Native Kubernetes YES Node-level infrastructure controller (Loggers, Monitoring agents).
barepod Native Kubernetes YES (CURRENTLY NOT SUPPORTED ) Standalone unmanaged container. Risky, but it is an active workload.
job Native Kubernetes SKIP ( CURRENTLY SUPPORTED, but not valid ) Batch processing controller that runs to a successful completion.
cronjob Native Kubernetes SKIP Timed batch controller that triggers workloads on a schedule.
replicaset Native Kubernetes SKIP Double-counting risk. Deployments wrap around ReplicaSets. If you count both deployment and replicaset, your dashboard will show double the amount of stateless workloads you actually have running. Deploying only using replicaset is not advisable.
staticpod System / Internal SKIP Control plane components managed directly by the node's kubelet (e.g., etcd). Tracking them alongside apps can skew operational metrics.
ConfigMap Configuration Data SKIP Pure text/binary configuration data. It contains no containers and executes no code.
CatalogSource Operator Metadata SKIP A package repository manifest for OLM (Operator Lifecycle Manager). It is an index registry, not a workload.
deploymentconfig Platform Specific (OpenShift) SKIP It is deprecated. It behaves just like a standard deployment, managing active application pods. No pod by default is tagged to deploymentconfig in openshift.
replicationcontroller Native (Legacy) SKIP Double-counting risk. Just like ReplicaSets, these are lower-level pod controllers. If you are using legacy DeploymentConfig objects, they spin these up underneath. Skip them to avoid inflated numbers.

ToDo:
Current code supports following workload types to createExperiment.
deployment, deploymentConfig, statefulset, replicaset, replicationcontroller, daemonset and job.
So, will be removing support for deploymentConfig, replicationcontroller, replicaset and job.

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes

How has this been tested?

After installing kruize and import datasource, only the supported workload types should show up.

Test Configuration

  • Kubernetes clusters tested on:
    ITCP cluster

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Include any additional information such as links, test results, screenshots here

Summary by Sourcery

Bug Fixes:

  • Prevent unsupported or irrelevant workload types from being included in Kruize cluster metadata by filtering Prometheus queries to supported workload types only.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
@kusumachalasani kusumachalasani self-assigned this May 21, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 21, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restricts imported workloads to native Kubernetes types supported by Kruize by tightening the Prometheus queries in the local monitoring metadata profile to only consider specific workload_type labels.

Sequence diagram for filtered workload import using Prometheus queries

sequenceDiagram
    participant Kruize
    participant Prometheus

    Kruize->>Prometheus: query namespace_workload_pod:kube_pod_owner:relabel with workload_type filter
    Prometheus-->>Kruize: metrics for deployment|statefulset|daemonset|barepod|pod
    Kruize->>Kruize: import supported workloads only
Loading

File-Level Changes

Change Details Files
Filter cluster-level workload and container metrics to only supported native Kubernetes workload types via Prometheus label selectors.
  • Update the workload-level aggregation query to filter namespace_workload_pod:kube_pod_owner:relabel metrics by workload_type matching deployment, statefulset, daemonset, barepod, or pod instead of only checking workload non-emptiness.
  • Update the container-level aggregation query join to use the same workload_type filter on namespace_workload_pod:kube_pod_owner:relabel so only containers belonging to supported workload types are counted.
  • Mirror these query changes in both the YAML and JSON versions of the cluster_metadata_local_monitoring metadata profile to keep them in sync.
manifests/autotune/metadata-profiles/cluster_metadata_local_monitoring.yaml
manifests/autotune/metadata-profiles/cluster_metadata_local_monitoring.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant