Skip to content

Commit

Permalink
Fix iam builder issues merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Ballman committed Oct 9, 2020
1 parent d7a10b7 commit a194a9b
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions pkg/model/iam/iam_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ func (b *PolicyBuilder) buildAWSS3Policy(p *Policy, bucket string, key string) *

p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Of(
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket",
"s3:ListBucketVersions",
),
Action: stringorslice.Of(
"s3:GetBucketLocation",
"s3:GetEncryptionConfiguration",
"s3:ListBucket",
"s3:ListBucketVersions",
),
Resource: stringorslice.Slice([]string{
strings.Join([]string{b.IAMPrefix(), ":s3:::", bucket}, ""),
}),
Expand Down Expand Up @@ -333,11 +333,11 @@ func (b *PolicyBuilder) buildAWSS3Policy(p *Policy, bucket string, key string) *
Resource: stringorslice.Of(resources...),
})

networkingSpec := b.Cluster.Spec.Networking
networkingSpec := b.Cluster.Spec.Networking

if networkingSpec != nil {
if networkingSpec != nil {
// @check if kuberoute is enabled and permit access to the private key
if networkingSpec.Kuberouter != nil {
if networkingSpec.Kuberouter != nil {
p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Slice([]string{"s3:Get*"}),
Expand All @@ -348,7 +348,7 @@ func (b *PolicyBuilder) buildAWSS3Policy(p *Policy, bucket string, key string) *
}

// @check if calico is enabled as the CNI provider and permit access to the client TLS certificate by default
if networkingSpec.Calico != nil {
if networkingSpec.Calico != nil {
p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Slice([]string{"s3:Get*"}),
Expand All @@ -358,26 +358,26 @@ func (b *PolicyBuilder) buildAWSS3Policy(p *Policy, bucket string, key string) *
})
}

// @check if cilium is enabled as the CNI provider and permit access to the cilium etc client TLS certificate by default
// As long as the Cilium Etcd cluster exists, we should do this
ciliumEtcd := false

for _, cluster := range b.Cluster.Spec.EtcdClusters {
if cluster.Name == "cilium" {
ciliumEtcd = true
break
}
}

if networkingSpec.Cilium != nil && ciliumEtcd {
p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Slice([]string{"s3:Get*"}),
Resource: stringorslice.Of(
strings.Join([]string{b.IAMPrefix(), ":s3:::", iamS3Path, "/pki/private/etcd-clients-ca-cilium/*"}, ""),
),
})
}
// @check if cilium is enabled as the CNI provider and permit access to the cilium etc client TLS certificate by default
// As long as the Cilium Etcd cluster exists, we should do this
ciliumEtcd := false

for _, cluster := range b.Cluster.Spec.EtcdClusters {
if cluster.Name == "cilium" {
ciliumEtcd = true
break
}
}

if networkingSpec.Cilium != nil && ciliumEtcd {
p.Statement = append(p.Statement, &Statement{
Effect: StatementEffectAllow,
Action: stringorslice.Slice([]string{"s3:Get*"}),
Resource: stringorslice.Of(
strings.Join([]string{b.IAMPrefix(), ":s3:::", iamS3Path, "/pki/private/etcd-clients-ca-cilium/*"}, ""),
),
})
}
}
}
}
Expand Down

0 comments on commit a194a9b

Please sign in to comment.