Skip to content

Commit

Permalink
Add signing region for use with custom endpoint. (#4064)
Browse files Browse the repository at this point in the history
* Add signing region for use with custom endpoint.

* Add comment
  • Loading branch information
mattdurham authored and captncraig committed Jun 6, 2023
1 parent dfee0b2 commit d07030d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ v0.34.0-rc.2 (2023-06-06)

- `prometheus.operator.podmonitors` and `prometheus.operator.servicemonitors` can now access cluster secrets for authentication to targets. (@captncraig)

### Bugfixes

- Add signing region to remote.s3 component for use with custom endpoints so that Authorization Headers work correctly when
proxying requests. (@mattdurham)

v0.34.0-rc.1 (2023-06-02)
--------------------

Expand Down
4 changes: 3 additions & 1 deletion component/remote/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ func generateS3Config(args Arguments) (*aws.Config, error) {
// Override the endpoint.
if args.Options.Endpoint != "" {
endFunc := aws.EndpointResolverWithOptionsFunc(func(service, region string, _ ...interface{}) (aws.Endpoint, error) {
return aws.Endpoint{URL: args.Options.Endpoint}, nil
// The S3 compatible system used for testing with does not require signing region, so it's fine to be blank
// but when using a proxy to real S3 it needs to be injected.
return aws.Endpoint{URL: args.Options.Endpoint, SigningRegion: args.Options.SigningRegion}, nil
})
endResolver := aws_config.WithEndpointResolverWithOptions(endFunc)
configOptions = append(configOptions, endResolver)
Expand Down
13 changes: 7 additions & 6 deletions component/remote/s3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ type Arguments struct {

// Client implements specific AWS configuration options
type Client struct {
AccessKey string `river:"key,attr,optional"`
Secret rivertypes.Secret `river:"secret,attr,optional"`
Endpoint string `river:"endpoint,attr,optional"`
DisableSSL bool `river:"disable_ssl,attr,optional"`
UsePathStyle bool `river:"use_path_style,attr,optional"`
Region string `river:"region,attr,optional"`
AccessKey string `river:"key,attr,optional"`
Secret rivertypes.Secret `river:"secret,attr,optional"`
Endpoint string `river:"endpoint,attr,optional"`
DisableSSL bool `river:"disable_ssl,attr,optional"`
UsePathStyle bool `river:"use_path_style,attr,optional"`
Region string `river:"region,attr,optional"`
SigningRegion string `river:"signing_region,attr,optional"`
}

const minimumPollFrequency = 30 * time.Second
Expand Down
16 changes: 9 additions & 7 deletions docs/sources/flow/reference/components/remote.s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ client | [client][] | Additional options for configuring the S3 client. | no

The `client` block customizes options to connect to the S3 server.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`key` | `string` | Used to override default access key. | | no
`secret` | `secret` | Used to override default secret value. | | no
`endpoint` | `string` | Specifies a custom url to access, used generally for S3-compatible systems. | | no
`disable_ssl` | `bool` | Used to disable SSL, generally used for testing. | | no
Name | Type | Description | Default | Required
---- | ---- |-----------------------------------------------------------------------------------------| ------- | --------
`key` | `string` | Used to override default access key. | | no
`secret` | `secret` | Used to override default secret value. | | no
`endpoint` | `string` | Specifies a custom url to access, used generally for S3-compatible systems. | | no
`disable_ssl` | `bool` | Used to disable SSL, generally used for testing. | | no
`use_path_style` | `string` | Path style is a deprecated setting that is generally enabled for S3 compatible systems. | `false` | no
`region` | `string` | Used to override default region. | | no
`region` | `string` | Used to override default region. | | no
`signing_region` | `string` | Used to override the signing region when using a custom endpoint. | | no


## Exported fields

Expand Down

0 comments on commit d07030d

Please sign in to comment.