diff --git a/pkg/apis/eksctl.io/v1alpha4/types.go b/pkg/apis/eksctl.io/v1alpha4/types.go index bb7c6f69a1..f076af4e86 100644 --- a/pkg/apis/eksctl.io/v1alpha4/types.go +++ b/pkg/apis/eksctl.io/v1alpha4/types.go @@ -312,7 +312,7 @@ func (c *ClusterConfig) NewNodeGroup() *NodeGroup { AutoScaler: NewBoolFalse(), ExternalDNS: NewBoolFalse(), AppMesh: NewBoolFalse(), - EBSCSI: NewBoolFalse(), + EBS: NewBoolFalse(), }, }, } @@ -422,6 +422,6 @@ type ( // +optional AppMesh *bool `json:"appMesh"` // +optional - EBSCSI *bool `json:"ebsCSI"` + EBS *bool `json:"ebs"` } ) diff --git a/pkg/apis/eksctl.io/v1alpha4/validation.go b/pkg/apis/eksctl.io/v1alpha4/validation.go index e5e45d4c8e..fd80849bd7 100644 --- a/pkg/apis/eksctl.io/v1alpha4/validation.go +++ b/pkg/apis/eksctl.io/v1alpha4/validation.go @@ -28,8 +28,8 @@ func validateNodeGroupIAM(i int, ng *NodeGroup, value, fieldName, path string) e if v := ng.IAM.WithAddonPolicies.AppMesh; v != nil && *v { return fmt.Errorf("%s.AppMesh cannot be set at the same time", p) } - if v := ng.IAM.WithAddonPolicies.EBSCSI; v != nil && *v { - return fmt.Errorf("%s.ebsCSI cannot be set at the same time", p) + if v := ng.IAM.WithAddonPolicies.EBS; v != nil && *v { + return fmt.Errorf("%s.ebs cannot be set at the same time", p) } } return nil diff --git a/pkg/apis/eksctl.io/v1alpha4/zz_generated.deepcopy.go b/pkg/apis/eksctl.io/v1alpha4/zz_generated.deepcopy.go index c268319409..3bca5a91ae 100644 --- a/pkg/apis/eksctl.io/v1alpha4/zz_generated.deepcopy.go +++ b/pkg/apis/eksctl.io/v1alpha4/zz_generated.deepcopy.go @@ -377,8 +377,8 @@ func (in *NodeGroupIAMAddonPolicies) DeepCopyInto(out *NodeGroupIAMAddonPolicies *out = new(bool) **out = **in } - if in.EBSCSI != nil { - in, out := &in.EBSCSI, &out.EBSCSI + if in.EBS != nil { + in, out := &in.EBS, &out.EBS *out = new(bool) **out = **in } diff --git a/pkg/cfn/builder/api_test.go b/pkg/cfn/builder/api_test.go index 2eafe31efb..e087dc3d6d 100644 --- a/pkg/cfn/builder/api_test.go +++ b/pkg/cfn/builder/api_test.go @@ -342,7 +342,7 @@ var _ = Describe("CloudFormation template builder API", func() { AutoScaler: api.NewBoolFalse(), ExternalDNS: api.NewBoolFalse(), AppMesh: api.NewBoolFalse(), - EBSCSI: api.NewBoolFalse(), + EBS: api.NewBoolFalse(), }, }, }, @@ -560,19 +560,19 @@ var _ = Describe("CloudFormation template builder API", func() { "appmesh:*", })) - Expect(obj.Resources).ToNot(HaveKey("PolicyEBSCSI")) + Expect(obj.Resources).ToNot(HaveKey("PolicyEBS")) Expect(obj.Resources).ToNot(HaveKey("PolicyAutoScaling")) }) }) - Context("NodeGroupEBSCSI", func() { + Context("NodeGroupEBS", func() { cfg, ng := newClusterConfigAndNodegroup(true) ng.VolumeSize = 0 - ng.IAM.WithAddonPolicies.EBSCSI = api.NewBoolTrue() + ng.IAM.WithAddonPolicies.EBS = api.NewBoolTrue() - build(cfg, "eksctl-test-ebscsi-cluster", ng) + build(cfg, "eksctl-test-ebs-cluster", ng) roundtript() @@ -582,11 +582,11 @@ var _ = Describe("CloudFormation template builder API", func() { Expect(obj.Resources).To(HaveKey("NodeLaunchConfig")) Expect(obj.Resources["NodeLaunchConfig"].Properties.BlockDeviceMappings).To(HaveLen(0)) - Expect(obj.Resources).To(HaveKey("PolicyEBSCSI")) - Expect(obj.Resources["PolicyEBSCSI"].Properties.PolicyDocument.Statement).To(HaveLen(1)) - Expect(obj.Resources["PolicyEBSCSI"].Properties.PolicyDocument.Statement[0].Effect).To(Equal("Allow")) - Expect(obj.Resources["PolicyEBSCSI"].Properties.PolicyDocument.Statement[0].Resource).To(Equal("*")) - Expect(obj.Resources["PolicyEBSCSI"].Properties.PolicyDocument.Statement[0].Action).To(Equal([]string{ + Expect(obj.Resources).To(HaveKey("PolicyEBS")) + Expect(obj.Resources["PolicyEBS"].Properties.PolicyDocument.Statement).To(HaveLen(1)) + Expect(obj.Resources["PolicyEBS"].Properties.PolicyDocument.Statement[0].Effect).To(Equal("Allow")) + Expect(obj.Resources["PolicyEBS"].Properties.PolicyDocument.Statement[0].Resource).To(Equal("*")) + Expect(obj.Resources["PolicyEBS"].Properties.PolicyDocument.Statement[0].Action).To(Equal([]string{ "ec2:AttachVolume", "ec2:CreateSnapshot", "ec2:CreateTags", diff --git a/pkg/cfn/builder/iam.go b/pkg/cfn/builder/iam.go index cf20ab4ae1..e18a02cfca 100644 --- a/pkg/cfn/builder/iam.go +++ b/pkg/cfn/builder/iam.go @@ -217,8 +217,8 @@ func (n *NodeGroupResourceSet) addResourcesForIAM() { ) } - if v := n.spec.IAM.WithAddonPolicies.EBSCSI; v != nil && *v { - n.rs.attachAllowPolicy("PolicyEBSCSI", refIR, "*", + if v := n.spec.IAM.WithAddonPolicies.EBS; v != nil && *v { + n.rs.attachAllowPolicy("PolicyEBS", refIR, "*", []string{ "ec2:AttachVolume", "ec2:CreateSnapshot",