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

remove healthCheckGracePeriodSeconds validation #805

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

ijin
Copy link
Contributor

@ijin ijin commented Feb 17, 2025

Problem

When running ECS services without load balancers, ecspresso verify fails if healthCheckGracePeriodSeconds is defined in the service definition. However, AWS ECS automatically adds this field (with value 0) to all services, making this validation unnecessary.

Current Behavior

// Service definition without healthCheckGracePeriodSeconds
{
  "availabilityZoneRebalancing": "ENABLED",
  "desiredCount": 1,
  "launchType": "FARGATE",
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "ENABLED",
      "securityGroups": [
        "sg-xxxxxxxx"
      ],
      "subnets": [
        "subnet-aaaaaa",
        "subnet-cccccc"
      ]
    }
  },
  "platformVersion": "LATEST",
  "healthCheckGracePeriodSeconds": 1,
  "propagateTags": "NONE"
}
$ ecspresso diff
-  "healthCheckGracePeriodSeconds": 0,
$ aws ecs describe-services --cluster test --services test | grep health
            "healthCheckGracePeriodSeconds": 0,

When adding the field to match AWS's behavior:

{
  "healthCheckGracePeriodSeconds": 0,
  "desiredCount": 1,
  // ... rest of service definition
}

ecspresso verify fails:

$ ecspresso verify
2025/02/17 03:50:37 test Starting verify
  TaskDefinition
    ExecutionRole[arn:aws:iam::012345678912:role/ecsTaskExecutionRole]
    --> [OK]
    ContainerDefinition[test]
      Image[redis]
      --> [OK]
      LogConfiguration[awslogs]
      --> [OK]
    --> [OK]
  --> [OK]
  ServiceDefinition
  --> [NG] service has no load balancers, but healthCheckGracePeriodSeconds is defined

Solution

Remove the validation check for healthCheckGracePeriodSeconds because:

  1. ECS adds this field by default with value 0
  2. Having this field is valid for services without load balancers
  3. The current validation causes unnecessary friction

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.

1 participant