-
Notifications
You must be signed in to change notification settings - Fork 104
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
FargateService cannot specify both launchType and capacityProviderStrategies #599
Comments
service.ts applies a default value when no |
Hey @kennyjwilli My apologies this has gone so long without being triaged / commented upon. So I believe the behaviour should be the following (for both EC2Service and FargateService)
This will allow each of those service types to no longer pass both parameters If you are happy with this, I can get this update and shipped Paul |
Thanks for taking a look @stack72.
I read "now" to be "not." This will not cover the case AWS defines as "If no capacityProviderStrategy or launchType is specified, the defaultCapacityProviderStrategy for the cluster is used.". These are the cases that are supported by AWS and I think should be supported by this API.
The fix I originally suggested (allowing launchType to be specified) is a breaking change. It'd require removing the default value set for launchType thus implicitly changing the default behavior. If users were to update to this version and not know about this change, their tasks would be launched using the defaultCapacityProviderStrategy. This is probably not desired. @stack72 and I discussed a different solution -- adding a new parameter This change would not be breaking for users, which is good. It does add some complexity to the API. Users will likely need to know the motivation for this parameter and when to use it (whenever using capacityProviderStrategies or wanting to use defaultCapacityProviderStrategy). It's also worth noting that if AWS adds a value to their launchType named There is also a case for making the breaking change. With the addition of cluster defaultCapacityProviderStrategy, setting |
Another approach would be to do the following:
I think this would be preferred because it doesn't attempt to introduce having the user reason about |
I like that approach @leezen. I might, however, suggest a different, more general name. This new class could avoid setting defaults and still provide the nice awsx API. Perhaps simply making this change to the underlying I thought I'd offer one other alternative. We could keep the classes as is and add in a |
Given
My 2 cents: it feels like |
Is there a workaround, or do we have to wait for a proper fix? |
@kennyjwilli Did you want to take a stab at the approach outlined above? Would be happy to review a PR. |
Realistically, I don't think I'm going to be able to get to it soon. I will add it to my list though to tackle if no one picks it up first. |
How can I rewrite the code posted by the author of this issue to fit the changes that were made to Pulumi. I am having a hard time to find any documentation on that. 🥹 I tried setting up const cluster = new awsx.ecs.Cluster(
'default-cluster',
{
capacityProviders: [
// 'FARGATE',
'FARGATE_SPOT',
],
defaultCapacityProviderStrategies: [
{
weight: 100,
capacityProvider: 'FARGATE_SPOT',
},
// {
// weight: 0,
// capacityProvider: 'FARGATE',
// },
],
}
)
const service = new awsx.ecs.FargateService(
'meilisearch',
{
cluster,
desiredCount: 1,
taskDefinitionArgs: {
container: {
image: 'getmeili/meilisearch',
cpu: 512,
memory: 128,
essential: true,
environment: Object.entries({
MEILI_MASTER_KEY: this.masterKey,
MEILI_HTTP_ADDR: `0.0.0.0:${PORT}`,
...environment,
}).map(([name, value]) => ({ name, value })),
},
},
}
) |
The
launchType
is currently explicitly set toFARGATE
. When usingcapacityProviderStrategies
, you cannot also specify alaunchType
. If you try to,pulumi up
will fail with this error.Here is a minimal repro.
Explicitly specifying the
launchType
also prevents the cluster defaultcapacityProviderStrategy
from being applied.From the RunTask API doc on capacityProviderStrategy:
To fix this, I suggest allowing the
launchType
parameter to be passed in to theFargateService
.The text was updated successfully, but these errors were encountered: