Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement/routeref #2094

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b89380b
update httprouterefs to routerefs in cc
AmaliMatharaarachchi Jan 24, 2024
474e481
rename httprouterefs to routerefs
AmaliMatharaarachchi Jan 24, 2024
b64bb30
rename httprouterefs to routerefs in crs
AmaliMatharaarachchi Jan 24, 2024
ce0bb1a
remove debug logs
AmaliMatharaarachchi Jan 24, 2024
8d674e0
fix lint issues
AmaliMatharaarachchi Mar 6, 2024
273952a
httpRouteRef=>routeRef change
tharindu1st Mar 6, 2024
bc0601a
Add modify api test
Tharsanan1 Feb 22, 2024
f9d923f
Update test/cucumber-tests/src/test/resources/tests/api/ModifyAPITest…
Tharsanan1 Feb 28, 2024
9dfe2f6
Update test/cucumber-tests/src/test/resources/tests/api/ModifyAPITest…
Tharsanan1 Feb 28, 2024
fa29953
Update test/cucumber-tests/src/test/resources/tests/api/ModifyAPITest…
Tharsanan1 Feb 28, 2024
4006891
Change gateway name
Tharsanan1 Mar 6, 2024
7c3a922
Add prometheus configs to adapter enforcer router
sgayangi Feb 19, 2024
6781d04
Add Prometheus support to common controller
sgayangi Feb 25, 2024
dde944a
Update exposed adapter and enforcer metrics
sgayangi Feb 25, 2024
3d36273
Update enforcer metric configs
sgayangi Feb 27, 2024
ebac428
Add Prometheus support to Config DS
sgayangi Feb 28, 2024
d1dfc14
Update configurations for Prometheus
sgayangi Feb 28, 2024
44302fc
Add Prometheus support to IdP DS
sgayangi Feb 29, 2024
3483bd4
Add Prometheus support to ratelimiter
sgayangi Mar 1, 2024
e532eff
Address review comments
sgayangi Mar 3, 2024
287c2c3
Watch for CM and secrets in token issuer controller
Tharsanan1 Feb 28, 2024
923f35b
Add predicates to tokenissuer watch
Tharsanan1 Mar 6, 2024
c4be1ed
Revert "Test api resource modifications"
Tharsanan1 Mar 6, 2024
826c877
Update ports used for Prometheus
sgayangi Mar 6, 2024
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
5 changes: 5 additions & 0 deletions adapter/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ var defaultConfig = &Config{
Namespaces: nil,
},
Environment: "Default",
Metrics: metrics{
Enabled: false,
Type: "prometheus",
Port: 18006,
},
},
Envoy: envoy{
ListenerCodecType: "AUTO",
Expand Down
8 changes: 6 additions & 2 deletions adapter/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ type adapter struct {
Operator operator
// Environment of the Adapter
Environment string
// Metric represents configurations to expose/export go metrics
Metrics metrics
}

// Envoy Listener Component related configurations.
Expand Down Expand Up @@ -299,8 +301,10 @@ type tracing struct {
}

type metrics struct {
Enabled bool
Type string
Enabled bool
Type string
Port int32
CollectionInterval int32
}

type analyticsAdapter struct {
Expand Down
10 changes: 9 additions & 1 deletion adapter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/pelletier/go-toml v1.9.5
github.com/prometheus/client_golang v1.17.0
github.com/sirupsen/logrus v1.9.0
github.com/wso2/apk/common-go-libs v0.0.0-20231208100153-24bee7b4bd81
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb
Expand All @@ -34,6 +35,7 @@ require (
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
Expand All @@ -47,19 +49,25 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.2 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/vektah/gqlparser v1.3.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.21.0 // indirect
Expand Down
23 changes: 23 additions & 0 deletions adapter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
Expand All @@ -62,6 +64,7 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Expand All @@ -88,6 +91,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
Expand All @@ -110,6 +115,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
Expand All @@ -121,6 +128,12 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/shirou/gopsutil/v3 v3.24.2 h1:kcR0erMbLg5/3LcInpw0X/rrPSqq4CDPyI6A6ZRC18Y=
github.com/shirou/gopsutil/v3 v3.24.2/go.mod h1:tSg/594BcA+8UdQU2XcW803GWYgdtauFFPgJCJKZlVk=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand All @@ -136,12 +149,18 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/vektah/gqlparser v1.3.1 h1:8b0IcD3qZKWJQHSzynbDlrtP3IxVydZ2DZepCGofqfU=
github.com/vektah/gqlparser v1.3.1/go.mod h1:bkVf0FX+Stjg/MHnm8mEyubuaArhNEqfQhF+OTiAL74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
Expand Down Expand Up @@ -182,15 +201,19 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
9 changes: 9 additions & 0 deletions adapter/internal/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package adapter

import (
"crypto/tls"
"strings"
"time"

discoveryv3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
Expand All @@ -33,6 +34,7 @@ import (
wso2_server "github.com/wso2/apk/adapter/pkg/discovery/protocol/server/v3"
"github.com/wso2/apk/adapter/pkg/health"
healthservice "github.com/wso2/apk/adapter/pkg/health/api/wso2/health/service"
metrics "github.com/wso2/apk/adapter/pkg/metrics"
"github.com/wso2/apk/adapter/pkg/utils/tlsutils"

"context"
Expand Down Expand Up @@ -154,6 +156,13 @@ func Run(conf *config.Config) {
}

logger.LoggerAPK.Info("Starting adapter ....")

// Start the metrics server
if conf.Adapter.Metrics.Enabled && strings.EqualFold(conf.Adapter.Metrics.Type, metrics.PrometheusMetricType) {
logger.LoggerAPK.Info("Starting Prometheus Metrics Server ....")
go metrics.StartPrometheusMetricsServer(conf.Adapter.Metrics.Port)
}

cache := xds.GetXdsCache()
enforcerCache := xds.GetEnforcerCache()
enforcerAPICache := xds.GetEnforcerAPICache()
Expand Down
45 changes: 45 additions & 0 deletions adapter/internal/discovery/xds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,3 +779,48 @@ func SanitizeGateway(gatewayName string, create bool) error {
}
return nil
}

// GetEnvoyGatewayConfigClusters method gets the number of clusters in envoy gateway config
func GetEnvoyGatewayConfigClusters() int {
totalClusters := 0
for _, config := range gatewayLabelConfigMap {
// Add the number of clusters in this EnvoyGatewayConfig instance to the total
totalClusters += len(config.clusters)
}
return totalClusters
}

// GetEnvoyInternalAPIRoutes method gets the number of routes in envoy internal API
func GetEnvoyInternalAPIRoutes() int {
totalRoutes := 0
for _, orgMap := range orgAPIMap {
for _, api := range orgMap {
// Add the number of routes in this EnvoyInternalAPI instance to the total
totalRoutes += len(api.routes)
}
}
return totalRoutes
}

// GetEnvoyInternalAPIClusters method gets the number of clusters in envoy internal API
func GetEnvoyInternalAPIClusters() int {
totalClusters := 0
for _, orgMap := range orgAPIMap {
for _, api := range orgMap {
// Add the number of clusters in this EnvoyInternalAPI instance to the total
totalClusters += len(api.clusters)
}
}
return totalClusters
}

// GetEnvoyInternalAPICount method gets the number of APIs deployed in Envoy
func GetEnvoyInternalAPICount() int {
totalCount := 0
for _, apiMap := range orgAPIMap {
for range apiMap {
totalCount++
}
}
return totalCount
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestCreateRoutesWithClustersWithExactAndRegularExpressionRules(t *testing.T
BasePath: "/test-api/2.0.0",
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
"test-api-2-prod-http-route",
},
},
Expand Down Expand Up @@ -218,7 +218,7 @@ func generateSampleAPI(apiName string, apiVersion string, basePath string) synch
BasePath: basePath,
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
apiName + "-prod-http-route",
},
},
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestCreateRoutesWithClustersWithMultiplePathPrefixRules(t *testing.T) {
BasePath: "/test-api/1.0.0",
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
"test-api-1-prod-http-route",
},
},
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestCreateRoutesWithClustersWithBackendTLSConfigs(t *testing.T) {
BasePath: "/test-api-3/1.0.0",
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
"test-api-3-prod-http-route",
},
},
Expand Down Expand Up @@ -553,7 +553,7 @@ func TestCreateRoutesWithClustersDifferentBackendRefs(t *testing.T) {
BasePath: "/test-api-different-backendrefs/1.0.0",
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
"test-api-different-backendrefs-prod-http-route",
},
},
Expand Down Expand Up @@ -645,7 +645,7 @@ func TestCreateRoutesWithClustersSameBackendRefs(t *testing.T) {
BasePath: "/test-api-same-backendrefs/1.0.0",
Production: []v1alpha2.EnvConfig{
{
HTTPRouteRefs: []string{
RouteRefs: []string{
"test-api-same-backendrefs-prod-http-route",
},
},
Expand Down
12 changes: 6 additions & 6 deletions adapter/internal/operator/controllers/dp/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ func (apiReconciler *APIReconciler) applyStartupAPIs() {
func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1alpha2.API) (*synchronizer.APIEvent, error) {
var prodRouteRefs, sandRouteRefs []string
if len(api.Spec.Production) > 0 {
prodRouteRefs = api.Spec.Production[0].HTTPRouteRefs
prodRouteRefs = api.Spec.Production[0].RouteRefs
}
if len(api.Spec.Sandbox) > 0 {
sandRouteRefs = api.Spec.Sandbox[0].HTTPRouteRefs
sandRouteRefs = api.Spec.Sandbox[0].RouteRefs
}

apiState := &synchronizer.APIState{
Expand Down Expand Up @@ -1484,7 +1484,7 @@ func addIndexes(ctx context.Context, mgr manager.Manager) error {
api := rawObj.(*dpv1alpha2.API)
var httpRoutes []string
if len(api.Spec.Production) > 0 {
for _, ref := range api.Spec.Production[0].HTTPRouteRefs {
for _, ref := range api.Spec.Production[0].RouteRefs {
if ref != "" {
httpRoutes = append(httpRoutes,
types.NamespacedName{
Expand All @@ -1495,7 +1495,7 @@ func addIndexes(ctx context.Context, mgr manager.Manager) error {
}
}
if len(api.Spec.Sandbox) > 0 {
for _, ref := range api.Spec.Sandbox[0].HTTPRouteRefs {
for _, ref := range api.Spec.Sandbox[0].RouteRefs {
if ref != "" {
httpRoutes = append(httpRoutes,
types.NamespacedName{
Expand All @@ -1515,7 +1515,7 @@ func addIndexes(ctx context.Context, mgr manager.Manager) error {
api := rawObj.(*dpv1alpha2.API)
var gqlRoutes []string
if len(api.Spec.Production) > 0 {
for _, ref := range api.Spec.Production[0].HTTPRouteRefs {
for _, ref := range api.Spec.Production[0].RouteRefs {
if ref != "" {
gqlRoutes = append(gqlRoutes,
types.NamespacedName{
Expand All @@ -1526,7 +1526,7 @@ func addIndexes(ctx context.Context, mgr manager.Manager) error {
}
}
if len(api.Spec.Sandbox) > 0 {
for _, ref := range api.Spec.Sandbox[0].HTTPRouteRefs {
for _, ref := range api.Spec.Sandbox[0].RouteRefs {
if ref != "" {
gqlRoutes = append(gqlRoutes,
types.NamespacedName{
Expand Down
Loading
Loading