Skip to content

Commit

Permalink
image-pruning: derefence imagestreamtags
Browse files Browse the repository at this point in the history
Create strong references to images for each pod/bc/dc/etc that uses
<host>/<repo>:tag reference.

Resolves [bz#1498604](https://bugzilla.redhat.com/show_bug.cgi?id=1498604)

Signed-off-by: Michal Minář <[email protected]>
  • Loading branch information
Michal Minář committed Oct 23, 2017
1 parent d61dcb0 commit c1ae9c6
Show file tree
Hide file tree
Showing 4 changed files with 433 additions and 266 deletions.
8 changes: 6 additions & 2 deletions pkg/image/graph/nodes/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ func EnsureAllImageStreamTagNodes(g osgraph.MutableUniqueGraph, is *imageapi.Ima
return ret
}

func FindImage(g osgraph.MutableUniqueGraph, imageName string) graph.Node {
return g.Find(ImageNodeName(&imageapi.Image{ObjectMeta: metav1.ObjectMeta{Name: imageName}}))
func FindImage(g osgraph.MutableUniqueGraph, imageName string) *ImageNode {
n := g.Find(ImageNodeName(&imageapi.Image{ObjectMeta: metav1.ObjectMeta{Name: imageName}}))
if imageNode, ok := n.(*ImageNode); ok {
return imageNode
}
return nil
}

// EnsureDockerRepositoryNode adds the named Docker repository tag reference to the graph if it does
Expand Down
Loading

0 comments on commit c1ae9c6

Please sign in to comment.