-
Notifications
You must be signed in to change notification settings - Fork 150
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
make mock driver support PV healthy monitor #268
Conversation
Welcome @fengzixu! |
Hi @fengzixu. Thanks for your PR. I'm waiting for a kubernetes-csi 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 |
@fengzixu: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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 |
/assign @xing-yang |
go.mod
Outdated
@@ -3,7 +3,7 @@ module github.com/kubernetes-csi/csi-test/v3 | |||
go 1.12 | |||
|
|||
require ( | |||
github.com/container-storage-interface/spec v1.2.0 | |||
github.com/container-storage-interface/spec v1.2.0-rc1.0.20200530102742-4c5274ab4e5e |
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.
You can use the latest v1.3.0 release:
https://github.com/container-storage-interface/spec/releases/tag/v1.3.0
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.
Got it.
mock/service/controller.go
Outdated
Status: &csi.ControllerGetVolumeResponse_VolumeStatus{}, | ||
} | ||
|
||
volumeStatus, err := s.NodeGetVolumeStats(ctx, &csi.NodeGetVolumeStatsRequest{}) |
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 NodeGetVolumeStats called within ControllerGetVolume?
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.
I misunderstand the working mechanism between Controller and Agent. Revised
mock/service/controller.go
Outdated
@@ -388,8 +420,19 @@ func (s *service) ListVolumes( | |||
) | |||
|
|||
for i = 0; i < len(entries); i++ { | |||
volumeStatus, err := s.NodeGetVolumeStats(ctx, &csi.NodeGetVolumeStatsRequest{ |
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.
ListVolumes is controller PRC. We should not call a Node PRC within a controller RPC.
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.
Sure. Thanks for your comment.
/assign @NickrenREN |
There are two newly added RPC interfaces, one is controller side: |
Please review it again. |
mock/service/controller.go
Outdated
|
||
i, v := s.findVolByID(ctx, req.VolumeId) | ||
if i < 0 { | ||
return nil, status.Error(codes.NotFound, req.VolumeId) |
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.
Could we return VolumeCondition
and set its Abnormal
and Message
fields
mock/service/controller.go
Outdated
|
||
resp := &csi.ControllerGetVolumeResponse{ | ||
Volume: &v, | ||
Status: &csi.ControllerGetVolumeResponse_VolumeStatus{}, |
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.
Could we generate the VolumeCondition
field instead of returning an empty one (nil)?
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.
Please refer to the comments
type ControllerGetVolumeResponse_VolumeStatus struct {
// A list of all the `node_id` of nodes that this volume is
// controller published on.
// This field is OPTIONAL.
// This field MUST be specified if the PUBLISH_UNPUBLISH_VOLUME
// controller capability is supported.
// published_node_ids MAY include nodes not published to or
// reported by the SP. The CO MUST be resilient to that.
PublishedNodeIds []string `protobuf:"bytes,1,rep,name=published_node_ids,json=publishedNodeIds,proto3" json:"published_node_ids,omitempty"`
// Information about the current condition of the volume.
// This field is OPTIONAL.
// This field MUST be specified if the
// VOLUME_CONDITION controller capability is supported.
VolumeCondition *VolumeCondition `protobuf:"bytes,2,opt,name=volume_condition,json=volumeCondition,proto3" json:"volume_condition,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
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.
For error, I mock the VolumeCondition filed. For normal response, I mocked the PublishedNodeIds
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.
// Information about the current condition of the volume.
// This field is OPTIONAL.
// This field MUST be specified if the
// VOLUME_CONDITION controller capability is supported.
mock/service/node.go
Outdated
@@ -427,6 +434,7 @@ func (s *service) NodeGetVolumeStats(ctx context.Context, | |||
Unit: csi.VolumeUsage_BYTES, | |||
}, | |||
}, | |||
VolumeCondition: &csi.VolumeCondition{}, |
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.
Could we also construct some abnormal conditions ?
@xing-yang @NickrenREN Request review |
resp.Status.VolumeCondition.Abnormal = true | ||
resp.Status.VolumeCondition.Message = "volume not found" | ||
return resp, status.Error(codes.NotFound, req.VolumeId) | ||
} |
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 add a case where volume is found but condition is Abnormal=true?
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.
For the mock test, I think we can divide it into 2 parts to do
- Add basic mock test functions for testing if volume-healthy-monitor can work(Due to the initial implementation PR wasn’t merged, it is hard to do further works)
- Add more unit, integration, e2e test for testing volume-healthy-monitor can work correctly on positive and negative cases
The reasons I want to do a testing task like above are below
- The initial PR blocks many works and it isn’t perfect. We can ensure it works normally and improves it
- After initial PR was merged. It is better for us to let more contributors contribute this project.
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.
Sure
/lgtm |
/assign @pohly |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fengzixu, pohly 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 |
What I did in this PR
This PR is for supporting test of PV health monitor
Fixes: kubernetes-csi/external-health-monitor#9