Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into APIGOV-26852
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollins-axway committed Dec 14, 2023
2 parents 4144b3b + 37dc140 commit 60a2364
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The Kong agents are used to discover, provision access to, and track usages of K
- [Kong admin API secured by Kong Gateway](#kong-admin-api-secured-by-kong-gateway)
- [Specification discovery methods](#specification-discovery-methods)
- [Local specification path](#local-specification-path)
- [Filtering gateway services](#filtering-gateway-services)
- [URL specification paths](#url-specification-paths)
- [Kong Dev Portal](#kong-dev-portal)
- [HTTP Log plugin](#http-log-plugin)
Expand Down Expand Up @@ -218,6 +219,16 @@ Configuration on my-service gateway service
}
```

##### Filtering gateway services

Some possible ways to use the filter for gateway services (all these are done with the env var `KONG_SPEC_FILTER`):

Ex1: "tag.Any() == \"spec_local_petstore.json\"" -> this will find all the services that have a tag as "spec_local_petstore.json"
Ex2: "tag.discover.Exists()" -> this will find all tags that are equal to "discover"
Note: while both ways can achieve the same functionality, the first one is preferred because it does not restrict you on character usages for Kong tags (note the dot in example 2)

Currently, functionalities such as tag.Any().Contains() are not implemented in the SDK and only fully equal values are taken into account

##### URL specification paths

The URL specification paths discovery method is configured by value(s) for the `KONG_SPEC_URLPATHS` variable, comma separated. When values are set here, and a local path is not set, The Kong agent will query each of these paths against the gateway service in order to find a specification file. Once a specification file is found none of the other configured URL paths will be queried as that specification file will be used in the creation of the API Service on Central.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Axway/agents-kong
go 1.18

require (
github.com/Axway/agent-sdk v1.1.70-0.20231207222513-e111e500a79c
github.com/Axway/agent-sdk v1.1.70
github.com/elastic/beats/v7 v7.17.15
github.com/google/uuid v1.3.1
github.com/kong/go-kong v0.47.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Axway/agent-sdk v1.1.70-0.20231207222513-e111e500a79c h1:Ps/20eSKr6DcmSumAf/yE/KkffrofExw3D/e3lMtoO8=
github.com/Axway/agent-sdk v1.1.70-0.20231207222513-e111e500a79c/go.mod h1:Iuv9KlWksVTbTKdfs4bKVYMDc33ZTLYoHt572z2CbbI=
github.com/Axway/agent-sdk v1.1.70 h1:34QravPV19zkTp7tout7u7KX7XCXaO0OBOil17pRYSE=
github.com/Axway/agent-sdk v1.1.70/go.mod h1:Iuv9KlWksVTbTKdfs4bKVYMDc33ZTLYoHt572z2CbbI=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
Expand Down
4 changes: 2 additions & 2 deletions pkg/discovery/gateway/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ func (gc *Client) processKongServicesList(ctx context.Context, services []*klib.
func toTagsMap(service *klib.Service) map[string]string {
// The SDK currently only supports map[string]string format.
filters := make(map[string]string)
for i, t := range service.Tags {
filters[fmt.Sprintf("t%d", i)] = *t
for _, tag := range service.Tags {
filters[*tag] = *tag
}
return filters
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/traceability/processor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processor

import (
"context"
"sync"
"testing"

"github.com/Axway/agent-sdk/pkg/traceability/redaction"
Expand Down Expand Up @@ -42,6 +43,7 @@ var testData = []byte(`[{
}]`)

func TestNewHandler(t *testing.T) {
testLock := sync.Mutex{}
cases := map[string]struct {
data []byte
constructorErr bool
Expand All @@ -68,6 +70,9 @@ func TestNewHandler(t *testing.T) {
}
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
testLock.Lock()
defer testLock.Unlock()

ctx := context.WithValue(context.Background(), "test", name)

redaction.SetupGlobalRedaction(redaction.DefaultConfig())
Expand Down

0 comments on commit 60a2364

Please sign in to comment.