Skip to content

Commit

Permalink
Merge pull request #1266 from Prateeknandle/fix-owner
Browse files Browse the repository at this point in the history
handling empty owner field
  • Loading branch information
daemon1024 authored Jun 13, 2023
2 parents c2f09c7 + 7f767ba commit 1346451
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions KubeArmor/feeder/feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,17 @@ func (fd *Feeder) PushLog(log tp.Log) {

pbAlert.NamespaceName = log.NamespaceName

var o *pb.Podowner
if log.Owner != nil {
o = &pb.Podowner{
var owner *pb.Podowner
if log.Owner != nil && (log.Owner.Ref != "" || log.Owner.Name != "" || log.Owner.Namespace != "") {
owner = &pb.Podowner{
Ref: log.Owner.Ref,
Name: log.Owner.Name,
Namespace: log.Owner.Namespace,
}
}

if pbAlert.Owner == nil {
pbAlert.Owner = o
if pbAlert.Owner == nil && owner != nil {
pbAlert.Owner = owner
}

pbAlert.PodName = log.PodName
Expand Down Expand Up @@ -688,17 +688,17 @@ func (fd *Feeder) PushLog(log tp.Log) {

pbLog.NamespaceName = log.NamespaceName

var o *pb.Podowner
if log.Owner != nil {
o = &pb.Podowner{
var owner *pb.Podowner
if log.Owner != nil && (log.Owner.Ref != "" || log.Owner.Name != "" || log.Owner.Namespace != "") {
owner = &pb.Podowner{
Ref: log.Owner.Ref,
Name: log.Owner.Name,
Namespace: log.Owner.Namespace,
}
}

if pbLog.Owner == nil {
pbLog.Owner = o
if pbLog.Owner == nil && owner != nil {
pbLog.Owner = owner
}

pbLog.PodName = log.PodName
Expand Down

0 comments on commit 1346451

Please sign in to comment.