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

feature: extend cri apis for remove volume #2124

Merged

Conversation

starnop
Copy link
Contributor

@starnop starnop commented Aug 20, 2018

Signed-off-by: Starnop [email protected]

Ⅰ. Describe what this PR did

extend cri apis for remove volume

  • PouchContainer CRI Manager provides an interface for removing volume.
  • PouchContainer CRI Manager supports querying the name of volume by containerstatus.

Ⅱ. Does this pull request fix one issue?

None.

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

use cri-tools that has been modified:starnop/cri-tools

# pouch volume ls
DRIVER   VOLUME NAME
local    687a243f9aafb0264b491dc1128b2c842b45f420894d36671332d30862c76bc7
local    c2ad62ff78afc55efe1d43649b9e77a780875bb348f2def8903ffefa3709f5b1
local    d8d84f8709e4e0093feb72c78eb6921f7dc1c02d92e121b520fb697add44a6af

# crictl rmv 687a243f9aafb0264b491dc1128b2c842b45f420894d36671332d30862c76bc7
DEBU[0000] RemoveVolumeRequest: &RemoveVolumeRequest{VolumeName:687a243f9aafb0264b491dc1128b2c842b45f420894d36671332d30862c76bc7,} 
DEBU[0000] RemoveVolumeResponse: &RemoveVolumeResponse{} 

# pouch volume ls
DRIVER   VOLUME NAME
local    d8d84f8709e4e0093feb72c78eb6921f7dc1c02d92e121b520fb697add44a6af
local    c2ad62ff78afc55efe1d43649b9e77a780875bb348f2def8903ffefa3709f5b1

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Aug 20, 2018

Codecov Report

Merging #2124 into master will decrease coverage by 0.11%.
The diff coverage is 40.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2124      +/-   ##
==========================================
- Coverage   64.38%   64.27%   -0.12%     
==========================================
  Files         209      209              
  Lines       16631    16655      +24     
==========================================
- Hits        10708    10705       -3     
- Misses       4595     4614      +19     
- Partials     1328     1336       +8
Flag Coverage Δ
#criv1alpha1test 32.78% <9.09%> (-0.18%) ⬇️
#criv1alpha2test 33.39% <40.9%> (-0.18%) ⬇️
#integrationtest 39.21% <9.09%> (-0.04%) ⬇️
#unittest 23.87% <0%> (-0.04%) ⬇️
Impacted Files Coverage Δ
cri/v1alpha2/cri_wrapper.go 52.08% <0%> (-1.8%) ⬇️
cri/v1alpha2/service/cri.go 85.71% <100%> (+1.09%) ⬆️
daemon/daemon.go 57.69% <100%> (ø) ⬆️
cri/criservice.go 64.7% <100%> (ø) ⬆️
cri/v1alpha2/cri.go 63.95% <37.5%> (-0.81%) ⬇️
ctrd/watch.go 72.72% <0%> (-7.58%) ⬇️
cri/stream/httpstream/spdy/upgrade.go 54.28% <0%> (-5.72%) ⬇️
ctrd/container.go 41.76% <0%> (-1.44%) ⬇️
daemon/mgr/container.go 56.03% <0%> (-0.42%) ⬇️
cri/v1alpha1/cri.go 63.3% <0%> (-0.4%) ⬇️
... and 5 more

@@ -181,6 +187,8 @@ message Mount {
bool selinux_relabel = 4;
// Requested propagation mode.
MountPropagation propagation = 5;
// Name of volume
string name = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need add more param in Mount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's enough for the moment. :)

}

message RemoveVolumeResponse {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is your Editor problem? :)

@starnop starnop force-pushed the cri-extend-removeVolume branch from b33168b to b4c0678 Compare August 21, 2018 01:51
@@ -39,7 +39,6 @@ generateproto(){
}

main(){
API_ROOT="${DIR}/cri/apis/v1alpha1" YEAR_TIME=" $(date '+%Y')" generateproto
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we don't need to extend the API of CRI v1alpha1. :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do not the extensive CRI advanced feature, should we find somewhere to record this change? @starnop

Copy link
Collaborator

Choose a reason for hiding this comment

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

@rudyfly
Copy link
Collaborator

rudyfly commented Aug 22, 2018

Can you add test for CRI remove volume?

@starnop
Copy link
Contributor Author

starnop commented Aug 22, 2018

@rudyfly The test for function of RemoveVolume is not necessary, as for functional testing, I've given the steps for validation.

@rudyfly
Copy link
Collaborator

rudyfly commented Aug 23, 2018

LGTM

@pouchrobot pouchrobot added LGTM one maintainer or community participant agrees to merge the pull reuqest. conflict/needs-rebase and removed LGTM one maintainer or community participant agrees to merge the pull reuqest. labels Aug 23, 2018
string volume_name = 1;
}

message RemoveVolumeResponse {
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a blank line here to make it happy. @starnop

@@ -181,6 +187,8 @@ message Mount {
bool selinux_relabel = 4;
// Requested propagation mode.
MountPropagation propagation = 5;
// Name of volume
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO:
classify the anonymous volume or not.

logrus.Infof("RemoveVolume %q", r.GetVolumeName())
defer func() {
if err != nil {
logrus.Errorf("RemoveVolume %q failed, error: %v", r.GetVolumeName(), err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

failed to do something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll submit a single PR to format logs.

@starnop starnop force-pushed the cri-extend-removeVolume branch from b4c0678 to 5a7d173 Compare August 23, 2018 02:49
@starnop starnop force-pushed the cri-extend-removeVolume branch 2 times, most recently from 912c373 to d7bca5c Compare August 23, 2018 03:22
@starnop starnop force-pushed the cri-extend-removeVolume branch from d7bca5c to 32f5cc9 Compare August 23, 2018 03:24
@starnop starnop force-pushed the cri-extend-removeVolume branch from 32f5cc9 to 845cff8 Compare August 23, 2018 03:25
@rudyfly rudyfly merged commit dabdb55 into AliyunContainerService:master Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants