Skip to content

feat(otel): add Karpenter metrics integration test#715

Open
vaishnavi-30-beep wants to merge 14 commits into
aws:mainfrom
vaishnavi-30-beep:feature/karpenter-integration
Open

feat(otel): add Karpenter metrics integration test#715
vaishnavi-30-beep wants to merge 14 commits into
aws:mainfrom
vaishnavi-30-beep:feature/karpenter-integration

Conversation

@vaishnavi-30-beep

@vaishnavi-30-beep vaishnavi-30-beep commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Add automated integration tests for the Karpenter metrics pipeline. Verifies that all 24 Karpenter metrics are scraped by the CloudWatch Agent and forwarded to CloudWatch with correct instrumentation scope, cluster name, namespace, and expected datapoint labels.

Changes

Test code (test/otel/integrations/karpenter/)

  • setup_test.go — TestMain initialization (region, cluster, SigV4 client, QueryCache)
  • metrics_test.go — 24 Karpenter metric definitions covering pods, nodes, cluster state, nodepools, cloudprovider, and disruption metrics
  • karpenter_test.go — test suites:
    • MetricsExist — all metrics are queryable in CloudWatch
    • Instrumentation — scope is github.com/aws/karpenter
    • InstrumentationConsistent — no mixed sources per metric
    • ExpectedLabels — datapoint labels (resource_type, phase, method, reason) present
    • ClusterIdentity, Namespace, DeploymentName, PodName — K8s resource attributes
    • CloudProvider, CloudPlatform, CloudRegion, CloudAccountID, CloudResourceID — cloud resource attributes

Terraform (terraform/eks/daemon/otel/)

  • Installs Karpenter via Helm with IAM role, Pod Identity
  • Tags subnets/SGs for Karpenter discovery
  • Deploys a minimal NodePool + EC2NodeClass for metric generation
  • Enables otelContainerInsights.integrations.karpenter.enabled=true in the CW Agent helm values
  • Adds Karpenter integration test run to the validator

Shared utility (util/otelmetrics/source_registry.go)

  • Adds SourceKarpenter to the MetricSource enum

Testing

CI integration tests passing for Karpenter under eks_daemon:otel_standard_test: https://github.com/aws/amazon-cloudwatch-agent/actions/runs/28984147604/job/86009444350
Screenshot 2026-07-09 at 10 58 37
Also verified locally against a live EKS cluster (karpenter-test, eu-north-1) — all tests passing.

Related

Comment thread test/otel/integrations/karpenter/karpenter_test.go Outdated
@vaishnavi-30-beep vaishnavi-30-beep force-pushed the feature/karpenter-integration branch from 0183053 to db96765 Compare July 6, 2026 10:49
Comment thread terraform/eks/daemon/otel/main.tf Outdated
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.

3 participants