-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the full-ecr-access flag to give power user instead of read only #216
Fix the full-ecr-access flag to give power user instead of read only #216
Conversation
Here is my lame'ish test. I couldn't figure out how to lookup the IAM policies on the generated template (EG: doing a diff --git a/pkg/cfn/builder/api_test.go b/pkg/cfn/builder/api_test.go
index e9dc454..b79ddd5 100644
--- a/pkg/cfn/builder/api_test.go
+++ b/pkg/cfn/builder/api_test.go
@@ -300,4 +300,38 @@ var _ = Describe("CloudFormation template builder API", func() {
checkScript("/var/lib/cloud/scripts/per-instance/bootstrap.al2.sh", true)
})
})
+
+ Describe("ECRReadOnlyAccess", func() {
+ spec := &api.ClusterConfig{
+ ClusterName: clusterName,
+ AvailabilityZones: testAZs,
+ NodeType: "t2.medium",
+ Region: "us-west-2",
+ }
+ rs := NewNodeGroupResourceSet(spec, "eksctl-test-123-cluster", 0)
+
+ err := rs.AddAllResources()
+ It("should have read only policy", func() {
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(spec.NodePolicyARNs).To(ContainElement("arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"))
+ })
+ })
+
+ Describe("ECRFullAccess", func() {
+ spec := &api.ClusterConfig{
+ ClusterName: clusterName,
+ AvailabilityZones: testAZs,
+ NodeType: "t2.medium",
+ Region: "us-west-2",
+ }
+ spec.Addons.WithIAM.PolicyAmazonEC2ContainerRegistryPowerUser = true
+
+ rs := NewNodeGroupResourceSet(spec, "eksctl-test-123-cluster", 0)
+
+ err := rs.AddAllResources()
+ It("should have power user policy", func() {
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(spec.NodePolicyARNs).To(ContainElement("arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"))
+ })
+ })
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot and thanks for the change @polothy. This looks good to me.
One small thing, do you want to add yourself to humans.txt?
@polothy - would you be able to rebase on master? |
63da529
to
2ebf715
Compare
Rebase done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for doing the rebase. Please merge when you get time.
Thanks for the approves!
Sorry, I assume you are talking to @defiantsoftware ? I don't have permission to merge. |
Great work, thanks @polothy! :-) |
Description
When using a command like
eksctl create cluster --full-ecr-access --name MyCluster --region us-east-1 --profile my-profile
then the IAM role for accessing ECR would have the policyAmazonEC2ContainerRegistryReadOnly
instead ofAmazonEC2ContainerRegistryPowerUser
.Workarounds
AmazonEC2ContainerRegistryReadOnly
policy and add theAmazonEC2ContainerRegistryPowerUser
policy.--full-ecr-access
flag ineksctl create cluster
command.Checklist
make build
)make test
)humans.txt
file