detection now uses annotation "gethomepage.dev/enabled" instead of label

pull/448/head
James Wynn 2 years ago
parent e15ba1c82c
commit 36ed1022e3

@ -135,7 +135,7 @@ export async function servicesFromKubernetes() {
} }
const networking = kc.makeApiClient(NetworkingV1Api); const networking = kc.makeApiClient(NetworkingV1Api);
const ingressList = await networking.listIngressForAllNamespaces(null, null, null, "gethomepage.dev/enabled=true") const ingressList = await networking.listIngressForAllNamespaces(null, null, null, null)
.then((response) => response.body) .then((response) => response.body)
.catch((error) => { .catch((error) => {
logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response); logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response);
@ -144,7 +144,9 @@ export async function servicesFromKubernetes() {
if (!ingressList) { if (!ingressList) {
return []; return [];
} }
const services = ingressList.items.map((ingress) => { const services = ingressList.items
.filter((ingress) => ingress.metadata.annotations && ingress.metadata.annotations['gethomepage.dev/enabled'] === 'true')
.map((ingress) => {
const constructedService = { const constructedService = {
app: ingress.metadata.name, app: ingress.metadata.name,
namespace: ingress.metadata.namespace, namespace: ingress.metadata.namespace,
@ -158,7 +160,7 @@ export async function servicesFromKubernetes() {
constructedService.podSelector = ingress.metadata.annotations['gethomepage.dev/pod-selector']; constructedService.podSelector = ingress.metadata.annotations['gethomepage.dev/pod-selector'];
} }
Object.keys(ingress.metadata.annotations).forEach((annotation) => { Object.keys(ingress.metadata.annotations).forEach((annotation) => {
if (annotation.startsWith("gethomepage.dev//widget/")) { if (annotation.startsWith("gethomepage.dev/widget/")) {
shvl.set(constructedService, annotation.replace("homepage/widget/", ""), ingress.metadata.annotations[annotation]); shvl.set(constructedService, annotation.replace("homepage/widget/", ""), ingress.metadata.annotations[annotation]);
} }
}); });

Loading…
Cancel
Save