mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-25 16:18:37 +00:00
transformers/image: loop refactoring
This commit is contained in:
@@ -85,20 +85,21 @@ func (pt *imageTransformer) updateContainers(obj map[string]interface{}, path st
|
||||
|
||||
imageName := containerImage.(string)
|
||||
for _, img := range pt.images {
|
||||
if isImageMatched(imageName, img.Name) {
|
||||
name, tag := split(imageName)
|
||||
if img.NewName != "" {
|
||||
name = img.NewName
|
||||
}
|
||||
if img.NewTag != "" {
|
||||
tag = ":" + img.NewTag
|
||||
}
|
||||
if img.Digest != "" {
|
||||
tag = "@" + img.Digest
|
||||
}
|
||||
container["image"] = name + tag
|
||||
break
|
||||
if !isImageMatched(imageName, img.Name) {
|
||||
continue
|
||||
}
|
||||
name, tag := split(imageName)
|
||||
if img.NewName != "" {
|
||||
name = img.NewName
|
||||
}
|
||||
if img.NewTag != "" {
|
||||
tag = ":" + img.NewTag
|
||||
}
|
||||
if img.Digest != "" {
|
||||
tag = "@" + img.Digest
|
||||
}
|
||||
container["image"] = name + tag
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user