Skip to content

Add tests for EBS CSI NVMe on EKS - #507

Merged
duhminick merged 11 commits into
mainfrom
dominic-ebs-eks-pr
Jul 5, 2025
Merged

Add tests for EBS CSI NVMe on EKS#507
duhminick merged 11 commits into
mainfrom
dominic-ebs-eks-pr

Conversation

@duhminick

@duhminick duhminick commented Apr 17, 2025

Copy link
Copy Markdown
Contributor

Description of the issue

Testing that the metrics and EMF logs are correct when CWA is emitting EBS NVMe metrics from the EBS CSI driver.

Description of changes

  1. New suite of tests that check that all metrics are emitted correctly with the correct dimension sets

  2. New test environment using Terraform
    I. Installs the agent using the Helm charts
    ii. Installs the EBS CSI add-on and enables the metrics
    iii. An Amazon Linux container is deployed with an ephemeral EBS volume attached to test the metrics

  3. These tests do assert on the Type label (as do the other tests) which needs to be updated in Add translation logic for NVME metrics amazon-cloudwatch-agent#1625 (comment) to work.

Update 1:

  1. Pinned the Helm version since it seems that versions > 3 have some breaking changes for us. This includes pod identity, entity, and of course, EBS.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

  1. https://github.com/aws/amazon-cloudwatch-agent/actions/runs/14500675779/job/40745198026
    I . The test ran with a dev build that has the EBS CSI Prometheus scraping logic

  2. Latest test with a real build: https://github.com/aws/amazon-cloudwatch-agent/actions/runs/15978524238/job/45067569331

@duhminick duhminick changed the title Add tests for EBS CSI NVMe on EKS [DO NOT MERGE] Add tests for EBS CSI NVMe on EKS Apr 21, 2025
@duhminick
duhminick marked this pull request as ready for review April 21, 2025 19:58
@duhminick
duhminick requested a review from a team as a code owner April 21, 2025 19:58
Comment thread terraform/eks/daemon/ebs/main.tf Outdated
}

func (t *DiskIOTestRunner) GetAgentRunDuration() time.Duration {
return 5 * time.Minute

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is 5 minutes necessary for NVME metrics? Can it be shorter or 5 is the most consistent we found

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I found this to be the most consistent. I would've liked it to be shorter :(

Comment thread test/ebscsi/resources/config.json Outdated
Comment thread test/ebscsi/resources/config.json Outdated
Comment thread terraform/eks/daemon/ebs/main.tf Outdated
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you provide a sample emf log to cross reference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

{
    "AutoScalingGroupName": "eks-dscia-ng-c8ca3ae1-cabd-aab3-a6d0-50ecc2aa8c30",
    "CloudWatchMetrics": [{
        "Namespace": "ContainerInsights",
        "Dimensions": [
            ["ClusterName"],
            ["ClusterName", "InstanceId", "NodeName"],
            ["ClusterName", "InstanceId", "NodeName", "VolumeId"]
        ],
        "Metrics": [{
            "Name": "node_diskio_ebs_volume_performance_exceeded_tp",
            "Unit": "Second",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_read_bytes",
            "Unit": "Bytes",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_ec2_instance_performance_exceeded_tp",
            "Unit": "Second",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_volume_performance_exceeded_iops",
            "Unit": "Second",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_read_ops",
            "Unit": "Count",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_write_bytes",
            "Unit": "Bytes",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_write_ops",
            "Unit": "Count",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_write_time",
            "Unit": "Second",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_ec2_instance_performance_exceeded_iops",
            "Unit": "Second",
            "StorageResolution": 60
        }, {
            "Name": "node_diskio_ebs_total_read_time",
            "Unit": "Second",
            "StorageResolution": 60
        }]
    }],
    "ClusterName": "dscia-testing",
    "InstanceId": "i-0434a029434c980f7",
    "InstanceType": "m5.large",
    "NodeName": "ip-192-168-8-144.ec2.internal",
    "Timestamp": "1745510582682",
    "Type": "NodeNVME",
    "Version": "0",
    "VolumeId": "vol-0eb35c5cbb1ebfc97",
    "http.scheme": "http",
    "instance_id": "i-0434a029434c980f7",
    "k8s.namespace.name": "kube-system",
    "kubernetes": {
        "host": "ip-192-168-8-144.ec2.internal"
    },
    "net.host.name": "ebs-csi-node.kube-system.svc",
    "net.host.port": "3302",
    "server.address": "ebs-csi-node.kube-system.svc",
    "server.port": "3302",
    "service.instance.id": "ebs-csi-node.kube-system.svc:3302",
    "service.name": "containerInsightsNVMeExporterScraper",
    "url.scheme": "http",
    "volume_id": "vol-0eb35c5cbb1ebfc97",
    "node_diskio_ebs_ec2_instance_performance_exceeded_iops": 0,
    "node_diskio_ebs_ec2_instance_performance_exceeded_tp": 0,
    "node_diskio_ebs_total_read_bytes": 1056768,
    "node_diskio_ebs_total_read_ops": 39,
    "node_diskio_ebs_total_read_time": 0.02430000000003929,
    "node_diskio_ebs_total_write_bytes": 135168,
    "node_diskio_ebs_total_write_ops": 23,
    "node_diskio_ebs_total_write_time": 0.020897999999988315,
    "node_diskio_ebs_volume_performance_exceeded_iops": 0,
    "node_diskio_ebs_volume_performance_exceeded_tp": 0
}

duhminick and others added 3 commits April 23, 2025 16:57
- Remove unnecessary operator image update
- Add missing metric from schema
- Remove empty logfile which should make it easier to debug later down
the line
- Remove run_as_user since root is already default
- Remove debug line
varunch77
varunch77 previously approved these changes Apr 28, 2025
@duhminick duhminick changed the title [DO NOT MERGE] Add tests for EBS CSI NVMe on EKS Add tests for EBS CSI NVMe on EKS Jun 2, 2025
Comment thread test/metric_value_benchmark/eks_resources/util.go Outdated
}
}

resource "helm_release" "aws_observability" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this called "helm_release"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

container {
name = "app"
image = "public.ecr.aws/amazonlinux/amazonlinux"
command = ["/bin/bash", "-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this necessary? To force a write on disk to produce a metric?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep!


variable "ami_type" {
type = string
default = "AL2_x86_64"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related to your PR but at some point we should start testing with AL2023 since EKS recommends AL2023

https://docs.aws.amazon.com/eks/latest/userguide/al2023.html

@duhminick
duhminick merged commit acd1943 into main Jul 5, 2025
2 checks passed
@duhminick
duhminick deleted the dominic-ebs-eks-pr branch July 5, 2025 20:15
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.

4 participants