Skip to content

Commit

Permalink
chore: Add forcePathStyle option to aws-s3 Kamelets
Browse files Browse the repository at this point in the history
- Since Apache Camel 4 the aws-s3 component supports to force the path style when accessing buckets on AWS S3
- Path style access is essential when testing with local AWS S3 instances such as LocalStack
  • Loading branch information
christophd committed Nov 9, 2023
1 parent 9824072 commit a9355dd
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 5 deletions.
10 changes: 9 additions & 1 deletion kamelets/aws-s3-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
keyName:
title: Key Name
description: The key name for saving an element in the bucket.
Expand All @@ -113,7 +120,7 @@ spec:
when:
- simple: '${propertiesExist:!keyName}'
steps:
- choice:
- choice:
when:
- simple: "${header[file]}"
steps:
Expand All @@ -140,4 +147,5 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
keyName: "{{?keyName}}"
8 changes: 8 additions & 0 deletions kamelets/aws-s3-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
delay:
title: Delay
description: The number of milliseconds before the next poll of the selected bucket.
Expand Down Expand Up @@ -188,6 +195,7 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
delay: "{{delay}}"
maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
steps:
Expand Down
10 changes: 9 additions & 1 deletion kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ spec:
description: The naming strategy to use in streaming upload mode. There are 2 enums and the value can be one of progressive, random
type: string
default: "progressive"
keyName:
keyName:
title: Key Name
description: Setting the key name for an element in the bucket through endpoint parameter. In Streaming Upload, with the default configuration, this will be the base for the progressive creation of files.
type: string
Expand All @@ -121,6 +121,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
dependencies:
- "camel:aws2-s3"
- "camel:kamelet"
Expand All @@ -145,3 +152,4 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
keyName:
title: Key Name
description: The key name for saving an element in the bucket.
Expand All @@ -113,7 +120,7 @@ spec:
when:
- simple: '${propertiesExist:!keyName}'
steps:
- choice:
- choice:
when:
- simple: "${header[file]}"
steps:
Expand All @@ -140,4 +147,5 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
keyName: "{{?keyName}}"
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
delay:
title: Delay
description: The number of milliseconds before the next poll of the selected bucket.
Expand Down Expand Up @@ -188,6 +195,7 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
delay: "{{delay}}"
maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ spec:
description: The naming strategy to use in streaming upload mode. There are 2 enums and the value can be one of progressive, random
type: string
default: "progressive"
keyName:
keyName:
title: Key Name
description: Setting the key name for an element in the bucket through endpoint parameter. In Streaming Upload, with the default configuration, this will be the base for the progressive creation of files.
type: string
Expand All @@ -121,6 +121,13 @@ spec:
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
forcePathStyle:
title: Force Path Style
description: Forces path style when accessing AWS S3 buckets.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
dependencies:
- "camel:aws2-s3"
- "camel:kamelet"
Expand All @@ -145,3 +152,4 @@ spec:
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
forcePathStyle: "{{forcePathStyle}}"
3 changes: 2 additions & 1 deletion test/aws-s3/amazonS3Client.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import software.amazon.awssdk.services.s3.S3Client

S3Client s3 = S3Client
.builder()
.endpointOverride(URI.create("${YAKS_TESTCONTAINERS_LOCALSTACK_S3_LOCAL_URL}".replace('localhost', '127.0.0.1')))
.endpointOverride(URI.create("${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}"))
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(
"${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}",
"${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}")
))
.forcePathStyle(true)
.region(Region.of("${YAKS_TESTCONTAINERS_LOCALSTACK_REGION}"))
.build()

Expand Down
1 change: 1 addition & 0 deletions test/aws-s3/aws-s3-to-http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
properties:
bucketNameOrArn: ${aws.s3.bucketNameOrArn}
overrideEndpoint: true
forcePathStyle: true
uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
Expand Down
1 change: 1 addition & 0 deletions test/aws-s3/aws-s3-to-knative-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
properties:
bucketNameOrArn: ${aws.s3.bucketNameOrArn}
overrideEndpoint: true
forcePathStyle: true
uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
Expand Down
1 change: 1 addition & 0 deletions test/aws-s3/aws-s3-to-knative-channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
properties:
bucketNameOrArn: ${aws.s3.bucketNameOrArn}
overrideEndpoint: true
forcePathStyle: true
uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
Expand Down
1 change: 1 addition & 0 deletions test/aws-s3/aws-s3-uri-pipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
properties:
bucketNameOrArn: ${aws.s3.bucketNameOrArn}
overrideEndpoint: true
forcePathStyle: true
uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
Expand Down

0 comments on commit a9355dd

Please sign in to comment.