Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing omitempty for fault injection task metadata field #4376

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

harishxr
Copy link
Contributor

@harishxr harishxr commented Oct 1, 2024

Summary

This PR removes the omitempty from the fault injection task metadata field.

Implementation details

  • Remove omitempty from FaultInjectionEnabled in type TaskResponse struct

Testing

  • Before removing omitempty
{
  "Cluster": "harishxr-ecs",
  "TaskARN": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/8ec46eb80d6e42a49a669ad9321076a2",
  "Family": "fis-omniempty",
  "Revision": "1",
  "DesiredStatus": "RUNNING",
  "KnownStatus": "RUNNING",
  "Limits": {
    "CPU": 1,
    "Memory": 3072
  },
  "PullStartedAt": "2024-10-01T22:03:05.264367788Z",
  "PullStoppedAt": "2024-10-01T22:03:05.343280945Z",
  "AvailabilityZone": "us-west-2c",
  "LaunchType": "EC2",
  "Containers": [
    {
      "DockerId": "c7c3a97cc6b22695746d477997b55b952153dcb9c938e86aecefa15593f0132e",
      "Name": "~internal~ecs~pause",
      "DockerName": "ecs-fis-omniempty-1-internalecspause-c89ddcec89bec8825400",
      "Image": "amazon/amazon-ecs-pause:0.1.0",
      "ImageID": "",
      "Labels": {
        "com.amazonaws.ecs.cluster": "harishxr-ecs",
        "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
        "com.amazonaws.ecs.task-arn": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/8ec46eb80d6e42a49a669ad9321076a2",
        "com.amazonaws.ecs.task-definition-family": "fis-omniempty",
        "com.amazonaws.ecs.task-definition-version": "1"
      },
      "DesiredStatus": "RESOURCES_PROVISIONED",
      "KnownStatus": "RESOURCES_PROVISIONED",
      "Limits": {
        "CPU": 2,
        "Memory": 0
      },
      "CreatedAt": "2024-10-01T22:03:04.229888206Z",
      "StartedAt": "2024-10-01T22:03:04.496784854Z",
      "Type": "CNI_PAUSE",
      "Networks": [
        {
          "NetworkMode": "awsvpc",
          "IPv4Addresses": [
            "172.31.156.252"
          ],
          "AttachmentIndex": 0,
          "MACAddress": "0a:3f:eb:8b:26:d7",
          "IPv4SubnetCIDRBlock": "172.31.128.0/17",
          "PrivateDNSName": "ip-172-31-156-252.us-west-2.compute.internal",
          "SubnetGatewayIpv4Address": "172.31.128.1/17"
        }
      ]
    },
    {
      "DockerId": "b997bbea697331c37e6b078635c1df4abff8bc3f840891901e55d03691eaae9b",
      "Name": "fis-omni",
      "DockerName": "ecs-fis-omniempty-1-fis-omni-c6ac88cd8082a1a92300",
      "Image": "public.ecr.aws/nginx/nginx:stable-perl",
      "ImageID": "sha256:988616769ca20aeb4b850f98a0b6e37256b5179e3b0c0a443c41daa3691a43a5",
      "Labels": {
        "com.amazonaws.ecs.cluster": "harishxr-ecs",
        "com.amazonaws.ecs.container-name": "fis-omni",
        "com.amazonaws.ecs.task-arn": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/8ec46eb80d6e42a49a669ad9321076a2",
        "com.amazonaws.ecs.task-definition-family": "fis-omniempty",
        "com.amazonaws.ecs.task-definition-version": "1"
      },
      "DesiredStatus": "RUNNING",
      "KnownStatus": "RUNNING",
      "Limits": {
        "CPU": 2,
        "Memory": 0
      },
      "CreatedAt": "2024-10-01T22:03:05.356372903Z",
      "StartedAt": "2024-10-01T22:03:05.613742123Z",
      "Type": "NORMAL",
      "LogDriver": "awslogs",
      "LogOptions": {
        "awslogs-create-group": "true",
        "awslogs-group": "/ecs/fis-omniempty",
        "awslogs-region": "us-west-2",
        "awslogs-stream": "ecs/fis-omni/8ec46eb80d6e42a49a669ad9321076a2",
        "max-buffer-size": "25m",
        "mode": "non-blocking"
      },
      "ContainerARN": "arn:aws:ecs:us-west-2:xxyyzz:container/harishxr-ecs/8ec46eb80d6e42a49a669ad9321076a2/daad66df-bad0-4cb4-bcc5-9d34958070e4",
      "Networks": [
        {
          "NetworkMode": "awsvpc",
          "IPv4Addresses": [
            "172.31.156.252"
          ],
          "AttachmentIndex": 0,
          "MACAddress": "0a:3f:eb:8b:26:d7",
          "IPv4SubnetCIDRBlock": "172.31.128.0/17",
          "PrivateDNSName": "ip-172-31-156-252.us-west-2.compute.internal",
          "SubnetGatewayIpv4Address": "172.31.128.1/17"
        }
      ]
    }
  ],
  "VPCID": "vpc-0eca12de1619e3962"
}
  • After removing omitempty
