fix(admin): use local config to fetch global rules in standalone mode#13122
Open
janiussyafiq wants to merge 7 commits intoapache:masterfrom
Open
fix(admin): use local config to fetch global rules in standalone mode#13122janiussyafiq wants to merge 7 commits intoapache:masterfrom
janiussyafiq wants to merge 7 commits intoapache:masterfrom
Conversation
Baoyuantop
previously approved these changes
Mar 27, 2026
6bfd931 to
fe9e2e2
Compare
apisix/admin/global_rules.lua
Outdated
|
|
||
| local function get_global_rules() | ||
| local local_conf = core.config.local_conf() | ||
| if local_conf.deployment.config_provider == "yaml" then |
Contributor
There was a problem hiding this comment.
get_global_rules is used to check if the incoming global rule conflicts with existing global rules, skipping the check entirely doesn't seem correct.
Contributor
Author
There was a problem hiding this comment.
that is right, good catch! should still get the global rules for standalone mode cases to prevent warning log from checking etcd. will do the fix
648ef51 to
240555d
Compare
shreemaan-abhishek
previously approved these changes
Apr 6, 2026
Baoyuantop
previously approved these changes
Apr 7, 2026
nic-6443
reviewed
Apr 7, 2026
apisix/admin/global_rules.lua
Outdated
|
|
||
| local function get_global_rules() | ||
| local local_conf = core.config.local_conf() | ||
| if local_conf.deployment.config_provider == "yaml" then |
Member
There was a problem hiding this comment.
The judgment of deployment.config_provider == "yaml" is not comprehensive, as its value can also be json. We can encapsulate a function to determine whether the current config_provider is local.
32e69ff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In standalone mode (
config_provider: yaml), theget_global_rules()function inapisix/admin/global_rules.luaunconditionally callscore.etcd.get("/global_rules")to check for duplicate plugin conflicts whenever a global rule is validated. This is triggered on everyPUT /apisix/admin/configsrequest from the ingress-controller that contains aglobal_rulesentry, causing repeated etcd connection errors in the logs even though etcd is not used in standalone mode.Root cause:
check_confcallsget_global_rules()which has no awareness of the current config provider, so it always attempts an etcd read regardless of deployment mode.Fix: guard
get_global_rules()to returnnilimmediately whenlocal_conf.deployment.config_provider == "yaml", skipping the etcd call entirely. This is safe because returningnilcausescheck_confto skip the conflict loop (already guarded byif global_rules then), and in standalone mode the ingress-controller is responsible for sending a consistent config atomically.Which issue(s) this PR fixes:
Fixes #12989
Checklist