-
Notifications
You must be signed in to change notification settings - Fork 10
feat(apisix): separate inline upstream #354
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
d36ec42
to
b7d3d36
Compare
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.
Please ensure that code is always formatted by Prettier and avoid making changes that serve no practical purpose.
this.subject = opts.eventSubject; | ||
} | ||
|
||
private operate(event: ADCSDK.Event) { |
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.
Given that service is a special case, creating an operateService
function for it is a better choice. Let other resources continue using the simple operate
function, while services with specific upstream expansion logic use a separate function.
private operate(event: ADCSDK.Event) {
// keep original codes
}
// handle only event for service
private operateService(event: ADCSDK.event) {
const operateWithRetry = (op) => defer(op).pipe(retry({count: 3, delay: 100/* or fn */}));
if (event.type === ADCSDK.EventType.DELETE) {
return from([() => this.client.delete("/apisix/admin/services/xxx"), () => this.client.delete("/apisix/admin/upstreams/xxx")]).pipe(
concatMap((op) => operateWithRetry(op))
)
} else {
return from([() => this.client.put("/apisix/admin/upstreams/xxx"), () => this.client.put("/apisix/admin/services/xxx")]).pipe(
concatMap((op) => operateWithRetry(op))
)
}
}
Description
Separate inline upstream in apisix backend as discussed in #319
Checklist