Merge pull request #809 from narg95/prevent_panic_image_trasformer

prevent panic on image transformer
This commit is contained in:
Kubernetes Prow Robot
2019-02-22 07:05:16 -08:00
committed by GitHub

View File

@@ -17,6 +17,7 @@ limitations under the License.
package transformers
import (
"fmt"
"regexp"
"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 {
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 {
container := containers[i].(map[string]interface{})
containerImage, found := container["image"]