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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable EBS CSI driver for snow device #1314

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

jigisha620
Copy link
Contributor

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 18, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 18, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @jigisha620!

It looks like this is your first PR to kubernetes-sigs/aws-ebs-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-ebs-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @jigisha620. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 18, 2022
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 18, 2022
@gtxu
Copy link
Contributor

gtxu commented Jul 18, 2022

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 18, 2022
@gtxu
Copy link
Contributor

gtxu commented Jul 25, 2022

/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 25, 2022
@jigisha620
Copy link
Contributor Author

Updating PR with changes that were discussed during the meeting.

t.Errorf("NewMetadataService() failed: got wrong region %v, expected %v", m.GetRegion(), stdRegion)
}
if m.GetAvailabilityZone() != stdAvailabilityZone {
if m.GetAvailabilityZone() != stdAvailabilityZone && m.GetAvailabilityZone() != snowRegion {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not conflate the notion of region and zone. Use separate constants for each. (Even in tests.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

@@ -695,6 +698,10 @@ func (d *nodeService) getVolumesLimit() int64 {
return d.driverOptions.volumeAttachLimit
}

if d.metadata.GetRegion() == "snow" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's avoid hardcoded inline constants.
Let's also avoid the assumption that every SBE's region name will be the same. (Five years from now, they may introduce an SBE device whose metadata says it is "snow-with-laser-pistols" or something. Let's define a function called isSBE(region string) bool (or something like that) to futureproofs against this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

@@ -695,6 +698,10 @@ func (d *nodeService) getVolumesLimit() int64 {
return d.driverOptions.volumeAttachLimit
}

if d.metadata.GetRegion() == "snow" {
return 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this stuff being special-cased up here? Wouldn't it be cleaner and more maintainable to teach /pkg/cloud about SBE devices?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not change, as per our discussion.

@@ -1924,6 +1925,7 @@ func TestNodeGetInfo(t *testing.T) {
instanceID: "i-123456789abcdef01",
instanceType: "t2.medium",
availabilityZone: "us-west-2b",
region: "us-west-2b",
Copy link
Contributor

Choose a reason for hiding this comment

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

"us-west-2" is a region. "us-west-2b" is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

pkg/cloud/metadata_ec2.go Outdated Show resolved Hide resolved
pkg/cloud/metadata_ec2.go Show resolved Hide resolved
pkg/cloud/metadata_k8s.go Outdated Show resolved Hide resolved
@torredil
Copy link
Member

torredil commented Aug 5, 2022

Looking real good now, this PR has come a long way. One last quick request: please squash the commits. Thanks for your contribution! :)

}

if len(doc.AvailabilityZone) == 0 {
return nil, fmt.Errorf("could not get valid EC2 availability zone")
if len(regionFromSession) != 0 && util.IsSBE(regionFromSession) {
doc.AvailabilityZone = regionFromSession
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we putting region name into AZ? Is there no way to determine the AZ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The availability zone for SBE is same as the region and there is no other way to determine it since snow metadata service doesn't provide any information about it.

@@ -714,6 +718,10 @@ func (d *nodeService) getVolumesLimit() int64 {
return d.driverOptions.volumeAttachLimit
}

if util.IsSBE(d.metadata.GetRegion()) {
return 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you store this 10 as a constant up top? Something like

sbeDeviceVolumeAttachmentLimit = 10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

@@ -51,6 +51,10 @@ const (
VolumeTypeSC1 = "sc1"
// VolumeTypeST1 represents a throughput-optimized HDD type of volume.
VolumeTypeST1 = "st1"
// VolumeTypeSBG1 represents a capacity-optimized HDD type of volume.
Copy link
Contributor

Choose a reason for hiding this comment

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

np: Can you add something like (only for SBE devices) to the comments, to make it easier for readers to know why we're adding these types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

Encrypted: aws.Bool(diskOptions.Encrypted),
}

if !util.IsSBE(zone) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the CreateVolume behavior if tags are provided for SBE volumes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fails with error that input is malformed.

}
_, err := c.ec2.CreateTagsWithContext(ctx, requestTagsInput)
if err != nil {
return nil, fmt.Errorf("could not attach tags to volume: %v. %v", volumeID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

The volume has already been created. You will need to delete the volume here, otherwise you will leak resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, made changes.

@gtxu
Copy link
Contributor

gtxu commented Aug 5, 2022

Restart the failed test.

Changes to extract snow device path from Block device mappings (#2)

* Updating metadata service to recognize snow region

* fixing snow device name search for static and dynamic provisioning

* fixing inconsistent vendoring

* inconsistent vendoring fix

* Update Chart.yaml

* Update Chart.yaml

* Adding logs to find issue with static provisioning

* Updated node_linux.go

* Updated node.go

* testing lsblk

* Adding implementation for lsblk

* Changing metadata_k8s for temporary testing

* Updated node_linux.go

* Updated node_linux.go

* changing lsblk path

* Updated node_linux.go

* Updated node_linux.go

* Updated node_linux.go

* Updated node_linux.go

* Updated node_linux.go

* Updated Dockerfile to point to Amazon Linux Image

* Testing lsblk implementation

* Updated node_linux.go

* node_linux.go

* Updated node_linux.go

* Updated node_linux.go

* Update node_linux.go

* reverting temp changes made to metadata_k8s.go

* Update node_linux.go

* Updated base image

* Updated metadata_k8s.go

* Updated Chaart.yaml

* Updated helm and testing change from upstream branch

* Testing changes fetched from upstream branch

* reverting repository changes

* Update Chart.yaml

* Adding logs to test failure for harbor

* Updated mount.go

* Adding changes for device name for snow

* Updated node_linux.go

* Removing dell csi dependency

* Fixing unit tests

* Update node_linux_test.go

* Updated node_linux_test.go

* Fixing test cases

* Fixed failing tests for snow

* Removing temporary changes from chart

* Updated node.yaml

Co-authored-by: Patil <patixjig@bcd0741b7bce.ant.amazon.com>

Reverting kubernetes api version update

Changes to resolve review comments

Changes as per review comments

Incorporating review comments
@torredil
Copy link
Member

torredil commented Aug 5, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 5, 2022
@jigisha620
Copy link
Contributor Author

/assign @gtxu

@gtxu
Copy link
Contributor

gtxu commented Aug 12, 2022

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gtxu, jigisha620

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2022
@torredil
Copy link
Member

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 12, 2022
@k8s-ci-robot k8s-ci-robot merged commit 6022149 into kubernetes-sigs:master Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants