From 1c8e4d9ef6c5add1d306c432815344beb27e3580 Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Wed, 18 Mar 2026 21:35:36 +0000 Subject: [PATCH] .gitea/workflows/e2e.yml aktualisiert --- .gitea/workflows/e2e.yml | 48 ++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/e2e.yml b/.gitea/workflows/e2e.yml index 043b33f..64e32c8 100644 --- a/.gitea/workflows/e2e.yml +++ b/.gitea/workflows/e2e.yml @@ -22,39 +22,35 @@ jobs: run: | echo "Try to Delete old cluster" kind delete cluster --name test-cluster || echo "No cluster Deleted" - kind create cluster --name test-cluster --wait 5m + kind create cluster --name test-cluster - - name: Connect kind to the job container's network and fix kubeconfig + - name: Attach kind control-plane to job network and wait run: | - # 1. Find the Docker network the job container is on - # The job container's hostname is the container ID - JOB_CONTAINER_ID=$(hostname) - NETWORK_NAME=$(docker inspect "$JOB_CONTAINER_ID" \ - --format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}') + apt-get update && apt-get install -y jq docker.io - echo "Job container network: $NETWORK_NAME" + JOB_CONTAINER_ID="$(hostname)" + NETWORK_NAME="$(docker inspect "$JOB_CONTAINER_ID" --format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}')" + echo "Job network: $NETWORK_NAME" - # 2. Get the kind control-plane container name - KIND_CONTAINER="test-cluster-control-plane" + CONTROL_PLANE="test-cluster-control-plane" + docker network connect "$NETWORK_NAME" "$CONTROL_PLANE" || true - # 3. Connect the kind container to the same network - docker network connect "$NETWORK_NAME" "$KIND_CONTAINER" + KIND_IP="$(docker inspect "$CONTROL_PLANE" --format "{{(index .NetworkSettings.Networks \"$NETWORK_NAME\").IPAddress}}")" + echo "Kind IP: $KIND_IP" - # 4. Get the kind container's IP on that network - KIND_IP=$(docker inspect "$KIND_CONTAINER" \ - --format "{{(index .NetworkSettings.Networks \"$NETWORK_NAME\").IPAddress}}") + # Point kubectl at the control-plane directly + kubectl config set-cluster kind-test-cluster --server="https://${KIND_IP}:6443" + kubectl config set-cluster kind-test-cluster --insecure-skip-tls-verify=true - echo "Kind container IP on shared network: $KIND_IP" - - # 5. Rewrite the kubeconfig to use the kind container's IP - # kind's API server listens on port 6443 inside the container - kubectl config set-cluster kind-test-cluster \ - --server="https://${KIND_IP}:6443" - - # 6. Since the TLS cert won't match the new IP, use insecure mode - # OR set insecure-skip-tls-verify - kubectl config set-cluster kind-test-cluster \ - --insecure-skip-tls-verify=true + # Wait for API and nodes + for i in $(seq 1 120); do + if kubectl get nodes >/dev/null 2>&1; then + break + fi + echo "Waiting for kind API... ($i/120)" + sleep 2 + done + kubectl get nodes - name: Verify cluster access run: |