Skip to content

Commit d9fda60

Browse files
[Egress providers - S3 store] Add support for service accounts when running dotnet monitor in kubernetes (#6626)
* Reference AWSSDK.SecurityToken in the S3 Storage project so that authentication via Open ID connect is possible It is enough for the project to be referenced for this to work, and there is no reference to it in the code base, because it's existence allows the AWS SDK to work * Documentation: add docs to cover the use of service accounts for S3 * Update documentation in line with spell checker Spell checker flagged that Kubernetes should have an uppercase K and to use the American spelling of utilize Co-authored-by: Justin Anderson <[email protected]> * PR Feedback: Add AWSSDK.SecurityToken.dll to the Signing.props file --------- Co-authored-by: Justin Anderson <[email protected]>
1 parent 20df9a2 commit d9fda60

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

Diff for: Directory.Packages.props

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project>
22
<ItemGroup>
33
<PackageVersion Include="AWSSDK.S3" Version="$(AwsSdkS3Version)" />
4+
<PackageVersion Include="AWSSDK.SecurityToken" Version="$(AwsSdkSecurityTokenVersion)" />
45
<PackageVersion Include="Azure.Identity" Version="$(AzureIdentityVersion)" />
56
<PackageVersion Include="Azure.Storage.Blobs" Version="$(AzureStorageBlobsVersion)" />
67
<PackageVersion Include="Azure.Storage.Queues" Version="$(AzureStorageQueuesVersion)" />

Diff for: documentation/configuration/egress-configuration.md

+8
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ The Queue Message's payload will be the blob name (`<BlobPrefix>/<ArtifactName>`
198198
```
199199
</details>
200200

201+
### Authenticating to S3 using service accounts
202+
If running workloads in Kubernetes it is common to authenticate with AWS via Kubernetes service accounts ([AWS Documentation](https://docs.aws.amazon.com/eks/latest/userguide/pod-configuration.html)). This is supported in dotnet monitor if none of: `accessKeyId`, `secretAccessKey`, `awsProfileName` are specified. In this case dotnet monitor will fallback to load credentials to login using AWS default defined environment variables, this means that workloads running in EKS can utilize service accounts as discussed in the above AWS documentation.
203+
204+
Specifically the use of service accounts set the following environment variables which are detected by AWS SDK and used for authentication as a fallback:
205+
- AWS_REGION
206+
- AWS_ROLE_ARN
207+
- AWS_WEB_IDENTITY_TOKEN_FILE
208+
201209
## Filesystem egress provider
202210

203211
| Name | Type | Description |

Diff for: eng/Signing.props

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<ItemGroup>
33
<FileSignInfo Include="AWSSDK.Core.dll" CertificateName="3PartySHA2" />
44
<FileSignInfo Include="AWSSDK.S3.dll" CertificateName="3PartySHA2" />
5+
<FileSignInfo Include="AWSSDK.SecurityToken.dll" CertificateName="3PartySHA2" />
56
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
67
<FileSignInfo Include="Newtonsoft.Json.Bson.dll" CertificateName="3PartySHA2" />
78
<FileSignInfo Include="Swashbuckle.AspNetCore.Swagger.dll" CertificateName="3PartySHA2" />

Diff for: eng/dependabot/independent/Packages.props

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleAspNetCoreVersion)" />
2020
<PackageReference Include="Moq" Version="$(MoqVersion)" />
2121
<PackageReference Include="AWSSDK.S3" Version="$(AwsSdkS3Version)" />
22+
<PackageReference Include="AWSSDK.SecurityToken" Version="$(AwsSdkSecurityTokenVersion)" />
2223
</ItemGroup>
2324
</Project>

Diff for: eng/dependabot/independent/Versions.props

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<NJsonSchemaVersion>11.0.0</NJsonSchemaVersion>
1616
<SwashbuckleAspNetCoreVersion>6.5.0</SwashbuckleAspNetCoreVersion>
1717
<AwsSdkS3Version>3.7.305.7</AwsSdkS3Version>
18+
<AwsSdkSecurityTokenVersion>3.7.300.33</AwsSdkSecurityTokenVersion>
1819

1920
<!--
2021
Moq version & constants derived from Moq.

Diff for: src/Extensions/S3Storage/S3Storage.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="AWSSDK.S3" />
14+
<PackageReference Include="AWSSDK.SecurityToken" />
1415
</ItemGroup>
1516

1617
<ItemGroup>
1718
<ProjectReference Include="..\..\Microsoft.Diagnostics.Monitoring.Extension.Common\Microsoft.Diagnostics.Monitoring.Extension.Common.csproj" />
1819
</ItemGroup>
19-
20+
2021
<ItemGroup>
2122
<Compile Update="OptionsDisplayStrings.Designer.cs">
2223
<DependentUpon>OptionsDisplayStrings.resx</DependentUpon>

0 commit comments

Comments
 (0)