Skip to content

Commit

Permalink
Support multiple instance annotation for Kubernetes Automatic Service…
Browse files Browse the repository at this point in the history
… Discovery
  • Loading branch information
aldycool committed Jun 5, 2024
1 parent 15cc1d9 commit bb5cdfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/configs/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ When the Kubernetes cluster connection has been properly configured, this servic

If you are using multiple instances of homepage, an `instance` annotation can be specified to limit services to a specific instance. If no instance is provided, the service will be visible on all instances.

If you have a single service that needs to be shown on multiple specific instances of homepage (but not on all of them), the service can be annotated by multiple `instance.name` annotations, where `name` can be the names of your specific multiple homepage instances. For example, a service that is annotated with `gethomepage.dev/instance.public: ""` and `gethomepage.dev/instance.internal: ""` will be shown on `public` and `internal` homepage instances.

### Traefik IngressRoute support

Homepage can also read ingresses defined using the Traefik IngressRoute custom resource definition. Due to the complex nature of Traefik routing rules, it is required for the `gethomepage.dev/href` annotation to be set:
Expand Down
3 changes: 2 additions & 1 deletion src/utils/config/service-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ export async function servicesFromKubernetes() {
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[`${ANNOTATION_BASE}/instance`] === instanceName ||
`${ANNOTATION_BASE}/instance.${instanceName}` in ingress.metadata.annotations),
)
.map((ingress) => {
let constructedService = {
Expand Down

0 comments on commit bb5cdfe

Please sign in to comment.