Skip to content

Commit

Permalink
fix: add admin schema in control_plane config
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangfucheng committed Jan 2, 2023
1 parent 5984321 commit 4b90878
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apisix/cli/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ local deployment_schema = {
control_plane = {
properties = {
etcd = etcd_schema,
admin = admin_schema,
role_control_plane = {
properties = {
config_provider = {
Expand Down Expand Up @@ -409,7 +410,7 @@ local deployment_schema = {
default = {},
},
},
required = {"etcd", "role_control_plane"}
required = {"etcd", "admin", "role_control_plane"}
},
data_plane = {
properties = {
Expand Down
32 changes: 32 additions & 0 deletions t/cli/test_deployment_control_plane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ fi

echo "passed: should check deployment schema during init"

# The 'admin.apisix.dev' is injected by ci/common.sh@set_coredns
echo '
apisix:
enable_admin: false
deployment:
role: control_plane
role_control_plane:
config_provider: etcd
conf_server:
listen: admin.apisix.dev:12345
cert: t/certs/mtls_server.crt
cert_key: t/certs/mtls_server.key
admin:
admin_listen:
port: "abcd"
etcd:
prefix: "/apisix"
host:
- http://127.0.0.1:2379
certs:
trusted_ca_cert: t/certs/mtls_ca.crt
' > conf/config.yaml

out=$(make init 2>&1 || true)
if ! echo "$out" | grep 'expect: number, but got: string'; then
echo "failed: should check deployment schema during init"
exit 1
fi

echo "passed: should check deployment schema during init"

# The 'admin.apisix.dev' is injected by ci/common.sh@set_coredns
echo '
apisix:
Expand Down Expand Up @@ -84,6 +115,7 @@ deployment:
listen: admin.apisix.dev:12345
cert: t/certs/mtls_server.crt
cert_key: t/certs/mtls_server.key
etcd:
prefix: "/apisix"
host:
Expand Down

0 comments on commit 4b90878

Please sign in to comment.