Skip to content

Commit 827d4ba

Browse files
feat: standalone mode status api (#12810)
Signed-off-by: Abhishek Choudhary <[email protected]>
1 parent 8dfb8fd commit 827d4ba

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

apisix/core/config_yaml.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ function _M.init_worker()
567567
-- sync data in each non-master process
568568
ngx.timer.every(1, read_apisix_config)
569569

570+
if apisix_yaml then
571+
update_config(apisix_yaml, apisix_yaml_mtime)
572+
end
573+
570574
return true
571575
end
572576

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
. ./t/cli/common.sh
21+
22+
standalone() {
23+
clean_up
24+
git checkout conf/apisix.yaml
25+
}
26+
27+
trap standalone EXIT
28+
29+
# support environment variables
30+
echo '
31+
apisix:
32+
enable_admin: false
33+
deployment:
34+
role: data_plane
35+
role_data_plane:
36+
config_provider: yaml
37+
nginx_config:
38+
error_log_level: warn
39+
apisix:
40+
status:
41+
ip: 127.0.0.1
42+
port: 7085
43+
' > conf/config.yaml
44+
45+
echo '
46+
routes:
47+
-
48+
uri: /get
49+
upstream:
50+
nodes:
51+
"httpbin.local:8280": 1
52+
type: roundrobin
53+
#END
54+
' > conf/apisix.yaml
55+
56+
# check for resolve variables
57+
make run
58+
59+
sleep 0.5
60+
61+
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:7085/status/ready | grep 200 \
62+
|| (echo "failed: status/ready api didn't return 200"; exit 1)
63+
64+
sleep 0.5
65+
66+
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:7085/status | grep 200 \
67+
|| (echo "failed: status api didn't return 200"; exit 1)

0 commit comments

Comments
 (0)