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

S3 Bucket constantly calls PutBucketNotification #1165

Closed
empath-nirvana opened this issue Feb 21, 2022 · 10 comments · Fixed by #1387 or #1389
Closed

S3 Bucket constantly calls PutBucketNotification #1165

empath-nirvana opened this issue Feb 21, 2022 · 10 comments · Fixed by #1387 or #1389
Labels
bug Something isn't working

Comments

@empath-nirvana
Copy link

What happened?

The issue is similar to this issue, however, I've hardcoded the ID in the notifications queue configuration and we're using version 0.21.2 which should have this fix in place:
#476

I've created a queue and it continuously tries to put in the notifications configuration, generating a test message every time.

How can we reproduce it?

Create a bucket with a notifications queue, check cloudtrail logs to see that it's making an api call every minute.

What environment did it happen in?

Crossplane version:

@empath-nirvana empath-nirvana added the bug Something isn't working label Feb 21, 2022
@MisterMX
Copy link
Collaborator

@empath-nirvana are you using queueArnRef to get the queue? If you so, this might have been fixed in #1161. Can you check again with the latest master?

@empath-nirvana
Copy link
Author

We aren't using that.

     - ID: Queue
       events:
       - s3:ObjectCreated:*
       filter:
         key:
           filterRules:
           - name: prefix
             value: (some prefix)
       queueArn: <some queue arn>

the bucket does work, it's just resyncing 1000 times a day and causing test messages to be sent.

Is there a way to get detailed logging so i can see what it thinks the difference is?

@MisterMX
Copy link
Collaborator

Thanks @empath-nirvana. I was able to reproduce the bug with your YAML.

It seems the cause of this issue is that the prefix filter rule is converted to camel case Prefix which generates a diff:

  []types.QueueConfiguration{
  	{
  		... // 1 ignored and 1 identical fields
  		Filter: &types.NotificationConfigurationFilter{
  			Key: &types.S3KeyFilter{
  				FilterRules: []types.FilterRule{
  					{
- 						Name: "Prefix",
+ 						Name: "prefix",
  						... // 2 ignored fields
  					},
  				},
  				... // 1 ignored field
  			},
  			... // 1 ignored field
  		},
  		... // 2 ignored fields
  	},
  }

This seems to be an issue on AWS side:

{
    "QueueConfigurations": [
        {
            "Id": "...",
            "QueueArn": "...",
            "Events": [
                "s3:ObjectCreated:*"
            ],
            "Filter": {
                "Key": {
                    "FilterRules": [
                        {
                            "Name": "Prefix",
                            "Value": "some-prefix"
                        }
                    ]
                }
            }
        }
    ]
}

The SDK itself also only defines prefix and suffix as correct values.

@empath-nirvana
Copy link
Author

Is there a way to work around this that doesn't involve waiting for a patch to the aws sdk for go?

@MisterMX
Copy link
Collaborator

Its a bit difficult because the controller uses go-cmp to compare the configurations and it does not have an ignore case option AFAIK.

@muvaf what would be the best way to circumvent this issue?

@empath-nirvana
Copy link
Author

What happens if you change the enum to allow "Prefix" and "Suffix"? Does s3 only accept lower case?

@empath-nirvana
Copy link
Author

Given that aws-sdk has said they won't fix the issue, is there some way this can be fixed by the cross-plane provider?

@MisterMX
Copy link
Collaborator

Since its a bug at AWS it would be best to wait for them to fix it on their side.

On provider level you could only add a hacky workaround by converting the respective fields to lowercase strings or find a way to ignore case when doing cmp.Equal.

@empath-nirvana
Copy link
Author

empath-nirvana commented Mar 10, 2022 via email

schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 14, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <paul.schroeder-extern@deutschebahn.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 15, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 15, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 15, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 15, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 15, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
haarchri added a commit that referenced this issue Jul 17, 2022
…-instead-of-prefix

fix(s3.bucket): Fixes #1165, discrepancy in QueueConfiguration.Filter.Key.FilterRules.Name
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 19, 2022
…guration.Filter.Key.FilterRules.Name (with extensive corner case testing)

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 19, 2022
…guration.Filter.Key.FilterRules.Name (with extensive corner case testing)

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
schroeder-paul added a commit to schroeder-paul/provider-aws that referenced this issue Jul 19, 2022
…guration.Filter.Key.FilterRules.Name (with extensive corner case testing)

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
haarchri added a commit that referenced this issue Jul 23, 2022
…-instead-of-prefix

fix(s3.bucket): Fixes #1165, discrepancy QueueConfiguration.Filter.Ke…
emelieakerstrom-sb1 pushed a commit to sparebank1utvikling/provider-aws that referenced this issue Sep 28, 2022
…guration.Filter.Key.FilterRules.Name

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
emelieakerstrom-sb1 pushed a commit to sparebank1utvikling/provider-aws that referenced this issue Sep 28, 2022
…guration.Filter.Key.FilterRules.Name (with extensive corner case testing)

Signed-off-by: Paul Schroeder <97968850+schroeder-paul@users.noreply.github.com>
@Yaswanth45
Copy link

Facing same issue but with TopicConfiguration.Filter.Key.FilterRules.Name. Crossplane is infinitely calling the PutBucketNotification on our bucket. Seems the same fix need to be applied to TopicConfiguration as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants