-
Notifications
You must be signed in to change notification settings - Fork 807
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
Conversation
Welcome @jigisha620! |
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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
/hold |
Updating PR with changes that were discussed during the meeting. |
pkg/cloud/metadata_test.go
Outdated
t.Errorf("NewMetadataService() failed: got wrong region %v, expected %v", m.GetRegion(), stdRegion) | ||
} | ||
if m.GetAvailabilityZone() != stdAvailabilityZone { | ||
if m.GetAvailabilityZone() != stdAvailabilityZone && m.GetAvailabilityZone() != snowRegion { |
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.
Let's not conflate the notion of region and zone. Use separate constants for each. (Even in tests.)
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.
Ack, made changes.
pkg/driver/node.go
Outdated
@@ -695,6 +698,10 @@ func (d *nodeService) getVolumesLimit() int64 { | |||
return d.driverOptions.volumeAttachLimit | |||
} | |||
|
|||
if d.metadata.GetRegion() == "snow" { |
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.
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.
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.
Ack, made changes.
pkg/driver/node.go
Outdated
@@ -695,6 +698,10 @@ func (d *nodeService) getVolumesLimit() int64 { | |||
return d.driverOptions.volumeAttachLimit | |||
} | |||
|
|||
if d.metadata.GetRegion() == "snow" { | |||
return 10 |
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.
Why is this stuff being special-cased up here? Wouldn't it be cleaner and more maintainable to teach /pkg/cloud about SBE devices?
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.
Did not change, as per our discussion.
pkg/driver/node_test.go
Outdated
@@ -1924,6 +1925,7 @@ func TestNodeGetInfo(t *testing.T) { | |||
instanceID: "i-123456789abcdef01", | |||
instanceType: "t2.medium", | |||
availabilityZone: "us-west-2b", | |||
region: "us-west-2b", |
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.
"us-west-2"
is a region. "us-west-2b"
is not.
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.
Ack, made changes.
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 |
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.
Why are we putting region name into AZ? Is there no way to determine the AZ?
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.
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.
pkg/driver/node.go
Outdated
@@ -714,6 +718,10 @@ func (d *nodeService) getVolumesLimit() int64 { | |||
return d.driverOptions.volumeAttachLimit | |||
} | |||
|
|||
if util.IsSBE(d.metadata.GetRegion()) { | |||
return 10 |
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.
Can you store this 10 as a constant up top? Something like
sbeDeviceVolumeAttachmentLimit = 10
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.
Ack, made changes.
pkg/cloud/cloud.go
Outdated
@@ -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. |
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.
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.
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.
Ack, made changes.
Encrypted: aws.Bool(diskOptions.Encrypted), | ||
} | ||
|
||
if !util.IsSBE(zone) { |
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.
What's the CreateVolume behavior if tags are provided for SBE volumes?
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.
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) |
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.
The volume has already been created. You will need to delete the volume here, otherwise you will leak resources.
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.
Ack, made changes.
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 <[email protected]> Reverting kubernetes api version update Changes to resolve review comments Changes as per review comments Incorporating review comments
/lgtm |
/assign @gtxu |
/lgtm |
[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 |
/unhold |
#1255