-
Notifications
You must be signed in to change notification settings - Fork 53
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
Deploying new revisions of Cloud Run resources yields 409: Conflict #350
Comments
@stack72 Get with me on the Slack org to set up a video call if you'd like me to walk you through what I'm experiencing. |
Can you post the code you're using to deploy so we can try repro this? |
You bet - var svc = new cloudrun.Service("my-service-name", new cloudrun.ServiceArgs
{
Name = "my-service-name",
Traffics = new InputList<cloudrun.Inputs.ServiceTrafficArgs>
{
new cloudrun.Inputs.ServiceTrafficArgs
{
LatestRevision = true,
Percent = 100
}
},
Template = new cloudrun.Inputs.ServiceTemplateArgs
{
Spec = new cloudrun.Inputs.ServiceTemplateSpecArgs
{
Containers = new InputList<cloudrun.Inputs.ServiceTemplateSpecContainerArgs> {
new cloudrun.Inputs.ServiceTemplateSpecContainerArgs {
Image = DockerImage, // a gcr.io docker image URL
Envs = new InputList<cloudrun.Inputs.ServiceTemplateSpecContainerEnvArgs> {
new cloudrun.Inputs.ServiceTemplateSpecContainerEnvArgs
{
Name = "Authentication__Google__ClientId",
Value = GoogleOauthClientId
},
new cloudrun.Inputs.ServiceTemplateSpecContainerEnvArgs
{
Name = "Authentication__AzureAD__ClientId",
Value = AzureOauthClientId
},
new cloudrun.Inputs.ServiceTemplateSpecContainerEnvArgs
{
Name = "Authentication__AzureAD__TenantId",
Value = AzureOauthTenantId
},
}
}
},
ContainerConcurrency = 1,
},
},
Location = "us-central1",
AutogenerateRevisionName = true
}); |
I am also having this issue, it happens when you modify something only and then try to modify it in pulumi. The strange thing is that now my stack is corrupted because pulumi thinks it successfully apply the change. |
Also I tried deleting the service in GCP and pulumi simply did not detect that the service was gone... I would have expected it to try to recreate it. |
Edit: I tried doing pure terraform and I don't see this problem, so this is a problem of Pulumi not using the provider correctly and not fetching the latest resource. |
I wonder if it has to do with Terraform's concept of "virtual fields". I searched for "virtual" in the codebase (both the GCP provider and core Pulumi) and didn't find much. |
One key thing that is different by default between Pulumi and Terraform is that Terraform does a "refresh" by default (but can opt-out), and Pulumi does not (but can opt-in). It may be that the Cloud Run resource was designed to require having a refresh done prior to being updated? Can you try running In general it is a "bug" in a provider if it cannot be used correctly without a refresh - as users can and often do opt-out of refresh by default in Terraform as well - but there may be cases where it is unavoidable. Note that we are considering changing this default in pulumi/pulumi#2247. |
Doing a refresh worked once, but when I added |
I have this exact same issue (409). return new gcp.cloudrun.Service(
`${prefix}-app`,
{
name: `${prefix}-app`,
location,
template: {
spec: {
containers: [
{
image: imageUrl,
envs: [
{
name: 'PUBLIC_BUCKET_URL',
value: publicBucketName,
},
],
resources: {
requests: {
memory: '64Mi',
cpu: '200m',
},
limits: {
memory: '256Mi',
cpu: '1000m',
},
},
},
],
containerConcurrency: 80,
},
},
},
{ dependsOn: enableCloudRun },
) When I try to add a new env variable and run
If I add this:
and run
Running |
Any update on this @jaxxstorm? |
We're taking a look. It'd be helpful if anyone running into this is able to post detailed logs (https://www.pulumi.com/docs/troubleshooting/#verbose-logging) from running |
Hi @leezen. I'm glad to provide logs. With the verbosity turned all the way up, will the logs contain secrets or other sensitive information that shouldn't be public? |
I will do that this weekend. yes it will contain sensitive stuff @floyd-may. Can you provide an email so we could send it to you securely @leezen thanks! |
Yes, if you don't want to clean it, can you please DM to me on slack.pulumi.com? Alternative, lee@ via email works, too. |
We believe this is now resolved with some upstream changes to the terraform provider. @stack72 and I could not reproduce this. If anyone else has this problem, please make sure you're using the latest version of the provider and if it persists, feel free to reopen this issue. |
I will test and confirm, can you link the issue/pr of the upstream provider for posterity @jaxxstorm? thanks! |
I've had this issue in the past, and everything's been fine for a while. It's just started happening again. The only thing I can think of is that during the deployment process a Cloud Function failed to deploy, (issue with the resource reference), which failed the process. I am then getting to a partially deployed state that causes the errors in Cloud Run world?
|
Does a |
refresh worked for me! |
Refresh usually works yes |
How can this issue be fixed when a I've tried refreshing, setting the revision name explicitly and also exporting the stack configuration and removing occurences the offending revision name from the I'm also interested to know why Pulumi (although I guess it's probably Terraform) even tries to upgrade using the current revision name? Won't that always fail? |
Using import with the resource id once did the trick for me: https://www.pulumi.com/docs/guides/adopting/import/ |
Got someone hitting this again by deploying a container that wouldn't start. Subsequent updates failed until a refresh was run. For Pulumi engineers: see https://pulumi.slack.com/archives/CBVJAP46L/p1715511335035519 for logs |
Same thing as @pierskarsenbarg. If container won't start, you can't update it anymore. Here's my error
|
A |
A simple |
The issue also happens when deploying an image change from outside pulumi, e.g. deploying the infra changes via pulumi, but an update in the image as part of another pipeline. |
…2622) This change fixes an issue with the `cloud_run_service` resource which causes a 409 conflict with the service whenever there is a change outside of pulumi. The conflict is caused by the `resourceVersion` property in the `metadata` blob, which is used for optimistic locking. This change adds a `TransformFromState` hook to the resource which deletes the `resourceVersion` from the state. This disables the optimistic locking behaviour and prevents the 409 conflicts caused by changes to the resource. fixes #350
This issue has been addressed in PR #2622 and shipped in release v8.9.2. |
Deploying new revisions of Cloud Run resources is failing due to the GCP API giving an error response of 409: Conflict. This occurs whether or not the
AutoGenerateRevisionName
field is set (as mentioned by this Terraform provider issue: hashicorp/terraform-provider-google#5898). I've triedAutoGenerateRevisionName
and manually generating a random name as well.The text was updated successfully, but these errors were encountered: