1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-18 02:06:52 +00:00

Fix kyverno panic with PodSpec.containers JSON merge patch w/o image ()

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
This commit is contained in:
Abhinav Sinha 2022-02-01 10:01:46 +05:30 committed by GitHub
parent 98284114f5
commit 25641abeb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,8 +134,13 @@ func convertToImageInfo(containers []interface{}, jsonPath string) (images []*Co
var index = 0
for _, ctr := range containers {
if container, ok := ctr.(map[string]interface{}); ok {
name := container["name"].(string)
image := container["image"].(string)
var name, image string
name = container["name"].(string)
if _, ok := container["image"]; ok {
image = container["image"].(string)
}
jp := strings.Join([]string{jsonPath, strconv.Itoa(index), "image"}, "/")
imageInfo, err := newImageInfo(image, jp)
if err != nil {