Skip to content

Commit

Permalink
Merge branch 'APIGOV-26463' into APIGOV-26659
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollins-axway authored Nov 13, 2023
2 parents bc61605 + c42afcd commit 09ac987
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ampc-beano-docker-release-phx.artifactory-phx.ecd.axway.int/base-images/beano-alpine-base:latest AS builder
FROM beano.swf-artifactory.lab.phx.axway.int/beano-alpine-base:latest as builder

RUN mkdir -p /go/src/git.ecd.axway.org/apigov/kong_traceability_agent

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ docker-ta:
@echo "TA Docker build complete"

docker: docker-da docker-ta
@echo "Docker build complete"
@echo "Docker build complete"
16 changes: 16 additions & 0 deletions cmd/discovery/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"fmt"
"os"

"github.com/Axway/agents-kong/pkg/cmd/discovery"
)

func main() {

if err := discovery.DiscoveryCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
16 changes: 16 additions & 0 deletions cmd/traceability/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"fmt"
"os"

_ "github.com/Axway/agent-sdk/pkg/traceability"
"github.com/Axway/agents-kong/pkg/cmd/traceability"
)

func main() {
if err := traceability.TraceCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
31 changes: 31 additions & 0 deletions default_kong_discovery_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# this is a sample config file. Copy the content of this file to a new file named kong_discovery_agent.yml
central:
environment: <AMPLIFY_CENTRAL_ENVIRONMENT_NAME>
mode: publishToEnvironmentAndCatalog
organizationID: "<AMPLIFY_ORG_ID>"
platformURL: https://platform.axway.com
pollInterval: 20s
team: "Default Team"
url: https://apicentral.axway.com
auth:
clientID: <AMPLIFY_CENTRAL_DOSA_CLIENT_ID>
privateKey: <AMPLIFY_CENTRAL_DOSA_PRIVATE_KEY_PATH>
publicKey: <AMPLIFY_CENTRAL_DOSA_PUBLIC_KEY_PATH>
realm: Broker
timeout: 20s
url: https://login.axway.com/auth

log:
level: debug
format: json
output: stdout
path: logs

kong:
adminEndpoint: <Domain>
token: 1234
proxyEndpoint: <Domain>
proxyEndpointProtocols:
http: 80
https: 443
specDownloadPaths: [<Paths>]
51 changes: 51 additions & 0 deletions default_kong_traceability_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# this is a sample config file. Copy the content of this file to a new file named kong_traceability_agent.yml
kong_traceability_agent:
central:
environment: <AMPLIFY_CENTRAL_ENVIRONMENT_NAME>
mode: publishToEnvironment
organizationID: "<AMPLIFY_ORG_ID>"
platformURL: https://platform.axway.com
pollInterval: 20s
team: "Default Team"
url: https://apicentral.axway.com
auth:
clientID: <AMPLIFY_CENTRAL_DOSA_CLIENT_ID>
privateKey: <AMPLIFY_CENTRAL_DOSA_PRIVATE_KEY_PATH>
publicKey: <AMPLIFY_CENTRAL_DOSA_PUBLIC_KEY_PATH>
realm: Broker
timeout: 20s
url: https://login.axway.com/auth

http_log_plugin_config:
# Path used by Kong's HTTP Log plugin to send request logs
path: ${LOGS_HTTP_SERVER_PATH}
# Port that listens for request logs sent by Kong's HTTP Log plugin
port: ${LOGS_HTTP_SERVER_PORT}

# Condor Ingestion service
output.traceability:
compression_level: ${TRACEABILITY_COMPRESSIONLEVEL:3}
enabled: true
hosts:
- ${TRACEABILITY_HOST:"ingestion-lumberjack.datasearch.axway.com:453"}
protocol: ${TRACEABILITY_PROTOCOL:"tcp"}
ssl:
enabled: true
verification_mode: none
cipher_suites:
- "ECDHE-ECDSA-AES-128-GCM-SHA256"
- "ECDHE-ECDSA-AES-256-GCM-SHA384"
- "ECDHE-ECDSA-CHACHA20-POLY1305"
- "ECDHE-RSA-AES-128-CBC-SHA256"
- "ECDHE-RSA-AES-128-GCM-SHA256"
- "ECDHE-RSA-AES-256-GCM-SHA384"
- "ECDHE-RSA-CHACHA20-POLY1205"
worker: 1
pipelining: 0
proxy_url: ${TRACEABILITY_PROXYURL:""}

logging:
metrics:
enabled: false
to_stderr: true
level: ${LOG_LEVEL:"info"}
14 changes: 7 additions & 7 deletions pkg/gateway/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ func (gc *Client) processSingleKongService(ctx context.Context, service *klib.Se
return err
}

if service.Protocol == nil {
return nil
}
if service.Host == nil {
return nil
// all three fields are needed to form the backend URL used in discovery process
if service.Protocol == nil && service.Host == nil {
err := fmt.Errorf("fields for backend URL are not set")
log.WithError(err).Error("failed to create backend URL")
return err
}
backendURL := fmt.Sprintf("%s://%s", *service.Protocol, *service.Host)
backendURL := *service.Protocol + "://" + *service.Host
if service.Path != nil {
backendURL += *service.Path
backendURL = backendURL + *service.Path
}

kongServiceSpec, err := gc.kongClient.GetSpecForService(ctx, backendURL)
Expand Down

0 comments on commit 09ac987

Please sign in to comment.