diff --git a/pkg/k8s/controller.go b/pkg/k8s/controller.go index 0c65007..dde3813 100644 --- a/pkg/k8s/controller.go +++ b/pkg/k8s/controller.go @@ -258,6 +258,11 @@ func checkIfOwnEntity(entity port.Entity, portClient *cli.PortClient) (*bool, er Operator: "contains", Value: fmt.Sprintf("statekey/%s", config.ApplicationConfig.StateKey), }, + { + Property: "$blueprint", + Operator: "=", + Value: entity.Blueprint, + }, }, Combinator: "and", }) @@ -294,7 +299,7 @@ func (c *Controller) entityHandler(portEntity port.Entity, action EventActionTyp } klog.V(0).Infof("Successfully deleted entity '%s' of blueprint '%s'", portEntity.Identifier, portEntity.Blueprint) } else { - klog.Warningf("trying to delete entity but didn't find it in port with k8s ownership", portEntity.Identifier, portEntity.Blueprint) + klog.Warningf("trying to delete entity but didn't find it in port with this exporter ownership, entity id: '%s', blueprint:'%s'", portEntity.Identifier, portEntity.Blueprint) } } diff --git a/pkg/k8s/controller_test.go b/pkg/k8s/controller_test.go index 004c10e..78c8e37 100644 --- a/pkg/k8s/controller_test.go +++ b/pkg/k8s/controller_test.go @@ -221,7 +221,7 @@ func TestDeleteDeploymentSameOwner(t *testing.T) { createItem := EventItem{Key: getKey(d, t), ActionType: CreateAction} item := EventItem{Key: getKey(d, t), ActionType: DeleteAction} - f := newFixture(t, "", "", fmt.Sprintf("statekey/%s", config.ApplicationConfig.StateKey)+"port-k8s-exporter", resource, objects) + f := newFixture(t, "", "", fmt.Sprintf("port-k8s-exporter/0.1 (statekey/%s)", config.ApplicationConfig.StateKey), resource, objects) f.runControllerSyncHandler(createItem, false) f.runControllerSyncHandler(item, false)