mirror of https://github.com/grpc/grpc-node.git
Fix Listener resource validation
This commit is contained in:
parent
e883425ef3
commit
87f703403c
|
@ -360,6 +360,10 @@ export class XdsDependencyManager {
|
||||||
constructor(private xdsClient: XdsClient, private listenerResourceName: string, private dataPlaneAuthority: string, private watcher: XdsConfigWatcher) {
|
constructor(private xdsClient: XdsClient, private listenerResourceName: string, private dataPlaneAuthority: string, private watcher: XdsConfigWatcher) {
|
||||||
this.ldsWatcher = new Watcher<Listener__Output>({
|
this.ldsWatcher = new Watcher<Listener__Output>({
|
||||||
onResourceChanged: (update: Listener__Output) => {
|
onResourceChanged: (update: Listener__Output) => {
|
||||||
|
if (!update.api_listener) {
|
||||||
|
this.trace('Received Listener resource not usable on client');
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.latestListener = update;
|
this.latestListener = update;
|
||||||
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL, update.api_listener!.api_listener!.value);
|
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL, update.api_listener!.api_listener!.value);
|
||||||
switch (httpConnectionManager.route_specifier) {
|
switch (httpConnectionManager.route_specifier) {
|
||||||
|
|
|
@ -294,6 +294,9 @@ export class ListenerResourceType extends XdsResourceType {
|
||||||
if (message.default_filter_chain) {
|
if (message.default_filter_chain) {
|
||||||
errors.push(...validateFilterChain(context, message.default_filter_chain).map(error => `default_filter_chain: ${error}`));
|
errors.push(...validateFilterChain(context, message.default_filter_chain).map(error => `default_filter_chain: ${error}`));
|
||||||
}
|
}
|
||||||
|
if (!message.api_listener && !message.default_filter_chain && message.filter_chains.length === 0) {
|
||||||
|
errors.push('No api_listener and no filter_chains and no default_filter_chain');
|
||||||
|
}
|
||||||
if (errors.length === 0) {
|
if (errors.length === 0) {
|
||||||
return {
|
return {
|
||||||
valid: true,
|
valid: true,
|
||||||
|
|
Loading…
Reference in New Issue