From 5c2aa4ebefedc6cd4194c6d668fdc8356156c8ca Mon Sep 17 00:00:00 2001 From: atropos Date: Sun, 17 Dec 2023 17:43:11 +0000 Subject: [PATCH] Documentation and cleanup --- docs/configs/kubernetes.md | 4 +++- src/utils/config/service-helpers.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/configs/kubernetes.md b/docs/configs/kubernetes.md index c1777612..c2c9e568 100644 --- a/docs/configs/kubernetes.md +++ b/docs/configs/kubernetes.md @@ -79,6 +79,7 @@ metadata: gethomepage.dev/widget.url: "https://emby.example.com" gethomepage.dev/pod-selector: "" gethomepage.dev/weight: 10 # optional + gethomepage.dev/instance: "public" # optional spec: rules: - host: emby.example.com @@ -93,7 +94,7 @@ spec: pathType: Prefix ``` -When the Kubernetes cluster connection has been properly configured, this service will be automatically discovered and added to your Homepage. **You do not need to specify the `namespace` or `app` values, as they will be automatically inferred.** +When the Kubernetes cluster connection has been properly configured, this service will be automatically discovered and added to your Homepage. **You do not need to specify the `namespace` or `app` values, as they will be automatically inferred.** In case of multiple instances of homepage, instance annotation can be specified to limit to a specific instance, if no instance is provided, the service will be visible on all instances. ### Traefik IngressRoute support @@ -116,6 +117,7 @@ metadata: gethomepage.dev/widget.url: "https://emby.example.com" gethomepage.dev/pod-selector: "" gethomepage.dev/weight: 10 # optional + gethomepage.dev/instance: "public" # optional spec: entryPoints: - websecure diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index f65ddab6..f96f6509 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -170,7 +170,7 @@ export async function servicesFromKubernetes() { const ANNOTATION_BASE = "gethomepage.dev"; const ANNOTATION_WIDGET_BASE = `${ANNOTATION_BASE}/widget.`; const { instanceName } = getSettings(); - + checkAndCopyConfig("kubernetes.yaml"); try { @@ -239,7 +239,10 @@ export async function servicesFromKubernetes() { const services = ingressList.items .filter( (ingress) => - ingress.metadata.annotations && ingress.metadata.annotations[`${ANNOTATION_BASE}/enabled`] === "true" && (!ingress.metadata.annotations[`${ANNOTATION_BASE}/instance`] || ingress.metadata.annotations[`${ANNOTATION_BASE}/instance`] === instanceName), + ingress.metadata.annotations && + ingress.metadata.annotations[`${ANNOTATION_BASE}/enabled`] === "true" && + (!ingress.metadata.annotations[`${ANNOTATION_BASE}/instance`] || + ingress.metadata.annotations[`${ANNOTATION_BASE}/instance`] === instanceName), ) .map((ingress) => { let constructedService = {