mirror of https://github.com/kubernetes/kops.git
aws: Always add KMS permissions to control plane
This commit is contained in:
parent
1597863a39
commit
24a8bc39d5
|
|
@ -357,9 +357,7 @@ func (r *NodeRoleAPIServer) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
||||||
return nil, fmt.Errorf("failed to generate AWS IAM S3 access statements: %v", err)
|
return nil, fmt.Errorf("failed to generate AWS IAM S3 access statements: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.KMSKeys != nil && len(b.KMSKeys) != 0 {
|
addKMSIAMPolicies(p)
|
||||||
addKMSIAMPolicies(p, stringorslice.Slice(b.KMSKeys))
|
|
||||||
}
|
|
||||||
|
|
||||||
if b.Cluster.Spec.IAM != nil && b.Cluster.Spec.IAM.AllowContainerRegistry {
|
if b.Cluster.Spec.IAM != nil && b.Cluster.Spec.IAM.AllowContainerRegistry {
|
||||||
addECRPermissions(p)
|
addECRPermissions(p)
|
||||||
|
|
@ -398,9 +396,7 @@ func (r *NodeRoleMaster) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
||||||
return nil, fmt.Errorf("failed to generate AWS IAM S3 access statements: %v", err)
|
return nil, fmt.Errorf("failed to generate AWS IAM S3 access statements: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.KMSKeys != nil && len(b.KMSKeys) != 0 {
|
addKMSIAMPolicies(p)
|
||||||
addKMSIAMPolicies(p, stringorslice.Slice(b.KMSKeys))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protokube needs dns-controller permissions in instance role even if UseServiceAccountExternalPermissions.
|
// Protokube needs dns-controller permissions in instance role even if UseServiceAccountExternalPermissions.
|
||||||
AddDNSControllerPermissions(b, p)
|
AddDNSControllerPermissions(b, p)
|
||||||
|
|
@ -1090,7 +1086,7 @@ func AddKubeRouterPermissions(b *PolicyBuilder, p *Policy) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addKMSIAMPolicies(p *Policy, resource stringorslice.StringOrSlice) {
|
func addKMSIAMPolicies(p *Policy) {
|
||||||
// TODO could use "kms:ViaService" Condition Key here?
|
// TODO could use "kms:ViaService" Condition Key here?
|
||||||
p.unconditionalAction.Insert(
|
p.unconditionalAction.Insert(
|
||||||
"kms:CreateGrant",
|
"kms:CreateGrant",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue