-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
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.
Some typos, and some opportunities to reduce the code a bit.
@@ -18,17 +18,17 @@ func (d *Daemon) pollForNewImages(logger log.Logger) { | |||
|
|||
ctx := context.Background() | |||
|
|||
candidateServices, err := d.unlockedAutomatedServices(ctx) | |||
candidateServicesPolicyMap, err := d.getUnlockedAutomatedServicesPolicyMap(ctx) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
@@ -21,14 +21,40 @@ type ImageRepos struct { | |||
imageRepos imageReposMap | |||
} | |||
|
|||
// LatestImage returns the latest releasable image for a repository | |||
// FindImageInfo retruns image.Info given an image ref. If the image cannot be |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
@@ -21,14 +21,40 @@ type ImageRepos struct { | |||
imageRepos imageReposMap | |||
} | |||
|
|||
// LatestImage returns the latest releasable image for a repository | |||
// FindImageInfo retruns image.Info given an image ref. If the image cannot be | |||
// found, return the image.Info with only rhe ID. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
return image.Info{}, false | ||
} | ||
|
||
// FilteredAvailable returns image.Info engtries for all the images in the |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
} | ||
|
||
// FilteredAvailable returns image.Info engtries for all the images in the | ||
// names image repository which match the tagGlob. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
|
||
// FilteredAvailable returns image.Info engtries for all the images in the | ||
// names image repository which match the tagGlob. | ||
func (r ImageRepos) FilteredAvailable(repo image.Name, tagGlob string) []image.Info { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
daemon/daemon.go
Outdated
FilteredImagesCount: filteredImagesCount, | ||
NewFilteredImagesCount: newFilteredImagesCount, | ||
}) | ||
if _, ok := fields["Name"]; ok { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -225,16 +225,16 @@ func (i Ref) WithNewTag(t string) Ref { | |||
// from its registry. | |||
type Info struct { | |||
// the reference to this image; probably a tagged image name | |||
ID Ref | |||
ID Ref `json:",omitempty"` |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
daemon/daemon.go
Outdated
@@ -544,23 +560,95 @@ func containers2containers(cs []resource.Container) []v6.Container { | |||
return res | |||
} | |||
|
|||
func containersWithAvailable(service cluster.Controller, images update.ImageMap) (res []v6.Container) { | |||
func getServiceContainers(service cluster.Controller, imageRepos update.ImageRepos, policyResourceMap policy.ResourceMap, overrideFields []string) (res []v6.Container, err error) { | |||
fields := map[string]struct{}{ |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
update/images.go
Outdated
// for which the tag matches a given pattern. A releasable image is | ||
// one that is not tagged "latest". (Assumes the available images are | ||
// in descending order of latestness.) If no such image exists, | ||
// returns a zero value and `false`, and the caller can decide whether | ||
// that's an error or not. | ||
func (m ImageMap) LatestImage(repo image.Name, tagGlob string) (image.Info, bool) { | ||
for _, available := range m.images[repo.CanonicalName()] { | ||
func (r ImageRepos) LatestFilteredImage(repo image.Name, tagGlob string) (image.Info, bool) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Nice work Aaron ⭐ I'm rerun the failing CI, which failed for a silly reason. |
Part of #913 to allow a HTTP client to receive image summary information instead of fetching all of the images.
Creates new fields in
containers
:LatestFiltered
- image.Info for the latest imageAvailableImagesCount
- count of all available imagesNewAvailableImagesCount
- count of all new available imagesFilteredImagesCount
- count of all images after tag filterNewFilteredImagesCount
- count of all new images after tag filterAllows specifiying which containerFields to return in the response via a
?containerFields=...
query parameterimages?containerFields=Name,Current,AvailableImagesCount
Refactors some of the variable names around image fetching to make it clearer what is happening (image repo stuff)
Changes
ListImages
interface and so we will have to update this in WC serviceDon't require queryParams like
?service=
- defaults to<all>