Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apim-apk-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
# -----------------------------------------------------------------------

FROM alpine:3.20.3
FROM alpine:3.22.1
LABEL maintainer="WSO2 Docker Maintainers <wso2.com>"

RUN apk update && apk upgrade --no-cache \
Expand Down Expand Up @@ -47,7 +47,7 @@ RUN \
&& echo '[ ! -z "${TERM}" -a -r /etc/motd ] && cat /etc/motd' >> /etc/bash.bashrc; echo "${MOTD}" > /etc/motd

RUN \
wget -q https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.37/grpc_health_probe-linux-${TARGETARCH} \
wget -q https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.42/grpc_health_probe-linux-${TARGETARCH} \
&& mv grpc_health_probe-linux-${TARGETARCH} ${GRPC_HEALTH_PROBE_PATH} \
&& if [ "${TARGETARCH}" = "amd64" ]; then echo "${CHECKSUM_AMD64} ${GRPC_HEALTH_PROBE_PATH}" | sha256sum -c -; fi

Expand Down
12 changes: 6 additions & 6 deletions apim-apk-agent/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/wso2/product-apim-tooling/apim-apk-agent

go 1.23.6
go 1.25.4

require (
github.com/gin-gonic/gin v1.10.0
Expand Down Expand Up @@ -82,12 +82,12 @@ require (
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/arch v0.14.0 // indirect
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/term v0.29.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.10.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250227231956-55c901821b1e // indirect
Expand All @@ -108,5 +108,5 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/streadway/amqp v1.1.0
github.com/wso2/apk/adapter v0.0.0-20250301092338-35fc1435165d
golang.org/x/sys v0.30.0 // indirect
golang.org/x/sys v0.38.0 // indirect
)
24 changes: 12 additions & 12 deletions apim-apk-agent/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7 h1:aWwlzYV971S4BXRS9AmqwDLAD85ouC6X+pocatKY58c=
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -227,8 +227,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -242,22 +242,22 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
12 changes: 6 additions & 6 deletions apim-apk-agent/internal/k8sClient/k8s_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func CreateAndUpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager,
loggers.LoggerK8sClient.Error("Unable to create TokenIssuer CR: " + err.Error())
return err
}
loggers.LoggerK8sClient.Infof("TokenIssuer CR created: " + tokenIssuer.Name)
loggers.LoggerK8sClient.Infof("TokenIssuer CR created: %s", tokenIssuer.Name)
} else {
crTokenIssuer.Spec = tokenIssuer.Spec
if err := k8sClient.Update(context.Background(), crTokenIssuer); err != nil {
Expand Down Expand Up @@ -700,7 +700,7 @@ func CreateAndUpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager,
internalKeyTokenIssuer.Spec.ConsumerKeyClaim = constants.ConsumerKeyClaim
internalKeyTokenIssuer.Spec.ScopesClaim = constants.ScopesClaim
crInternalTokenIssuer := &dpv1alpha2.TokenIssuer{}
if err := k8sClient.Get(context.Background(), client.ObjectKey{Namespace: internalKeyTokenIssuer.ObjectMeta.Namespace, Name: internalKeyTokenIssuer.Name}, crInternalTokenIssuer); err != nil {
if err := k8sClient.Get(context.Background(), client.ObjectKey{Namespace: internalKeyTokenIssuer.Namespace, Name: internalKeyTokenIssuer.Name}, crInternalTokenIssuer); err != nil {
if !k8error.IsNotFound(err) {
loggers.LoggerK8sClient.Error("Unable to get Internal TokenIssuer CR: " + err.Error())
}
Expand All @@ -709,7 +709,7 @@ func CreateAndUpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager,
loggers.LoggerK8sClient.Error("Unable to create Internal TokenIssuer CR: " + err.Error())
return err
}
loggers.LoggerK8sClient.Infof("Internal TokenIssuer CR created: " + internalKeyTokenIssuer.Name)
loggers.LoggerK8sClient.Infof("Internal TokenIssuer CR created: %s", internalKeyTokenIssuer.Name)
} else {
crInternalTokenIssuer.Spec = internalKeyTokenIssuer.Spec
if err := k8sClient.Update(context.Background(), crInternalTokenIssuer); err != nil {
Expand Down Expand Up @@ -796,12 +796,12 @@ func UpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager, k8sClient
if keyManager.KeyManagerConfig.ScopesClaim != "" {
tokenIssuer.Spec.ScopesClaim = keyManager.KeyManagerConfig.ScopesClaim
}
err = k8sClient.Update(context.Background(), tokenIssuer)
err = k8sClient.Create(context.Background(), tokenIssuer)
if err != nil {
loggers.LoggerK8sClient.Error("Unable to update TokenIssuer CR: " + err.Error())
loggers.LoggerK8sClient.Error("Unable to create TokenIssuer CR: " + err.Error())
return err
}
loggers.LoggerK8sClient.Debug("TokenIssuer CR updated: " + tokenIssuer.Name)
loggers.LoggerK8sClient.Infof("TokenIssuer CR created: %s", tokenIssuer.Name)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion apim-apk-agent/internal/logging/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestPrintError(t *testing.T) {
Severity: severity,
}

errorLog := PrintError(code, severity, message)
errorLog := PrintError(code, severity, "%s", message)
if errorLog != expectedError {
t.Errorf("PrintError returned unexpected result. Expected: %v, Got: %v", expectedError, errorLog)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func FetchAIProvidersOnEvent(aiProviderName string, aiProviderVersion string, or
}

// Make the request
logger.LoggerSynchronizer.Debugf("Sending the control plane request" + req.RequestURI)
logger.LoggerSynchronizer.Debugf("Sending the control plane request %s", req.RequestURI)
resp, err := tlsutils.InvokeControlPlane(req, skipSSL)
var errorMsg string
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions apim-apk-agent/internal/utils/apis_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ func FetchAPIsOnEvent(conf *config.Config, apiUUID *string, k8sClient client.Cli

// apiFiles represents zipped API files fetched from API Manager
apiFiles := make(map[string]*zip.File)
// Read the .zip files within the root apis.zip and add apis to apiFiles array.
for _, file := range zipReader.File {
apiFiles[file.Name] = file
logger.LoggerUtils.Debugf("API file found: " + file.Name)
// Read the .zip files within the root apis.zip and add apis to apiFiles array.
for _, file := range zipReader.File {
apiFiles[file.Name] = file
logger.LoggerUtils.Debugf("API file found: %s", file.Name)
// Todo: Read the apis.zip and extract the api.zip,deployments.json
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion apim-apk-agent/pkg/logging/log_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func init() {

// Format sets a custom format for loggers.
func (f *plainFormatter) Format(entry *logrus.Entry) ([]byte, error) {
timestamp := fmt.Sprintf(entry.Time.Format(f.TimestampFormat))
timestamp := entry.Time.Format(f.TimestampFormat)
return []byte(fmt.Sprintf("%s %s [%s:%d] - [%s] [-] %s [%s]\n",
timestamp,
f.LevelDesc[entry.Level],
Expand Down
2 changes: 1 addition & 1 deletion apim-apk-agent/pkg/logging/package_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Log struct {

// ErrorC can be used for formal error logs
func (l *Log) ErrorC(e ErrorDetails) {
l.WithFields(logrus.Fields{SEVERITY: e.Severity, ERRORCODE: e.ErrorCode}).Errorf(e.Message)
l.WithFields(logrus.Fields{SEVERITY: e.Severity, ERRORCODE: e.ErrorCode}).Errorf("%s", e.Message)
if e.Severity == BLOCKER {
l.Exit(1)
}
Expand Down
Loading