From cb470338382cafcac1c564e975ee8cf8c33704a9 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 14 Apr 2026 16:44:57 +0530 Subject: [PATCH 1/2] fix(dev): use NC_INSTANCE_URL in all the places Signed-off-by: Anupam Kumar --- development/redeploy_host_k8s.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/development/redeploy_host_k8s.sh b/development/redeploy_host_k8s.sh index f8da05e..0b893bb 100755 --- a/development/redeploy_host_k8s.sh +++ b/development/redeploy_host_k8s.sh @@ -48,10 +48,10 @@ PROXY_IP=$(docker inspect master-proxy-1 \ --format "{{(index .NetworkSettings.Networks \"$NC_DOCKER_NETWORK\").IPAddress}}" 2>/dev/null || true) K8S_HOST_ALIASES="" if [ -n "$PROXY_IP" ]; then - K8S_HOST_ALIASES="nextcloud.local:${PROXY_IP}" - echo " nextcloud.local -> $PROXY_IP" + K8S_HOST_ALIASES="${NC_HOSTNAME}:${PROXY_IP}" + echo " ${NC_HOSTNAME} -> $PROXY_IP" else - echo " WARNING: Could not detect proxy IP. ExApp pods may not resolve nextcloud.local." + echo " WARNING: Could not detect proxy IP. ExApp pods may not resolve ${NC_HOSTNAME}." fi echo "==> Removing old HaRP container..." From a4ad02aae76bca7a497fab421dd186d556ccfa43 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 14 Apr 2026 16:45:34 +0530 Subject: [PATCH 2/2] fix(dev): use kind container's gateway IP instead of NC's proxy IP This skips the addition of master_default (NC's network) to the kind container and uses the host network for pod -> NC communication. All other communication takes place in host so it would be consistent, and make development easier. Signed-off-by: Anupam Kumar --- development/redeploy_host_k8s.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/development/redeploy_host_k8s.sh b/development/redeploy_host_k8s.sh index 0b893bb..d328416 100755 --- a/development/redeploy_host_k8s.sh +++ b/development/redeploy_host_k8s.sh @@ -32,24 +32,17 @@ echo "==> Generating fresh bearer token for SA '$K8S_SA' (valid 1 year)..." K8S_BEARER_TOKEN=$(kubectl --context "$K8S_CONTEXT" -n "$K8S_NAMESPACE" create token "$K8S_SA" --duration=8760h) echo " Token generated (${#K8S_BEARER_TOKEN} chars)" -# ── Ensure kind node can reach the Nextcloud Docker network ─────────── -echo "==> Connecting kind node '$KIND_NODE' to Docker network '$NC_DOCKER_NETWORK'..." -if docker network connect "$NC_DOCKER_NETWORK" "$KIND_NODE" 2>/dev/null; then - echo " Connected." -else - echo " Already connected (or network not found)." -fi - -# Detect the nginx proxy IP on NC_DOCKER_NETWORK for pod DNS resolution. +# Extract the kind container's gateway IP for pod DNS resolution. # Pods inside the kind cluster cannot resolve hostnames like "nextcloud.local" that only exist in the host's /etc/hosts. -# Try to inject hostAliases so that ExApp pods can reach Nextcloud. +# Try to inject hostAliases so that ExApp pods can reach Nextcloud on the host network. echo "==> Detecting nginx proxy IP for host aliases..." -PROXY_IP=$(docker inspect master-proxy-1 \ - --format "{{(index .NetworkSettings.Networks \"$NC_DOCKER_NETWORK\").IPAddress}}" 2>/dev/null || true) +KIND_HOST_IP=$(docker inspect nc-exapps-control-plane \ + --format "{{(index .NetworkSettings.Networks \"kind\").Gateway}}" 2>/dev/null || true) +NC_HOSTNAME="$(echo $NC_INSTANCE_URL | awk -F[/:] '{print $4}')" K8S_HOST_ALIASES="" -if [ -n "$PROXY_IP" ]; then - K8S_HOST_ALIASES="${NC_HOSTNAME}:${PROXY_IP}" - echo " ${NC_HOSTNAME} -> $PROXY_IP" +if [ -n "$KIND_HOST_IP" ]; then + K8S_HOST_ALIASES="${NC_HOSTNAME}:${KIND_HOST_IP}" + echo " ${NC_HOSTNAME} -> $KIND_HOST_IP" else echo " WARNING: Could not detect proxy IP. ExApp pods may not resolve ${NC_HOSTNAME}." fi