Merge pull request #1607 from dan5py/fix/1606

Update Traefik API
This commit is contained in:
shamoon 2023-06-13 14:56:09 -07:00 committed by GitHub
commit 106eec8cdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,13 +158,22 @@ export async function servicesFromKubernetes() {
return null; return null;
}); });
const traefikIngressList = await crd.listClusterCustomObject("traefik.containo.us", "v1alpha1", "ingressroutes") const traefikIngressList = await crd.listClusterCustomObject("traefik.io", "v1alpha1", "ingressroutes")
.then((response) => response.body) .then((response) => response.body)
.catch((error) => { .catch(async (error) => {
logger.error("Error getting traefik ingresses: %d %s %s", error.statusCode, error.body, error.response); logger.error("Error getting traefik ingresses from traefik.io: %d %s %s", error.statusCode, error.body, error.response);
// Fallback to the old traefik CRD group
const fallbackIngressList = await crd.listClusterCustomObject("traefik.containo.us", "v1alpha1", "ingressroutes")
.then((response) => response.body)
.catch((fallbackError) => {
logger.error("Error getting traefik ingresses from traefik.containo.us: %d %s %s", fallbackError.statusCode, fallbackError.body, fallbackError.response);
return null; return null;
}); });
return fallbackIngressList;
});
if (traefikIngressList && traefikIngressList.items.length > 0) { if (traefikIngressList && traefikIngressList.items.length > 0) {
const traefikServices = traefikIngressList.items const traefikServices = traefikIngressList.items
.filter((ingress) => ingress.metadata.annotations && ingress.metadata.annotations[`${ANNOTATION_BASE}/href`]) .filter((ingress) => ingress.metadata.annotations && ingress.metadata.annotations[`${ANNOTATION_BASE}/href`])