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

[flyteadmin] Add support for KMS SSE to S3 backend #4897

Closed
wants to merge 17 commits into from

Conversation

ddl-rliu
Copy link
Contributor

@ddl-rliu ddl-rliu commented Feb 13, 2024

Tracking issue

Part of a group:

  1. Add support for KMS SSE to S3 backend stow#11
  2. [flyteadmin] Add support for KMS SSE to S3 backend #4897
  3. Add S3 server-side-encryption headers for pre-signed URLs flytekit#2193

Why are the changes needed?

S3 Stow implementation does not yet support setting ServerSideEncryption (SSE). We are particularly interested in the AWS Key Management Service (KMS) case.

What changes were proposed in this pull request?

Adds a new extra_args key (optional string field) to the stow config, which contains the keys/value like ServerSideEncryption: x, SSEKMSKeyId: x. It is passed through the storage.yaml section.

How was this patch tested?

See flyteorg/stow#11

Tested on a Flyte deployment, against an S3 bucket with policy denying any request without "s3:x-amz-server-side-encryption": "aws:kms".

(Pdb) rsp.url
'https://...s3.us-west-2.amazonaws.com/...&X-Amz-SignedHeaders=content-md5%3Bhost%3B
x-amz-server-side-encryption%3Bx-amz-server-side-encryption-aws-kms-key-id
&x-amz-server-side-encryption=aws%3Akms&x-amz-server-side-encryption-aws-kms-key-id=...
&X-Amz-Signature=...'
(Pdb) rsp.status_code
200
(Pdb) rsp.headers
{'x-amz-id-2': '...', 'x-amz-request-id': '...', 'Date': 'Thu, 15 Feb 2024 23:28:48 GMT', 
'x-amz-server-side-encryption': 'aws:kms', 'x-amz-server-side-encryption-aws-kms-key-id': ''...', 
'Server': 'AmazonS3', ...}

Related PRs

  1. Add support for KMS SSE to S3 backend stow#11
  2. [flyteadmin] Add support for KMS SSE to S3 backend #4897
  3. Add S3 server-side-encryption headers for pre-signed URLs flytekit#2193

Docs link

Copy link

welcome bot commented Feb 13, 2024

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Feb 13, 2024
@ddl-rliu ddl-rliu force-pushed the rliu.aws-sse-kms branch 2 times, most recently from f72d2d4 to b76c42b Compare February 14, 2024 00:39
@ddl-rliu ddl-rliu changed the title [wip] Add aws sse kms Add support for KMS SSE to S3 backend Feb 14, 2024
@ddl-rliu ddl-rliu changed the title Add support for KMS SSE to S3 backend [flyteadmin] Add support for KMS SSE to S3 backend Feb 14, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 14, 2024
@ddl-rliu ddl-rliu marked this pull request as draft February 15, 2024 03:05
@ddl-rliu ddl-rliu marked this pull request as ready for review February 15, 2024 23:37
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 15, 2024
Signed-off-by: ddl-rliu <[email protected]>
This reverts commit 1110d29.

Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
Signed-off-by: ddl-rliu <[email protected]>
@@ -84,6 +84,7 @@ type ConnectionConfig struct {
SecretKey string `json:"secret-key" pflag:",Secret to use when accesskey is set."`
Region string `json:"region" pflag:",Region to connect to."`
DisableSSL bool `json:"disable-ssl" pflag:",Disables SSL connection. Should only be used for development."`
ExtraArgs string `json:"extra-args" pflag:",Extra arguments, as a JSON object of key/value pairs, passed to S3 upload."`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be surfaced in the Helm chart in any way? Or can this already be handled through the configmap values as they're currently defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if I missed the question, but what I did to get this to work in my deployment was to manually edit the flyte-admin-base-config configmap - key storage.yaml storage.connection.extra-args and value "{\"ServerSideEncryption\": \"aws:kms\", \"SSEKMSKeyId\": \"kmsId\"}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, if it automatically flowed in through the config map without anything special, that's great!

I think you might want to add it to the values.yaml for documentation IFF all the other possible settings are there. If there's just a link to the Go config struct already then you probably don't need to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/ddl-rliu/flyte/pull/1/files Drafted this PR with what I think would be the right changes to the documentation/values.yaml/etc.

Copy link
Contributor

@ddl-ebrown ddl-ebrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder to bump to latest stow

@@ -13,7 +13,6 @@ require (
github.com/spf13/pflag v1.0.5
golang.org/x/sync v0.3.0
gorm.io/driver/postgres v1.5.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to go get to update the stow version once https://github.com/flyteorg/stow/pull/11/files merges, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, will hold off on this PR until the stow change merges

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add this to flyte propeller too + associated configmap storage.yaml changes

@ddl-ebrown
Copy link
Contributor

Filed #4949 to discuss the ETags aren't MD5 issue

@ddl-rliu
Copy link
Contributor Author

ddl-rliu commented Mar 5, 2024

See flyteorg/stow#11 (comment)

@ddl-rliu ddl-rliu closed this Mar 5, 2024
@ddl-rliu ddl-rliu deleted the rliu.aws-sse-kms branch April 5, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants