mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 01:39:06 +00:00
prevent panic on image transformer
Signed-off-by: Nestor <nesterran@gmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package transformers
|
package transformers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -75,7 +76,10 @@ func (pt *imageTransformer) findAndReplaceImage(obj map[string]interface{}) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pt *imageTransformer) updateContainers(obj map[string]interface{}, path string) error {
|
func (pt *imageTransformer) updateContainers(obj map[string]interface{}, path string) error {
|
||||||
containers := obj[path].([]interface{})
|
containers, ok := obj[path].([]interface{})
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("containers path is not of type []interface{} but %T", obj[path])
|
||||||
|
}
|
||||||
for i := range containers {
|
for i := range containers {
|
||||||
container := containers[i].(map[string]interface{})
|
container := containers[i].(map[string]interface{})
|
||||||
containerImage, found := container["image"]
|
containerImage, found := container["image"]
|
||||||
|
|||||||
Reference in New Issue
Block a user