Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Jul 11, 2018
1 parent 2ecf6a7 commit 25a4e3b
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions pkg/image/registry/imagestream/etcd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,14 @@ func NewImageLayerIndex(lw ImageListWatch) ImageLayerIndex {
}
// reduce the full image list to a smaller subset.
out := &metainternalversion.List{
ListMeta: metav1.ListMeta{
Continue: list.Continue,
ResourceVersion: list.ResourceVersion,
},
Items: make([]runtime.Object, len(list.Items)),
}
out.Continue = list.Continue
out.ResourceVersion = list.ResourceVersion
for i, image := range list.Items {
out.Items[i] = &ImageLayers{
Name: image.Name,
Layers: image.DockerImageLayers,
Manifest: manifestFromImage(&image),
}
out.Items[i] = imageLayersForImage(&image)
}
return out, nil
},
Expand All @@ -102,13 +100,7 @@ func NewImageLayerIndex(lw ImageListWatch) ImageLayerIndex {
if !ok {
return in, true
}
layers := &ImageLayers{
Name: image.Name,
ResourceVersion: image.ResourceVersion,
Layers: image.DockerImageLayers,
Manifest: manifestFromImage(image),
}
in.Object = layers
in.Object = imageLayersForImage(image)
return in, true
}), nil
},
Expand Down Expand Up @@ -157,6 +149,15 @@ type ImageLayers struct {
Layers []imagev1.ImageLayer
}

func imageLayersForImage(image *imagev1.Image) *ImageLayers {
return &ImageLayers{
Name: image.Name,
ResourceVersion: image.ResourceVersion,
Layers: image.DockerImageLayers,
Manifest: manifestFromImage(image),
}
}

var (
_ runtime.Object = &ImageLayers{}
_ metav1.Object = &ImageLayers{}
Expand Down

0 comments on commit 25a4e3b

Please sign in to comment.