JVB init script patches hostname into JVB_ADVERTISE_IPS (expects IP list)

Setup

openDesk Version v1.3.1, but probably more are affected.

When using a LoadBalancer which uses .status.loadBalancer.ingress[0].hostname instead of .status.loadBalancer.ingress[0].ip. One can set cluster.networking.loadBalancerStatusField to hostname 1.

Actual Behavior

  • The script2 patches JVB_ADVERTISE_IPS (and DOCKER_HOST_ADDRESS) with a literal hostname string.
  • JVB consuming that environment variable fails to interpret the hostname.
  • This causes Jitsi/JVB to be fairly unstable, especially with more than 2 participants.

Expected Behavior

  • If loadbalancerStatusField is hostname, the script should perform DNS resolution, collect all A/AAAA records, join them into a comma-separated string, and then patch using that IP list.

Here's a suggested patch:

--- configmap.yaml.orig	2025-05-05 01:27:09
+++ configmap.yaml	2025-05-05 01:37:43
@@ -57,19 +57,38 @@
     counter=0
     maxRetries=30
     until [ $counter -gt ${maxRetries} ]; do
-    echo "Wait for LoadBalancer IP (${counter}/${maxRetries})"
-    ip=$(kubectl get svc jitsi-jvb -o jsonpath='{.status.loadBalancer.ingress[0].{{ .Values.patchJVB.configuration.loadbalancerStatusField }}}' || true);
-    if [ ${ip} ]; then
-      break;
-    else
-      ((counter++));
-      sleep 5;
-    fi
+      echo "Wait for LoadBalancer endpoint (${counter}/${maxRetries})"
+      endpoint=$(kubectl get svc jitsi-jvb \
+        -o jsonpath='{.status.loadBalancer.ingress[0].{{ .Values.patchJVB.configuration.loadbalancerStatusField }}}' \
+        || true)
+
+      if [ -n "$endpoint" ]; then
+        {{- if eq .Values.patchJVB.configuration.loadbalancerStatusField "hostname" }}
+        echo "Resolving hostname: $endpoint"
+        # requires 'dig' in the container
+        ips=$(dig +short "$endpoint" | paste -sd, -)
+        if [ -z "$ips" ]; then
+          echo "DNS lookup failed for $endpoint, retrying..."
+          unset endpoint
+        else
+          ip=$ips
+          break
+        fi
+        {{- else if eq .Values.patchJVB.configuration.loadbalancerStatusField "ip" }}
+        ip=$endpoint
+        break
+        {{- else }}
+        echo "Unsupported loadbalancerStatusField: {{ .Values.patchJVB.configuration.loadbalancerStatusField }}"
+        exit 1
+        {{- end }}
+      fi
+      ((counter++))
+      sleep 5
     done
-    if [ $counter -gt 30 ]; then
+    if [ $counter -gt ${maxRetries} ]; then
       echo "Reached retries limit, exiting..."
       exit 1
-    fi;
+    fi
 
     echo "Patching JVB to advertise IP: ${ip}"
     INDEX_JVB_ADVERTISE_IPS=$(kubectl get deployment jitsi-jvb -o json | jq '.spec.template.spec.containers[0].env | to_entries | map(select(.value.name == "JVB_ADVERTISE_IPS")) | .[0].key')
  1. https://gitlab.opencode.de/bmi/opendesk/deployment/opendesk/-/blob/818c8b3062c14e47e3650071e67ecd8b96976ba2/helmfile/environments/default/cluster.yaml.gotmpl#L31

  2. https://gitlab.opencode.de/bmi/opendesk/components/platform-development/charts/opendesk-jitsi/-/blob/171c86540fae70802da8ef1b7c7ab5cc1b1da0fe/charts/opendesk-jitsi/templates/configmap.yaml#L61