Skip to content

Migrate resource metrics from kube-state-metrics ConfigMaps to ResourceMetricsPolicy#87

Merged
scotwells merged 5 commits into
mainfrom
feat/resource-metrics-policy-conversion
Apr 29, 2026
Merged

Migrate resource metrics from kube-state-metrics ConfigMaps to ResourceMetricsPolicy#87
scotwells merged 5 commits into
mainfrom
feat/resource-metrics-policy-conversion

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

@scotwells scotwells commented Apr 19, 2026

What this does

Replaces the ConfigMap-based CustomResourceStateMetrics configuration (consumed by kube-state-metrics) with a ResourceMetricsPolicy CRD, and removes the old config/components/resource-metrics/ component entirely.

The resource-metrics operator is designed for multi-tenant scaling — it handles metrics collection per-tenant without requiring a shared kube-state-metrics instance, making it a better fit as we scale across tenants.

Additional improvements over the old ConfigMap approach:

  • Status conditions — every condition type is tracked automatically. Previously only specific named conditions were captured; new condition types now appear without any config change.
  • Network interfaces — all interfaces on an instance are tracked. Previously only the first interface was captured, so multi-homed instances had incomplete network visibility.

Test plan

  • Deploy to a dev environment and confirm metrics appear in Victoria Metrics for Workloads, Workload Deployments, and Instances
  • Verify that all condition types show up as separate series per resource
  • For instances with multiple network interfaces, confirm each interface appears as its own series
  • Confirm the old ConfigMap (workload-services-metrics) is no longer created

🤖 Generated with Claude Code

scotwells and others added 2 commits April 19, 2026 15:05
Converts the three CustomResourceStateMetrics configs for Workload,
WorkloadDeployment, and Instance resources into a single
ResourceMetricsPolicy named compute-metrics using CEL expressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded per-condition-type metrics with a single forEach-based
metric that iterates object.status.conditions, and replace the
networkInterfaces[0] hardcoded index with forEach over
object.status.networkInterfaces so all interfaces are captured.
@scotwells scotwells changed the title feat: convert resource metrics to ResourceMetricsPolicy Track all status conditions and all network interfaces per instance Apr 20, 2026
@scotwells scotwells changed the title Track all status conditions and all network interfaces per instance Migrate resource metrics from kube-state-metrics ConfigMaps to ResourceMetricsPolicy Apr 28, 2026
@scotwells scotwells requested a review from JoseSzycho April 28, 2026 22:29
scotwells and others added 3 commits April 28, 2026 17:30
…MetricsPolicy

Deletes the config/components/resource-metrics/ ConfigMap approach now that
all metrics are covered by the ResourceMetricsPolicy CRD in
config/resource-metrics-policies/. Adds the new policy to the single-cluster
overlay so it is deployed as part of the standard install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Relocates the new policy files from config/resource-metrics-policies/ to
config/components/resource-metrics/, consistent with where the old
ConfigMap-based metrics config lived.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scotwells scotwells requested a review from a team April 28, 2026 22:41
@scotwells scotwells marked this pull request as ready for review April 28, 2026 22:41
@scotwells scotwells merged commit 46a94ce into main Apr 29, 2026
9 checks passed
@scotwells scotwells deleted the feat/resource-metrics-policy-conversion branch April 29, 2026 15:41
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