Skip to content

Commit

Permalink
Avoid nil pointer deference in extractHeadlessEndpoints
Browse files Browse the repository at this point in the history
Skip address when TargetRef is nil
  • Loading branch information
allenporter committed Mar 27, 2021
1 parent 10d0ee1 commit 77f1d5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (sc *serviceSource) extractHeadlessEndpoints(svc *v1.Service, hostname stri

for _, address := range addresses {
// find pod for this address
if address.TargetRef.APIVersion != "" || address.TargetRef.Kind != "Pod" {
if address.TargetRef == nil || address.TargetRef.APIVersion != "" || address.TargetRef.Kind != "Pod" {
log.Debugf("Skipping address because its target is not a pod: %v", address)
continue
}
Expand Down

0 comments on commit 77f1d5e

Please sign in to comment.