daemon: split image search to a separate service#44032
daemon: split image search to a separate service#44032thaJeztah wants to merge 5 commits intomoby:masterfrom
Conversation
57aacfc to
74ae853
Compare
api/server/router/image/image.go
Outdated
| func NewRouter(backend Backend, referenceBackend reference.Store, imageStore image.Store, layerStore layer.Store) router.Router { | ||
| func NewRouter(backend Backend, searchBackend SearchBackend, referenceBackend reference.Store, imageStore image.Store, layerStore layer.Store) router.Router { | ||
| ir := &imageRouter{ | ||
| backend: backend, | ||
| searchBackend: searchBackend, |
There was a problem hiding this comment.
FWIW; perhaps this should be a separate router, but we can do so in a follow-up. I kept it here, as the endpoint is still /images/search, so it felt like for the "router" it still made sense to have it here
|
Ah, dang; forgot to GoDoc this one |
74ae853 to
9192fdb
Compare
corhere
left a comment
There was a problem hiding this comment.
The registry config is reloadable so any config updates need to also be propagated into SearchService. (And despite being synchronized with a mutex, the config reload is not atomic! 🤦) Perhaps introduce a "registry config store" which holds the config and is passed into both registry services? E.g.:
package registry
type ConfigStore struct {
v atomic.Value // or go1.19 atomic.Pointer[serviceConfig]
}
func (s ConfigStore) get() *serviceConfig {
p := s.v.Load()
if p == nil {
return emptyServiceConfig
}
return p.(*serviceConfig)
}
func (s ConfigStore) Set(opts ServiceOptions) error {
cfg, err := newServiceConfig(opts)
if err != nil {
return err
}
s.v.Store(cfg)
return nil
}|
Ah, good one; I didn't think of reloading "insecure registries" (does it use mirrors?) for this one. 🤔 |
9192fdb to
7689955
Compare
Moves the TestPingRegistryEndpoint and TestEndpoint tests. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also touching-up some comments. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This extracts the image search to its own service, as searching a registry for images does not depend on functionality of the image service. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
There's only a single implementation, so no need to return an interface. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
7689955 to
22e3724
Compare
Oh, sorry, yes, I only did a rebase to prevent it fully bit-rotting; need to reserve some time to find the best approach for the config reloading part. Ignore for now, I'll give a ping when I found time for that 😅 |
This extracts the image search to its own service, as searching a registry for images does not depend on functionality of the image service.
See individual commits for details.