-
Notifications
You must be signed in to change notification settings - Fork 101
Prioritise API with api write=on #1315
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
base: main
Are you sure you want to change the base?
Conversation
return false | ||
} | ||
|
||
func (ncp *NginxConfigParser) sortPlusAPIs(apis []*model.APIDetails) []*model.APIDetails { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment or update the naming to explain that this is trying to prioritise and find apis with write enabled?
server_name _; | ||
location /api/ { | ||
api write=on; | ||
api write=off; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add unit test for
- the case where there are multiple apis and the first one doesn't have write enabled but another does
- the function that prioritises the api with write on
// the API CA file path | ||
string Ca = 3; | ||
// flag to know API is configured with 'write=on;' | ||
bool write_enabled = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a change need to happen to the MPI ? Do the management planes care about the write status ? Could the change instead only be made to the APIDetails struct
thats internal to the Agent?
Issue:
Currently, if more than one Plus API is defined in NGINX config, Agent will always select the first working API URL, and if that API has "api write=off", that leads to "MethodDisabled" error while trying to update upstream using an API.
Fix:
With this change agent is parsing all the Plus API's defined in the NGINX config to find if any of them have "api write=on" and if yes, then we are selecting that as the default api; else we are selecting the first API defined in the NGINX config as the default one, which is the current behaviour.
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)