Skip to content

Commit

Permalink
Merge pull request #193 from reasonerjt/putobj-checksum-1.9
Browse files Browse the repository at this point in the history
[v1.9.x] Set the default checksum algorithm for PutObject to S3
  • Loading branch information
ywk253100 authored Feb 23, 2024
2 parents 946986d + 3c501db commit cc4024b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions velero-plugin-for-aws/object_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type ObjectStore struct {
signatureVersion string
serverSideEncryption string
tagging string
checksumAlg string
}

func newObjectStore(logger logrus.FieldLogger) *ObjectStore {
Expand Down Expand Up @@ -187,6 +188,8 @@ func (o *ObjectStore) Init(config map[string]string) error {
return err
}
}
// TODO: Make it configurable in plugin v1.10
o.checksumAlg = string(types.ChecksumAlgorithmCrc32)
return nil
}

Expand Down Expand Up @@ -241,6 +244,10 @@ func (o *ObjectStore) PutObject(bucket, key string, body io.Reader) error {
input.ServerSideEncryption = types.ServerSideEncryption(o.serverSideEncryption)
}

if o.checksumAlg != "" {
input.ChecksumAlgorithm = types.ChecksumAlgorithm(o.checksumAlg)
}

_, err := o.s3Uploader.Upload(context.Background(), input)

return errors.Wrapf(err, "error putting object %s", key)
Expand Down

0 comments on commit cc4024b

Please sign in to comment.