# curl ${ECS_CONTAINER_METADATA_URI_V4}/task
{
  "Cluster": "harishxr-ecs",
  "TaskARN": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/0fdcc5ebf7df41ab927c4ee8b6214306",
  "Family": "fis-omniempty",
  "Revision": "1",
  "DesiredStatus": "RUNNING",
  "KnownStatus": "RUNNING",
  "Limits": {
    "CPU": 1,
    "Memory": 3072
  },
  "PullStartedAt": "2024-10-01T20:54:24.850558404Z",
  "PullStoppedAt": "2024-10-01T20:54:24.930660769Z",
  "AvailabilityZone": "us-west-2c",
  "LaunchType": "EC2",
  "Containers": [
    {
      "DockerId": "339df43dd3fcd9156f862ba73b632b85178a1d2d993e99db35a9a16e886cbf98",
      "Name": "~internal~ecs~pause",
      "DockerName": "ecs-fis-omniempty-1-internalecspause-9ae2fac2bff5ebc94b00",
      "Image": "amazon/amazon-ecs-pause:0.1.0",
      "ImageID": "",
      "Labels": {
        "com.amazonaws.ecs.cluster": "harishxr-ecs",
        "com.amazonaws.ecs.container-name": "~internal~ecs~pause",
        "com.amazonaws.ecs.task-arn": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/0fdcc5ebf7df41ab927c4ee8b6214306",
        "com.amazonaws.ecs.task-definition-family": "fis-omniempty",
        "com.amazonaws.ecs.task-definition-version": "1"
      },
      "DesiredStatus": "RESOURCES_PROVISIONED",
      "KnownStatus": "RESOURCES_PROVISIONED",
      "Limits": {
        "CPU": 2,
        "Memory": 0
      },
      "CreatedAt": "2024-10-01T20:54:23.941243117Z",
      "StartedAt": "2024-10-01T20:54:24.19547403Z",
      "Type": "CNI_PAUSE",
      "Networks": [
        {
          "NetworkMode": "awsvpc",
          "IPv4Addresses": [
            "172.31.250.169"
          ],
          "AttachmentIndex": 0,
          "MACAddress": "0a:d0:1c:f0:45:19",
          "IPv4SubnetCIDRBlock": "172.31.128.0/17",
          "PrivateDNSName": "ip-172-31-250-169.us-west-2.compute.internal",
          "SubnetGatewayIpv4Address": "172.31.128.1/17"
        }
      ]
    },
    {
      "DockerId": "ae3c936816e089ddf90c2a5b3e8f5ab96f1264e8860035166870f4974702a943",
      "Name": "fis-omni",
      "DockerName": "ecs-fis-omniempty-1-fis-omni-8e9aa98dc0c3dbcc2a00",
      "Image": "public.ecr.aws/nginx/nginx:stable-perl",
      "ImageID": "sha256:988616769ca20aeb4b850f98a0b6e37256b5179e3b0c0a443c41daa3691a43a5",
      "Labels": {
        "com.amazonaws.ecs.cluster": "harishxr-ecs",
        "com.amazonaws.ecs.container-name": "fis-omni",
        "com.amazonaws.ecs.task-arn": "arn:aws:ecs:us-west-2:xxyyzz:task/harishxr-ecs/0fdcc5ebf7df41ab927c4ee8b6214306",
        "com.amazonaws.ecs.task-definition-family": "fis-omniempty",
        "com.amazonaws.ecs.task-definition-version": "1"
      },
      "DesiredStatus": "RUNNING",
      "KnownStatus": "RUNNING",
      "Limits": {
        "CPU": 2,
        "Memory": 0
      },
      "CreatedAt": "2024-10-01T20:54:24.943565746Z",
      "StartedAt": "2024-10-01T20:54:25.164074976Z",
      "Type": "NORMAL",
      "LogDriver": "awslogs",
      "LogOptions": {
        "awslogs-create-group": "true",
        "awslogs-group": "/ecs/fis-omniempty",
        "awslogs-region": "us-west-2",
        "awslogs-stream": "ecs/fis-omni/0fdcc5ebf7df41ab927c4ee8b6214306",
        "max-buffer-size": "25m",
        "mode": "non-blocking"
      },
      "ContainerARN": "arn:aws:ecs:us-west-2:xxyyzz:container/harishxr-ecs/0fdcc5ebf7df41ab927c4ee8b6214306/13d9e096-c7b7-4b30-9bbe-e1186ab3c300",
      "Networks": [
        {
          "NetworkMode": "awsvpc",
          "IPv4Addresses": [
            "172.31.250.169"
          ],
          "AttachmentIndex": 0,
          "MACAddress": "0a:d0:1c:f0:45:19",
          "IPv4SubnetCIDRBlock": "172.31.128.0/17",
          "PrivateDNSName": "ip-172-31-250-169.us-west-2.compute.internal",
          "SubnetGatewayIpv4Address": "172.31.128.1/17"
        }
      ]
    }
  ],
  "VPCID": "vpc-0eca12de1619e3962",
  "FaultInjectionEnabled": false
}

New tests cover the changes:

Description for the changelog

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@harishxr harishxr marked this pull request as ready for review October 1, 2024 22:06
@harishxr harishxr requested a review from a team as a code owner October 1, 2024 22:06
@harishxr harishxr merged commit 310e9a6 into aws:feature/fis Oct 2, 2024
40 checks passed
mye956 pushed a commit to mye956/amazon-ecs-agent that referenced this pull request Oct 3, 2024
mye956 pushed a commit to mye956/amazon-ecs-agent that referenced this pull request Oct 3, 2024
harishxr added a commit to harishxr/amazon-ecs-agent that referenced this pull request Oct 11, 2024
amogh09 pushed a commit to amogh09/amazon-ecs-agent that referenced this pull request Oct 21, 2024
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