-
Notifications
You must be signed in to change notification settings - Fork 949
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: Update CRI from v1alpha1 to v1alpha2 & support down-level compatibility #1359
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1359 +/- ##
==========================================
- Coverage 17.29% 16.29% -1.01%
==========================================
Files 190 197 +7
Lines 11911 13387 +1476
==========================================
+ Hits 2060 2181 +121
- Misses 9703 11056 +1353
- Partials 148 150 +2
|
cri/criservice.go
Outdated
case "v1alpha1": | ||
runv1alpha1(daemonconfig, containerMgr, imageMgr) | ||
case "v1alpha2": | ||
runv1alpha2(daemonconfig, containerMgr, imageMgr) |
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.
If user doesn't specify the CRI version, use "v1alpha2" by default.
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.
OK, I'll change it.
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.
If user doesn't specify the CRI version, use "v1alpha2" by default.
Yes, I think this is reasonable to set a default one. And throw out a line of related log.
internal/generator.go
Outdated
@@ -5,7 +5,7 @@ import ( | |||
"path" | |||
|
|||
"github.com/alibaba/pouch/apis/plugins" | |||
cri "github.com/alibaba/pouch/cri/src" | |||
cri "github.com/alibaba/pouch/cri/v1alpha1" |
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.
GenCriMgr
in this file is no longer needed.
cri/criservice.go
Outdated
return | ||
} | ||
|
||
func runv1alpha1(daemonconfig *config.Config, containerMgr mgr.ContainerMgr, imageMgr mgr.ImageMgr) { |
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.
Print a log here, like Start CRI services, version: v1alpha1
(just an example, could be better?), which may be helpful in debugging.
The same for function runv1alpha2
.
@@ -5,7 +5,7 @@ import ( | |||
"os" | |||
"syscall" | |||
|
|||
cri "github.com/alibaba/pouch/cri/src" | |||
cri "github.com/alibaba/pouch/cri/v1alpha1" |
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.
This directory could be deprecated as well?
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.
@YaoZengzeng All mentioned above has been done.
7b8a2be
to
cfbce09
Compare
3fcb71f
to
4b148ec
Compare
cri/criservice.go
Outdated
} | ||
|
||
func runv1alpha1(daemonconfig *config.Config, containerMgr mgr.ContainerMgr, imageMgr mgr.ImageMgr) { | ||
logrus.Infof("Start CRI services with CRI version: v1alpha1") |
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.
CRI services
-> CRI service
, please be consistent with other places :)
cri/criservice.go
Outdated
} | ||
|
||
func runv1alpha2(daemonconfig *config.Config, containerMgr mgr.ContainerMgr, imageMgr mgr.ImageMgr) { | ||
logrus.Infof("Start CRI services with CRI version: v1alpha2") |
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.
Same as above.
ac3fcd0
to
2e09bb7
Compare
cri/criservice.go
Outdated
close(streamServerCloseCh) | ||
}() | ||
|
||
<-streamServerCloseCh |
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 you please create issue to track the thing that it is to make server close gracefully? Thanks
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.
Maybe with a TODO annotation ?
cri/v1alpha2/cri_network.go
Outdated
} | ||
|
||
defer func() { | ||
if err != 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.
I don't think the defer
function work here, because it has finished if the err is not null.
if err != nil { | ||
return 0, fmt.Errorf("failed to start exec for container %q: %v", containerID, 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.
Please add the todo/fixme as reminder. I think we can find the better way to handle this case gracefully instead of the dead loop. WDYT?
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.
@fuweid All mentioned above has been done.
Signed-off-by: Starnop <[email protected]>
LGTM |
cherry-pick: cherry-pick #1359 from master to 0.5.x
Hi @starnop, may I ask a question? Since I think we may want to track the newer version, not the old one. |
@idealhack I'm sorry for my negligence. I'll fix that, thank you! |
Basically, Pouch has not supported Kubernetes 1.10+ because of update CRI from v1alpha1 to v1alpha2.
Signed-off-by: Starnop [email protected]
Ⅰ. Describe what this PR did
Update CRI from v1alpha1 to v1alpha2 & support down-level compatibility
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
to support CRI v1alpha1/v1alpha2
Ⅴ. Special notes for reviews
The doc will be updated in the back PR.
The function of ReopenContainerLog has not been implemented, I'll fix it in the back PR.