mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Merge pull request #781 from saromanov/loop-refactoring
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)
|
imageName := containerImage.(string)
|
||||||
for _, img := range pt.images {
|
for _, img := range pt.images {
|
||||||
if isImageMatched(imageName, img.Name) {
|
if !isImageMatched(imageName, img.Name) {
|
||||||
name, tag := split(imageName)
|
continue
|
||||||
if img.NewName != "" {
|
|
||||||
name = img.NewName
|
|
||||||
}
|
|
||||||
if img.NewTag != "" {
|
|
||||||
tag = ":" + img.NewTag
|
|
||||||
}
|
|
||||||
if img.Digest != "" {
|
|
||||||
tag = "@" + img.Digest
|
|
||||||
}
|
|
||||||
container["image"] = name + tag
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
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
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user