Skip to content

Commit

Permalink
Handle empty object references when parsing imageStreams
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <komish@flutes.dev>
  • Loading branch information
komish authored and acornett21 committed Oct 15, 2024
1 parent 5d2fbdb commit c59f1a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (oe *openshiftClient) GetImages(ctx context.Context) (map[string]struct{},
}
for _, imageStream := range imageStreamList.Items {
for _, tag := range imageStream.Spec.Tags {
if tag.From.Kind == "DockerImage" {
if tag.From != nil && tag.From.Kind == "DockerImage" {
imageList[tag.From.Name] = struct{}{}
}
}
Expand Down
9 changes: 9 additions & 0 deletions internal/openshift/openshift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ var _ = Describe("OpenShift Engine", func() {
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "imagestream-empty-objectref",
Namespace: "testns",
},
Spec: imagestreamv1.ImageStreamSpec{
Tags: []imagestreamv1.TagReference{},
},
},
},
}

Expand Down

0 comments on commit c59f1a3

Please sign in to comment.