Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not wait for aws-ebs-csi-driver if there are no nodegroups #5929

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

radTuti
Copy link
Contributor

@radTuti radTuti commented Nov 14, 2022

Description

similar to #5458; closes #5891, #5585

aws-ebs-csi-driver will stay in degraded state until nodegroups are added.
SInce the addon is now a requirement for k8s 1.23, the cluster creation should not fail.

Manual validation

Given cluster config cluster.yaml

kind: ClusterConfig
apiVersion: eksctl.io/v1alpha5

metadata:
  name: cluster-1jnq
  region: us-west-2
  version: "1.23"

iam:
  withOIDC: true
  serviceAccounts:
  - metadata:
      name: ebs-csi-controller-sa
      namespace: kube-system
    attachPolicyARNs:
    - "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy"
    roleOnly: true
    roleName: cluster-1jnq-AmazonEKS_EBS_CSI_DriverRole

addons:
- name: aws-ebs-csi-driver
  version: v1.11.4-eksbuild.1
  serviceAccountRoleARN: arn:aws:iam::ACCOUNT_ID:role/cluster-1jnq-AmazonEKS_EBS_CSI_DriverRole

nodeGroups:
  - name: worker-pool
    instanceType: t3.large
    desiredCapacity: 3

Running eksctl create cluster -f cluster.yaml --without-nodegroup successfully creates the cluster with no node group.

Additional validated scenarios:

  • setting desiredCapacity: 0 in cluster.yaml and running eksctl create cluster -f cluster.yaml
  • setting desiredCapacity:0, maxSize: 3 in cluster.yaml and running eksctl create cluster -f cluster.yaml

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes
  • (Core team) Added labels for change area (e.g. area/nodegroup) and kind (e.g. kind/improvement)

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 馃く

  • Backfilled missing tests for code in same general area 馃帀
  • Refactored something and made the world a better place 馃専

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello radTuti 馃憢 Thank you for opening a Pull Request in eksctl project. The team will review the Pull Request and aim to respond within 1-10 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines here. You can find out more information about eksctl on our website

@radTuti radTuti force-pushed the addon-deployment-no-nodegroup branch 2 times, most recently from db73b4f to 6d86abd Compare November 15, 2022 17:00
@cPu1 cPu1 added the kind/bug label Nov 21, 2022
Copy link
Collaborator

@cPu1 cPu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed PR. I have left some suggestions on improving the tests but otherwise it LGTM!

Comment on lines 30 to 32
var (
ExportWaitForAddonToBeActive = (*Manager).waitForAddonToBeActive
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want this exposed outside of this package, especially since there's an alternative. You could test this case by calling manager.Create, passing a non-zero waitTimeout. You'll have to mock the Addons API though. There are examples in pkg/actions/addon/create_test.go.

Suggested change
var (
ExportWaitForAddonToBeActive = (*Manager).waitForAddonToBeActive
)

Comment on lines 15 to 48
var (
clusterConfig *api.ClusterConfig
mockProvider *mockprovider.MockProvider
manager *addon.Manager
)

BeforeEach(func() {
var err error
clusterConfig = &api.ClusterConfig{Metadata: &api.ClusterMeta{
Version: "1.18",
Name: "my-cluster",
}}
mockProvider = mockprovider.NewMockProvider()
manager, err = addon.New(clusterConfig, mockProvider.EKS(), nil, false, nil, nil)
Expect(err).NotTo(HaveOccurred())
})

When("addon is coredns with no nodegroup", func() {
It("does not wait for addon to be active", func() {
a := &api.Addon{
Name: api.CoreDNSAddon,
}
err := addon.ExportWaitForAddonToBeActive(manager, context.Background(), a, 0)
Expect(err).To(BeNil())
})
})

When("addon is aws-ebs-csi-driver with no nodegroup", func() {
It("does not wait for addon to be active", func() {
a := &api.Addon{
Name: api.AWSEBSCSIDriverAddon,
}
err := addon.ExportWaitForAddonToBeActive(manager, context.Background(), a, 0)
Expect(err).To(BeNil())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in pkg/actions/addon/create_test.go and, as noted in the comment above, it should be tested by calling manager.Create.

Comment on lines -26 to -27
vpcCNIName = "vpc-cni"
ebsCSIDriverName = "aws-ebs-csi-driver"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃憤

@cPu1 cPu1 self-assigned this Nov 21, 2022
@radTuti radTuti force-pushed the addon-deployment-no-nodegroup branch from e092b8c to c2b4e08 Compare November 21, 2022 20:08
@radTuti
Copy link
Contributor Author

radTuti commented Nov 21, 2022

Thanks for the detailed PR. I have left some suggestions on improving the tests but otherwise it LGTM!

Thanks for the review and updating the tests. I have updated the branch. Is there anything else needed to get this merged?

@cPu1 cPu1 force-pushed the addon-deployment-no-nodegroup branch from c2b4e08 to 708c544 Compare November 22, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] creating cluster with --without-nodegroups and aws-ebs-csi-driver addon fails
2 participants