Skip to content

Commit

Permalink
Merge pull request #995 from openshift-cherrypick-robot/cherry-pick-9…
Browse files Browse the repository at this point in the history
…94-to-release-4.14

[release-4.14] OCPBUGS-28989: pkg/storage/s3: enable bucket key on encryption settings
  • Loading branch information
openshift-merge-bot[bot] committed Feb 22, 2024
2 parents 791c39c + 963e0f5 commit ecff686
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/storage/s3/s3.go
Expand Up @@ -794,12 +794,14 @@ func (d *driver) CreateStorage(cr *imageregistryv1.Config) error {
encryptionType = s3.ServerSideEncryptionAes256
}

enableBucketKey := true
_, err = svc.PutBucketEncryptionWithContext(d.Context, &s3.PutBucketEncryptionInput{
Bucket: aws.String(d.Config.Bucket),
ServerSideEncryptionConfiguration: &s3.ServerSideEncryptionConfiguration{
Rules: []*s3.ServerSideEncryptionRule{
{
ApplyServerSideEncryptionByDefault: encryption,
BucketKeyEnabled: &enableBucketKey,
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/aws_test.go
Expand Up @@ -226,7 +226,7 @@ func TestAWSDefaults(t *testing.T) {
ApplyServerSideEncryptionByDefault: &s3.ServerSideEncryptionByDefault{
SSEAlgorithm: aws.String(s3.ServerSideEncryptionAes256),
},
BucketKeyEnabled: aws.Bool(false),
BucketKeyEnabled: aws.Bool(true),
},
},
}
Expand Down Expand Up @@ -552,7 +552,7 @@ func TestAWSChangeS3Encryption(t *testing.T) {
ApplyServerSideEncryptionByDefault: &s3.ServerSideEncryptionByDefault{
SSEAlgorithm: aws.String(s3.ServerSideEncryptionAes256),
},
BucketKeyEnabled: aws.Bool(false),
BucketKeyEnabled: aws.Bool(true),
},
},
}
Expand Down Expand Up @@ -602,7 +602,7 @@ func TestAWSChangeS3Encryption(t *testing.T) {
SSEAlgorithm: aws.String(s3.ServerSideEncryptionAwsKms),
KMSMasterKeyID: aws.String("testKey"),
},
BucketKeyEnabled: aws.Bool(false),
BucketKeyEnabled: aws.Bool(true),
},
},
}
Expand Down

0 comments on commit ecff686

Please sign in to comment.