From 82d2f08e8b1376bde1d21eddf6f7e0f552d10c22 Mon Sep 17 00:00:00 2001 From: Atropos <33070637+atropos112@users.noreply.github.com> Date: Mon, 28 Aug 2023 19:00:39 +0100 Subject: [PATCH] Enhancement: support silmultaneous traefik .containio.us and .io ingress routes for k8s (#1875) --- src/utils/config/service-helpers.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index cabe386a0..a9af9cd07 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -158,21 +158,28 @@ export async function servicesFromKubernetes() { return null; }); - const traefikIngressList = await crd.listClusterCustomObject("traefik.io", "v1alpha1", "ingressroutes") + const traefikIngressListContaino = await crd.listClusterCustomObject("traefik.containo.us", "v1alpha1", "ingressroutes") .then((response) => response.body) .catch(async (error) => { - 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; - }); + if (error.statusCode !== 404) { + logger.error("Error getting traefik ingresses from traefik.containo.us: %d %s %s", error.statusCode, error.body, error.response); + } + + return []; + }); - return fallbackIngressList; + const traefikIngressListIo = await crd.listClusterCustomObject("traefik.io", "v1alpha1", "ingressroutes") + .then((response) => response.body) + .catch(async (error) => { + if (error.statusCode !== 404) { + logger.error("Error getting traefik ingresses from traefik.io: %d %s %s", error.statusCode, error.body, error.response); + } + + return []; }); + + + const traefikIngressList = [...traefikIngressListContaino, ...traefikIngressListIo]; if (traefikIngressList && traefikIngressList.items.length > 0) { const traefikServices = traefikIngressList.items