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

Add etcd s3 config secret implementation #10340

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brandond
Copy link
Contributor

@brandond brandond commented Jun 11, 2024

Proposed Changes

Add implementation of etcd snapshot s3 config secret support, as covered by the ADR from #9364

  • Move snapshot structs and functions into pkg/etcd/snapshot
  • Move s3 client code and functions into pkg/etcd/s3
  • Refactor pkg/etcd to track snapshot and s3 moves
  • Add support for reading s3 client config from secret
  • Add minio client cache, since S3 client configuration can now be changed at runtime by modifying the secret, and don't want to have to create a new minio client every time we read config.

Types of Changes

New feature

Verification

See ADR for intended use

Testing

Yes, S3 integration test is updated

Linked Issues

User-Facing Change

A proxy can now be configured for use when uploading etcd snapshots to a s3-compatible storage service. This overrides any proxy settings passed via environment variables.
Credentials and endpoint configuration for storing etcd snapshots on a s3-compatible storage service can now be read from a Secret, instead of passing them via the CLI or config file. See https://github.com/k3s-io/k3s/blob/master/docs/adrs/etcd-s3-secret.md for more information.

Further Comments

Copy link

codecov bot commented Jun 11, 2024

Codecov Report

Attention: Patch coverage is 48.58841% with 346 lines in your changes missing coverage. Please review.

Project coverage is 43.56%. Comparing base (b4d4ed8) to head (270d540).

Files Patch % Lines
pkg/etcd/snapshot/types.go 6.55% 114 Missing ⚠️
pkg/etcd/snapshot.go 4.08% 94 Missing ⚠️
pkg/etcd/s3/s3.go 80.58% 39 Missing and 21 partials ⚠️
pkg/etcd/etcd.go 13.79% 23 Missing and 2 partials ⚠️
pkg/etcd/snapshot_handler.go 0.00% 22 Missing ⚠️
pkg/cli/server/server.go 0.00% 13 Missing and 1 partial ⚠️
pkg/etcd/snapshot_controller.go 0.00% 10 Missing ⚠️
pkg/etcd/s3/config_secret.go 87.50% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10340      +/-   ##
==========================================
- Coverage   47.97%   43.56%   -4.42%     
==========================================
  Files         177      179       +2     
  Lines       14807    14892      +85     
==========================================
- Hits         7104     6487     -617     
- Misses       6363     7207     +844     
+ Partials     1340     1198     -142     
Flag Coverage Δ
e2etests 36.35% <2.37%> (-10.19%) ⬇️
inttests 36.66% <0.59%> (-0.40%) ⬇️
unittests 13.39% <46.50%> (+2.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brandond brandond force-pushed the etcd-s3-secret-impl branch 3 times, most recently from 478031c to 2385ab0 Compare June 12, 2024 23:03
@brandond brandond marked this pull request as ready for review June 12, 2024 23:03
@brandond brandond requested a review from a team as a code owner June 12, 2024 23:03
@brandond brandond force-pushed the etcd-s3-secret-impl branch 14 times, most recently from 4b96923 to ec9bd75 Compare June 18, 2024 08:21
* Move snapshot structs and functions into pkg/etcd/snapshot
* Move s3 client code and functions into pkg/etcd/s3
* Refactor pkg/etcd to track snapshot and s3 moves
* Add support for reading s3 client config from secret
* Add minio client cache, since S3 client configuration can now be
  changed at runtime by modifying the secret, and don't want to have to
  create a new minio client every time we read config.
* Add tests for pkg/etcd/s3

Signed-off-by: Brad Davidson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant