mirror of https://github.com/kubernetes/kops.git
Use NewPolicy for the non-master roles
This commit is contained in:
parent
19833e6b73
commit
9885714957
|
|
@ -384,9 +384,7 @@ func (r *NodeRoleMaster) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
|||
func (r *NodeRoleNode) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
||||
resource := createResource(b)
|
||||
|
||||
p := &Policy{
|
||||
Version: PolicyDefaultVersion,
|
||||
}
|
||||
p := NewPolicy(b.Cluster.GetClusterName())
|
||||
|
||||
addNodeEC2Policies(p, resource)
|
||||
addASLifecyclePolicies(p, resource, b.Cluster.GetName(), r.enableLifecycleHookPermissions)
|
||||
|
|
@ -418,19 +416,11 @@ func (r *NodeRoleNode) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
|||
|
||||
// BuildAWSPolicy generates a custom policy for a bastion host.
|
||||
func (r *NodeRoleBastion) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
|
||||
resource := createResource(b)
|
||||
|
||||
p := &Policy{
|
||||
Version: PolicyDefaultVersion,
|
||||
}
|
||||
p := NewPolicy(b.Cluster.GetClusterName())
|
||||
|
||||
// Bastion hosts currently don't require any specific permissions.
|
||||
// A trivial permission is granted, because empty policies are not allowed.
|
||||
p.Statement = append(p.Statement, &Statement{
|
||||
Effect: StatementEffectAllow,
|
||||
Action: stringorslice.Slice([]string{"ec2:DescribeRegions"}),
|
||||
Resource: resource,
|
||||
})
|
||||
p.unconditionalAction.Insert("ec2:DescribeRegions")
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1448,13 +1448,9 @@
|
|||
"PolicyDocument": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1604,13 +1604,9 @@
|
|||
"PolicyDocument": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1590,13 +1590,9 @@
|
|||
"PolicyDocument": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1590,13 +1590,9 @@
|
|||
"PolicyDocument": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1623,13 +1623,9 @@
|
|||
"PolicyDocument": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Action": "ec2:DescribeRegions",
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
"Resource": "*"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
|
|
|
|||
Loading…
Reference in New Issue