Skip to content

Commit

Permalink
Merge pull request #93 from port-labs/PORT-12601-bug-kubernetes-expor…
Browse files Browse the repository at this point in the history
…ter-entities-ownership

Fix bug with entities ownership
  • Loading branch information
ivankalinovski authored Jan 21, 2025
2 parents 9f85629 + 934e271 commit 8732c1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions pkg/port/cli/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/port-labs/port-k8s-exporter/pkg/port"
"k8s.io/klog/v2"
"net/url"
"strconv"

"github.com/port-labs/port-k8s-exporter/pkg/port"
"k8s.io/klog/v2"
)

func (c *PortClient) SearchEntities(ctx context.Context, body port.SearchBody) ([]port.Entity, error) {
Expand Down Expand Up @@ -100,7 +101,7 @@ func (c *PortClient) DeleteStaleEntities(ctx context.Context, stateKey string, e
{
Property: "$datasource",
Operator: "contains",
Value: fmt.Sprintf("statekey/%s", stateKey),
Value: fmt.Sprintf("(statekey/%s)", stateKey),
},
},
Combinator: "and",
Expand Down
9 changes: 5 additions & 4 deletions pkg/port/entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"encoding/json"
"fmt"
"hash/fnv"
"reflect"
"strconv"

"github.com/port-labs/port-k8s-exporter/pkg/config"
"github.com/port-labs/port-k8s-exporter/pkg/jq"
"github.com/port-labs/port-k8s-exporter/pkg/port"
"github.com/port-labs/port-k8s-exporter/pkg/port/cli"
"hash/fnv"
"reflect"
"strconv"
)

func CheckIfOwnEntity(entity port.EntityRequest, portClient *cli.PortClient) (*bool, error) {
Expand All @@ -29,7 +30,7 @@ func CheckIfOwnEntity(entity port.EntityRequest, portClient *cli.PortClient) (*b
{
Property: "$datasource",
Operator: "contains",
Value: fmt.Sprintf("statekey/%s", config.ApplicationConfig.StateKey),
Value: fmt.Sprintf("(statekey/%s)", config.ApplicationConfig.StateKey),
},
{
Property: "$blueprint",
Expand Down

0 comments on commit 8732c1b

Please sign in to comment.