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

feat: change etcd prefix for ssl and proto #2693

Merged
merged 13 commits into from
Dec 22, 2022
5 changes: 0 additions & 5 deletions .github/workflows/backend-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ jobs:
sed -i 's@0.0.0.0/0:9000@127.0.0.1:9000@' ./api/conf/conf.yaml
sed -i 's/enabled: false/enabled: true/' ./api/conf/conf.yaml

- name: download file Dockerfile-apisix
working-directory: ./api/test/docker
run: |
curl -o Dockerfile-apisix https://raw.githubusercontent.com/apache/apisix-docker/master/alpine/Dockerfile

- name: build docker images
working-directory: ./api/test/docker
continue-on-error: true
Expand Down
8 changes: 4 additions & 4 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ require (
github.com/getkin/kin-openapi v0.33.0
github.com/gin-contrib/gzip v0.0.3
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e
github.com/gin-gonic/gin v1.6.3
github.com/gin-gonic/gin v1.7.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/gorilla/sessions v1.2.1
github.com/juliangruber/go-intersect v1.1.0
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.0
github.com/shiningrush/droplet v0.2.6-0.20210127040147-53817015cd1b
github.com/shiningrush/droplet/wrapper/gin v0.2.1
github.com/shiningrush/droplet v0.3.0
github.com/shiningrush/droplet/wrapper/gin v0.3.0
github.com/sony/sonyflake v1.0.0
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.1
github.com/stretchr/testify v1.8.0
github.com/tidwall/gjson v1.6.7
github.com/xeipuuv/gojsonschema v1.2.0
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
Expand Down
20 changes: 12 additions & 8 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e h1:8bZpGwoPxkaivQPrAbWl+7zjjUcbFUnYp7yQcx2r2N0=
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e/go.mod h1:VhW/Ch/3FhimwZb8Oj+qJmdMmoB8r7lmJ5auRjm50oQ=
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand All @@ -154,8 +155,9 @@ github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEK
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.3.0 h1:nZU+7q+yJoFmwvNgv/LnPUkwPal62+b2xXj0AU1Es7o=
github.com/go-playground/validator/v10 v10.3.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down Expand Up @@ -369,10 +371,10 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shiningrush/droplet v0.2.4/go.mod h1:akW2vIeamvMD6zj6wIBfzYn6StGXBxwlW3gA+hcHu5M=
github.com/shiningrush/droplet v0.2.6-0.20210127040147-53817015cd1b h1:kAS+hyJuHUm/lAN4xbKY4/QHbRse95lcjxcIZwSJEvM=
github.com/shiningrush/droplet v0.2.6-0.20210127040147-53817015cd1b/go.mod h1:akW2vIeamvMD6zj6wIBfzYn6StGXBxwlW3gA+hcHu5M=
github.com/shiningrush/droplet/wrapper/gin v0.2.1 h1:1o+5KUF2sKsdZ7SkmOC5ahAP1qaZKqnm0c5hOYFV6YQ=
github.com/shiningrush/droplet/wrapper/gin v0.2.1/go.mod h1:cx5BfLuStFDFIKuEOc1zBTpiT3B4Ezkg3MdlP6rW51I=
github.com/shiningrush/droplet v0.3.0 h1:Pqm+TmpiZLwMfNH3XEYn59nsY3Jh5ioc8Btp+JCHSRo=
github.com/shiningrush/droplet v0.3.0/go.mod h1:gUZc/LriGh+fIzGeYTbGSoHv2kNcDg2BhgXVh5YSOaM=
github.com/shiningrush/droplet/wrapper/gin v0.3.0 h1:QVj6qkxef0WDDECRJVD9/UP/GnPDHtWSEUrEvfUOOwc=
github.com/shiningrush/droplet/wrapper/gin v0.3.0/go.mod h1:Y3nOchWIqL8rGi9GR9wR8yOtRFct/xsXSf7NydvWzVw=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
Expand All @@ -396,16 +398,18 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44=
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tidwall/gjson v1.6.7 h1:Mb1M9HZCRWEcXQ8ieJo7auYyyiSux6w9XN3AdTpxJrE=
Expand Down
4 changes: 2 additions & 2 deletions api/internal/core/store/storehub.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func InitStores() error {
}

err = InitStore(HubKeySsl, GenericStoreOption{
BasePath: conf.ETCDConfig.Prefix + "/ssl",
BasePath: conf.ETCDConfig.Prefix + "/ssls",
ObjType: reflect.TypeOf(entity.SSL{}),
KeyFunc: func(obj interface{}) string {
r := obj.(*entity.SSL)
Expand Down Expand Up @@ -209,7 +209,7 @@ func InitStores() error {
}

err = InitStore(HubKeyProto, GenericStoreOption{
BasePath: conf.ETCDConfig.Prefix + "/proto",
BasePath: conf.ETCDConfig.Prefix + "/protos",
ObjType: reflect.TypeOf(entity.Proto{}),
KeyFunc: func(obj interface{}) string {
r := obj.(*entity.Proto)
Expand Down
22 changes: 9 additions & 13 deletions api/test/docker/apisix_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
# If you want to set the specified configuration value, you can set the new
# in this file. For example if you want to specify the etcd address:
#
etcd:
host:
- "http://etcd:2379"
resync_delay: 0

deployment:
admin:
allow_admin:
- 0.0.0.0/0
etcd:
host:
- "http://etcd:2379"
resync_delay: 0

apisix:
id: "apisix-server1"
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin
allow_admin:
- 0.0.0.0/0
admin_listen:
ip: 0.0.0.0
port: 9180
enable_control: true
control:
ip: "0.0.0.0"
Expand Down
22 changes: 9 additions & 13 deletions api/test/docker/apisix_config2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
# If you want to set the specified configuration value, you can set the new
# in this file. For example if you want to specify the etcd address:
#
etcd:
host:
- "http://etcd:2379"
resync_delay: 0

deployment:
admin:
allow_admin:
- 0.0.0.0/0
etcd:
host:
- "http://etcd:2379"
resync_delay: 0

apisix:
id: "apisix-server2"
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin
allow_admin:
- 0.0.0.0/0
admin_listen:
ip: 0.0.0.0
port: 9180

nginx_config:
error_log_level: "debug"
Expand Down
8 changes: 2 additions & 6 deletions api/test/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ services:

apisix:
hostname: apisix_server1
image: apache/apisix:2.15.1-debian
image: apache/apisix:3.0.0-debian
restart: always
volumes:
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
- ./apisix_logs:/usr/local/apisix/logs
depends_on:
- etcd
Expand All @@ -91,12 +89,10 @@ services:

apisix2:
hostname: apisix_server2
image: apache/apisix:2.15.1-debian
image: apache/apisix:3.0.0-debian
restart: always
volumes:
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
depends_on:
- etcd
ports:
Expand Down
18 changes: 12 additions & 6 deletions api/test/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ go 1.15
require (
github.com/Nerzal/gocloak/v11 v11.2.0
github.com/PuerkitoBio/goquery v1.8.0
github.com/gavv/httpexpect/v2 v2.3.1
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.6.1 // indirect
github.com/gavv/httpexpect/v2 v2.8.0
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/klauspost/compress v1.15.13 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/ginkgo/v2 v2.6.1
github.com/onsi/gomega v1.24.2
github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873
github.com/stretchr/testify v1.7.1
github.com/tidwall/gjson v1.11.0
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d
github.com/sergi/go-diff v1.2.0 // indirect
github.com/stretchr/testify v1.8.1
github.com/tidwall/gjson v1.14.4
github.com/tidwall/pretty v1.2.1 // indirect
github.com/valyala/fasthttp v1.43.0 // indirect
)