mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Enhancement: support silmultaneous traefik .containio.us and .io ingress routes for k8s (#1875)
This commit is contained in:
parent
43b32fd1fb
commit
82d2f08e8b
@ -158,22 +158,29 @@ export async function servicesFromKubernetes() {
|
|||||||
return null;
|
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)
|
.then((response) => response.body)
|
||||||
.catch(async (error) => {
|
.catch(async (error) => {
|
||||||
logger.error("Error getting traefik ingresses from traefik.io: %d %s %s", error.statusCode, error.body, error.response);
|
if (error.statusCode !== 404) {
|
||||||
|
logger.error("Error getting traefik ingresses from traefik.containo.us: %d %s %s", error.statusCode, error.body, error.response);
|
||||||
|
}
|
||||||
|
|
||||||
// Fallback to the old traefik CRD group
|
return [];
|
||||||
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 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) {
|
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`])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user