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

Daemon scheduling sets wrong deploymentConfiguration defaults #2209

Closed
SoManyHs opened this issue Apr 9, 2019 · 0 comments · Fixed by #2210 · May be fixed by MechanicalRock/account-reaper#6
Closed

Daemon scheduling sets wrong deploymentConfiguration defaults #2209

SoManyHs opened this issue Apr 9, 2019 · 0 comments · Fixed by #2210 · May be fixed by MechanicalRock/account-reaper#6
Assignees
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug.

Comments

@SoManyHs
Copy link
Contributor

SoManyHs commented Apr 9, 2019

The following code raises an error:

import ecs = require('@aws-cdk/aws-ecs');
import ec2 = require('@aws-cdk/aws-ec2');
import cdk = require('@aws-cdk/cdk');

const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs');

// Create a cluster
const vpc = new ec2.VpcNetwork(stack, 'Vpc', { maxAZs: 2 });
const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
  instanceType: new ec2.InstanceType('t2.micro')
});

// Create Task Definition with placement constraint
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef');
const container = taskDefinition.addContainer('web', {
  image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
  memoryLimitMiB: 256,
});

container.addPortMappings({
  containerPort: 80,
  hostPort: 8080,
  protocol: ecs.Protocol.Tcp
});

// Create Service
new ecs.Ec2Service(stack, "Service", {
  cluster,
  taskDefinition,
  daemon: true,
});

app.run();

Error:

 | Service/Service (ServiceD69D759B) The daemon scheduling strategy does not support values above 100 for maximumPercent on a deployment configuration. Change the maximumPercent value to 100, and try again (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: xxxxxxxx-5b19-11e9-9a23-f1a4d7df54a9)

This is bc base service sets max/min defaults to 200/50, respectively. when it should be 100/0.

From the docs:

If deploymentConfiguration is specified, the maximum percent parameter must be 100. The default value for a daemon service for maximumPercent is 100%. The default value for a daemon service for minimumHealthyPercent is 0% for the AWS CLI, the AWS SDKs, and the APIs, and 50% for the AWS Management Console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container bug This issue is a bug.
Projects
None yet
1 participant