Skip to content

Commit

Permalink
Merge pull request #9207 from hakman/automated-cherry-pick-of-#9205-u…
Browse files Browse the repository at this point in the history
…pstream-release-1.16

Automated cherry pick of #9205: Allow listing versions for objects in the S3 bucket
  • Loading branch information
k8s-ci-robot authored May 29, 2020
2 parents 348cc87 + 5bf6bb4 commit 3c5e892
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion pkg/model/iam/iam_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ func (b *PolicyBuilder) AddS3Permissions(p *Policy) (*Policy, error) {

p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Of("s3:GetBucketLocation", "s3:GetEncryptionConfiguration", "s3:ListBucket"),
Action: stringorslice.Of(
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket",
"s3:ListBucketVersions",
),
Resource: stringorslice.Slice([]string{
strings.Join([]string{b.IAMPrefix(), ":s3:::", s3Path.Bucket()}, ""),
}),
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_master_legacy.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_master_strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_master_strict_ecr.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_node_legacy.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_node_strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down
3 changes: 2 additions & 1 deletion pkg/model/iam/tests/iam_builder_node_strict_ecr.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"Action": [
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket"
"s3:ListBucket",
"s3:ListBucketVersions"
],
"Resource": [
"arn:aws:s3:::kops-tests"
Expand Down

0 comments on commit 3c5e892

Please sign in to comment.