feat(otel): add Karpenter metrics integration test - #715
Open
vaishnavi-30-beep wants to merge 29 commits into
Open
feat(otel): add Karpenter metrics integration test#715vaishnavi-30-beep wants to merge 29 commits into
vaishnavi-30-beep wants to merge 29 commits into
Conversation
miconeilaws
reviewed
Jul 2, 2026
vaishnavi-30-beep
force-pushed
the
feature/karpenter-integration
branch
from
July 6, 2026 10:49
0183053 to
db96765
Compare
petruanica
reviewed
Jul 6, 2026
vaishnavi-30-beep
force-pushed
the
feature/karpenter-integration
branch
from
July 27, 2026 10:41
33caed0 to
5f0f260
Compare
Contributor
|
It seems we are not testing what happens when Karpenter provisions new nodes. Should we validate we can scrape the metrics that are only emitted during scaling operations? |
petruanica
reviewed
Jul 27, 2026
petruanica
reviewed
Jul 27, 2026
Add karpenter-test taint to NodePool so trigger pod is unschedulable on managed node group nodes. This guarantees Karpenter must provision a new node on every run, ensuring provisioning metrics (karpenter_nodeclaims_created_total, karpenter_nodes_created_total, karpenter_cloudprovider_duration_seconds, karpenter_pods_bound_duration_seconds) are always emitted. Changes: - Add karpenter-test:NoSchedule taint to NodePool spec - Replace karpenter.sh/disruption toleration with karpenter-test toleration on trigger pod - Remove || true from kubectl wait so terraform fails loudly if Karpenter cannot provision
cloud.account.id is always present on Karpenter metrics. Replace conditional check with require.True assertion to fail explicitly if the attribute is ever missing.
- Add karpenter_scale_trigger to validator depends_on so terraform waits for Karpenter to actually provision a node before starting the metric propagation sleep - Increase sleep to 4 minutes to give the agent time to scrape the provisioning counter metrics after node creation
- Add kubectl wait for karpenter deployment readiness + 10s settle before applying NodePool CRDs - Increase scale-trigger timeout to 600s to allow for slower EC2 provisioning in CI environments
vaishnavi-30-beep
force-pushed
the
feature/karpenter-integration
branch
from
July 27, 2026 14:51
db1a0d4 to
a3b8d37
Compare
Karpenter v1 manages instance profiles directly. Add GetInstanceProfile, CreateInstanceProfile, AddRoleToInstanceProfile, DeleteInstanceProfile, RemoveRoleFromInstanceProfile, and TagInstanceProfile to the controller IAM policy. Without these, EC2NodeClass stays 'not ready' and NodePool is ignored.
- Expand instance-category to c,m,r,t and sizes to medium,large,xlarge t3.medium/large don't have enough allocatable CPU for the trigger pod - Add ec2:DescribeSpotPriceHistory (Karpenter pricing controller) - Add iam:ListInstanceProfiles (Karpenter GC controller)
Verify karpenter_nodeclaims_created_total and karpenter_nodes_created_total have value >= 1, confirming Karpenter actually provisioned a node.
- Revert helm chart clone to aws-observability/helm-charts with helm_chart_branch variable - Remove karpenter_chart_ref variable (testing-only) - Remove diagnostic log dump from scale-trigger timeout
petruanica
reviewed
Jul 28, 2026
petruanica
approved these changes
Jul 28, 2026
TravisStark
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add automated integration tests for the Karpenter metrics pipeline. Verifies that all 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/solutions/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, disruption, and scaling event metricskarpenter_test.go— test suites:github.com/aws/karpenterTerraform (
terraform/eks/daemon/otel/)karpenter-test: NoScheduletaint + EC2NodeClass for metric generationkarpenter-scale-triggerworkload with matching toleration to guarantee Karpenter provisions a node on every run (ensures scaling-event metrics likekarpenter_nodeclaims_created_totalandkarpenter_nodes_created_totalare always emitted)otelContainerInsights.solutions.karpenter.enabled=truein the CW Agent helm valuesShared utility (
util/otelmetrics/source_registry.go)SourceKarpenterto the MetricSource enumTesting
CI integration tests passing for Karpenter under eks_daemon:otel_standard_test: https://github.com/aws/amazon-cloudwatch-agent/actions/runs/30315568293/job/90140403199
Also verified locally against a live EKS cluster (
karpenter-test, eu-north-1) — all tests passing.Related