Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Refactor filterImages as per Michael comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Jan 23, 2019
1 parent cf5c238 commit 08b4429
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cluster/kubernetes/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ func (c *Cluster) ImagesToFetch() registry.ImageCreds {

// filterImages returns an image list from a pod spec
// by removing those matching the exclusion list
func (c *Cluster) filterImages(podTemplate apiv1.PodTemplateSpec) []image.Name {
images := []image.Name{}
func (c *Cluster) filterImages(podTemplate apiv1.PodTemplateSpec, imageExcludeList []string) []image.Name {
var images []image.Name

for _, container := range podTemplate.Spec.InitContainers {
r, err := image.ParseRef(container.Image)
Expand Down Expand Up @@ -177,12 +177,11 @@ func (c *Cluster) filterImages(podTemplate apiv1.PodTemplateSpec) []image.Name {
for _, exp := range c.imageExcludeList {
if glob.Glob(exp, imageName) {
include = false
break
}
}
if include {
result = append(result, imageID)
} else {
//c.logger.Log("debug", fmt.Sprintf("image %s excluded", imageName))
}
}

Expand Down

0 comments on commit 08b4429

Please sign in to comment.