cri: call RegisterReadiness after NewCRIService
`NewCRIService()` may easily fail and its error has to be ignored unless the CRI plugin is in the `required_plugins` list. Now this has to be called before `RegisterReadiness()`, as PR 9153 "Require plugins to succeed after registering readiness" was merged on 2023-09-29. Fix issue 9163: `[Regression in main (2023-09-29)]: containerd-rootless.sh doesn't start up` Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
c5ce2a5f75
commit
5365f4b29e
@ -54,7 +54,6 @@ func init() {
|
||||
}
|
||||
|
||||
func initCRIService(ic *plugin.InitContext) (interface{}, error) {
|
||||
ready := ic.RegisterReadiness()
|
||||
ic.Meta.Platforms = []imagespec.Platform{platforms.DefaultSpec()}
|
||||
ic.Meta.Exports = map[string]string{"CRIVersion": constants.CRIVersion}
|
||||
ctx := ic.Context
|
||||
@ -99,6 +98,8 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) {
|
||||
return nil, fmt.Errorf("failed to create CRI service: %w", err)
|
||||
}
|
||||
|
||||
// RegisterReadiness() must be called after NewCRIService(): https://github.com/containerd/containerd/issues/9163
|
||||
ready := ic.RegisterReadiness()
|
||||
go func() {
|
||||
if err := s.Run(ready); err != nil {
|
||||
log.G(ctx).WithError(err).Fatal("Failed to run CRI service")
|
||||
|
Loading…
Reference in New Issue
Block a user