Fix Listener resource validation

This commit is contained in:
Michael Lumish 2025-02-19 17:23:42 -08:00
parent e883425ef3
commit 87f703403c
2 changed files with 7 additions and 0 deletions

View File

@ -360,6 +360,10 @@ export class XdsDependencyManager {
constructor(private xdsClient: XdsClient, private listenerResourceName: string, private dataPlaneAuthority: string, private watcher: XdsConfigWatcher) {
this.ldsWatcher = new Watcher<Listener__Output>({
onResourceChanged: (update: Listener__Output) => {
if (!update.api_listener) {
this.trace('Received Listener resource not usable on client');
return;
}
this.latestListener = update;
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL, update.api_listener!.api_listener!.value);
switch (httpConnectionManager.route_specifier) {

View File

@ -294,6 +294,9 @@ export class ListenerResourceType extends XdsResourceType {
if (message.default_filter_chain) {
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) {
return {
valid: true,