Applied pnpm prettier rules to code.
This commit is contained in:
parent
ac997ea841
commit
94a934ec65
@ -38,23 +38,17 @@ export async function checkCRD(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getSchemaFromGateway = async (gatewayRef) => {
|
const getSchemaFromGateway = async (gatewayRef) => {
|
||||||
|
const schema = await crd
|
||||||
const schema = await crd.getNamespacedCustomObject(
|
.getNamespacedCustomObject(apiGroup, version, gatewayRef.namespace, "gateways", gatewayRef.name)
|
||||||
apiGroup,
|
.then((response) => {
|
||||||
version,
|
const listner = response.body.spec.listeners.filter((listener) => listener.name === gatewayRef.sectionName)[0];
|
||||||
gatewayRef.namespace,
|
return listner.protocol.toLowerCase();
|
||||||
"gateways",
|
})
|
||||||
gatewayRef.name,
|
.catch((error) => {
|
||||||
)
|
logger.error("Error getting gateways: %d %s %s", error.statusCode, error.body, error.response);
|
||||||
.then((response) => {
|
logger.debug(error);
|
||||||
const listner = response.body.spec.listeners.filter((listener) => listener.name === gatewayRef.sectionName)[0]
|
return "";
|
||||||
return listner.protocol.toLowerCase();
|
});
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
logger.error("Error getting gateways: %d %s %s", error.statusCode, error.body, error.response);
|
|
||||||
logger.debug(error);
|
|
||||||
return "";
|
|
||||||
});
|
|
||||||
return schema;
|
return schema;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,26 +67,19 @@ function getUrlFromIngress(ingress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getHttpRouteList() {
|
async function getHttpRouteList() {
|
||||||
|
|
||||||
// httproutes
|
// httproutes
|
||||||
const getHttpRoute = (async (namespace) =>
|
const getHttpRoute = async (namespace) =>
|
||||||
crd
|
crd
|
||||||
.listNamespacedCustomObject(
|
.listNamespacedCustomObject(apiGroup, version, namespace, "httproutes")
|
||||||
apiGroup,
|
.then((response) => {
|
||||||
version,
|
const [httpRoute] = response.body.items;
|
||||||
namespace,
|
return httpRoute;
|
||||||
"httproutes"
|
})
|
||||||
)
|
.catch((error) => {
|
||||||
.then((response) => {
|
logger.error("Error getting httproutes: %d %s %s", error.statusCode, error.body, error.response);
|
||||||
const [httpRoute] = response.body.items;
|
logger.debug(error);
|
||||||
return httpRoute;
|
return null;
|
||||||
})
|
});
|
||||||
.catch((error) => {
|
|
||||||
logger.error("Error getting httproutes: %d %s %s", error.statusCode, error.body, error.response);
|
|
||||||
logger.debug(error);
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
// namespaces
|
// namespaces
|
||||||
const namespaces = await core
|
const namespaces = await core
|
||||||
@ -106,18 +93,14 @@ async function getHttpRouteList() {
|
|||||||
|
|
||||||
let httpRouteList = [];
|
let httpRouteList = [];
|
||||||
if (namespaces) {
|
if (namespaces) {
|
||||||
|
const httpRouteListUnfiltered = await Promise.all(
|
||||||
const httpRouteListUnfiltered = await Promise.all(
|
namespaces.map(async (namespace) => {
|
||||||
namespaces
|
|
||||||
.map( async(namespace) => {
|
|
||||||
const httpRoute = await getHttpRoute(namespace);
|
const httpRoute = await getHttpRoute(namespace);
|
||||||
return httpRoute;
|
return httpRoute;
|
||||||
})
|
}),
|
||||||
)
|
);
|
||||||
|
|
||||||
httpRouteList = httpRouteListUnfiltered
|
|
||||||
.filter((httpRoute) => httpRoute !== undefined)
|
|
||||||
|
|
||||||
|
httpRouteList = httpRouteListUnfiltered.filter((httpRoute) => httpRoute !== undefined);
|
||||||
}
|
}
|
||||||
return httpRouteList;
|
return httpRouteList;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user